appservice

package
v0.0.0-...-8a33f75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithStateMachineAccessPointDeviceInfoCache

func WithStateMachineAccessPointDeviceInfoCache(deviceInfoCache *DeviceInfoCache) GenericApplier[*StateMachineAccessPoint]

Types

type ApplicationServiceAccessPoint

type ApplicationServiceAccessPoint struct {
	ApplicationServiceElementContract
	ServiceAccessPointContract
	*DefaultRFormatter `ignore:"true"`
	// contains filtered or unexported fields
}

func NewApplicationServiceAccessPoint

func NewApplicationServiceAccessPoint(localLog zerolog.Logger, options ...Option) (*ApplicationServiceAccessPoint, error)

func (*ApplicationServiceAccessPoint) AlternateString

func (a *ApplicationServiceAccessPoint) AlternateString() (string, bool)

func (*ApplicationServiceAccessPoint) Confirmation

func (a *ApplicationServiceAccessPoint) Confirmation(args Args, kwArgs KWArgs) error

TODO: big WIP

func (*ApplicationServiceAccessPoint) Indication

func (a *ApplicationServiceAccessPoint) Indication(args Args, kwArgs KWArgs) error

func (*ApplicationServiceAccessPoint) SapConfirmation

func (a *ApplicationServiceAccessPoint) SapConfirmation(args Args, kwArgs KWArgs) error

TODO: big WIP

func (*ApplicationServiceAccessPoint) SapIndication

func (a *ApplicationServiceAccessPoint) SapIndication(args Args, kwArgs KWArgs) error

func (*ApplicationServiceAccessPoint) Serialize

func (d *ApplicationServiceAccessPoint) Serialize() ([]byte, error)

func (*ApplicationServiceAccessPoint) SerializeWithWriteBuffer

func (d *ApplicationServiceAccessPoint) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*ApplicationServiceAccessPoint) String

type ClientSSM

type ClientSSM struct {
	*SSM
	// contains filtered or unexported fields
}

func NewClientSSM

func NewClientSSM(localLog zerolog.Logger, sap SSMSAPRequirements, pduAddress *Address) (*ClientSSM, error)

func (*ClientSSM) Confirmation

func (c *ClientSSM) Confirmation(args Args, kwArgs KWArgs) error

Confirmation This function is called by the device for all upstream messages related to the transaction.

func (*ClientSSM) Indication

func (c *ClientSSM) Indication(args Args, kwArgs KWArgs) error

Indication This function is called after the device has bound a new transaction and wants to start the process

rolling

func (*ClientSSM) ProcessTask

func (c *ClientSSM) ProcessTask() error

ProcessTask This function is called when something has taken too long

func (*ClientSSM) Request

func (c *ClientSSM) Request(args Args, kwArgs KWArgs) error

Request This function is called by client transaction functions when it wants to send a message to the device

func (*ClientSSM) Response

func (c *ClientSSM) Response(args Args, kwArgs KWArgs) error

Response This function is called by client transaction functions when they want to send a message to the application.

type DeviceInfo

type DeviceInfo struct {
	DeviceIdentifier readWriteModel.BACnetTagPayloadObjectIdentifier
	Address          Address

	MaximumApduLengthAccepted *readWriteModel.MaxApduLengthAccepted `stringer:"true"`
	SegmentationSupported     *readWriteModel.BACnetSegmentation    `stringer:"true"`
	MaxSegmentsAccepted       *readWriteModel.MaxSegmentsAccepted   `stringer:"true"`
	VendorId                  *readWriteModel.BACnetVendorId        `stringer:"true"`
	MaximumNpduLength         *uint
	// contains filtered or unexported fields
}

func NewDeviceInfo

func NewDeviceInfo(deviceIdentifier readWriteModel.BACnetTagPayloadObjectIdentifier, address Address) DeviceInfo

func (*DeviceInfo) Serialize

func (d *DeviceInfo) Serialize() ([]byte, error)

func (*DeviceInfo) SerializeWithWriteBuffer

func (d *DeviceInfo) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*DeviceInfo) String

func (d *DeviceInfo) String() string

type DeviceInfoCache

type DeviceInfoCache struct {
	// contains filtered or unexported fields
}

func NewDeviceInfoCache

func NewDeviceInfoCache(localLog zerolog.Logger) *DeviceInfoCache

func (*DeviceInfoCache) Acquire

Acquire Return the known information about the device and mark the record as being used by a segmentation state

machine.

func (*DeviceInfoCache) GetDeviceInfo

func (d *DeviceInfoCache) GetDeviceInfo(key DeviceInfoCacheKey) (DeviceInfo, bool)

