This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch feature/ads-symbol-discovery in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit d04f12f8a624320167483c6c444a21e5c801696e Author: Christofer Dutz <[email protected]> AuthorDate: Thu Aug 25 10:31:52 2022 +0200 chore(plc4go): Renamed multiple elements: - PLCValueType -> PlcValueType - PlcDiscoveryEvent -> PlcDiscoveryItem --- plc4go/pkg/api/driver.go | 4 ++-- plc4go/pkg/api/driverManager.go | 4 ++-- plc4go/pkg/api/values/plc_value.go | 8 ++++---- plc4go/protocols/s7/readwrite/model/COTPPacket.go | 1 + plc4go/spi/PlcDiscoverer.go | 2 +- plc4go/spi/default/DefaultDriver.go | 2 +- plc4go/spi/values/BINT.go | 4 ++-- plc4go/spi/values/BOOL.go | 4 ++-- plc4go/spi/values/BREAL.go | 4 ++-- plc4go/spi/values/BYTE.go | 4 ++-- plc4go/spi/values/CHAR.go | 4 ++-- plc4go/spi/values/DATE.go | 4 ++-- plc4go/spi/values/DATE_AND_TIME.go | 4 ++-- plc4go/spi/values/DINT.go | 4 ++-- plc4go/spi/values/DWORD.go | 4 ++-- plc4go/spi/values/INT.go | 4 ++-- plc4go/spi/values/LINT.go | 4 ++-- plc4go/spi/values/LREAL.go | 4 ++-- plc4go/spi/values/LTIME.go | 4 ++-- plc4go/spi/values/LWORD.go | 4 ++-- plc4go/spi/values/NULL.go | 4 ++-- plc4go/spi/values/PlcBitString.go | 2 +- plc4go/spi/values/PlcByteArray.go | 2 +- plc4go/spi/values/PlcList.go | 4 ++-- plc4go/spi/values/PlcStruct.go | 4 ++-- plc4go/spi/values/PlcValueAdapter.go | 4 ++-- plc4go/spi/values/REAL.go | 4 ++-- plc4go/spi/values/RawPlcValue.go | 4 ++-- plc4go/spi/values/SINT.go | 4 ++-- plc4go/spi/values/STRING.go | 4 ++-- plc4go/spi/values/TIME.go | 4 ++-- plc4go/spi/values/TIME_OF_DAY.go | 4 ++-- plc4go/spi/values/UDINT.go | 4 ++-- plc4go/spi/values/UINT.go | 4 ++-- plc4go/spi/values/ULINT.go | 4 ++-- plc4go/spi/values/USINT.go | 4 ++-- plc4go/spi/values/WCHAR.go | 4 ++-- plc4go/spi/values/WORD.go | 4 ++-- plc4go/spi/values/WSTRING.go | 4 ++-- plc4go/spi/values/value_combination_test.go | 8 ++++---- plc4go/tests/drivers/tests/manual_cbus_driver_test.go | 2 +- plc4go/tools/plc4xbrowser/ui/commands.go | 2 +- 42 files changed, 81 insertions(+), 80 deletions(-) diff --git a/plc4go/pkg/api/driver.go b/plc4go/pkg/api/driver.go index 67760f4d3..151941cfa 100644 --- a/plc4go/pkg/api/driver.go +++ b/plc4go/pkg/api/driver.go @@ -30,7 +30,7 @@ import ( type PlcDriver interface { // GetProtocolCode Get the short code used to identify this driver (As used in the connection string) GetProtocolCode() string - // GetProtocolName Get a human readable name for this driver + // GetProtocolName Get a human-readable name for this driver GetProtocolName() string // GetDefaultTransport If the driver has a default form of transport, provide this and make @@ -50,5 +50,5 @@ type PlcDriver interface { // Discover TODO: document me // FIXME: this leaks spi in the signature move to spi driver or create interfaces. Can also be done by moving spi in a proper module Discover(callback func(event model.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error - DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryEvent), discoveryOptions ...options.WithDiscoveryOption) error + DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error } diff --git a/plc4go/pkg/api/driverManager.go b/plc4go/pkg/api/driverManager.go index 4e8e5ecc4..964518cb0 100644 --- a/plc4go/pkg/api/driverManager.go +++ b/plc4go/pkg/api/driverManager.go @@ -44,7 +44,7 @@ type PlcDriverManager interface { // Discover Execute all available discovery methods on all available drivers using all transports Discover(callback func(event model.PlcDiscoveryItem), discoveryOptions ...WithDiscoveryOption) error // DiscoverWithContext Execute all available discovery methods on all available drivers using all transports - DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryEvent), discoveryOptions ...WithDiscoveryOption) error + DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryItem), discoveryOptions ...WithDiscoveryOption) error } func NewPlcDriverManager() PlcDriverManager { @@ -289,7 +289,7 @@ func (m *plcDriverManger) Discover(callback func(event model.PlcDiscoveryItem), return m.DiscoverWithContext(context.TODO(), callback, discoveryOptions...) } -func (m *plcDriverManger) DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryEvent), discoveryOptions ...WithDiscoveryOption) error { +func (m *plcDriverManger) DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryItem), discoveryOptions ...WithDiscoveryOption) error { // Check if we've got at least one option to restrict to certain protocols only. // If there is at least one, we only check that protocol, if there are none, all // available protocols are checked. diff --git a/plc4go/pkg/api/values/plc_value.go b/plc4go/pkg/api/values/plc_value.go index 003e0b6ea..8de4570c2 100644 --- a/plc4go/pkg/api/values/plc_value.go +++ b/plc4go/pkg/api/values/plc_value.go @@ -132,7 +132,7 @@ type PlcValue interface { // /// - GetPLCValueType() PLCValueType + GetPlcValueType() PlcValueType } // RawPlcValue This type is used in cases where the driver doesn't have access to type information and therefore can't decode @@ -149,10 +149,10 @@ type RawPlcValue interface { RawReset() } -type PLCValueType uint8 +type PlcValueType uint8 const ( - BINT PLCValueType = iota + BINT PlcValueType = iota BIT_STRING BOOL BREAL @@ -186,7 +186,7 @@ const ( WSTRING ) -func (p PLCValueType) String() string { +func (p PlcValueType) String() string { switch { case p == BINT: return "BINT" diff --git a/plc4go/protocols/s7/readwrite/model/COTPPacket.go b/plc4go/protocols/s7/readwrite/model/COTPPacket.go index a056a8bfd..9e08df261 100644 --- a/plc4go/protocols/s7/readwrite/model/COTPPacket.go +++ b/plc4go/protocols/s7/readwrite/model/COTPPacket.go @@ -152,6 +152,7 @@ func COTPPacketParse(readBuffer utils.ReadBuffer, cotpLen uint16) (COTPPacket, e currentPos := positionAware.GetPos() _ = currentPos var startPos = positionAware.GetPos() + _ = startPos var curPos uint16 // Implicit Field (headerLength) (Used for parsing, but its value is not stored as it's implicitly given by the objects content) diff --git a/plc4go/spi/PlcDiscoverer.go b/plc4go/spi/PlcDiscoverer.go index d0241389a..0d0f854cc 100644 --- a/plc4go/spi/PlcDiscoverer.go +++ b/plc4go/spi/PlcDiscoverer.go @@ -27,5 +27,5 @@ import ( type PlcDiscoverer interface { Discover(callback func(event model.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error - DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryEvent), discoveryOptions ...options.WithDiscoveryOption) error + DiscoverWithContext(ctx context.Context, callback func(event model.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error } diff --git a/plc4go/spi/default/DefaultDriver.go b/plc4go/spi/default/DefaultDriver.go index 1f9164b07..733e15445 100644 --- a/plc4go/spi/default/DefaultDriver.go +++ b/plc4go/spi/default/DefaultDriver.go @@ -94,7 +94,7 @@ func (d *defaultDriver) Discover(_ func(event apiModel.PlcDiscoveryItem), _ ...o panic("not available") } -func (d *defaultDriver) DiscoverWithContext(_ context.Context, callback func(event apiModel.PlcDiscoveryEvent), discoveryOptions ...options.WithDiscoveryOption) error { +func (d *defaultDriver) DiscoverWithContext(_ context.Context, callback func(event apiModel.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error { panic("not available") } diff --git a/plc4go/spi/values/BINT.go b/plc4go/spi/values/BINT.go index d2694a771..236923c79 100644 --- a/plc4go/spi/values/BINT.go +++ b/plc4go/spi/values/BINT.go @@ -136,7 +136,7 @@ func (m PlcBINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcBINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcBINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.BINT } @@ -161,5 +161,5 @@ func (m PlcBINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcBINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), m.value.BitLen(), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), m.value.BitLen(), m.value) } diff --git a/plc4go/spi/values/BOOL.go b/plc4go/spi/values/BOOL.go index b8545c14b..f55738f32 100644 --- a/plc4go/spi/values/BOOL.go +++ b/plc4go/spi/values/BOOL.go @@ -78,7 +78,7 @@ func (m PlcBOOL) GetString() string { } } -func (m PlcBOOL) GetPLCValueType() apiValues.PLCValueType { +func (m PlcBOOL) GetPlcValueType() apiValues.PlcValueType { return apiValues.BOOL } @@ -87,5 +87,5 @@ func (m PlcBOOL) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcBOOL) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 1, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 1, m.value) } diff --git a/plc4go/spi/values/BREAL.go b/plc4go/spi/values/BREAL.go index 7ac32c036..ee3cc0e59 100644 --- a/plc4go/spi/values/BREAL.go +++ b/plc4go/spi/values/BREAL.go @@ -165,7 +165,7 @@ func (m PlcBREAL) GetString() string { return fmt.Sprintf("%g", m.GetFloat64()) } -func (m PlcBREAL) GetPLCValueType() apiValues.PLCValueType { +func (m PlcBREAL) GetPlcValueType() apiValues.PlcValueType { return apiValues.BREAL } @@ -191,5 +191,5 @@ func (m PlcBREAL) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcBREAL) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), m.value.MinPrec(), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), m.value.MinPrec(), m.value) } diff --git a/plc4go/spi/values/BYTE.go b/plc4go/spi/values/BYTE.go index 0dfffeee5..7bfa9fea4 100644 --- a/plc4go/spi/values/BYTE.go +++ b/plc4go/spi/values/BYTE.go @@ -100,7 +100,7 @@ func (m PlcBYTE) GetString() string { return strVal } -func (m PlcBYTE) GetPLCValueType() apiValues.PLCValueType { +func (m PlcBYTE) GetPlcValueType() apiValues.PlcValueType { return apiValues.BYTE } @@ -109,5 +109,5 @@ func (m PlcBYTE) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcBYTE) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 8, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 8, m.value) } diff --git a/plc4go/spi/values/CHAR.go b/plc4go/spi/values/CHAR.go index 60c8d040e..5d2164eb1 100644 --- a/plc4go/spi/values/CHAR.go +++ b/plc4go/spi/values/CHAR.go @@ -49,7 +49,7 @@ func (m PlcCHAR) GetString() string { return string(m.value) } -func (m PlcCHAR) GetPLCValueType() apiValues.PLCValueType { +func (m PlcCHAR) GetPlcValueType() apiValues.PlcValueType { return apiValues.CHAR } @@ -58,5 +58,5 @@ func (m PlcCHAR) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcCHAR) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 16, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 16, m.value) } diff --git a/plc4go/spi/values/DATE.go b/plc4go/spi/values/DATE.go index c0d3822dc..cd1c87a66 100644 --- a/plc4go/spi/values/DATE.go +++ b/plc4go/spi/values/DATE.go @@ -68,7 +68,7 @@ func (m PlcDATE) GetString() string { return m.GetDate().Format("2006-01-02") } -func (m PlcDATE) GetPLCValueType() apiValues.PLCValueType { +func (m PlcDATE) GetPlcValueType() apiValues.PlcValueType { return apiValues.DATE } @@ -77,5 +77,5 @@ func (m PlcDATE) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcDATE) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len([]rune(m.GetString()))*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len([]rune(m.GetString()))*8), m.value) } diff --git a/plc4go/spi/values/DATE_AND_TIME.go b/plc4go/spi/values/DATE_AND_TIME.go index 589e1e7e1..9cc4f3793 100644 --- a/plc4go/spi/values/DATE_AND_TIME.go +++ b/plc4go/spi/values/DATE_AND_TIME.go @@ -54,7 +54,7 @@ func (m PlcDATE_AND_TIME) GetString() string { return fmt.Sprintf("%v", m.GetDateTime()) } -func (m PlcDATE_AND_TIME) GetPLCValueType() apiValues.PLCValueType { +func (m PlcDATE_AND_TIME) GetPlcValueType() apiValues.PlcValueType { return apiValues.DATE_AND_TIME } @@ -63,5 +63,5 @@ func (m PlcDATE_AND_TIME) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcDATE_AND_TIME) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len([]rune(m.GetString()))*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len([]rune(m.GetString()))*8), m.value) } diff --git a/plc4go/spi/values/DINT.go b/plc4go/spi/values/DINT.go index 997201bd6..49ed96ca0 100644 --- a/plc4go/spi/values/DINT.go +++ b/plc4go/spi/values/DINT.go @@ -147,7 +147,7 @@ func (m PlcDINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcDINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcDINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.DINT } @@ -156,5 +156,5 @@ func (m PlcDINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcDINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 32, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 32, m.value) } diff --git a/plc4go/spi/values/DWORD.go b/plc4go/spi/values/DWORD.go index ed3e475fa..fbe5e50f8 100644 --- a/plc4go/spi/values/DWORD.go +++ b/plc4go/spi/values/DWORD.go @@ -99,7 +99,7 @@ func (m PlcDWORD) GetString() string { return strVal } -func (m PlcDWORD) GetPLCValueType() apiValues.PLCValueType { +func (m PlcDWORD) GetPlcValueType() apiValues.PlcValueType { return apiValues.DWORD } @@ -108,5 +108,5 @@ func (m PlcDWORD) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcDWORD) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 32, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 32, m.value) } diff --git a/plc4go/spi/values/INT.go b/plc4go/spi/values/INT.go index 29a7f0832..54e08aa11 100644 --- a/plc4go/spi/values/INT.go +++ b/plc4go/spi/values/INT.go @@ -140,7 +140,7 @@ func (m PlcINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.INT } @@ -149,5 +149,5 @@ func (m PlcINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 16, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 16, m.value) } diff --git a/plc4go/spi/values/LINT.go b/plc4go/spi/values/LINT.go index 5bb1d749a..9e1304700 100644 --- a/plc4go/spi/values/LINT.go +++ b/plc4go/spi/values/LINT.go @@ -154,7 +154,7 @@ func (m PlcLINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcLINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcLINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.LINT } @@ -163,5 +163,5 @@ func (m PlcLINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcLINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 64, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 64, m.value) } diff --git a/plc4go/spi/values/LREAL.go b/plc4go/spi/values/LREAL.go index 5827ce47d..2d6a215f7 100644 --- a/plc4go/spi/values/LREAL.go +++ b/plc4go/spi/values/LREAL.go @@ -161,7 +161,7 @@ func (m PlcLREAL) GetString() string { return fmt.Sprintf("%g", m.GetFloat64()) } -func (m PlcLREAL) GetPLCValueType() apiValues.PLCValueType { +func (m PlcLREAL) GetPlcValueType() apiValues.PlcValueType { return apiValues.LREAL } @@ -170,5 +170,5 @@ func (m PlcLREAL) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcLREAL) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 64, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 64, m.value) } diff --git a/plc4go/spi/values/LTIME.go b/plc4go/spi/values/LTIME.go index 5b4dbada3..43501255d 100644 --- a/plc4go/spi/values/LTIME.go +++ b/plc4go/spi/values/LTIME.go @@ -59,7 +59,7 @@ func (m PlcLTIME) GetString() string { return fmt.Sprintf("PT%0.fS", m.GetDuration().Seconds()) } -func (m PlcLTIME) GetPLCValueType() apiValues.PLCValueType { +func (m PlcLTIME) GetPlcValueType() apiValues.PlcValueType { return apiValues.LTIME } @@ -68,5 +68,5 @@ func (m PlcLTIME) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcLTIME) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len([]rune(m.GetString()))*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len([]rune(m.GetString()))*8), m.value) } diff --git a/plc4go/spi/values/LWORD.go b/plc4go/spi/values/LWORD.go index e0f508be3..01cffba99 100644 --- a/plc4go/spi/values/LWORD.go +++ b/plc4go/spi/values/LWORD.go @@ -115,7 +115,7 @@ func (m PlcLWORD) GetString() string { return strVal } -func (m PlcLWORD) GetPLCValueType() apiValues.PLCValueType { +func (m PlcLWORD) GetPlcValueType() apiValues.PlcValueType { return apiValues.LWORD } @@ -124,5 +124,5 @@ func (m PlcLWORD) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcLWORD) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 64, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 64, m.value) } diff --git a/plc4go/spi/values/NULL.go b/plc4go/spi/values/NULL.go index d7b093918..abe612582 100644 --- a/plc4go/spi/values/NULL.go +++ b/plc4go/spi/values/NULL.go @@ -36,10 +36,10 @@ func (m PlcNULL) GetRaw() []byte { return []byte{} } -func (m PlcNULL) GetPLCValueType() apiValues.PLCValueType { +func (m PlcNULL) GetPlcValueType() apiValues.PlcValueType { return apiValues.NULL } func (m PlcNULL) String() string { - return fmt.Sprintf("%s", m.GetPLCValueType()) + return fmt.Sprintf("%s", m.GetPlcValueType()) } diff --git a/plc4go/spi/values/PlcBitString.go b/plc4go/spi/values/PlcBitString.go index faa33e203..5c951b3a4 100644 --- a/plc4go/spi/values/PlcBitString.go +++ b/plc4go/spi/values/PlcBitString.go @@ -80,6 +80,6 @@ func (m PlcBitString) GetList() []apiValues.PlcValue { return m.Values } -func (m PlcBitString) GetPLCValueType() apiValues.PLCValueType { +func (m PlcBitString) GetPlcValueType() apiValues.PlcValueType { return apiValues.BIT_STRING } diff --git a/plc4go/spi/values/PlcByteArray.go b/plc4go/spi/values/PlcByteArray.go index b5afba384..231ed94c3 100644 --- a/plc4go/spi/values/PlcByteArray.go +++ b/plc4go/spi/values/PlcByteArray.go @@ -59,7 +59,7 @@ func (m PlcByteArray) GetList() []apiValues.PlcValue { return plcValues } -func (m PlcByteArray) GetPLCValueType() apiValues.PLCValueType { +func (m PlcByteArray) GetPlcValueType() apiValues.PlcValueType { return apiValues.BYTE_ARRAY } diff --git a/plc4go/spi/values/PlcList.go b/plc4go/spi/values/PlcList.go index f90c8eed6..e6bf4eb0a 100644 --- a/plc4go/spi/values/PlcList.go +++ b/plc4go/spi/values/PlcList.go @@ -202,7 +202,7 @@ func (m PlcList) GetStruct() map[string]apiValues.PlcValue { // /// -func (m PlcList) GetPLCValueType() apiValues.PLCValueType { +func (m PlcList) GetPlcValueType() apiValues.PlcValueType { return apiValues.LIST } @@ -228,5 +228,5 @@ func (m PlcList) Serialize(writeBuffer utils.WriteBuffer) error { func (m PlcList) String() string { allBits := 0 // TODO: do we want to aggregate the bit length? - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), allBits, m.Values) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), allBits, m.Values) } diff --git a/plc4go/spi/values/PlcStruct.go b/plc4go/spi/values/PlcStruct.go index 133125230..10d721fdd 100644 --- a/plc4go/spi/values/PlcStruct.go +++ b/plc4go/spi/values/PlcStruct.go @@ -82,7 +82,7 @@ func (m PlcStruct) GetString() string { return sb.String() } -func (m PlcStruct) GetPLCValueType() apiValues.PLCValueType { +func (m PlcStruct) GetPlcValueType() apiValues.PlcValueType { return apiValues.STRUCT } @@ -113,5 +113,5 @@ func (m PlcStruct) Serialize(writeBuffer utils.WriteBuffer) error { func (m PlcStruct) String() string { allBits := 0 // TODO: do we want to aggregate the bit length? - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), allBits, m.values) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), allBits, m.values) } diff --git a/plc4go/spi/values/PlcValueAdapter.go b/plc4go/spi/values/PlcValueAdapter.go index 09f1243e5..1e127f74d 100644 --- a/plc4go/spi/values/PlcValueAdapter.go +++ b/plc4go/spi/values/PlcValueAdapter.go @@ -237,8 +237,8 @@ func (m PlcValueAdapter) GetDateTime() time.Time { panic("GetDateTime not implemented") } -func (m PlcValueAdapter) GetPLCValueType() apiValues.PLCValueType { - panic("GetPLCValueType not implemented") +func (m PlcValueAdapter) GetPlcValueType() apiValues.PlcValueType { + panic("GetPlcValueType not implemented") } type PlcSimpleValueAdapter struct { diff --git a/plc4go/spi/values/REAL.go b/plc4go/spi/values/REAL.go index 8f8b92f2f..4ff08e76b 100644 --- a/plc4go/spi/values/REAL.go +++ b/plc4go/spi/values/REAL.go @@ -163,7 +163,7 @@ func (m PlcREAL) GetString() string { return fmt.Sprintf("%g", m.GetFloat32()) } -func (m PlcREAL) GetPLCValueType() apiValues.PLCValueType { +func (m PlcREAL) GetPlcValueType() apiValues.PlcValueType { return apiValues.REAL } @@ -172,5 +172,5 @@ func (m PlcREAL) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcREAL) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 32, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 32, m.value) } diff --git a/plc4go/spi/values/RawPlcValue.go b/plc4go/spi/values/RawPlcValue.go index d419453ef..30b7bc3df 100644 --- a/plc4go/spi/values/RawPlcValue.go +++ b/plc4go/spi/values/RawPlcValue.go @@ -83,10 +83,10 @@ func (m RawPlcValue) GetString() string { return hex.EncodeToString(m.GetRaw()) } -func (m RawPlcValue) GetPLCValueType() apiValues.PLCValueType { +func (m RawPlcValue) GetPlcValueType() apiValues.PlcValueType { return apiValues.RAW_PLC_VALUE } func (m RawPlcValue) String() string { - return fmt.Sprintf("%s", m.GetPLCValueType()) + return fmt.Sprintf("%s", m.GetPlcValueType()) } diff --git a/plc4go/spi/values/SINT.go b/plc4go/spi/values/SINT.go index 39a401a2f..c4b808763 100644 --- a/plc4go/spi/values/SINT.go +++ b/plc4go/spi/values/SINT.go @@ -132,7 +132,7 @@ func (m PlcSINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcSINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcSINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.SINT } @@ -141,5 +141,5 @@ func (m PlcSINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcSINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 8, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 8, m.value) } diff --git a/plc4go/spi/values/STRING.go b/plc4go/spi/values/STRING.go index 458038c3a..a5f3d8da3 100644 --- a/plc4go/spi/values/STRING.go +++ b/plc4go/spi/values/STRING.go @@ -50,7 +50,7 @@ func (m PlcSTRING) GetString() string { return m.value } -func (m PlcSTRING) GetPLCValueType() apiValues.PLCValueType { +func (m PlcSTRING) GetPlcValueType() apiValues.PlcValueType { return apiValues.STRING } @@ -59,5 +59,5 @@ func (m PlcSTRING) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcSTRING) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len([]rune(m.value))*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len([]rune(m.value))*8), m.value) } diff --git a/plc4go/spi/values/TIME.go b/plc4go/spi/values/TIME.go index 96e4a2cf8..b8321a68c 100644 --- a/plc4go/spi/values/TIME.go +++ b/plc4go/spi/values/TIME.go @@ -59,7 +59,7 @@ func (m PlcTIME) GetString() string { return fmt.Sprintf("PT%0.fS", m.GetDuration().Seconds()) } -func (m PlcTIME) GetPLCValueType() apiValues.PLCValueType { +func (m PlcTIME) GetPlcValueType() apiValues.PlcValueType { return apiValues.TIME } @@ -68,5 +68,5 @@ func (m PlcTIME) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcTIME) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len([]rune(m.GetString()))*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len([]rune(m.GetString()))*8), m.value) } diff --git a/plc4go/spi/values/TIME_OF_DAY.go b/plc4go/spi/values/TIME_OF_DAY.go index 43a879426..cf153e938 100644 --- a/plc4go/spi/values/TIME_OF_DAY.go +++ b/plc4go/spi/values/TIME_OF_DAY.go @@ -71,7 +71,7 @@ func (m PlcTIME_OF_DAY) GetString() string { return m.value.Format("15:04:05.000") } -func (m PlcTIME_OF_DAY) GetPLCValueType() apiValues.PLCValueType { +func (m PlcTIME_OF_DAY) GetPlcValueType() apiValues.PlcValueType { return apiValues.TIME_OF_DAY } @@ -80,5 +80,5 @@ func (m PlcTIME_OF_DAY) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcTIME_OF_DAY) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len([]rune(m.GetString()))*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len([]rune(m.GetString()))*8), m.value) } diff --git a/plc4go/spi/values/UDINT.go b/plc4go/spi/values/UDINT.go index 3ba0f4d3a..1d902b992 100644 --- a/plc4go/spi/values/UDINT.go +++ b/plc4go/spi/values/UDINT.go @@ -140,7 +140,7 @@ func (m PlcUDINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcUDINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcUDINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.UDINT } @@ -149,5 +149,5 @@ func (m PlcUDINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcUDINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 32, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 32, m.value) } diff --git a/plc4go/spi/values/UINT.go b/plc4go/spi/values/UINT.go index 2186b761e..bbdc294c3 100644 --- a/plc4go/spi/values/UINT.go +++ b/plc4go/spi/values/UINT.go @@ -126,7 +126,7 @@ func (m PlcUINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcUINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcUINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.UINT } @@ -135,5 +135,5 @@ func (m PlcUINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcUINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 16, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 16, m.value) } diff --git a/plc4go/spi/values/ULINT.go b/plc4go/spi/values/ULINT.go index 243f2a1e6..ee7fcbb02 100644 --- a/plc4go/spi/values/ULINT.go +++ b/plc4go/spi/values/ULINT.go @@ -154,7 +154,7 @@ func (m PlcULINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcULINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcULINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.ULINT } @@ -163,5 +163,5 @@ func (m PlcULINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcULINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 64, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 64, m.value) } diff --git a/plc4go/spi/values/USINT.go b/plc4go/spi/values/USINT.go index 12da8ac59..c5d7b0508 100644 --- a/plc4go/spi/values/USINT.go +++ b/plc4go/spi/values/USINT.go @@ -112,7 +112,7 @@ func (m PlcUSINT) GetString() string { return strconv.Itoa(int(m.GetInt64())) } -func (m PlcUSINT) GetPLCValueType() apiValues.PLCValueType { +func (m PlcUSINT) GetPlcValueType() apiValues.PlcValueType { return apiValues.USINT } @@ -121,5 +121,5 @@ func (m PlcUSINT) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcUSINT) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 8, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 8, m.value) } diff --git a/plc4go/spi/values/WCHAR.go b/plc4go/spi/values/WCHAR.go index f2996e7b4..731eb2f68 100644 --- a/plc4go/spi/values/WCHAR.go +++ b/plc4go/spi/values/WCHAR.go @@ -51,7 +51,7 @@ func (m PlcWCHAR) GetString() string { return string(m.value) } -func (m PlcWCHAR) GetPLCValueType() apiValues.PLCValueType { +func (m PlcWCHAR) GetPlcValueType() apiValues.PlcValueType { return apiValues.WCHAR } @@ -60,5 +60,5 @@ func (m PlcWCHAR) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcWCHAR) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len(m.value)*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len(m.value)*8), m.value) } diff --git a/plc4go/spi/values/WORD.go b/plc4go/spi/values/WORD.go index dd92a7ab6..548a51d1c 100644 --- a/plc4go/spi/values/WORD.go +++ b/plc4go/spi/values/WORD.go @@ -91,7 +91,7 @@ func (m PlcWORD) GetString() string { return strVal } -func (m PlcWORD) GetPLCValueType() apiValues.PLCValueType { +func (m PlcWORD) GetPlcValueType() apiValues.PlcValueType { return apiValues.WORD } @@ -100,5 +100,5 @@ func (m PlcWORD) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcWORD) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), 16, m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), 16, m.value) } diff --git a/plc4go/spi/values/WSTRING.go b/plc4go/spi/values/WSTRING.go index 89a9ed3c7..6a39c054f 100644 --- a/plc4go/spi/values/WSTRING.go +++ b/plc4go/spi/values/WSTRING.go @@ -51,7 +51,7 @@ func (m PlcWSTRING) GetString() string { return string(m.value) } -func (m PlcWSTRING) GetPLCValueType() apiValues.PLCValueType { +func (m PlcWSTRING) GetPlcValueType() apiValues.PlcValueType { return apiValues.WSTRING } @@ -60,5 +60,5 @@ func (m PlcWSTRING) Serialize(writeBuffer utils.WriteBuffer) error { } func (m PlcWSTRING) String() string { - return fmt.Sprintf("%s(%dbit):%v", m.GetPLCValueType(), uint32(len(m.value)*8), m.value) + return fmt.Sprintf("%s(%dbit):%v", m.GetPlcValueType(), uint32(len(m.value)*8), m.value) } diff --git a/plc4go/spi/values/value_combination_test.go b/plc4go/spi/values/value_combination_test.go index a190e54c0..37a399aa0 100644 --- a/plc4go/spi/values/value_combination_test.go +++ b/plc4go/spi/values/value_combination_test.go @@ -34,7 +34,7 @@ import ( func TestCombinations(t *testing.T) { tests := []struct { - name apiValues.PLCValueType + name apiValues.PlcValueType arguments []apiValues.PlcValue }{ { @@ -307,10 +307,10 @@ func TestCombinations(t *testing.T) { for _, argument := range tt.arguments { argumentCopy := argument t.Run(fmt.Sprintf("%s", argument), func(t *testing.T) { - plcValueType := reflect.TypeOf((*apiValues.PlcValue)(nil)).Elem() + PlcValueType := reflect.TypeOf((*apiValues.PlcValue)(nil)).Elem() methods := make(map[string]reflect.Method) - for i := 0; i < plcValueType.NumMethod(); i++ { - method := plcValueType.Method(i) + for i := 0; i < PlcValueType.NumMethod(); i++ { + method := PlcValueType.Method(i) methods[method.Name] = method } diff --git a/plc4go/tests/drivers/tests/manual_cbus_driver_test.go b/plc4go/tests/drivers/tests/manual_cbus_driver_test.go index 20d25c5e1..6fbc971d3 100644 --- a/plc4go/tests/drivers/tests/manual_cbus_driver_test.go +++ b/plc4go/tests/drivers/tests/manual_cbus_driver_test.go @@ -175,7 +175,7 @@ func TestManualDiscovery(t *testing.T) { driver := cbus.NewDriver() driverManager.RegisterDriver(driver) transports.RegisterTcpTransport(driverManager) - err := driver.Discover(func(event model.PlcDiscoveryEvent) { + err := driver.Discover(func(event model.PlcDiscoveryItem) { println(event.(fmt.Stringer).String()) }) require.NoError(t, err) diff --git a/plc4go/tools/plc4xbrowser/ui/commands.go b/plc4go/tools/plc4xbrowser/ui/commands.go index 70c76cf07..d2edfe39e 100644 --- a/plc4go/tools/plc4xbrowser/ui/commands.go +++ b/plc4go/tools/plc4xbrowser/ui/commands.go @@ -52,7 +52,7 @@ var rootCommand = Command{ if !driver.SupportsDiscovery() { return errors.Errorf("%s doesn't support discovery", driverId) } - return driver.Discover(func(event model.PlcDiscoveryEvent) { + return driver.Discover(func(event model.PlcDiscoveryItem) { _, _ = fmt.Fprintf(messageOutput, "%v\n", event) }) } else {
