spine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DeviceInformationEntityId uint = 0
View Source
const NodeManagementFeatureId uint = 0

Variables

View Source
var Events events
View Source
var SpecificationVersion model.SpecificationVersionType = "1.1.1"

Functions

func CreateFunctionData

func CreateFunctionData[F any](featureType model.FeatureTypeType) []F

func EntityAddressType

func EntityAddressType(deviceAdress *model.AddressDeviceType, entityAddress []model.AddressEntityType) *model.EntityAddressType

func NewAddressEntityType

func NewAddressEntityType(entityIds []uint) []model.AddressEntityType

func NewEntityAddressType

func NewEntityAddressType(deviceName string, entityIds []uint) *model.EntityAddressType

func NewNodeManagementBindingRequestCallType

func NewNodeManagementBindingRequestCallType(clientAddress *model.FeatureAddressType, serverAddress *model.FeatureAddressType, featureType model.FeatureTypeType) *model.NodeManagementBindingRequestCallType

func NewNodeManagementSubscriptionRequestCallType

func NewNodeManagementSubscriptionRequestCallType(clientAddress *model.FeatureAddressType, serverAddress *model.FeatureAddressType, featureType model.FeatureTypeType) *model.NodeManagementSubscriptionRequestCallType

func NodeManagementAddress

func NodeManagementAddress(deviceAdress *model.AddressDeviceType) *model.FeatureAddressType

Types

type BindingEntry

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

type BindingManager

type BindingManager interface {
	AddBinding(localDevice *DeviceLocalImpl, remoteDevice *DeviceRemoteImpl, data model.BindingManagementRequestCallType) error
	RemoveBinding(data model.BindingManagementDeleteCallType, remoteDevice *DeviceRemoteImpl) error
	Bindings(remoteDevice *DeviceRemoteImpl) []*BindingEntry
	BindingsOnFeature(featureAddress model.FeatureAddressType) []*BindingEntry
}

func NewBindingManager

func NewBindingManager() BindingManager

type BindingManagerImpl

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

func (*BindingManagerImpl) AddBinding

func (c *BindingManagerImpl) AddBinding(localDevice *DeviceLocalImpl, remoteDevice *DeviceRemoteImpl, data model.BindingManagementRequestCallType) error

is sent from the client (remote device) to the server (local device)

func (*BindingManagerImpl) Bindings

func (c *BindingManagerImpl) Bindings(remoteDevice *DeviceRemoteImpl) []*BindingEntry

func (*BindingManagerImpl) BindingsOnFeature

func (c *BindingManagerImpl) BindingsOnFeature(featureAddress model.FeatureAddressType) []*BindingEntry

func (*BindingManagerImpl) RemoveBinding

func (c *BindingManagerImpl) RemoveBinding(data model.BindingManagementDeleteCallType, remoteDevice *DeviceRemoteImpl) error

type ComControl

type ComControl interface {
	// This must be connected to the correct remote device !!
	SendSpineMessage(datagram model.DatagramType) error
}

type DeviceImpl

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

func NewDeviceImpl

func NewDeviceImpl(address *model.AddressDeviceType, dType *model.DeviceTypeType, featureSet *model.NetworkManagementFeatureSetType) *DeviceImpl

Initialize a new device Both values are required for a local device but provided as empty strings for a remote device as the address is only provided via detailed discovery response

func (*DeviceImpl) Address

func (r *DeviceImpl) Address() *model.AddressDeviceType

func (*DeviceImpl) DestinationData

func (r *DeviceImpl) DestinationData() model.NodeManagementDestinationDataType

func (*DeviceImpl) DeviceType

func (r *DeviceImpl) DeviceType() *model.DeviceTypeType

func (*DeviceImpl) FeatureSet

func (*DeviceImpl) UseCaseManager

func (r *DeviceImpl) UseCaseManager() *UseCaseManager

type DeviceLocalConnection added in v0.1.2

type DeviceLocalConnection interface {
	RemoveRemoteDeviceConnection(ski string)
	AddRemoteDevice(ski string, writeI SpineDataConnection) SpineDataProcessing
}

implemented by spine.DeviceLocalImpl and used by shipConnection

type DeviceLocalImpl

type DeviceLocalImpl struct {
	*DeviceImpl
	// contains filtered or unexported fields
}

func NewDeviceLocalImpl

func NewDeviceLocalImpl(brandName, deviceModel, serialNumber, deviceCode, deviceAddress string, deviceType model.DeviceTypeType, featureSet model.NetworkManagementFeatureSetType) *DeviceLocalImpl

BrandName is the brand DeviceModel is the model SerialNumber is the serial number DeviceCode is the SHIP id (accessMethods.id) DeviceAddress is the SPINE device address

func (*DeviceLocalImpl) AddEntity

func (r *DeviceLocalImpl) AddEntity(entity *EntityLocalImpl)

