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:32:42 UTC

[plc4x] branch feature/plc4go updated: - Made the BOOL and BitString types not include the numeric features

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


The following commit(s) were added to refs/heads/feature/plc4go by this push:
     new cd9b4dd  - Made the BOOL and BitString types not include the numeric features
cd9b4dd is described below

commit cd9b4dd6f64cef0fc33a88292b732b06cb2d5130
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Oct 16 15:32:34 2020 +0200

    - Made the BOOL and BitString types not include the numeric features
---
 sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go  | 51 +++------------------------
 sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go  | 12 ++++---
 sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go | 12 ++++---
 sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go | 12 ++++---
 sandbox/plc4go/pkg/plc4go/values/plc_WORD.go  | 12 ++++---
 5 files changed, 33 insertions(+), 66 deletions(-)

diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go b/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go
index 651473f..11a2101 100644
--- a/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_BOOL.go
@@ -20,7 +20,7 @@ package values
 
 type PlcBOOL struct {
 	value bool
-	plcSimpleNumericValueAdapter
+	plcValueAdapter
 }
 
 func NewPlcBOOL(value bool) PlcBOOL {
@@ -29,6 +29,10 @@ func NewPlcBOOL(value bool) PlcBOOL {
 	}
 }
 
+func (m PlcBOOL) IsBoolean() bool {
+	return true
+}
+
 func (m PlcBOOL) GetBooleanLength() uint8 {
 	return 1
 }
@@ -40,48 +44,3 @@ func (m PlcBOOL) GetBoolean() bool {
 func (m PlcBOOL) GetBooleanArray() []bool {
 	return []bool{m.value}
 }
-
-func (m PlcBOOL) GetUint8() uint8 {
-	if m.value == true {
-		return 1
-	}
-	return 0
-}
-
-func (m PlcBOOL) GetUint16() uint16 {
-	return uint16(m.GetUint8())
-}
-
-func (m PlcBOOL) GetUint32() uint32 {
-	return uint32(m.GetUint8())
-}
-
-func (m PlcBOOL) GetUint64() uint64 {
-	return uint64(m.GetUint8())
-}
-
-func (m PlcBOOL) GetInt8() int8 {
-	return int8(m.GetUint8())
-}
-
-func (m PlcBOOL) GetInt16() int16 {
-	return int16(m.GetUint8())
-}
-
-func (m PlcBOOL) GetInt32() int32 {
-	return int32(m.GetUint8())
-}
-
-func (m PlcBOOL) GetInt64() int64 {
-	return int64(m.GetUint8())
-}
-
-func (m PlcBOOL) GetFloat32() float32 {
-	//TODO: Check if this is ok
-	return float32(m.GetUint8())
-}
-
-func (m PlcBOOL) GetFloat64() float64 {
-	//TODO: Check if this is ok
-	return float64(m.GetUint8())
-}
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go b/sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go
index 66982a4..17f5a55 100644
--- a/sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_BYTE.go
@@ -19,18 +19,20 @@
 package values
 
 type PlcBYTE struct {
-	PlcUSINT
+	value uint8
+	plcValueAdapter
 }
 
 func NewPlcBYTE(value uint8) PlcBYTE {
-	child := PlcUSINT{
-		value: value,
-	}
 	return PlcBYTE{
-		child,
+		value: value,
 	}
 }
 
+func (m PlcBYTE) IsBoolean() bool {
+	return true
+}
+
 func (m PlcBYTE) GetBooleanLength() uint8 {
 	return 8
 }
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go b/sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go
index a9fe150..bb37af7 100644
--- a/sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_DWORD.go
@@ -19,18 +19,20 @@
 package values
 
 type PlcDWORD struct {
-	PlcUDINT
+	value uint32
+	plcValueAdapter
 }
 
 func NewPlcDWORD(value uint32) PlcDWORD {
-	child := PlcUDINT{
-		value: value,
-	}
 	return PlcDWORD{
-		child,
+		value: value,
 	}
 }
 
+func (m PlcDWORD) IsBoolean() bool {
+	return true
+}
+
 func (m PlcDWORD) GetBooleanLength() uint8 {
 	return 32
 }
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go b/sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go
index 6096500..768f85c 100644
--- a/sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_LWORD.go
@@ -19,18 +19,20 @@
 package values
 
 type PlcLWORD struct {
-	PlcULINT
+	value uint64
+	plcValueAdapter
 }
 
 func NewPlcLWORD(value uint64) PlcLWORD {
-	child := PlcULINT{
-		value: value,
-	}
 	return PlcLWORD{
-		child,
+		value: value,
 	}
 }
 
+func (m PlcLWORD) IsBoolean() bool {
+	return true
+}
+
 func (m PlcLWORD) GetBooleanLength() uint8 {
 	return 64
 }
diff --git a/sandbox/plc4go/pkg/plc4go/values/plc_WORD.go b/sandbox/plc4go/pkg/plc4go/values/plc_WORD.go
index 848d19b..7cbda29 100644
--- a/sandbox/plc4go/pkg/plc4go/values/plc_WORD.go
+++ b/sandbox/plc4go/pkg/plc4go/values/plc_WORD.go
@@ -19,18 +19,20 @@
 package values
 
 type PlcWORD struct {
-	PlcUINT
+	value uint16
+	plcValueAdapter
 }
 
 func NewPlcWORD(value uint16) PlcWORD {
-	child := PlcUINT{
-		value: value,
-	}
 	return PlcWORD{
-		child,
+		value: value,
 	}
 }
 
+func (m PlcWORD) IsBoolean() bool {
+	return true
+}
+
 func (m PlcWORD) GetBooleanLength() uint8 {
 	return 16
 }