Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop' into featu…
Browse files Browse the repository at this point in the history
…re/update-parent-pom
  • Loading branch information
chrisdutz committed Sep 13, 2024
2 parents ca0f8c6 + 9ba4d7f commit 7f6d1ba
Show file tree
Hide file tree
Showing 82 changed files with 723 additions and 547 deletions.
3 changes: 2 additions & 1 deletion plc4go/internal/bacnetip/bacgopes/apdu/apdu_APDU.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func NewAPDU(apdu readWriteModel.APDU, opts ...func(*__APDU)) (APDU, error) {
opt(a)
}
a._APCI = NewAPCI(apdu).(*_APCI)
a.PDUData = NewPDUData(NoArgs, NoKWArgs)
a.PDUData = NewPDUData(NoArgs, NoKWArgs())
a.AddExtraPrinters(a.PDUData.(DebugContentPrinter))
// Do a post construct for a bit more easy initialization
for _, f := range a._postConstruct {
f()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewConfirmedPrivateTransferRequest(_ Args, _ KWArgs) (*ConfirmedPrivateTran
nil,
0,
),
NoKWArgs,
NoKWArgs(),
WithConfirmedRequestSequenceExtension(c),
)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewWhoIsRequest() (*WhoIsRequest, error) {
readWriteModel.CreateBACnetContextTagUnsignedInteger(1, 0),
0,
),
NoKWArgs,
NoKWArgs(),
WithUnconfirmedRequestSequenceExtension(w),
)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions plc4go/internal/bacnetip/bacgopes/app/app_Application.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func NewApplication(localLog zerolog.Logger, localDevice *LocalDeviceObject, opt
if !a._startupDisabled {
for fn := range a.CapabilityFunctions("startup") {
localLog.Debug().Interface("fn", fn).Msg("startup fn")
Deferred(fn, NoArgs, NoKWArgs)
Deferred(fn, NoArgs, NoKWArgs())
}
}
return a, nil
Expand Down Expand Up @@ -273,7 +273,7 @@ func (a *Application) Indication(args Args, kwArgs KWArgs) error {
a.log.Debug().Err(err).Msg("err result")
panic("do it")
// TODO: do proper mapping
if err := a.Response(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, readWriteModel.NewAPDUError(0, readWriteModel.BACnetConfirmedServiceChoice_CREATE_OBJECT, nil, 0)))), NoKWArgs); err != nil {
if err := a.Response(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, readWriteModel.NewAPDUError(0, readWriteModel.BACnetConfirmedServiceChoice_CREATE_OBJECT, nil, 0)))), NoKWArgs()); err != nil {
return err
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (a *ApplicationIOController) _AppRequest(apdu PDU) {
a.log.Debug().Stringer("apdu", apdu).Msg("_AppRequest")

// send it downstream, bypass the guard
if err := a.Application.Request(NA(apdu), NoKWArgs); err != nil {
if err := a.Application.Request(NA(apdu), NoKWArgs()); err != nil {
a.log.Error().Stack().Err(err).Msg("Uh oh")
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (a *ApplicationServiceAccessPoint) Indication(args Args, kwArgs KWArgs) err
// no error so far, keep going
if errorFound == nil {
a.log.Trace().Msg("no decoding error")
if err := a.SapRequest(NA(xpdu), NoKWArgs); err != nil {
if err := a.SapRequest(NA(xpdu), NoKWArgs()); err != nil {
panic("if no abort or reject bubble up")
errorFound = err
}
Expand All @@ -126,7 +126,7 @@ func (a *ApplicationServiceAccessPoint) Indication(args Args, kwArgs KWArgs) err
a.log.Debug().Err(errorFound).Msg("got error")

// TODO: map it to a error... code temporary placeholder
return a.Response(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, readWriteModel.NewAPDUReject(_apdu.GetInvokeId(), nil, 0)))), NoKWArgs)
return a.Response(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, readWriteModel.NewAPDUReject(_apdu.GetInvokeId(), nil, 0)))), NoKWArgs())
}
case readWriteModel.APDUUnconfirmedRequest:
var apduService readWriteModel.BACnetUnconfirmedServiceChoice
Expand All @@ -147,7 +147,7 @@ func (a *ApplicationServiceAccessPoint) Indication(args Args, kwArgs KWArgs) err
}

// forward the decoded packet
if err := a.SapRequest(NA(xpdu), NoKWArgs); err != nil {
if err := a.SapRequest(NA(xpdu), NoKWArgs()); err != nil {
panic("if no abort or reject bubble up")
}
default:
Expand Down Expand Up @@ -189,7 +189,7 @@ func (a *ApplicationServiceAccessPoint) SapIndication(args Args, kwArgs KWArgs)
}