func (*DeviceLocalImpl) AddRemoteDevice

func (r *DeviceLocalImpl) AddRemoteDevice(ski string, writeI SpineDataConnection) SpineDataProcessing

Adds a new remote device with a given SKI and triggers SPINE requesting device details

func (*DeviceLocalImpl) AddRemoteDeviceForSki added in v0.2.0

func (r *DeviceLocalImpl) AddRemoteDeviceForSki(ski string, rDevice *DeviceRemoteImpl)

Helper method used by tests and AddRemoteDevice

func (*DeviceLocalImpl) BindingManager

func (r *DeviceLocalImpl) BindingManager() BindingManager

func (*DeviceLocalImpl) Entities

func (r *DeviceLocalImpl) Entities() []*EntityLocalImpl

func (*DeviceLocalImpl) Entity

func (*DeviceLocalImpl) FeatureByAddress

func (r *DeviceLocalImpl) FeatureByAddress(address *model.FeatureAddressType) FeatureLocal

func (*DeviceLocalImpl) FeatureByTypeAndRole

func (r *DeviceLocalImpl) FeatureByTypeAndRole(featureType model.FeatureTypeType, role model.RoleType) FeatureLocal

func (*DeviceLocalImpl) HandleEvent

func (r *DeviceLocalImpl) HandleEvent(payload EventPayload)

React to some specific events

func (*DeviceLocalImpl) NotifySubscribers

func (r *DeviceLocalImpl) NotifySubscribers(featureAddress *model.FeatureAddressType, cmd model.CmdType)

func (*DeviceLocalImpl) ProcessCmd

func (r *DeviceLocalImpl) ProcessCmd(datagram model.DatagramType, remoteDevice *DeviceRemoteImpl) error

func (*DeviceLocalImpl) RemoteDeviceForSki

func (r *DeviceLocalImpl) RemoteDeviceForSki(ski string) *DeviceRemoteImpl

func (*DeviceLocalImpl) RemoteDevices

func (r *DeviceLocalImpl) RemoteDevices() []*DeviceRemoteImpl

func (*DeviceLocalImpl) RemoveEntity

func (r *DeviceLocalImpl) RemoveEntity(entity *EntityLocalImpl)

func (*DeviceLocalImpl) RemoveRemoteDevice

func (r *DeviceLocalImpl) RemoveRemoteDevice(ski string)

func (*DeviceLocalImpl) RemoveRemoteDeviceConnection added in v0.1.2

func (r *DeviceLocalImpl) RemoveRemoteDeviceConnection(ski string)

func (*DeviceLocalImpl) SubscriptionManager

func (r *DeviceLocalImpl) SubscriptionManager() SubscriptionManager

type DeviceRemoteImpl

type DeviceRemoteImpl struct {
	*DeviceImpl
	// contains filtered or unexported fields
}

func NewDeviceRemoteImpl

func NewDeviceRemoteImpl(localDevice *DeviceLocalImpl, ski string, writeHandler SpineDataConnection) *DeviceRemoteImpl

func (*DeviceRemoteImpl) AddEntityAndFeatures

func (d *DeviceRemoteImpl) AddEntityAndFeatures(initialData bool, data *model.NodeManagementDetailedDiscoveryDataType) ([]*EntityRemoteImpl, error)

func (*DeviceRemoteImpl) CheckEntityInformation

func (d *DeviceRemoteImpl) CheckEntityInformation(initialData bool, entity model.NodeManagementDetailedDiscoveryEntityInformationType) error

check if the provided entity information is correct provide initialData to check if the entity is new and not an update

func (*DeviceRemoteImpl) CloseConnection

func (d *DeviceRemoteImpl) CloseConnection()

this connection is closed

func (*DeviceRemoteImpl) Entities

func (d *DeviceRemoteImpl) Entities() []*EntityRemoteImpl

Return all entities of this device

func (*DeviceRemoteImpl) Entity

Return an entity with a given address

func (*DeviceRemoteImpl) FeatureByAddress

func (d *DeviceRemoteImpl) FeatureByAddress(address *model.FeatureAddressType) *FeatureRemoteImpl

Return the feature for a given address

func (*DeviceRemoteImpl) FeatureByEntityTypeAndRole

func (r *DeviceRemoteImpl) FeatureByEntityTypeAndRole(entity *EntityRemoteImpl, featureType model.FeatureTypeType, role model.RoleType) *FeatureRemoteImpl

Get the feature for a given entity, feature type and feature role

func (*DeviceRemoteImpl) HandleIncomingSpineMesssage

func (d *DeviceRemoteImpl) HandleIncomingSpineMesssage(message []byte) (*model.MsgCounterType, error)

processing incoming SPINE message from the associated SHIP connection

func (*DeviceRemoteImpl) IsHeartbeatMsgCounter

