You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2026/10/12 12:21:34 UTC

(plc4x) 03/04: feat(plc4go,plc4net): add the response codes the two bindings were missing

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 247758db52acb4f8bad0c786060fbe5ad2974389
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Oct 12 14:17:29 2026 +0200

    feat(plc4go,plc4net): add the response codes the two bindings were missing
    
    plc4go had no NOT_READY or OUT_OF_RANGE; they get the next free values (0x13,
    0x14) in its own numbering. plc4net had no InvalidData, RemoteBusy,
    RemoteError, NotReady or OutOfRange; they are appended so the existing
    members keep their values, and documented as in plc4j. With this every
    binding has the same set of response codes.
---
 plc4go/pkg/api/model/plc_response_code.go      |  6 ++++++
 plc4go/pkg/api/model/plc_response_code_test.go |  2 ++
 plc4net/api/types/PlcResponseCode.cs           | 24 +++++++++++++++++++++++-
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/plc4go/pkg/api/model/plc_response_code.go b/plc4go/pkg/api/model/plc_response_code.go
index ee0fb53cb0..1e7fb9c85d 100644
--- a/plc4go/pkg/api/model/plc_response_code.go
+++ b/plc4go/pkg/api/model/plc_response_code.go
@@ -40,6 +40,8 @@ const (
 	PlcResponseCode_UNSUPPORTED      PlcResponseCode = 0x10
 	PlcResponseCode_RESPONSE_PENDING PlcResponseCode = 0x11
 	PlcResponseCode_REQUEST_TIMEOUT  PlcResponseCode = 0x12
+	PlcResponseCode_NOT_READY        PlcResponseCode = 0x13
+	PlcResponseCode_OUT_OF_RANGE     PlcResponseCode = 0x14
 )
 
 func (m PlcResponseCode) GetName() string {
@@ -68,6 +70,10 @@ func (m PlcResponseCode) GetName() string {
 		return "RESPONSE_PENDING"
 	case PlcResponseCode_REQUEST_TIMEOUT:
 		return "REQUEST_TIMEOUT"
+	case PlcResponseCode_NOT_READY:
+		return "NOT_READY"
+	case PlcResponseCode_OUT_OF_RANGE:
+		return "OUT_OF_RANGE"
 	default:
 		return ""
 	}
diff --git a/plc4go/pkg/api/model/plc_response_code_test.go b/plc4go/pkg/api/model/plc_response_code_test.go
index e2981b38c9..8c3e299897 100644
--- a/plc4go/pkg/api/model/plc_response_code_test.go
+++ b/plc4go/pkg/api/model/plc_response_code_test.go
@@ -45,6 +45,8 @@ func TestPlcResponseCode_GetName(t *testing.T) {
 		{m: PlcResponseCode_UNSUPPORTED, want: "UNSUPPORTED"},
 		{m: PlcResponseCode_RESPONSE_PENDING, want: "RESPONSE_PENDING"},
 		{m: PlcResponseCode_REQUEST_TIMEOUT, want: "REQUEST_TIMEOUT"},
+		{m: PlcResponseCode_NOT_READY, want: "NOT_READY"},
+		{m: PlcResponseCode_OUT_OF_RANGE, want: "OUT_OF_RANGE"},
 		{m: 0xff},
 	}
 	for _, tt := range tests {
diff --git a/plc4net/api/types/PlcResponseCode.cs b/plc4net/api/types/PlcResponseCode.cs
index 1f5c74bd14..1fab9f225f 100644
--- a/plc4net/api/types/PlcResponseCode.cs
+++ b/plc4net/api/types/PlcResponseCode.cs
@@ -37,6 +37,28 @@ namespace org.apache.plc4net.types
 
         /// <summary>The device rejected the request as unsupported (e.g. an
         /// illegal function code).</summary>
-        Unsupported
+        Unsupported,
+
+        // Added after the others so that the values above keep their numbers.
+
+        /// <summary>A value carried by the request is malformed.</summary>
+        InvalidData,
+
+        /// <summary>The device is currently unable to process the request due to overload.</summary>
+        RemoteBusy,
+
+        /// <summary>Something went wrong on the remote side.</summary>
+        RemoteError,
+
+        /// <summary>The request and the connection are healthy, but the data the tag points at
+        /// is not available yet - typically an asynchronous source (cyclic IO, a subscription,
+        /// a cache) has not delivered its first value. Retry shortly; this is not permanent.
+        /// Unlike <see cref="ResponsePending"/>, there is no request in flight.</summary>
+        NotReady,
+
+        /// <summary>The request is well-formed, but a value it carries is outside the range the
+        /// target accepts (e.g. a number too large for the datatype, or an address beyond the
+        /// device's extent). Unlike <see cref="InvalidData"/>, the value is not malformed.</summary>
+        OutOfRange
     }
 }
\ No newline at end of file