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 2020/10/16 13:05:39 UTC
[plc4x] 02/02: - Implemented the missing IEC plc-values
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/plc4go
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit d7bf2abcd9c66146171734e6958a28215d853214
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Oct 16 15:05:29 2020 +0200
- Implemented the missing IEC plc-values
---
sandbox/plc4go/go.mod | 6 +-
sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go | 8 +++
.../{go.mod => pkg/plc4go/values/plc_BYTE.go} | 38 ++++++++--
.../{go.mod => pkg/plc4go/values/plc_CHAR.go} | 22 ++++--
.../{go.mod => pkg/plc4go/values/plc_DATE.go} | 23 ++++--
.../plc4go/values/plc_DATE_AND_TIME.go} | 22 ++++--
sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go | 66 +++++++++++++++++
.../{go.mod => pkg/plc4go/values/plc_LTIME.go} | 25 +++++--
sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go | 82 ++++++++++++++++++++++
.../{go.mod => pkg/plc4go/values/plc_STRING.go} | 22 ++++--
.../{go.mod => pkg/plc4go/values/plc_TIME.go} | 25 +++++--
.../plc4go/values/plc_TIME_OF_DAY.go} | 23 ++++--
.../{go.mod => pkg/plc4go/values/plc_WCHAR.go} | 26 +++++--
.../{go.mod => pkg/plc4go/values/plc_WORD.go} | 42 +++++++++--
.../{go.mod => pkg/plc4go/values/plc_WSTRING.go} | 24 +++++--
sandbox/plc4go/pkg/plc4go/values/plc_value.go | 15 ++++
16 files changed, 424 insertions(+), 45 deletions(-)
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/go.mod
index abf31a2..56d5086 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/go.mod
@@ -21,4 +21,8 @@ module plc4x.apache.org/plc4go-modbus-driver/0.8.0
go 1.15
require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+
+require (
+ github.com/golang-collections/go-datastructures v0.0.0-20150211160725-59788d5eb259
+ github.com/icza/bitio v1.0.0
+)
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go b/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go
index e962731..651473f 100644
--- a/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go
@@ -29,10 +29,18 @@ func NewPlcBOOL(value bool) PlcBOOL {
}
}
+func (m PlcBOOL) GetBooleanLength() uint8 {
+ return 1
+}
+
func (m PlcBOOL) GetBoolean() bool {
return m.value
}
+func (m PlcBOOL) GetBooleanArray() []bool {
+ return []bool{m.value}
+}
+
func (m PlcBOOL) GetUint8() uint8 {
if m.value == true {
return 1
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go
similarity index 57%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go
index abf31a2..66982a4 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go
@@ -16,9 +16,39 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+type PlcBYTE struct {
+ PlcUSINT
+}
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+func NewPlcBYTE(value uint8) PlcBYTE {
+ child := PlcUSINT{
+ value: value,
+ }
+ return PlcBYTE{
+ child,
+ }
+}
+
+func (m PlcBYTE) GetBooleanLength() uint8 {
+ return 8
+}
+
+func (m PlcBYTE) GetBoolean() bool {
+ return m.value&1 == 1
+}
+
+func (m PlcBYTE) GetBooleanAt(index uint8) bool {
+ if index > 7 {
+ return false
+ }
+ return m.value>>index&1 == 1
+}
+
+func (m PlcBYTE) GetBooleanArray() []bool {
+ return []bool{m.value&1 == 1, m.value>>1&1 == 1,
+ m.value>>2&1 == 1, m.value>>3&1 == 1,
+ m.value>>4&1 == 1, m.value>>5&1 == 1,
+ m.value>>6&1 == 1, m.value>>7&1 == 1}
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_CHAR.go
similarity index 74%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_CHAR.go
index abf31a2..353439f 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_CHAR.go
@@ -16,9 +16,23 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+type PlcCHAR struct {
+ value []byte
+ plcSimpleValueAdapter
+}
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+func NewPlcCHAR(value uint8) PlcCHAR {
+ return PlcCHAR{
+ value: []byte{value},
+ }
+}
+
+func (m PlcCHAR) IsString() bool {
+ return true
+}
+
+func (m PlcCHAR) GetString() string {
+ return string(m.value)
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_DATE.go
similarity index 69%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_DATE.go
index abf31a2..9fc10a3 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_DATE.go
@@ -16,9 +16,24 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+import "time"
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+type PlcDATE struct {
+ value time.Time
+}
+
+func NewPlcDATE(value time.Time) PlcDATE {
+ safeValue := time.Date(value.Year(), value.Month(), value.Day(), 0, 0, 0, 0, value.Location())
+ return PlcDATE{
+ safeValue,
+ }
+}
+
+func (m PlcDATE) IsTime() bool {
+ return true
+}
+func (m PlcDATE) GetTime() time.Time {
+ return m.value
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_DATE_AND_TIME.go
similarity index 73%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_DATE_AND_TIME.go
index abf31a2..2dd82f8 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_DATE_AND_TIME.go
@@ -16,9 +16,23 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+import "time"
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+type PlcDATEANDTIME struct {
+ value time.Time
+}
+
+func NewPlcDATEANDTIME(value time.Time) PlcDATEANDTIME {
+ return PlcDATEANDTIME{
+ value,
+ }
+}
+
+func (m PlcDATEANDTIME) IsTime() bool {
+ return true
+}
+func (m PlcDATEANDTIME) GetTime() time.Time {
+ return m.value
+}
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go b/sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go
new file mode 100644
index 0000000..a9fe150
--- /dev/null
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go
@@ -0,0 +1,66 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+package values
+
+type PlcDWORD struct {
+ PlcUDINT
+}
+
+func NewPlcDWORD(value uint32) PlcDWORD {
+ child := PlcUDINT{
+ value: value,
+ }
+ return PlcDWORD{
+ child,
+ }
+}
+
+func (m PlcDWORD) GetBooleanLength() uint8 {
+ return 32
+}
+
+func (m PlcDWORD) GetBoolean() bool {
+ return m.value&1 == 1
+}
+
+func (m PlcDWORD) GetBooleanAt(index uint8) bool {
+ if index > 31 {
+ return false
+ }
+ return m.value>>index&1 == 1
+}
+
+func (m PlcDWORD) GetBooleanArray() []bool {
+ return []bool{m.value&1 == 1, m.value>>1&1 == 1,
+ m.value>>2&1 == 1, m.value>>3&1 == 1,
+ m.value>>4&1 == 1, m.value>>5&1 == 1,
+ m.value>>6&1 == 1, m.value>>7&1 == 1,
+ m.value>>8&1 == 1, m.value>>9&1 == 1,
+ m.value>>10&1 == 1, m.value>>11&1 == 1,
+ m.value>>12&1 == 1, m.value>>13&1 == 1,
+ m.value>>14&1 == 1, m.value>>15&1 == 1,
+ m.value>>16&1 == 1, m.value>>17&1 == 1,
+ m.value>>18&1 == 1, m.value>>19&1 == 1,
+ m.value>>20&1 == 1, m.value>>21&1 == 1,
+ m.value>>22&1 == 1, m.value>>23&1 == 1,
+ m.value>>24&1 == 1, m.value>>25&1 == 1,
+ m.value>>26&1 == 1, m.value>>27&1 == 1,
+ m.value>>28&1 == 1, m.value>>29&1 == 1,
+ m.value>>30&1 == 1, m.value>>31&1 == 1}
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_LTIME.go
similarity index 72%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_LTIME.go
index abf31a2..68b394b 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_LTIME.go
@@ -16,9 +16,26 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+import "time"
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+type PlcLTIME struct {
+ PlcULINT
+}
+
+func NewPlcLTIME(value uint64) PlcLTIME {
+ child := PlcULINT{
+ value: value,
+ }
+ return PlcLTIME{
+ child,
+ }
+}
+
+func (m PlcLTIME) IsDuration() bool {
+ return true
+}
+func (m PlcLTIME) GetDuration() time.Duration {
+ return time.Duration(m.value)
+}
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go b/sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go
new file mode 100644
index 0000000..6096500
--- /dev/null
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go
@@ -0,0 +1,82 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+package values
+
+type PlcLWORD struct {
+ PlcULINT
+}
+
+func NewPlcLWORD(value uint64) PlcLWORD {
+ child := PlcULINT{
+ value: value,
+ }
+ return PlcLWORD{
+ child,
+ }
+}
+
+func (m PlcLWORD) GetBooleanLength() uint8 {
+ return 64
+}
+
+func (m PlcLWORD) GetBoolean() bool {
+ return m.value&1 == 1
+}
+
+func (m PlcLWORD) GetBooleanAt(index uint8) bool {
+ if index > 63 {
+ return false
+ }
+ return m.value>>index&1 == 1
+}
+
+func (m PlcLWORD) GetBooleanArray() []bool {
+ return []bool{m.value&1 == 1, m.value>>1&1 == 1,
+ m.value>>2&1 == 1, m.value>>3&1 == 1,
+ m.value>>4&1 == 1, m.value>>5&1 == 1,
+ m.value>>6&1 == 1, m.value>>7&1 == 1,
+ m.value>>8&1 == 1, m.value>>9&1 == 1,
+ m.value>>10&1 == 1, m.value>>11&1 == 1,
+ m.value>>12&1 == 1, m.value>>13&1 == 1,
+ m.value>>14&1 == 1, m.value>>15&1 == 1,
+ m.value>>16&1 == 1, m.value>>17&1 == 1,
+ m.value>>18&1 == 1, m.value>>19&1 == 1,
+ m.value>>20&1 == 1, m.value>>21&1 == 1,
+ m.value>>22&1 == 1, m.value>>23&1 == 1,
+ m.value>>24&1 == 1, m.value>>25&1 == 1,
+ m.value>>26&1 == 1, m.value>>27&1 == 1,
+ m.value>>28&1 == 1, m.value>>29&1 == 1,
+ m.value>>30&1 == 1, m.value>>31&1 == 1,
+ m.value>>32&1 == 1, m.value>>33&1 == 1,
+ m.value>>34&1 == 1, m.value>>35&1 == 1,
+ m.value>>36&1 == 1, m.value>>37&1 == 1,
+ m.value>>38&1 == 1, m.value>>39&1 == 1,
+ m.value>>40&1 == 1, m.value>>41&1 == 1,
+ m.value>>42&1 == 1, m.value>>43&1 == 1,
+ m.value>>44&1 == 1, m.value>>45&1 == 1,
+ m.value>>46&1 == 1, m.value>>47&1 == 1,
+ m.value>>48&1 == 1, m.value>>49&1 == 1,
+ m.value>>50&1 == 1, m.value>>51&1 == 1,
+ m.value>>52&1 == 1, m.value>>53&1 == 1,
+ m.value>>54&1 == 1, m.value>>55&1 == 1,
+ m.value>>56&1 == 1, m.value>>57&1 == 1,
+ m.value>>58&1 == 1, m.value>>59&1 == 1,
+ m.value>>60&1 == 1, m.value>>61&1 == 1,
+ m.value>>62&1 == 1, m.value>>63&1 == 1}
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_STRING.go
similarity index 74%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_STRING.go
index abf31a2..82d42d9 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_STRING.go
@@ -16,9 +16,23 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+type PlcSTRING struct {
+ value []byte
+ plcSimpleValueAdapter
+}
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+func NewPlcSTRING(value []uint8) PlcSTRING {
+ return PlcSTRING{
+ value: value,
+ }
+}
+
+func (m PlcSTRING) IsString() bool {
+ return true
+}
+
+func (m PlcSTRING) GetString() string {
+ return string(m.value)
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_TIME.go
similarity index 72%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_TIME.go
index abf31a2..d97dbaf 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_TIME.go
@@ -16,9 +16,26 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+import "time"
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+type PlcTIME struct {
+ PlcUDINT
+}
+
+func NewPlcTIME(value uint32) PlcTIME {
+ child := PlcUDINT{
+ value: value,
+ }
+ return PlcTIME{
+ child,
+ }
+}
+
+func (m PlcTIME) IsDuration() bool {
+ return true
+}
+func (m PlcTIME) GetDuration() time.Duration {
+ return time.Duration(m.value)
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_TIME_OF_DAY.go
similarity index 66%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_TIME_OF_DAY.go
index abf31a2..7add3d0 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_TIME_OF_DAY.go
@@ -16,9 +16,24 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+import "time"
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+type PlcTIMEOFDAY struct {
+ value time.Time
+}
+
+func NewPlcTIME_OF_DAY(value time.Time) PlcTIMEOFDAY {
+ safeValue := time.Date(0, 0, 0, value.Hour(), value.Minute(), value.Second(), value.Nanosecond(), value.Location())
+ return PlcTIMEOFDAY{
+ safeValue,
+ }
+}
+
+func (m PlcTIMEOFDAY) IsTime() bool {
+ return true
+}
+func (m PlcTIMEOFDAY) GetTime() time.Time {
+ return m.value
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_WCHAR.go
similarity index 71%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_WCHAR.go
index abf31a2..f719abd 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_WCHAR.go
@@ -16,9 +16,27 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+import (
+ "unicode/utf16"
+)
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+type PlcWCHAR struct {
+ value []rune
+ plcSimpleValueAdapter
+}
+
+func NewPlcWCHAR(value uint16) PlcWCHAR {
+ return PlcWCHAR{
+ value: utf16.Decode([]uint16{value}),
+ }
+}
+
+func (m PlcWCHAR) IsString() bool {
+ return true
+}
+
+func (m PlcWCHAR) GetString() string {
+ return string(m.value)
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_WORD.go
similarity index 51%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_WORD.go
index abf31a2..848d19b 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_WORD.go
@@ -16,9 +16,43 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+type PlcWORD struct {
+ PlcUINT
+}
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+func NewPlcWORD(value uint16) PlcWORD {
+ child := PlcUINT{
+ value: value,
+ }
+ return PlcWORD{
+ child,
+ }
+}
+
+func (m PlcWORD) GetBooleanLength() uint8 {
+ return 16
+}
+
+func (m PlcWORD) GetBoolean() bool {
+ return m.value&1 == 1
+}
+
+func (m PlcWORD) GetBooleanAt(index uint8) bool {
+ if index > 15 {
+ return false
+ }
+ return m.value>>index&1 == 1
+}
+
+func (m PlcWORD) GetBooleanArray() []bool {
+ return []bool{m.value&1 == 1, m.value>>1&1 == 1,
+ m.value>>2&1 == 1, m.value>>3&1 == 1,
+ m.value>>4&1 == 1, m.value>>5&1 == 1,
+ m.value>>6&1 == 1, m.value>>7&1 == 1,
+ m.value>>8&1 == 1, m.value>>9&1 == 1,
+ m.value>>10&1 == 1, m.value>>11&1 == 1,
+ m.value>>12&1 == 1, m.value>>13&1 == 1,
+ m.value>>14&1 == 1, m.value>>15&1 == 1}
+}
diff --git a/sandbox/plc4go/go.mod b/sandbox/plc4go/pkg/plc4go/values/plc_WSTRING.go
similarity index 71%
copy from sandbox/plc4go/go.mod
copy to sandbox/plc4go/pkg/plc4go/values/plc_WSTRING.go
index abf31a2..b37b992 100644
--- a/sandbox/plc4go/go.mod
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_WSTRING.go
@@ -16,9 +16,25 @@
// specific language governing permissions and limitations
// under the License.
//
-module plc4x.apache.org/plc4go-modbus-driver/0.8.0
+package values
-go 1.15
+import "unicode/utf16"
-require github.com/sirupsen/logrus v1.7.0
-require github.com/icza/bitio v1.0.0
+type PlcWSTRING struct {
+ value []rune
+ plcSimpleValueAdapter
+}
+
+func NewPlcWSTRING(value []uint16) PlcWSTRING {
+ return PlcWSTRING{
+ value: utf16.Decode(value),
+ }
+}
+
+func (m PlcWSTRING) IsString() bool {
+ return true
+}
+
+func (m PlcWSTRING) GetString() string {
+ return string(m.value)
+}
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_value.go b/sandbox/plc4go/pkg/plc4go/values/plc_value.go
index b38d30a..b32bc33 100644
--- a/sandbox/plc4go/pkg/plc4go/values/plc_value.go
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_value.go
@@ -29,7 +29,10 @@ type PlcValue interface {
// Boolean
IsBoolean() bool
+ GetBooleanLength() uint8
GetBoolean() bool
+ GetBooleanAt(index uint8) bool
+ GetBooleanArray() []bool
// Integer
IsUint8() bool
@@ -103,9 +106,21 @@ func (m plcValueAdapter) IsNull() bool {
func (m plcValueAdapter) IsBoolean() bool {
return false
}
+func (m plcValueAdapter) GetBooleanLength() uint8 {
+ return 1
+}
func (m plcValueAdapter) GetBoolean() bool {
return false
}
+func (m plcValueAdapter) GetBooleanAt(index uint8) bool {
+ if index == 0 {
+ return m.GetBoolean()
+ }
+ return false
+}
+func (m plcValueAdapter) GetBooleanArray() []bool {
+ return nil
+}
// Integer
func (m plcValueAdapter) IsUint8() bool {