GetDeviceInfo gets a DeviceInfo from cache

func (*DeviceInfoCache) HasDeviceInfo

func (d *DeviceInfoCache) HasDeviceInfo(key DeviceInfoCacheKey) bool

HasDeviceInfo Return true if cache has information about the device.

func (*DeviceInfoCache) IAmDeviceInfo

func (d *DeviceInfoCache) IAmDeviceInfo(iAm readWriteModel.BACnetUnconfirmedServiceRequestIAm, pduSource Address)

IAmDeviceInfo Create a device information record based on the contents of an IAmRequest and put it in the cache.

func (*DeviceInfoCache) Release

func (d *DeviceInfoCache) Release(deviceInfo DeviceInfo) error

Release This function is called by the segmentation state machine when it has finished with the device information.

func (*DeviceInfoCache) Serialize

func (d *DeviceInfoCache) Serialize() ([]byte, error)

func (*DeviceInfoCache) SerializeWithWriteBuffer

func (d *DeviceInfoCache) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*DeviceInfoCache) String

func (d *DeviceInfoCache) String() string

func (*DeviceInfoCache) UpdateDeviceInfo

func (d *DeviceInfoCache) UpdateDeviceInfo(deviceInfo DeviceInfo)

UpdateDeviceInfo The application has updated one or more fields in the device information record and the cache needs

to be updated to reflect the changes.  If this is a cached version of a persistent record then this is the
opportunity to update the database.

type DeviceInfoCacheKey

type DeviceInfoCacheKey struct {
	Instance  *uint32
	PduSource *Address
}

DeviceInfoCacheKey caches by either Instance, PduSource of both

func (DeviceInfoCacheKey) HashKey

func (k DeviceInfoCacheKey) HashKey() uint32

func (DeviceInfoCacheKey) String

func (k DeviceInfoCacheKey) String() string

type SSM

type SSM struct {
	*OneShotTask
	SSMProcessingRequirements
	// contains filtered or unexported fields
}

SSM - Segmentation State Machine

func NewSSM

func NewSSM(localLog zerolog.Logger, sap interface {
	SSMSAPRequirements
	SSMProcessingRequirements
}, pduAddress *Address) (*SSM, error)

func (*SSM) RestartTimer

func (s *SSM) RestartTimer(millis uint)

func (*SSM) StartTimer

func (s *SSM) StartTimer(millis uint)

func (*SSM) StopTimer

func (s *SSM) StopTimer()

type SSMProcessingRequirements

type SSMProcessingRequirements interface {
	// contains filtered or unexported methods
}

type SSMSAPRequirements

type SSMSAPRequirements interface {
	ServiceAccessPointContract
	Client
	GetDeviceInfoCache() *DeviceInfoCache
	GetLocalDevice() LocalDeviceObject
	GetProposedWindowSize() uint8
	GetClientTransactions() []*ClientSSM
	RemoveClientTransaction(*ClientSSM)
	GetServerTransactions() []*ServerSSM
	RemoveServerTransaction(*ServerSSM)
	GetApplicationTimeout() uint
	GetDefaultAPDUTimeout() uint
	GetDefaultSegmentationSupported() readWriteModel.BACnetSegmentation
	GetDefaultAPDUSegmentTimeout() uint
	GetDefaultMaxSegmentsAccepted() readWriteModel.MaxSegmentsAccepted
	GetDefaultMaximumApduLengthAccepted() readWriteModel.MaxApduLengthAccepted
}

type SSMState

type SSMState uint8
const (
	SSMState_IDLE SSMState = iota
	SSMState_SEGMENTED_REQUEST
	SSMState_AWAIT_CONFIRMATION
	SSMState_AWAIT_RESPONSE
	SSMState_SEGMENTED_RESPONSE
	SSMState_SEGMENTED_CONFIRMATION
	SSMState_COMPLETED
	SSMState_ABORTED
)

func (SSMState) String

func (s SSMState) String() string

type ServerSSM

type ServerSSM struct {
	*SSM
	// contains filtered or unexported fields
}

func NewServerSSM

func NewServerSSM(localLog zerolog.Logger, sap SSMSAPRequirements, pduAddress *Address) (*ServerSSM, error)

func (*ServerSSM) Confirmation

func (s *ServerSSM) Confirmation(args Args, kwArgs KWArgs) error

Confirmation This function is called when the application has provided a response and needs it to be sent to the

client.

func (*ServerSSM) Indication

func (s *ServerSSM) Indication(args Args, kwArgs KWArgs) error