func (d *DeviceRemoteImpl) IsHeartbeatMsgCounter(msgCounter model.MsgCounterType) bool

func (*DeviceRemoteImpl) RemoveByAddress

func (d *DeviceRemoteImpl) RemoveByAddress(addr []model.AddressEntityType) *EntityRemoteImpl

Remove an entity with a given address from this device

func (*DeviceRemoteImpl) Sender

func (d *DeviceRemoteImpl) Sender() Sender

func (*DeviceRemoteImpl) Ski

func (d *DeviceRemoteImpl) Ski() string

return the device SKI

func (*DeviceRemoteImpl) StartHeartbeatSend

func (d *DeviceRemoteImpl) StartHeartbeatSend(senderAddr, destinationAddr *model.FeatureAddressType)

Needs to be called by the CEM implementation once a subscription for the local DeviceDiagnosis server feature is received

func (*DeviceRemoteImpl) Stopheartbeat

func (d *DeviceRemoteImpl) Stopheartbeat()

Needs to be called by the CEM implementation once a subscription for the local DeviceDiagnosis server feature is removed

func (*DeviceRemoteImpl) UpdateDevice

type ElementChangeType

type ElementChangeType uint16
const (
	ElementChangeAdd ElementChangeType = iota
	ElementChangeUpdate
	ElementChangeRemove
)

type EntityImpl

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

func NewEntity

func NewEntity(eType model.EntityTypeType, deviceAdress *model.AddressDeviceType, entityAddress []model.AddressEntityType) *EntityImpl

func (*EntityImpl) Address

func (r *EntityImpl) Address() *model.EntityAddressType

func (*EntityImpl) EntityType

func (r *EntityImpl) EntityType() model.EntityTypeType

func (*EntityImpl) NextFeatureId

func (r *EntityImpl) NextFeatureId() uint

func (*EntityImpl) SetDescription

func (r *EntityImpl) SetDescription(d *model.DescriptionType)

type EntityLocalImpl

type EntityLocalImpl struct {
	*EntityImpl
	// contains filtered or unexported fields
}

func NewEntityLocalImpl

func NewEntityLocalImpl(device *DeviceLocalImpl, eType model.EntityTypeType, entityAddress []model.AddressEntityType) *EntityLocalImpl

func (*EntityLocalImpl) AddFeature

func (r *EntityLocalImpl) AddFeature(f FeatureLocal)

Add a feature to the entity if it is not already added

func (*EntityLocalImpl) Device

func (r *EntityLocalImpl) Device() *DeviceLocalImpl

func (*EntityLocalImpl) Feature

func (r *EntityLocalImpl) Feature(addressFeature *model.AddressFeatureType) FeatureLocal

func (*EntityLocalImpl) FeatureOfTypeAndRole

func (r *EntityLocalImpl) FeatureOfTypeAndRole(featureType model.FeatureTypeType, role model.RoleType) FeatureLocal

func (*EntityLocalImpl) Features

func (r *EntityLocalImpl) Features() []FeatureLocal

func (*EntityLocalImpl) GetOrAddFeature

func (r *EntityLocalImpl) GetOrAddFeature(featureType model.FeatureTypeType, role model.RoleType) FeatureLocal

either returns an existing feature or creates a new one for a given entity, featuretype and role

type EntityRemoteImpl

type EntityRemoteImpl struct {
	*EntityImpl
	// contains filtered or unexported fields
}

func NewEntityRemoteImpl

func NewEntityRemoteImpl(device *DeviceRemoteImpl, eType model.EntityTypeType, entityAddress []model.AddressEntityType) *EntityRemoteImpl

func (*EntityRemoteImpl) AddFeature

func (r *EntityRemoteImpl) AddFeature(f *FeatureRemoteImpl)

func (*EntityRemoteImpl) Device

func (r *EntityRemoteImpl) Device() *DeviceRemoteImpl

func (*EntityRemoteImpl) Feature

func (r *EntityRemoteImpl) Feature(addressFeature *model.AddressFeatureType) *FeatureRemoteImpl

func (*EntityRemoteImpl) Features

func (r *EntityRemoteImpl) Features() []*FeatureRemoteImpl

func (*EntityRemoteImpl) RemoveAllFeatures

func (r *EntityRemoteImpl) RemoveAllFeatures()

type ErrorType

type ErrorType struct {
	ErrorNumber model.ErrorNumberType
	Description *model.DescriptionType
}

func NewErrorType

func NewErrorType(errorNumber model.ErrorNumberType, description string) *ErrorType

func NewErrorTypeFromNumber

func NewErrorTypeFromNumber(errorNumber model.ErrorNumberType) *ErrorType

func NewErrorTypeFromResult

func NewErrorTypeFromResult(result *model.ResultDataType) *ErrorType

func NewErrorTypeFromString

func NewErrorTypeFromString(description string) *ErrorType

