You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2022/01/27 17:31:59 UTC

[plc4x] 01/02: refactor(plc4go/spi): Added a GetString implementation for RawPlcValue types

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

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

commit 835136a3a168fd7485db6cbe026bc7bcf292637b
Author: cdutz <ch...@c-ware.de>
AuthorDate: Thu Jan 27 18:31:24 2022 +0100

    refactor(plc4go/spi): Added a GetString implementation for RawPlcValue types
---
 plc4go/internal/plc4go/spi/values/RawPlcValue.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/plc4go/internal/plc4go/spi/values/RawPlcValue.go b/plc4go/internal/plc4go/spi/values/RawPlcValue.go
index 06aa974..dc2ccf6 100644
--- a/plc4go/internal/plc4go/spi/values/RawPlcValue.go
+++ b/plc4go/internal/plc4go/spi/values/RawPlcValue.go
@@ -20,6 +20,7 @@
 package values
 
 import (
+	"encoding/hex"
 	"github.com/apache/plc4x/plc4go/internal/plc4go/spi/utils"
 	api "github.com/apache/plc4x/plc4go/pkg/plc4go/values"
 )
@@ -76,3 +77,7 @@ func (m RawPlcValue) RawHasMore() bool {
 func (m RawPlcValue) RawReset() {
 	m.readBuffer.(utils.ReadBufferByteBased).Reset(0)
 }
+
+func (m RawPlcValue) GetString() string {
+	return hex.EncodeToString(m.GetRaw())
+}