You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by hu...@apache.org on 2024/02/19 04:12:21 UTC

(plc4x) 01/02: fix(plc4py): Add support for adding PlcTags instead of address string in read request builder.

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

hutcheb pushed a commit to branch fix/plc4py/documentation
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 5d39b97c597b0a9b2928827dbf8cbe5526e31b03
Author: Ben Hutcheson <be...@gmail.com>
AuthorDate: Sun Feb 18 06:56:07 2024 +0100

    fix(plc4py): Add support for adding PlcTags instead of address string in read request builder.
---
 sandbox/plc4py/plc4py/spi/messages/PlcRequest.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sandbox/plc4py/plc4py/spi/messages/PlcRequest.py b/sandbox/plc4py/plc4py/spi/messages/PlcRequest.py
index 5a6397dd17..1b11171ecb 100644
--- a/sandbox/plc4py/plc4py/spi/messages/PlcRequest.py
+++ b/sandbox/plc4py/plc4py/spi/messages/PlcRequest.py
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-
+from plc4py.api.messages.PlcField import PlcTag
 from plc4py.api.messages.PlcRequest import (
     PlcReadRequest,
     ReadRequestBuilder,
@@ -44,6 +44,9 @@ class DefaultReadRequestBuilder(ReadRequestBuilder):
         tag = self.tag_builder.create(address_string)
         self.read_request.tags[tag_name] = tag
 
+    def add_tag(self, tag_name: str, tag: PlcTag) -> None:
+        self.read_request.tags[tag_name] = tag
+
 
 class DefaultBrowseRequestBuilder(BrowseRequestBuilder):
     def __init__(self):