func (*ErrorType) String

func (e *ErrorType) String() string

type EventHandler

type EventHandler interface {
	HandleEvent(EventPayload)
}

type EventPayload

type EventPayload struct {
	Ski           string            // required
	EventType     EventType         // required
	ChangeType    ElementChangeType // required
	Device        *DeviceRemoteImpl // required for DetailedDiscovery Call
	Entity        *EntityRemoteImpl // required for DetailedDiscovery Call and Notify
	Feature       *FeatureRemoteImpl
	CmdClassifier *model.CmdClassifierType // optional, used together with EventType EventTypeDataChange
	Data          any
}

type EventType

type EventType uint16
const (
	EventTypeDeviceChange       EventType = iota // Sent after successful response of NodeManagementDetailedDiscovery
	EventTypeEntityChange                        // Sent after successful response of NodeManagementDetailedDiscovery
	EventTypeSubscriptionChange                  // Sent after successful subscription request from remote
	EventTypeBindingChange                       // Sent after successful binding request from remote
	EventTypeDataChange                          // Sent after remote provided new data items for a function
)

type Feature

type Feature interface {
	Address() *model.FeatureAddressType
	Type() model.FeatureTypeType
	Role() model.RoleType
}

type FeatureImpl

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

func NewFeatureImpl

func NewFeatureImpl(address *model.FeatureAddressType, ftype model.FeatureTypeType, role model.RoleType) *FeatureImpl

func (*FeatureImpl) Address

func (r *FeatureImpl) Address() *model.FeatureAddressType

func (*FeatureImpl) Description

func (r *FeatureImpl) Description() *model.DescriptionType

func (*FeatureImpl) Operations

func (r *FeatureImpl) Operations() map[model.FunctionType]*Operations

func (*FeatureImpl) Role

func (r *FeatureImpl) Role() model.RoleType

func (*FeatureImpl) SetDescription

func (r *FeatureImpl) SetDescription(d *model.DescriptionType)

func (*FeatureImpl) SetDescriptionString

func (r *FeatureImpl) SetDescriptionString(s string)

func (*FeatureImpl) String

func (r *FeatureImpl) String() string

func (*FeatureImpl) Type

func (r *FeatureImpl) Type() model.FeatureTypeType

type FeatureLocal

type FeatureLocal interface {
	Feature
	Data(function model.FunctionType) any
	SetData(function model.FunctionType, data any)
	AddResultHandler(handler FeatureResult)
	Information() *model.NodeManagementDetailedDiscoveryFeatureInformationType
	AddFunctionType(function model.FunctionType, read, write bool)
	RequestData(
		function model.FunctionType,
		selector any,
		elements any,
		destination *FeatureRemoteImpl) (*model.MsgCounterType, *ErrorType)
	RequestDataBySenderAddress(
		cmd model.CmdType,
		sender Sender,
		destinationSki string,
		destinationAddress *model.FeatureAddressType,
		maxDelay time.Duration) (*model.MsgCounterType, *ErrorType)
	FetchRequestData(
		msgCounter model.MsgCounterType,
		destination *FeatureRemoteImpl) (any, *ErrorType)
	RequestAndFetchData(
		function model.FunctionType,
		selector any,
		elements any,
		destination *FeatureRemoteImpl) (any, *ErrorType)
	Subscribe(remoteDevice *DeviceRemoteImpl, remoteAdress *model.FeatureAddressType) (*model.MsgCounterType, *ErrorType)
	// SubscribeAndWait(remoteDevice *DeviceRemoteImpl, remoteAdress *model.FeatureAddressType) *ErrorType // Subscribes the local feature to the given destination feature; the go routine will block until the response is processed
	Bind(remoteDevice *DeviceRemoteImpl, remoteAdress *model.FeatureAddressType) (*model.MsgCounterType, *ErrorType)
	// BindAndWait(remoteDevice *DeviceRemoteImpl, remoteAddress *model.FeatureAddressType) *ErrorType
	NotifyData(
		function model.FunctionType,
		deleteSelector, partialSelector any,
		partialWithoutSelector bool,
		deleteElements any,
		destination *FeatureRemoteImpl) (*model.MsgCounterType, *ErrorType)
	WriteData(
		function model.FunctionType,
		deleteSelector, partialSelector any,
		deleteElements any,
		destination *FeatureRemoteImpl) (*model.MsgCounterType, *ErrorType)
	HandleMessage(message *Message) *ErrorType
}

type FeatureLocalImpl

type FeatureLocalImpl struct {
	*FeatureImpl
	// contains filtered or unexported fields
}

func NewFeatureLocalImpl

func NewFeatureLocalImpl(id uint, entity *EntityLocalImpl, ftype model.FeatureTypeType, role model.RoleType) *FeatureLocalImpl

func (*FeatureLocalImpl) AddFunctionType