Indication This function is called for each downstream packet related to

the transaction

func (*ServerSSM) ProcessTask

func (s *ServerSSM) ProcessTask() error

ProcessTask This function is called when the client has failed to send all the segments of a segmented request,

the application has taken too long to complete the request, or the client failed to ack the segments of a
segmented response

func (*ServerSSM) Request

func (s *ServerSSM) Request(args Args, kwArgs KWArgs) error

Request This function is called by transaction functions to send to the application

func (*ServerSSM) Response

func (s *ServerSSM) Response(args Args, kwArgs KWArgs) error

Response This function is called by client transaction functions when they want to send a message to the application.

type StateMachineAccessPoint

type StateMachineAccessPoint struct {
	ClientContract
	ServiceAccessPointContract
	*DefaultRFormatter `ignore:"true"`
	// contains filtered or unexported fields
}

func NewStateMachineAccessPoint

func NewStateMachineAccessPoint(localLog zerolog.Logger, localDevice LocalDeviceObject, options ...Option) (*StateMachineAccessPoint, error)

func (*StateMachineAccessPoint) AlternateString

func (s *StateMachineAccessPoint) AlternateString() (string, bool)

func (*StateMachineAccessPoint) Confirmation

func (s *StateMachineAccessPoint) Confirmation(args Args, kwArgs KWArgs) error

Confirmation Packets coming up the stack are APDU's

func (*StateMachineAccessPoint) GetApplicationTimeout

func (s *StateMachineAccessPoint) GetApplicationTimeout() uint

func (*StateMachineAccessPoint) GetClientTransactions

func (s *StateMachineAccessPoint) GetClientTransactions() []*ClientSSM

func (*StateMachineAccessPoint) GetDefaultAPDUSegmentTimeout

func (s *StateMachineAccessPoint) GetDefaultAPDUSegmentTimeout() uint

func (*StateMachineAccessPoint) GetDefaultAPDUTimeout

func (s *StateMachineAccessPoint) GetDefaultAPDUTimeout() uint

func (*StateMachineAccessPoint) GetDefaultMaxSegmentsAccepted

func (s *StateMachineAccessPoint) GetDefaultMaxSegmentsAccepted() readWriteModel.MaxSegmentsAccepted

func (*StateMachineAccessPoint) GetDefaultMaximumApduLengthAccepted

func (s *StateMachineAccessPoint) GetDefaultMaximumApduLengthAccepted() readWriteModel.MaxApduLengthAccepted

func (*StateMachineAccessPoint) GetDefaultSegmentationSupported

func (s *StateMachineAccessPoint) GetDefaultSegmentationSupported() readWriteModel.BACnetSegmentation

func (*StateMachineAccessPoint) GetDeviceInfoCache

func (s *StateMachineAccessPoint) GetDeviceInfoCache() *DeviceInfoCache

func (*StateMachineAccessPoint) GetLocalDevice

func (s *StateMachineAccessPoint) GetLocalDevice() LocalDeviceObject

func (*StateMachineAccessPoint) GetProposedWindowSize

func (s *StateMachineAccessPoint) GetProposedWindowSize() uint8

func (*StateMachineAccessPoint) GetServerTransactions

func (s *StateMachineAccessPoint) GetServerTransactions() []*ServerSSM

func (*StateMachineAccessPoint) RemoveClientTransaction

func (s *StateMachineAccessPoint) RemoveClientTransaction(c *ClientSSM)

func (*StateMachineAccessPoint) RemoveServerTransaction

func (s *StateMachineAccessPoint) RemoveServerTransaction(sssm *ServerSSM)

func (*StateMachineAccessPoint) SapConfirmation

func (s *StateMachineAccessPoint) SapConfirmation(args Args, kwArgs KWArgs) error

SapConfirmation This function is called when the application is responding to a request, the apdu may be a simple

ack, complex ack, error, reject or abort

func (*StateMachineAccessPoint) SapIndication

func (s *StateMachineAccessPoint) SapIndication(args Args, kwArgs KWArgs) error

SapIndication This function is called when the application is requesting a new transaction as a client.

func (*StateMachineAccessPoint) Serialize

func (d *StateMachineAccessPoint) Serialize() ([]byte, error)

func (*StateMachineAccessPoint) SerializeWithWriteBuffer

func (d *StateMachineAccessPoint) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*StateMachineAccessPoint) SetDeviceInfoCache

func (s *StateMachineAccessPoint) SetDeviceInfoCache(cache *DeviceInfoCache)

func (*StateMachineAccessPoint) String

func (d *StateMachineAccessPoint) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL