You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/08/02 09:38:00 UTC

[plc4x] branch develop updated (bd3ccd185 -> da22859fc)

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

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


    from bd3ccd185 chore(build): enable-all-checks for regular build
     new eede89a6b test(plc4go): fixed ManualTestRunner crashing and not cleaning up properly.
     new 0056237ae fix(plc-simulator/cbus): fixed simulator returning wrong status
     new da22859fc test(plc4go/cbus): fixed some issues during connection setup and fallback for random sal

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/internal/cbus/Connection.go                 |  18 +-
 plc4go/internal/cbus/MessageCodec.go               |   8 +
 plc4go/internal/spi/testutils/ManualTestRunner.go  |   8 +-
 .../cbus/readwrite/model/StaticHelper_test.go      | 646 +++++++++++++++++++++
 .../server/cbus/protocol/CBusServerAdapter.java    |  24 +-
 5 files changed, 686 insertions(+), 18 deletions(-)
 create mode 100644 plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go


[plc4x] 02/03: fix(plc-simulator/cbus): fixed simulator returning wrong status

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0056237aee193bed70aefb6906bf3a103f7ff008
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Aug 2 10:58:04 2022 +0200

    fix(plc-simulator/cbus): fixed simulator returning wrong status
---
 .../server/cbus/protocol/CBusServerAdapter.java    | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