func (r *FeatureLocalImpl) AddFunctionType(function model.FunctionType, read, write bool)

Add supported function to the feature if its role is Server or Special

func (*FeatureLocalImpl) AddResultHandler

func (r *FeatureLocalImpl) AddResultHandler(handler FeatureResult)

func (*FeatureLocalImpl) Bind

func (r *FeatureLocalImpl) Bind(remoteDevice *DeviceRemoteImpl, remoteAddress *model.FeatureAddressType) (*model.MsgCounterType, *ErrorType)

Bind to a remote feature

func (*FeatureLocalImpl) Data

func (r *FeatureLocalImpl) Data(function model.FunctionType) any

func (*FeatureLocalImpl) Device

func (r *FeatureLocalImpl) Device() *DeviceLocalImpl

func (*FeatureLocalImpl) Entity

func (r *FeatureLocalImpl) Entity() *EntityLocalImpl

func (*FeatureLocalImpl) FetchRequestData

func (r *FeatureLocalImpl) FetchRequestData(
	msgCounter model.MsgCounterType,
	destination *FeatureRemoteImpl) (any, *ErrorType)

Wait and return the response from destination for a message with the msgCounter ID this will block until the response is received

func (*FeatureLocalImpl) HandleMessage

func (r *FeatureLocalImpl) HandleMessage(message *Message) *ErrorType

func (*FeatureLocalImpl) NotifyData

func (r *FeatureLocalImpl) NotifyData(
	function model.FunctionType,
	deleteSelector, partialSelector any,
	partialWithoutSelector bool,
	deleteElements any,
	destination *FeatureRemoteImpl) (*model.MsgCounterType, *ErrorType)

Send a notification message with the current data of function to the destination

func (*FeatureLocalImpl) RequestAndFetchData

func (r *FeatureLocalImpl) RequestAndFetchData(
	function model.FunctionType,
	selector any,
	elements any,
	destination *FeatureRemoteImpl) (any, *ErrorType)

Send a data request for function to destination and return the response this will block until the response is received

func (*FeatureLocalImpl) RequestData

func (r *FeatureLocalImpl) RequestData(
	function model.FunctionType,
	selector any,
	elements any,
	destination *FeatureRemoteImpl) (*model.MsgCounterType, *ErrorType)

func (*FeatureLocalImpl) RequestDataBySenderAddress

func (r *FeatureLocalImpl) RequestDataBySenderAddress(
	cmd model.CmdType,
	sender Sender,
	deviceSki string,
	destinationAddress *model.FeatureAddressType,
	maxDelay time.Duration) (*model.MsgCounterType, *ErrorType)

func (*FeatureLocalImpl) SetData

func (r *FeatureLocalImpl) SetData(function model.FunctionType, data any)

func (*FeatureLocalImpl) Subscribe

func (r *FeatureLocalImpl) Subscribe(remoteDevice *DeviceRemoteImpl, remoteAdress *model.FeatureAddressType) (*model.MsgCounterType, *ErrorType)

Subscribe to a remote feature

func (*FeatureLocalImpl) WriteData

func (r *FeatureLocalImpl) WriteData(
	function model.FunctionType,
	deleteSelector, partialSelector any,
	deleteElements any,
	destination *FeatureRemoteImpl) (*model.MsgCounterType, *ErrorType)

Send a write message with provided data of function to the destination

type FeatureRemoteImpl

type FeatureRemoteImpl struct {
	*FeatureImpl
	// contains filtered or unexported fields
}

func NewFeatureRemoteImpl

func NewFeatureRemoteImpl(id uint, entity *EntityRemoteImpl, ftype model.FeatureTypeType, role model.RoleType) *FeatureRemoteImpl

func (*FeatureRemoteImpl) Data

func (r *FeatureRemoteImpl) Data(function model.FunctionType) any

func (*FeatureRemoteImpl) Device

func (r *FeatureRemoteImpl) Device() *DeviceRemoteImpl

func (*FeatureRemoteImpl) Entity

func (r *FeatureRemoteImpl) Entity() *EntityRemoteImpl

func (*FeatureRemoteImpl) MaxResponseDelayDuration

func (r *FeatureRemoteImpl) MaxResponseDelayDuration() time.Duration

func (*FeatureRemoteImpl) Sender

func (r *FeatureRemoteImpl) Sender() Sender

func (*FeatureRemoteImpl) SetMaxResponseDelay

func (r *FeatureRemoteImpl) SetMaxResponseDelay(delay *model.MaxResponseDelayType)

func (*FeatureRemoteImpl) SetOperations

func (r *FeatureRemoteImpl) SetOperations(functions []model.FunctionPropertyType)

func (*FeatureRemoteImpl) UpdateData

func (r *FeatureRemoteImpl) UpdateData(function model.FunctionType, data any, filterPartial *model.FilterType, filterDelete *model.FilterType)

