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 2023/01/11 11:10:58 UTC

[plc4x] 02/04: refactor(plc4go/bacnet): smaller cleanups

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 8e25dd229cba633173e6adb3a8fb27fb16e1ec35
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jan 10 16:49:18 2023 +0100

    refactor(plc4go/bacnet): smaller cleanups
---
 plc4go/internal/bacnetip/ApplicationLayer.go     | 3 ++-
 plc4go/internal/bacnetip/CommunicationsModule.go | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/plc4go/internal/bacnetip/ApplicationLayer.go b/plc4go/internal/bacnetip/ApplicationLayer.go
index 2d7f279317..0dec61bed2 100644
--- a/plc4go/internal/bacnetip/ApplicationLayer.go
+++ b/plc4go/internal/bacnetip/ApplicationLayer.go
@@ -1943,7 +1943,7 @@ func NewApplicationServiceAccessPoint(aseID *int, sapID *int) (*ApplicationServi
 func (a *ApplicationServiceAccessPoint) Indication(apdu _PDU) error {
 	log.Debug().Msgf("Indication\n%s", apdu)
 
-	switch _apdu := apdu.(type) {
+	switch _apdu := apdu.GetMessage().(type) {
 	case readWriteModel.APDUConfirmedRequestExactly:
 		//assume no errors found
 		var errorFound error
@@ -2007,6 +2007,7 @@ func (a *ApplicationServiceAccessPoint) Confirmation(apdu _PDU) error {
 
 	// TODO: check if we need to check apdu here
 
+	// forward the decoded packet
 	return a.SapResponse(apdu)
 }
 
diff --git a/plc4go/internal/bacnetip/CommunicationsModule.go b/plc4go/internal/bacnetip/CommunicationsModule.go
index c666e2d2ff..25b06d9e79 100644
--- a/plc4go/internal/bacnetip/CommunicationsModule.go
+++ b/plc4go/internal/bacnetip/CommunicationsModule.go
@@ -21,6 +21,7 @@ package bacnetip
 
 import (
 	"fmt"
+	"github.com/apache/plc4x/plc4go/spi"
 	"github.com/pkg/errors"
 	"github.com/rs/zerolog/log"
 )
@@ -40,14 +41,13 @@ func init() {
 	elementMap = make(map[int]*ApplicationServiceElement)
 }
 
-// TODO: implement me
 type _PCI struct {
-	pduUserData    interface{}
+	pduUserData    spi.Message
 	pduSource      *Address
 	pduDestination *Address
 }
 
-func _New_PCI(pduUserData interface{}, pduSource *Address, pduDestination *Address) *_PCI {
+func _New_PCI(pduUserData spi.Message, pduSource *Address, pduDestination *Address) *_PCI {
 	return &_PCI{pduUserData, pduSource, pduDestination}
 }