// forward the encoded packet
err := a.Request(NA(xpdu), NoKWArgs)
err := a.Request(NA(xpdu), NoKWArgs())
if err != nil {
return errors.Wrap(err, "error forwarding the request ")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ func (c *ClientSSM) segmentedRequest(apdu PDU) error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Request(NA(abort), NoKWArgs); err != nil { // send it ot the device
if err := c.Request(NA(abort), NoKWArgs()); err != nil { // send it ot the device
c.log.Debug().Err(err).Msg("error sending request")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil { // send it ot the application
if err := c.Response(NA(abort), NoKWArgs()); err != nil { // send it ot the application
c.log.Debug().Err(err).Msg("error sending response")
}
} else {
Expand All @@ -317,18 +317,18 @@ func (c *ClientSSM) segmentedRequest(apdu PDU) error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Request(NA(abort), NoKWArgs); err != nil { // send it ot the device
if err := c.Request(NA(abort), NoKWArgs()); err != nil { // send it ot the device
c.log.Debug().Err(err).Msg("error sending request")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil { // send it ot the application
if err := c.Response(NA(abort), NoKWArgs()); err != nil { // send it ot the application
c.log.Debug().Err(err).Msg("error sending response")
}
} else if !_apdu.GetSegmentedMessage() {
// ack is not segmented
if err := c.setState(SSMState_COMPLETED, nil); err != nil {
return errors.Wrap(err, "error switching state")
}
if err := c.Response(NA(apdu), NoKWArgs); err != nil {
if err := c.Response(NA(apdu), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
} else {
Expand All @@ -351,7 +351,7 @@ func (c *ClientSSM) segmentedRequest(apdu PDU) error {
if err := c.setState(SSMState_COMPLETED, nil); err != nil {
return errors.Wrap(err, "error switching state")
}
if err := c.Response(NA(apdu), NoKWArgs); err != nil {
if err := c.Response(NA(apdu), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
default:
Expand All @@ -374,7 +374,7 @@ func (c *ClientSSM) segmentedRequestTimeout() error {
if err != nil {
return errors.Wrap(err, "error getting first segment")
}
if err := c.Request(NA(apdu), NoKWArgs); err != nil {
if err := c.Request(NA(apdu), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending request")
}
} else {
Expand All @@ -389,7 +389,7 @@ func (c *ClientSSM) segmentedRequestTimeout() error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil {
if err := c.Response(NA(abort), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
}
Expand All @@ -406,7 +406,7 @@ func (c *ClientSSM) awaitConfirmation(apdu PDU) error {
if err := c.setState(SSMState_ABORTED, nil); err != nil {
return errors.Wrap(err, "error switching state")
}
if err := c.Response(NA(apdu), NoKWArgs); err != nil {
if err := c.Response(NA(apdu), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
case readWriteModel.APDUSimpleAck, readWriteModel.APDUError, readWriteModel.APDUReject:
Expand All @@ -415,7 +415,7 @@ func (c *ClientSSM) awaitConfirmation(apdu PDU) error {
if err := c.setState(SSMState_COMPLETED, nil); err != nil {
return errors.Wrap(err, "error switching state")
}
if err := c.Response(NA(apdu), NoKWArgs); err != nil {
if err := c.Response(NA(apdu), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
case readWriteModel.APDUComplexAck:
Expand All @@ -427,7 +427,7 @@ func (c *ClientSSM) awaitConfirmation(apdu PDU) error {
if err := c.setState(SSMState_COMPLETED, nil); err != nil {
return errors.Wrap(err, "error switching state")
}
if err := c.Response(NA(apdu), NoKWArgs); err != nil {
if err := c.Response(NA(apdu), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
} else if c.segmentationSupported != readWriteModel.BACnetSegmentation_SEGMENTED_RECEIVE && c.segmentationSupported != readWriteModel.BACnetSegmentation_SEGMENTED_BOTH {
Expand All @@ -437,7 +437,7 @@ func (c *ClientSSM) awaitConfirmation(apdu PDU) error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil {
if err := c.Response(NA(abort), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
} else if *_apdu.GetSequenceNumber() == 0 {
Expand All @@ -457,7 +457,7 @@ func (c *ClientSSM) awaitConfirmation(apdu PDU) error {

// send back a segment ack
segmentAck := readWriteModel.NewAPDUSegmentAck(false, false, c.invokeId, c.initialSequenceNumber, *c.actualWindowSize, 0)
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs); err != nil {
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending request")
}
} else {
Expand All @@ -467,10 +467,10 @@ func (c *ClientSSM) awaitConfirmation(apdu PDU) error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Request(NA(abort), NoKWArgs); err != nil { // send it ot the device
if err := c.Request(NA(abort), NoKWArgs()); err != nil { // send it ot the device
c.log.Debug().Err(err).Msg("error sending request")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil { // send it ot the application
if err := c.Response(NA(abort), NoKWArgs()); err != nil { // send it ot the application
c.log.Debug().Err(err).Msg("error sending response")
}
}
Expand All @@ -496,7 +496,7 @@ func (c *ClientSSM) awaitConfirmationTimeout() error {
// save the retry count, indication acts like the request is coming from the application so the retryCount gets
// re-initialized.
saveCount := c.retryCount
if err := c.Indication(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, c.segmentAPDU.originalApdu, KWCPCIDestination, c.pduAddress))), NoKWArgs); err != nil { // TODO: check that it is really the intention to re-send the original apdu here
if err := c.Indication(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, c.segmentAPDU.originalApdu, KWCPCIDestination, c.pduAddress))), NoKWArgs()); err != nil { // TODO: check that it is really the intention to re-send the original apdu here
return err
}
c.retryCount = saveCount
Expand All @@ -510,7 +510,7 @@ func (c *ClientSSM) awaitConfirmationTimeout() error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil {
if err := c.Response(NA(abort), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
}
Expand All @@ -529,10 +529,10 @@ func (c *ClientSSM) segmentedConfirmation(apdu PDU) error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Request(NA(abort), NoKWArgs); err != nil { // send it ot the device
if err := c.Request(NA(abort), NoKWArgs()); err != nil { // send it ot the device
c.log.Debug().Err(err).Msg("error sending request")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil { // send it ot the application
if err := c.Response(NA(abort), NoKWArgs()); err != nil { // send it ot the application
c.log.Debug().Err(err).Msg("error sending response")
}
}
Expand All @@ -543,10 +543,10 @@ func (c *ClientSSM) segmentedConfirmation(apdu PDU) error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
if err := c.Request(NA(abort), NoKWArgs); err != nil { // send it ot the device
if err := c.Request(NA(abort), NoKWArgs()); err != nil { // send it ot the device
c.log.Debug().Err(err).Msg("error sending request")
}
if err := c.Response(NA(abort), NoKWArgs); err != nil { // send it ot the application
if err := c.Response(NA(abort), NoKWArgs()); err != nil { // send it ot the application
c.log.Debug().Err(err).Msg("error sending response")
}
}
Expand All @@ -561,7 +561,7 @@ func (c *ClientSSM) segmentedConfirmation(apdu PDU) error {
// segment received out of order
c.RestartTimer(c.segmentTimeout)
segmentAck := readWriteModel.NewAPDUSegmentAck(true, false, c.invokeId, c.initialSequenceNumber, *c.actualWindowSize, 0)
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs); err != nil {
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending request")
}
return nil
Expand All @@ -581,7 +581,7 @@ func (c *ClientSSM) segmentedConfirmation(apdu PDU) error {

// send final ack
segmentAck := readWriteModel.NewAPDUSegmentAck(false, false, c.invokeId, c.lastSequenceNumber, *c.actualWindowSize, 0)
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs); err != nil {
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending request")
}

Expand All @@ -595,7 +595,7 @@ func (c *ClientSSM) segmentedConfirmation(apdu PDU) error {
if err != nil {
return errors.Wrap(err, "error parsing apdu")
}
if err := c.Response(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, parse))), NoKWArgs); err != nil {
if err := c.Response(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, parse))), NoKWArgs()); err != nil {
c.log.Debug().Err(err).Msg("error sending response")
}
} else if *apduComplexAck.GetSequenceNumber() == c.initialSequenceNumber+*c.actualWindowSize {
Expand All @@ -604,7 +604,7 @@ func (c *ClientSSM) segmentedConfirmation(apdu PDU) error {
c.initialSequenceNumber = c.lastSequenceNumber
c.RestartTimer(c.segmentTimeout)
segmentAck := readWriteModel.NewAPDUSegmentAck(false, false, c.invokeId, c.lastSequenceNumber, *c.actualWindowSize, 0)
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs); err != nil { // send it ot the device
if err := c.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, segmentAck))), NoKWArgs()); err != nil { // send it ot the device
c.log.Debug().Err(err).Msg("error sending request")
}
} else {
Expand All @@ -623,5 +623,5 @@ func (c *ClientSSM) segmentedConfirmationTimeout() error {
if err != nil {
return errors.Wrap(err, "error creating abort")
}
return c.Response(NA(abort), NoKWArgs)
return c.Response(NA(abort), NoKWArgs())
}
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func (s *SSM) fillWindow(sequenceNumber uint8) error {
if err != nil {
return errors.Wrapf(err, "Error sending out segment %d", i)
}
if err := s.ssmSAP.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, apdu.GetRootMessage(), KWCPCIDestination, s.pduAddress))), NoKWArgs); err != nil {
if err := s.ssmSAP.Request(NA(NewPDU(NoArgs, NKW(KWCompRootMessage, apdu.GetRootMessage(), KWCPCIDestination, s.pduAddress))), NoKWArgs()); err != nil {
s.log.Debug().Err(err).Msg("error sending request")
}
if moreFollows {
Expand Down
Loading

0 comments on commit 7f6d1ba

Please sign in to comment.