type FeatureResult

type FeatureResult interface {
	HandleResult(ResultMessage)
}

type FunctionData

type FunctionData interface {
	Function() model.FunctionType
	DataAny() any
	UpdateDataAny(data any, filterPartial *model.FilterType, filterDelete *model.FilterType)
}

type FunctionDataCmd

type FunctionDataCmd interface {
	FunctionData
	ReadCmdType(partialSelector any, elements any) model.CmdType
	ReplyCmdType(partial bool) model.CmdType
	NotifyCmdType(deleteSelector, partialSelector any, partialWithoutSelector bool, deleteElements any) model.CmdType
	WriteCmdType(deleteSelector, partialSelector any, deleteElements any) model.CmdType
}

type FunctionDataCmdImpl

type FunctionDataCmdImpl[T any] struct {
	*FunctionDataImpl[T]
}

func NewFunctionDataCmd

func NewFunctionDataCmd[T any](function model.FunctionType) *FunctionDataCmdImpl[T]

func (*FunctionDataCmdImpl[T]) NotifyCmdType

func (r *FunctionDataCmdImpl[T]) NotifyCmdType(deleteSelector, partialSelector any, partialWithoutSelector bool, deleteElements any) model.CmdType

func (*FunctionDataCmdImpl[T]) ReadCmdType

func (r *FunctionDataCmdImpl[T]) ReadCmdType(partialSelector any, elements any) model.CmdType

func (*FunctionDataCmdImpl[T]) ReplyCmdType

func (r *FunctionDataCmdImpl[T]) ReplyCmdType(partial bool) model.CmdType

func (*FunctionDataCmdImpl[T]) WriteCmdType

func (r *FunctionDataCmdImpl[T]) WriteCmdType(deleteSelector, partialSelector any, deleteElements any) model.CmdType

type FunctionDataImpl

type FunctionDataImpl[T any] struct {
	// contains filtered or unexported fields
}

func NewFunctionData

func NewFunctionData[T any](function model.FunctionType) *FunctionDataImpl[T]

func (*FunctionDataImpl[T]) Data

func (r *FunctionDataImpl[T]) Data() *T

func (*FunctionDataImpl[T]) DataAny

func (r *FunctionDataImpl[T]) DataAny() any

func (*FunctionDataImpl[T]) Function

func (r *FunctionDataImpl[T]) Function() model.FunctionType

func (*FunctionDataImpl[T]) UpdateData

func (r *FunctionDataImpl[T]) UpdateData(newData *T, filterPartial *model.FilterType, filterDelete *model.FilterType) *ErrorType

func (*FunctionDataImpl[T]) UpdateDataAny

func (r *FunctionDataImpl[T]) UpdateDataAny(newData any, filterPartial *model.FilterType, filterDelete *model.FilterType)

type HeartbeatSender

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

func NewHeartbeatSender

func NewHeartbeatSender(sender Sender) *HeartbeatSender

func (*HeartbeatSender) AddMsgCounter

func (c *HeartbeatSender) AddMsgCounter(msgCounter *model.MsgCounterType)

func (*HeartbeatSender) IsHeartbeatMsgCounter

func (c *HeartbeatSender) IsHeartbeatMsgCounter(msgCounter model.MsgCounterType) bool

func (*HeartbeatSender) SendHeartBeatData

func (c *HeartbeatSender) SendHeartBeatData(requestHeader *model.HeaderType) error

func (*HeartbeatSender) StartHeartbeatSend

func (c *HeartbeatSender) StartHeartbeatSend(senderAddr, destinationAddr *model.FeatureAddressType)

func (*HeartbeatSender) StopHeartbeat

func (c *HeartbeatSender) StopHeartbeat()

type Message

type Message struct {
	RequestHeader *model.HeaderType
	CmdClassifier model.CmdClassifierType
	Cmd           model.CmdType
	FilterPartial *model.FilterType
	FilterDelete  *model.FilterType
	FeatureRemote *FeatureRemoteImpl
	EntityRemote  *EntityRemoteImpl
	DeviceRemote  *DeviceRemoteImpl
}

type NodeManagementImpl

type NodeManagementImpl struct {
	*FeatureLocalImpl
	// contains filtered or unexported fields
}

func NewNodeManagementImpl

func NewNodeManagementImpl(id uint, entity *EntityLocalImpl) *NodeManagementImpl

func (*NodeManagementImpl) Device

func (r *NodeManagementImpl) Device() *DeviceLocalImpl

func (*NodeManagementImpl) HandleMessage

func (r *NodeManagementImpl) HandleMessage(message *Message) *ErrorType

func (*NodeManagementImpl) RequestDestinationListData

func (r *NodeManagementImpl) RequestDestinationListData(remoteDeviceAddress *model.AddressDeviceType, sender Sender) (*model.MsgCounterType, *ErrorType)