index 429ca705b..41d36a7c8 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/cbus/protocol/CBusServerAdapter.java
@@ -214,13 +214,22 @@ public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
                         StatusRequest statusRequest = cBusPointToMultiPointCommandStatus.getStatusRequest();
                         if (statusRequest instanceof StatusRequestBinaryState) {
                             StatusRequestBinaryState statusRequestBinaryState = (StatusRequestBinaryState) statusRequest;
-                            StatusHeader statusHeader = new StatusHeader((short) (2 + 1)); // 2 we have always + 1 as we got one status byte
-                            // TODO: map actuall values from simulator
-                            byte blockStart = 0x0;
-                            List<StatusByte> statusBytes = List.of(new StatusByte(GAVState.ON, GAVState.ERROR, GAVState.OFF, GAVState.DOES_NOT_EXIST));
-                            // TODO: this might be extended or standard depeding on exstat
-                            StandardFormatStatusReply standardFormatStatusReply = new StandardFormatStatusReply(statusHeader, statusRequestBinaryState.getApplication(), blockStart, statusBytes);
-                            EncodedReply encodedReply = new EncodedReplyStandardFormatStatusReply((byte) 0xC0, standardFormatStatusReply, cBusOptions, requestContext);
+                            EncodedReply encodedReply;
+                            if (exstat) {
+                                ExtendedStatusHeader extendedStatusHeader = new ExtendedStatusHeader((short) (3 + 1));
+                                // TODO: map actuall values from simulator
+                                byte blockStart = 0x0;
+                                List<StatusByte> statusBytes = List.of(new StatusByte(GAVState.ON, GAVState.ERROR, GAVState.OFF, GAVState.DOES_NOT_EXIST));
+                                ExtendedFormatStatusReply extendedFormatStatusReply = new ExtendedFormatStatusReply(extendedStatusHeader, StatusCoding.BINARY_BY_THIS_SERIAL_INTERFACE, statusRequestBinaryState.getApplication(), blockStart, statusBytes, null);// 3 we have always + 1 as we got one status byte
+                                encodedReply = new EncodedReplyExtendedFormatStatusReply((byte) 0xE0, extendedFormatStatusReply, cBusOptions, requestContext);
+                            } else {
+                                StatusHeader statusHeader = new StatusHeader((short) (2 + 1)); // 2 we have always + 1 as we got one status byte
+                                // TODO: map actuall values from simulator
+                                byte blockStart = 0x0;
+                                List<StatusByte> statusBytes = List.of(new StatusByte(GAVState.ON, GAVState.ERROR, GAVState.OFF, GAVState.DOES_NOT_EXIST));
+                                StandardFormatStatusReply standardFormatStatusReply = new StandardFormatStatusReply(statusHeader, statusRequestBinaryState.getApplication(), blockStart, statusBytes);
+                                encodedReply = new EncodedReplyStandardFormatStatusReply((byte) 0xC0, standardFormatStatusReply, cBusOptions, requestContext);
+                            }
                             ReplyEncodedReply replyEncodedReply = new ReplyEncodedReply((byte) 0xC0, encodedReply, null, cBusOptions, requestContext);
                             ReplyOrConfirmation replyOrConfirmation = new ReplyOrConfirmationReply((byte) 0xFF, replyEncodedReply, new ResponseTermination(), cBusOptions, requestContext);
                             Alpha alpha = requestCommand.getAlpha();
@@ -312,6 +321,7 @@ public class CBusServerAdapter extends ChannelInboundHandlerAdapter {
                 pun = false;
                 pcn = false;
                 srchk = false;
+                stopMonitor();
                 return;
             }
             if (request instanceof RequestSmartConnectShortcut) {


[plc4x] 01/03: test(plc4go): fixed ManualTestRunner crashing and not cleaning up properly.

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit eede89a6b2980ca0e8b187450a07cbc13f155f2d
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Aug 2 10:48:25 2022 +0200

    test(plc4go): fixed ManualTestRunner crashing and not cleaning up properly.
---
 plc4go/internal/spi/testutils/ManualTestRunner.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plc4go/internal/spi/testutils/ManualTestRunner.go b/plc4go/internal/spi/testutils/ManualTestRunner.go
index dbf22becc..c30009090 100644
--- a/plc4go/internal/spi/testutils/ManualTestRunner.go
+++ b/plc4go/internal/spi/testutils/ManualTestRunner.go
@@ -59,10 +59,14 @@ func (m *ManualTestSuite) AddTestCase(address string, expectedReadValue interfac
 
 func (m *ManualTestSuite) Run() plc4go.PlcConnection {
 	connectionResult := <-m.DriverManager.GetConnection(m.ConnectionString)
-	if connectionResult.GetErr() != nil {
-		panic(connectionResult.GetErr())
+	if err := connectionResult.GetErr(); err != nil {
+		m.t.Error(err)
+		m.t.FailNow()
 	}
 	connection := connectionResult.GetConnection()
+	m.t.Cleanup(func() {
+		connection.Close()
+	})
 	log.Info().Msg("Reading all types in separate requests")
 	// Run all entries separately:
 	for _, testCase := range m.TestCases {


[plc4x] 03/03: test(plc4go/cbus): fixed some issues during connection setup and fallback for random sal

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit da22859fc74497088b07f92fe83823cebe23402c
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Aug 2 10:59:20 2022 +0200

    test(plc4go/cbus): fixed some issues during connection setup and fallback for random sal
---
 plc4go/internal/cbus/Connection.go                 |  18 +-
 plc4go/internal/cbus/MessageCodec.go               |   8 +
 .../cbus/readwrite/model/StaticHelper_test.go      | 646 +++++++++++++++++++++
 3 files changed, 663 insertions(+), 9 deletions(-)

diff --git a/plc4go/internal/cbus/Connection.go b/plc4go/internal/cbus/Connection.go
index 196c230aa..f6a991692 100644
--- a/plc4go/internal/cbus/Connection.go
+++ b/plc4go/internal/cbus/Connection.go
@@ -227,6 +227,7 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
 			c.fireConnectionError(errors.Errorf("Timeout after %v", timeout), ch)
 			return
 		}
+		log.Debug().Msg("Reset done")
 	}
 	{
 		log.Debug().Msg("Set application filter to all")
@@ -234,36 +235,34 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
 		if !c.sendCalDataWrite(ch, readWriteModel.Parameter_APPLICATION_ADDRESS_1, applicationAddress1, requestContext, cbusOptions) {
 			return
 		}
+		log.Debug().Msg("Application filter set")
 	}
 	{
 		log.Debug().Msg("Set interface options 3")
 		interfaceOptions3 := readWriteModel.NewParameterValueInterfaceOptions3(readWriteModel.NewInterfaceOptions3(true, false, true, false), 1)
-		var newCBusOptions readWriteModel.CBusOptions
-		newCBusOptions = readWriteModel.NewCBusOptions(false, false, false, true, false, false, false, false, false)
-		cbusOptions = &newCBusOptions
 		if !c.sendCalDataWrite(ch, readWriteModel.Parameter_INTERFACE_OPTIONS_3, interfaceOptions3, requestContext, cbusOptions) {
 			return
 		}
+		*cbusOptions = readWriteModel.NewCBusOptions(false, false, false, true, false, false, false, false, false)
+		log.Debug().Msg("Interface options 3 set")
 	}
 	{
 		log.Debug().Msg("Set interface options 1 power up settings")
-		var newCBusOptions readWriteModel.CBusOptions
-		newCBusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
-		cbusOptions = &newCBusOptions
 		interfaceOptions1PowerUpSettings := readWriteModel.NewParameterValueInterfaceOptions1PowerUpSettings(readWriteModel.NewInterfaceOptions1PowerUpSettings(readWriteModel.NewInterfaceOptions1(true, true, true, true, false, true)), 1)
 		if !c.sendCalDataWrite(ch, readWriteModel.Parameter_INTERFACE_OPTIONS_1_POWER_UP_SETTINGS, interfaceOptions1PowerUpSettings, requestContext, cbusOptions) {
 			return
 		}
+		*cbusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
+		log.Debug().Msg("Interface options 1 power up settings set")
 	}
 	{
 		log.Debug().Msg("Set interface options 1")
-		var newCBusOptions readWriteModel.CBusOptions
-		newCBusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
-		cbusOptions = &newCBusOptions
 		interfaceOptions1 := readWriteModel.NewParameterValueInterfaceOptions1(readWriteModel.NewInterfaceOptions1(true, true, true, true, false, true), 1)
 		if !c.sendCalDataWrite(ch, readWriteModel.Parameter_INTERFACE_OPTIONS_1, interfaceOptions1, requestContext, cbusOptions) {
 			return
 		}
+		*cbusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
+		log.Debug().Msg("Interface options 1 set")
 	}
 	c.fireConnected(ch)
 
@@ -278,6 +277,7 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
 			}
 		}
 	}()
+	log.Debug().Msg("Subscription handler stated")
 }
 
 func (c *Connection) sendCalDataWrite(ch chan plc4go.PlcConnectionConnectResult, paramNo readWriteModel.Parameter, parameterValue readWriteModel.ParameterValue, requestContext *readWriteModel.RequestContext, cbusOptions *readWriteModel.CBusOptions) bool {
diff --git a/plc4go/internal/cbus/MessageCodec.go b/plc4go/internal/cbus/MessageCodec.go
index 0570da211..8db9ff1bb 100644
--- a/plc4go/internal/cbus/MessageCodec.go
+++ b/plc4go/internal/cbus/MessageCodec.go
@@ -178,6 +178,14 @@ lookingForTheEnd:
 	rb := utils.NewReadBufferByteBased(read)
 	cBusMessage, err := readwriteModel.CBusMessageParse(rb, pciResponse, m.requestContext, m.cbusOptions)
 	if err != nil {
+		// TODO: bit bad we need to do this but cal detection is not reliable enough
+		rb := utils.NewReadBufferByteBased(read)
+		cBusMessage, secondErr := readwriteModel.CBusMessageParse(rb, pciResponse, readwriteModel.NewRequestContext(false, false, false), m.cbusOptions)
+		if secondErr == nil {
+			return cBusMessage, nil
+		} else {
+			log.Debug().Err(secondErr).Msg("Second parse failed too")
+		}
 		log.Warn().Err(err).Msg("error parsing")
 		// TODO: Possibly clean up ...
 		return nil, nil
diff --git a/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go b/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go
new file mode 100644
index 000000000..04eab1177
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go
@@ -0,0 +1,646 @@
+/*
+ * 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
+ *
+ *   https://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 model
+
+import (
+	"github.com/apache/plc4x/plc4go/internal/spi"
+	"github.com/apache/plc4x/plc4go/internal/spi/utils"
+	"reflect"
+	"testing"
+)
+
+func TestCalculateChecksum(t *testing.T) {
+	type args struct {
+		writeBuffer utils.WriteBuffer
+		message     spi.Message
+		srchk       bool
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := CalculateChecksum(tt.args.writeBuffer, tt.args.message, tt.args.srchk); (err != nil) != tt.wantErr {
+				t.Errorf("CalculateChecksum() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func TestKnowsAccessControlCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsAccessControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsAccessControlCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsAirConditioningCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsAirConditioningCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsAirConditioningCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsCALCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsCALCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsCALCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsClockAndTimekeepingCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsClockAndTimekeepingCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsClockAndTimekeepingCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsEnableControlCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsEnableControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsEnableControlCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsErrorReportingCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsErrorReportingCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsErrorReportingCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsLightingCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsLightingCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsLightingCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsMeasurementCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsMeasurementCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsMeasurementCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsMediaTransportControlCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsMediaTransportControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsMediaTransportControlCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsMeteringCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsMeteringCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsMeteringCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsSecurityCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsSecurityCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsSecurityCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsTelephonyCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsTelephonyCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsTelephonyCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsTemperatureBroadcastCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsTemperatureBroadcastCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsTemperatureBroadcastCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestKnowsTriggerControlCommandTypeContainer(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := KnowsTriggerControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+				t.Errorf("KnowsTriggerControlCommandTypeContainer() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestReadAndValidateChecksum(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+		message    spi.Message
+		srchk      bool
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    Checksum
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := ReadAndValidateChecksum(tt.args.readBuffer, tt.args.message, tt.args.srchk)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("ReadAndValidateChecksum() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("ReadAndValidateChecksum() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestReadCALData(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    CALData
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := ReadCALData(tt.args.readBuffer)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("ReadCALData() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("ReadCALData() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestReadCBusCommand(t *testing.T) {
+	type args struct {
+		readBuffer  utils.ReadBuffer
+		cBusOptions CBusOptions
+		srchk       bool
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    CBusCommand
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := ReadCBusCommand(tt.args.readBuffer, tt.args.cBusOptions, tt.args.srchk)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("ReadCBusCommand() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("ReadCBusCommand() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestReadEncodedReply(t *testing.T) {
+	type args struct {
+		readBuffer     utils.ReadBuffer
+		options        CBusOptions
+		requestContext RequestContext
+		srchk          bool
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    EncodedReply
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := ReadEncodedReply(tt.args.readBuffer, tt.args.options, tt.args.requestContext, tt.args.srchk)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("ReadEncodedReply() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("ReadEncodedReply() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestWriteCALData(t *testing.T) {
+	type args struct {
+		writeBuffer utils.WriteBuffer
+		calData     CALData
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := WriteCALData(tt.args.writeBuffer, tt.args.calData); (err != nil) != tt.wantErr {
+				t.Errorf("WriteCALData() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func TestWriteCBusCommand(t *testing.T) {
+	type args struct {
+		writeBuffer utils.WriteBuffer
+		cbusCommand CBusCommand
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := WriteCBusCommand(tt.args.writeBuffer, tt.args.cbusCommand); (err != nil) != tt.wantErr {
+				t.Errorf("WriteCBusCommand() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func TestWriteEncodedReply(t *testing.T) {
+	type args struct {
+		writeBuffer  utils.WriteBuffer
+		encodedReply EncodedReply
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := WriteEncodedReply(tt.args.writeBuffer, tt.args.encodedReply); (err != nil) != tt.wantErr {
+				t.Errorf("WriteEncodedReply() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func Test_encodeHexUpperCase(t *testing.T) {
+	type args struct {
+		dst []byte
+		src []byte
+	}
+	tests := []struct {
+		name string
+		args args
+		want int
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := encodeHexUpperCase(tt.args.dst, tt.args.src); got != tt.want {
+				t.Errorf("encodeHexUpperCase() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func Test_findHexEnd(t *testing.T) {
+	type args struct {
+		readBuffer utils.ReadBuffer
+	}
+	tests := []struct {
+		name string
+		args args
+		want int
+	}{
+		{
+			name: "sal end",
+			args: args{readBuffer: utils.NewReadBufferByteBased([]byte("0500380022AFE012"))},
+			want: 16,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := findHexEnd(tt.args.readBuffer); got != tt.want {
+				t.Errorf("findHexEnd() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func Test_getChecksum(t *testing.T) {
+	type args struct {
+		message spi.Message
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    byte
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := getChecksum(tt.args.message)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("getChecksum() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if got != tt.want {
+				t.Errorf("getChecksum() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func Test_readBytesFromHex(t *testing.T) {
+	type args struct {
+		logicalName string
+		readBuffer  utils.ReadBuffer
+		srchk       bool
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    []byte
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := readBytesFromHex(tt.args.logicalName, tt.args.readBuffer, tt.args.srchk)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("readBytesFromHex() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("readBytesFromHex() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func Test_writeSerializableToHex(t *testing.T) {
+	type args struct {
+		logicalName  string
+		writeBuffer  utils.WriteBuffer
+		serializable utils.Serializable
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := writeSerializableToHex(tt.args.logicalName, tt.args.writeBuffer, tt.args.serializable); (err != nil) != tt.wantErr {
+				t.Errorf("writeSerializableToHex() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}
+
+func Test_writeToHex(t *testing.T) {
+	type args struct {
+		logicalName  string
+		writeBuffer  utils.WriteBuffer
+		bytesToWrite []byte
+	}
+	tests := []struct {
+		name    string
+		args    args
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if err := writeToHex(tt.args.logicalName, tt.args.writeBuffer, tt.args.bytesToWrite); (err != nil) != tt.wantErr {
+				t.Errorf("writeToHex() error = %v, wantErr %v", err, tt.wantErr)
+			}
+		})
+	}
+}