func (*NodeManagementImpl) RequestDetailedDiscovery

func (r *NodeManagementImpl) RequestDetailedDiscovery(remoteDeviceSki string, remoteDeviceAddress *model.AddressDeviceType, sender Sender) (*model.MsgCounterType, *ErrorType)

request detailed discovery data from a remote device

func (*NodeManagementImpl) RequestUseCaseData

func (r *NodeManagementImpl) RequestUseCaseData(remoteDeviceSki string, remoteDeviceAddress *model.AddressDeviceType, sender Sender) (*model.MsgCounterType, *ErrorType)

type Operations

type Operations struct {
	Read, Write bool
}

func NewOperations

func NewOperations(read, write bool) *Operations

func (*Operations) Information

func (r *Operations) Information() *model.PossibleOperationsType

func (*Operations) String

func (r *Operations) String() string

type PendingRequests

type PendingRequests interface {
	Add(ski string, counter model.MsgCounterType, maxDelay time.Duration)
	SetData(ski string, counter model.MsgCounterType, data any) *ErrorType
	SetResult(ski string, counter model.MsgCounterType, errorResult *ErrorType) *ErrorType
	GetData(ski string, counter model.MsgCounterType) (any, *ErrorType)
	Remove(ski string, counter model.MsgCounterType) *ErrorType
}

func NewPendingRequest

func NewPendingRequest() PendingRequests

type PendingRequestsImpl

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

func (*PendingRequestsImpl) Add

func (r *PendingRequestsImpl) Add(ski string, counter model.MsgCounterType, maxDelay time.Duration)

func (*PendingRequestsImpl) GetData

func (r *PendingRequestsImpl) GetData(ski string, counter model.MsgCounterType) (any, *ErrorType)

func (*PendingRequestsImpl) Remove

func (r *PendingRequestsImpl) Remove(ski string, counter model.MsgCounterType) *ErrorType

func (*PendingRequestsImpl) SetData

func (r *PendingRequestsImpl) SetData(ski string, counter model.MsgCounterType, data any) *ErrorType

func (*PendingRequestsImpl) SetResult

func (r *PendingRequestsImpl) SetResult(ski string, counter model.MsgCounterType, errorResult *ErrorType) *ErrorType

type ResultMessage

type ResultMessage struct {
	MsgCounterReference model.MsgCounterType  // required
	Result              *model.ResultDataType // required, may not be nil
	FeatureLocal        *FeatureLocalImpl     // required, may not be nil
	FeatureRemote       *FeatureRemoteImpl    // required, may not be nil
	EntityRemote        *EntityRemoteImpl     // required, may not be nil
	DeviceRemote        *DeviceRemoteImpl     // required, may not be nil
}

type Sender

type Sender interface {
	// Sends a read cmd to request some data
	Request(cmdClassifier model.CmdClassifierType, senderAddress, destinationAddress *model.FeatureAddressType, ackRequest bool, cmd []model.CmdType) (*model.MsgCounterType, error)
	// Sends a result cmd with no error to indicate that a message was processed successfully
	ResultSuccess(requestHeader *model.HeaderType, senderAddress *model.FeatureAddressType) error
	// Sends a result cmd with error information to indicate that a message processing failed
	ResultError(requestHeader *model.HeaderType, senderAddress *model.FeatureAddressType, err *ErrorType) error
	// Sends a reply cmd to response to a read cmd
	Reply(requestHeader *model.HeaderType, senderAddress *model.FeatureAddressType, cmd model.CmdType) error
	// Sends a call cmd with a subscription request
	Subscribe(senderAddress, destinationAddress *model.FeatureAddressType, serverFeatureType model.FeatureTypeType) (*model.MsgCounterType, error)
	// Sends a call cmd with a binding request
	Bind(senderAddress, destinationAddress *model.FeatureAddressType, serverFeatureType model.FeatureTypeType) (*model.MsgCounterType, error)
	// Sends a notify cmd to indicate that a subscribed feature changed
	Notify(senderAddress, destinationAddress *model.FeatureAddressType, cmd model.CmdType) (*model.MsgCounterType, error)
	// Sends a write cmd, setting properties of remote features
	Write(senderAddress, destinationAddress *model.FeatureAddressType, cmd model.CmdType) (*model.MsgCounterType, error)
}

func NewSender

func NewSender(writeI SpineDataConnection) Sender

type SenderImpl

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

func (*SenderImpl) Bind

func (c *SenderImpl) Bind(senderAddress, destinationAddress *model.FeatureAddressType, serverFeatureType model.FeatureTypeType) (*model.MsgCounterType, error)

Send a binding request to a remote server feature

func (*SenderImpl) Notify

func (c *SenderImpl) Notify(senderAddress, destinationAddress *model.FeatureAddressType, cmd model.CmdType) (*model.MsgCounterType, error)

Notify sends notification to destination

func (*SenderImpl) Reply

func (c *SenderImpl) Reply(requestHeader *model.HeaderType, senderAddress *model.FeatureAddressType, cmd model.CmdType) error

Reply sends reply to original sender

func (*SenderImpl) Request

func (c *SenderImpl) Request(cmdClassifier model.CmdClassifierType, senderAddress, destinationAddress *model.FeatureAddressType, ackRequest bool, cmd []model.CmdType) (*model.MsgCounterType, error)

Sends request

func (*SenderImpl) ResultError

func (c *SenderImpl) ResultError(requestHeader *model.HeaderType, senderAddress *model.FeatureAddressType, err *ErrorType) error

func (*SenderImpl) ResultSuccess

func (c *SenderImpl) ResultSuccess(requestHeader *model.HeaderType, senderAddress *model.FeatureAddressType) error

func (*SenderImpl) Subscribe

func (c *SenderImpl) Subscribe(senderAddress, destinationAddress *model.FeatureAddressType, serverFeatureType model.FeatureTypeType) (*model.MsgCounterType, error)

Send a subscription request to a remote server feature

func (*SenderImpl) Write

func (c *SenderImpl) Write(senderAddress, destinationAddress *model.FeatureAddressType, cmd model.CmdType) (*model.MsgCounterType, error)

Write sends notification to destination

type SpineDataConnection

type SpineDataConnection interface {
	WriteSpineMessage(message []byte)
}

Used to pass an outgoing SPINE message from a DeviceLocalImpl to the SHIP connection

Implemented by ShipConnection, used by DeviceLocalImpl

type SpineDataProcessing

type SpineDataProcessing interface {
	HandleIncomingSpineMesssage(message []byte) (*model.MsgCounterType, error)
}

Used to pass an incoming SPINE message from a SHIP connection to the proper DeviceRemoteImpl

Implemented by DeviceRemoteImpl, used by ShipConnection

type SubscriptionEntry

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

type SubscriptionManager

type SubscriptionManager interface {
	AddSubscription(localDevice *DeviceLocalImpl, remoteDevice *DeviceRemoteImpl, data model.SubscriptionManagementRequestCallType) error
	RemoveSubscription(data model.SubscriptionManagementDeleteCallType, remoteDevice *DeviceRemoteImpl) error
	RemoveSubscriptionsForEntity(remoteEntity *EntityRemoteImpl)
	Subscriptions(remoteDevice *DeviceRemoteImpl) []*SubscriptionEntry
	SubscriptionsOnFeature(featureAddress model.FeatureAddressType) []*SubscriptionEntry
}

func NewSubscriptionManager

func NewSubscriptionManager() SubscriptionManager

type SubscriptionManagerImpl

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

func (*SubscriptionManagerImpl) AddSubscription

func (c *SubscriptionManagerImpl) AddSubscription(localDevice *DeviceLocalImpl, remoteDevice *DeviceRemoteImpl, data model.SubscriptionManagementRequestCallType) error

is sent from the client (remote device) to the server (local device)

func (*SubscriptionManagerImpl) RemoveSubscription

Remove a specific subscription that is provided by a delete message from a remote device

func (*SubscriptionManagerImpl) RemoveSubscriptionsForEntity

func (c *SubscriptionManagerImpl) RemoveSubscriptionsForEntity(remoteEntity *EntityRemoteImpl)

Remove all existing subscriptions for a given remote device entity

func (*SubscriptionManagerImpl) Subscriptions

func (c *SubscriptionManagerImpl) Subscriptions(remoteDevice *DeviceRemoteImpl) []*SubscriptionEntry

func (*SubscriptionManagerImpl) SubscriptionsOnFeature

func (c *SubscriptionManagerImpl) SubscriptionsOnFeature(featureAddress model.FeatureAddressType) []*SubscriptionEntry

type UseCaseImpl

type UseCaseImpl struct {
	Entity *EntityLocalImpl
	Actor  model.UseCaseActorType
	// contains filtered or unexported fields
}

func NewUseCase

func NewUseCase(entity *EntityLocalImpl, ucEnumType model.UseCaseNameType, useCaseVersion model.SpecificationVersionType, scenarioSupport []model.UseCaseScenarioSupportType) *UseCaseImpl

func NewUseCaseWithActor added in v0.2.0

func NewUseCaseWithActor(entity *EntityLocalImpl, actor model.UseCaseActorType, ucEnumType model.UseCaseNameType, useCaseVersion model.SpecificationVersionType, scenarioSupport []model.UseCaseScenarioSupportType) *UseCaseImpl

type UseCaseManager

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

func NewUseCaseManager

func NewUseCaseManager() *UseCaseManager

func (*UseCaseManager) Add

func (*UseCaseManager) UseCaseInformation

func (r *UseCaseManager) UseCaseInformation() []model.UseCaseInformationDataType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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