api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 9 Imported by: 8 modules, 31 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDataForMetadataKeyNotFound = errors.New("data for key not found")

ErrDataForMetadataKeyNotFound indicates that no data item is found for the given key

View Source
var ErrDataInvalid = errors.New("data not valid")

ErrDataInvalid indicates that the currently available data is not valid and should be ignored

View Source
var ErrDataNotAvailable = errors.New("data not available")

ErrDataNotAvailable indicates that no data set is yet available

View Source
var ErrDeviceDisconnected = errors.New("device is disconnected")
View Source
var ErrEntityNotFound = errors.New("entity not found")
View Source
var ErrFunctionNotSupported = errors.New("function is not supported")
View Source
var ErrMetadataNotAvailable = errors.New("meta data not available")

ErrMetadataNotAvailable indicates that the meta data information is not available e.g. decsriptions, constraints, ...

View Source
var ErrMissingData = errors.New("missing data")
View Source
var ErrNoCompatibleEntity = errors.New("no compatible entity")
View Source
var ErrNotSupported = errors.New("not supported")
View Source
var ErrOperationOnFunctionNotSupported = errors.New("operation is not supported on function")
View Source
var ErrUsecCaseNotSupported = errors.New("usecase is not supported")

Functions

This section is empty.

Types

type Configuration

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

defines requires meta information about this service

func NewConfiguration

func NewConfiguration(
	vendorCode,
	deviceBrand,
	deviceModel,
	serialNumber string,
	deviceCategories []shipapi.DeviceCategoryType,
	deviceType model.DeviceTypeType,
	entityTypes []model.EntityTypeType,
	port int,
	certificate tls.Certificate,
	heartbeatTimeout time.Duration,
	pairingConfig *shipapi.PairingConfig,
	ringBufferPersistence shipapi.RingBufferPersistence,
) (*Configuration, error)

Setup a Configuration with the required parameters

Parameters:

  • vendorCode: The vendors IANA PEN, optional but highly recommended.
  • deviceBrand: The deviceBrand of the device, required (may not be longer than 32 UTF8 characters)
  • deviceModel: The device model, required (may not be longer than 32 UTF8 characters)
  • serialNumber: Serial number of the device, required (may not be longer than 32 UTF8 characters)
  • deviceCategories: Device categories of the device model, required
  • deviceType: SPINE device type of the device model, required
  • entityTypes: SPINE entity types for each entity that should automatically be created, can be empty
  • port: The port address of the websocket server, required
  • certificate: The certificate used for the service and its connections, required
  • heartbeatTimeout: The timeout to be used for sending heartbeats and applied to all local entities created on setup of the service
  • pairingConfig: Optional SHIP Pairing configuration. Pass nil if SHIP Pairing should not be used
  • ringBufferPersistence: Interface to Pairing ring buffer persistence. SHALL be set if pairingConfig is set to listener mode (i.e. devA). See ship-go examples on how to create an implementation of this interface

Returns:

  • *Configuration: The created configuration
  • error: An error if the configuration could not be created

func (*Configuration) Certificate

func (s *Configuration) Certificate() tls.Certificate

Returns the certificate

func (*Configuration) DeviceBrand

func (s *Configuration) DeviceBrand() string

Returns the configuration device brand

func (*Configuration) DeviceCategories added in v0.8.0

func (c *Configuration) DeviceCategories() []shipapi.DeviceCategoryType

Returns the configuration device categories

func (*Configuration) DeviceModel

func (s *Configuration) DeviceModel() string

Returns the configuration device model

func (*Configuration) DeviceSerialNumber

func (s *Configuration) DeviceSerialNumber() string

Returns the configuration device serial number

func (*Configuration) DeviceType

func (s *Configuration) DeviceType() model.DeviceTypeType

Returns the configuration device type

func (*Configuration) EntityTypes

func (s *Configuration) EntityTypes() []model.EntityTypeType

Returns the configuration entity types

func (*Configuration) FeatureSet

Returns the configuration network management feature set type

func (*Configuration) HeartbeatTimeout

func (s *Configuration) HeartbeatTimeout() time.Duration

Returns the heartbeat timeout

func (*Configuration) Identifier

func (s *Configuration) Identifier() string

return the identifier to be used for mDNS and SHIP ID returns in this order: - alternateIdentifier - generateIdentifier

func (*Configuration) Interfaces

func (s *Configuration) Interfaces() []string

Returns the configuration network interfaces

func (*Configuration) MdnsProviderSelection

func (s *Configuration) MdnsProviderSelection() mdns.MdnsProviderSelection

Returns the mDNS provider selection

func (*Configuration) MdnsServiceName

func (s *Configuration) MdnsServiceName() string

return the name to be used as the mDNS service name returns in this order: - alternateMdnsServiceName - generateIdentifier

func (*Configuration) PairingConfig added in v0.8.0

func (s *Configuration) PairingConfig() *shipapi.PairingConfig

func (*Configuration) Port

func (s *Configuration) Port() int

Returns the port

func (*Configuration) RingBufferPersistence added in v0.8.0

func (s *Configuration) RingBufferPersistence() shipapi.RingBufferPersistence

func (*Configuration) SetAlternateIdentifier

func (s *Configuration) SetAlternateIdentifier(identifier string)

set an alternative mDNS and SHIP identifier usually this is only used when no deviceCode is available or identical to the brand if this is not set, generated identifier is used

func (*Configuration) SetAlternateMdnsServiceName

func (s *Configuration) SetAlternateMdnsServiceName(name string)

set an alternative mDNS service name this is normally not needed or used

func (*Configuration) SetCertificate

func (s *Configuration) SetCertificate(cert tls.Certificate)

Set the certificate

func (*Configuration) SetInterfaces

func (s *Configuration) SetInterfaces(ifaces []string)

define which network interfaces should be considered instead of all existing expects a list of network interface names

func (*Configuration) SetMdnsProviderSelection

func (s *Configuration) SetMdnsProviderSelection(providerSelection mdns.MdnsProviderSelection)

set the mDNS provider selection

func (*Configuration) VendorCode

func (s *Configuration) VendorCode() string

Returns the configuration vendor code

type DeviceClassificationClientInterface added in v0.6.0

type DeviceClassificationClientInterface interface {
	// request DeviceClassificationManufacturerData from a remote device entity
	RequestManufacturerDetails() (*model.MsgCounterType, error)
}

type DeviceClassificationCommonInterface added in v0.6.0

type DeviceClassificationCommonInterface interface {
	// get the current manufacturer details for a remote device entity
	GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error)
}

Common interface for DeviceClassificationClientInterface and DeviceClassificationServerInterface

type DeviceClassificationServerInterface added in v0.6.0

type DeviceClassificationServerInterface interface {
}

type DeviceConfigurationClientInterface added in v0.6.0

type DeviceConfigurationClientInterface interface {
	DeviceConfigurationCommonInterface

	// request DeviceConfigurationKeyValueDescriptionDataType from a remote entity
	RequestKeyValueDescriptions(
		selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType,
		elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType,
	) (*model.MsgCounterType, error)

	// request DeviceConfigurationKeyValueListData from a remote entity
	RequestKeyValues(
		selector *model.DeviceConfigurationKeyValueListDataSelectorsType,
		elements *model.DeviceConfigurationKeyValueDataElementsType,
	) (*model.MsgCounterType, error)

	// write key values
	// returns an error if this failed
	WriteKeyValues(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)
}

type DeviceConfigurationCommonInterface added in v0.6.0

type DeviceConfigurationCommonInterface interface {
	// check if spine.EventPayload Data contains data for a given filter
	//
	// data type will be checked for model.DeviceConfigurationKeyValueListDataType,
	// filter type will be checked for model.DeviceConfigurationKeyValueDescriptionDataType
	CheckEventPayloadDataForFilter(payloadData any, filter any) bool

	// Get the description for a given keyId
	//
	// Will return nil if no matching description was found
	GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)

	// Get the description for a given value combination
	//
	// Returns an error if no matching description was found
	GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)

	// Get the key value data for a given keyId
	//
	// Will return nil if no matching data was found
	GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)

	// Get key value data for a given filter
	//
	// Will return nil if no matching data was found
	GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)
}

Common interface for DeviceConfigurationClientInterface and DeviceConfigurationServerInterface

type DeviceConfigurationServerInterface added in v0.6.0

type DeviceConfigurationServerInterface interface {
	DeviceConfigurationCommonInterface

	// Add a new description data set and return the keyId
	//
	// will return nil if the data set could not be added
	AddKeyValueDescription(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType

	// Set or update data set for a keyId
	// Elements provided in deleteElements will be removed from the data set before the update
	//
	// Will return an error if the data set could not be updated
	UpdateKeyValueDataForKeyId(
		data model.DeviceConfigurationKeyValueDataType,
		deleteElements *model.DeviceConfigurationKeyValueDataElementsType,
		keyId model.DeviceConfigurationKeyIdType,
	) error

	// Set or update data set for a filter
	// Elements provided in deleteElements will be removed from the data set before the update
	//
	// Will return an error if the data set could not be updated
	UpdateKeyValueDataForFilter(
		data model.DeviceConfigurationKeyValueDataType,
		deleteElements *model.DeviceConfigurationKeyValueDataElementsType,
		filter model.DeviceConfigurationKeyValueDescriptionDataType,
	) error
}

type DeviceDiagnosisClientInterface added in v0.6.0

type DeviceDiagnosisClientInterface interface {
	// request DeviceDiagnosisStateData from a remote entity
	RequestState() (*model.MsgCounterType, error)

	// request FunctionTypeDeviceDiagnosisHeartbeatData from a remote device
	RequestHeartbeat() (*model.MsgCounterType, error)
}

type DeviceDiagnosisCommonInterface added in v0.6.0

type DeviceDiagnosisCommonInterface interface {
	// get the current diagnosis state for an device entity
	GetState() (*model.DeviceDiagnosisStateDataType, error)

	// check if the currently available heartbeat data is within a time duration
	IsHeartbeatWithinDuration(duration time.Duration) bool
}

Common interface for DeviceDiagnosisClientInterface and DeviceDiagnosisServerInterface

type DeviceDiagnosisServerInterface added in v0.6.0

type DeviceDiagnosisServerInterface interface {
	// set the local device diagnosis state of the device
	SetLocalState(statetate *model.DeviceDiagnosisStateDataType)

	// set the local device diagnosis operating state
	SetLocalOperatingState(operatingState model.DeviceDiagnosisOperatingStateType)
}

type ElectricalConnectionClientInterface added in v0.6.0

type ElectricalConnectionClientInterface interface {
	// request ElectricalConnectionDescriptionListDataType from a remote entity
	RequestDescriptions(
		selector *model.ElectricalConnectionDescriptionListDataSelectorsType,
		elements *model.ElectricalConnectionDescriptionDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeElectricalConnectionParameterDescriptionListData from a remote entity
	RequestParameterDescriptions(
		selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType,
		elements *model.ElectricalConnectionParameterDescriptionDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeElectricalConnectionPermittedValueSetListData from a remote entity
	RequestPermittedValueSets(
		selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType,
		elements *model.ElectricalConnectionPermittedValueSetDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeElectricalConnectionCharacteristicListData from a remote entity
	RequestCharacteristics(
		selector *model.ElectricalConnectionCharacteristicListDataSelectorsType,
		elements *model.ElectricalConnectionCharacteristicDataElementsType,
	) (*model.MsgCounterType, error)
}

type ElectricalConnectionCommonInterface added in v0.6.0

type ElectricalConnectionCommonInterface interface {
	// check if spine.EventPayload Data contains data for a given filter
	//
	// data type will be checked for model.ElectricalConnectionPermittedValueSetListDataType,
	// filter type will be checked for model.ElectricalConnectionParameterDescriptionDataType
	CheckEventPayloadDataForFilter(payloadData any, filter any) bool

	// Get the description for a given filter
	//
	// Returns an error if no matching description is found
	GetDescriptionsForFilter(
		filter model.ElectricalConnectionDescriptionDataType,
	) ([]model.ElectricalConnectionDescriptionDataType, error)

	// Get the description for a given parameter description
	//
	// Returns an error if no matching description is found
	GetDescriptionForParameterDescriptionFilter(
		filter model.ElectricalConnectionParameterDescriptionDataType) (
		*model.ElectricalConnectionDescriptionDataType, error)

	// Get the description for a given filter
	//
	// Returns an error if no matching description is found
	GetParameterDescriptionsForFilter(
		filter model.ElectricalConnectionParameterDescriptionDataType,
	) ([]model.ElectricalConnectionParameterDescriptionDataType, error)

	// return permitted values for all Electrical Connections
	GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
		[]model.ElectricalConnectionPermittedValueSetDataType, error)

	// returns minimum, maximum, default/pause limit values
	GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
		float64, float64, float64, error)

	// Get the min, max, default current limits for each phase
	GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) (
		resultMin map[model.ElectricalConnectionPhaseNameType]float64, resultMax map[model.ElectricalConnectionPhaseNameType]float64, resultDefault map[model.ElectricalConnectionPhaseNameType]float64, resultErr error)

	// Adjust a value to be within the permitted value range
	AdjustValueToBeWithinPermittedValuesForParameterId(
		value float64, parameterId model.ElectricalConnectionParameterIdType) float64

	// Get the characteristics for a given filter
	//
	// Returns an error if no matching description is found
	GetCharacteristicsForFilter(
		filter model.ElectricalConnectionCharacteristicDataType,
	) ([]model.ElectricalConnectionCharacteristicDataType, error)
}

Common interface for ElectricalConnectionClientInterface and ElectricalConnectionServerInterface

type ElectricalConnectionPermittedValueSetForFilter added in v0.8.0

type ElectricalConnectionPermittedValueSetForFilter struct {
	Data   model.ElectricalConnectionPermittedValueSetDataType
	Filter model.ElectricalConnectionParameterDescriptionDataType
}

type ElectricalConnectionPermittedValueSetForID added in v0.8.0

type ElectricalConnectionPermittedValueSetForID struct {
	Data                   model.ElectricalConnectionPermittedValueSetDataType
	ElectricalConnectionId model.ElectricalConnectionIdType
	ParameterId            model.ElectricalConnectionParameterIdType
}

type ElectricalConnectionServerInterface added in v0.6.0

type ElectricalConnectionServerInterface interface {
	ElectricalConnectionCommonInterface

	// Add a new description data set
	//
	// NOTE: the electricalConnectionId has to be provided
	//
	// will return nil if the data set could not be added
	AddDescription(
		description model.ElectricalConnectionDescriptionDataType,
	) error

	// Add a new parameter description data sett and return the parameterId
	//
	// NOTE: the electricalConnectionId has to be provided, parameterId may not be provided
	//
	// will return nil if the data set could not be added
	AddParameterDescription(
		description model.ElectricalConnectionParameterDescriptionDataType,
	) *model.ElectricalConnectionParameterIdType

	// Add a new characteristic data set
	//
	// Note: ElectricalConnectionId and ParameterId must be set, CharacteristicId will be set automatically
	//
	// Will return an error if the data set could not be added
	AddCharacteristic(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)

	// Update data set for a filter
	// Elements provided in deleteElements will be removed from the data set before the update
	//
	// // ElectricalConnectionId, ParameterId and CharacteristicId must be set
	//
	// Will return an error if the data set could not be updated
	UpdateCharacteristic(
		data model.ElectricalConnectionCharacteristicDataType,
		deleteElements *model.ElectricalConnectionCharacteristicDataElementsType,
	) error

	// Set or update data set for a parameterId
	//
	// Will return an error if the data set could not be updated
	UpdatePermittedValueSetForIds(
		data []ElectricalConnectionPermittedValueSetForID,
	) error

	// Set or update data set for a filter
	// deleteSelector will trigger removal of matching items from the data set before the update
	// deleteElement will limit the fields to be removed using Id
	//
	// Will return an error if the data set could not be updated
	UpdatePermittedValueSetForFilters(
		data []ElectricalConnectionPermittedValueSetForFilter,
		deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType,
		deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType,
	) error

	// either returns the given description id or creates a new one for the given description
	//
	// will return error if could not add the new description
	GetOrAddIdForDescription(
		electricalConnectionDescription model.ElectricalConnectionDescriptionDataType,
	) (*model.ElectricalConnectionIdType, error)
}

type EntityEventCallback added in v0.6.0

type EntityEventCallback func(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event EventType)

Entity event callback

Used by Use Case implementations

type EventType added in v0.6.0

type EventType string

EventType is used for the usecase specific event names

type FeatureClientInterface added in v0.6.0

type FeatureClientInterface interface {
	// check if there is a subscription to the remote feature
	HasSubscription() bool

	// subscribe to the feature of the entity
	Subscribe() (*model.MsgCounterType, error)

	// check if there is a binding to the remote feature
	HasBinding() bool

	// bind to the feature of the entity
	Bind() (*model.MsgCounterType, error)

	// add a callback function to be invoked once a result or reply message for a msgCounter came in
	AddResponseCallback(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error

	// add a callback function to be invoked once a result came in
	AddResultCallback(function func(msg api.ResponseMessage))
}

Feature client interface were the local feature role is client and the remote feature role is server

type FeatureServerInterface added in v0.6.0

type FeatureServerInterface interface {
}

Feature server interface were the local feature role is a server

type IdentificationClientInterface added in v0.6.0

type IdentificationClientInterface interface {
	// request FunctionTypeIdentificationListData from a remote entity
	RequestValues() (*model.MsgCounterType, error)
}

type IdentificationCommonInterface added in v0.6.0

type IdentificationCommonInterface interface {
	// check if spine.EventPayload Data contains identification data
	//
	// data type will be checked for model.IdentificationListDataType
	CheckEventPayloadDataForFilter(payloadData any) bool

	// return current values for Identification
	GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error)
}

Common interface for IdentificationClientInterface and IdentificationServerInterface

type IdentificationServerInterface added in v0.6.0

type IdentificationServerInterface interface {
}

type IncentiveTableClientInterface added in v0.6.0

type IncentiveTableClientInterface interface {
	// request FunctionTypeIncentiveTableDescriptionData from a remote entity
	RequestDescriptions() (*model.MsgCounterType, error)

	// request FunctionTypeIncentiveTableConstraintsData from a remote entity
	RequestConstraints() (*model.MsgCounterType, error)

	// request FunctionTypeIncentiveTableData from a remote entity
	RequestValues() (*model.MsgCounterType, error)

	// write incentivetable descriptions
	// returns an error if this failed
	WriteDescriptions(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)

	// write incentivetable descriptions
	// returns an error if this failed
	WriteValues(data []model.IncentiveTableType) (*model.MsgCounterType, error)
}

type IncentiveTableCommonInterface added in v0.6.0

type IncentiveTableCommonInterface interface {
	// return list of descriptions for a given filter
	GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)

	// return list of constraints
	GetConstraints() ([]model.IncentiveTableConstraintsType, error)

	// return current data for Time Series
	GetData() ([]model.IncentiveTableType, error)
}

Common interface for IncentiveTableClientInterface and IncentiveTableServerInterface

type IncentiveTableServerInterface added in v0.6.0

type IncentiveTableServerInterface interface {
}

type LoadControlClientInterface added in v0.6.0

type LoadControlClientInterface interface {
	// request FunctionTypeLoadControlLimitDescriptionListData from a remote device
	RequestLimitDescriptions(
		selector *model.LoadControlLimitDescriptionListDataSelectorsType,
		elements *model.LoadControlLimitDescriptionDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeLoadControlLimitConstraintsListData from a remote device
	RequestLimitConstraints(
		selector *model.LoadControlLimitConstraintsListDataSelectorsType,
		elements *model.LoadControlLimitConstraintsDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeLoadControlLimitListData from a remote device
	RequestLimitData(
		selector *model.LoadControlLimitListDataSelectorsType,
		elements *model.LoadControlLimitDataElementsType,
	) (*model.MsgCounterType, error)

	// write load control limits
	// returns an error if this failed
	WriteLimitData(
		data []model.LoadControlLimitDataType,
		deleteSelectors *model.LoadControlLimitListDataSelectorsType,
		deleteElements *model.LoadControlLimitDataElementsType,
	) (*model.MsgCounterType, error)
}

type LoadControlCommonInterface added in v0.6.0

type LoadControlCommonInterface interface {
	// check if spine.EventPayload Data contains data for a given filter
	//
	// data type will be checked for model.LoadControlLimitListDataType,
	// filter type will be checked for model.LoadControlLimitDescriptionDataType
	CheckEventPayloadDataForFilter(payloadData any, filter any) bool

	// Get the description for a given limitId
	//
	// Will return nil if no matching description is found
	GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (
		*model.LoadControlLimitDescriptionDataType, error)

	// Get the description for a given filter
	//
	// Returns an error if no matching description is found
	GetLimitDescriptionsForFilter(
		filter model.LoadControlLimitDescriptionDataType,
	) ([]model.LoadControlLimitDescriptionDataType, error)

	// Get the description for a given limitId
	//
	// Will return nil if no data is available
	GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)

	// Get limit data for a given filter
	//
	// Will return nil if no data is available
	GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)
}

Common interface for LoadControlClientInterface and LoadControlServerInterface

type LoadControlLimitDataForFilter added in v0.8.0

type LoadControlLimitDataForFilter struct {
	Data   model.LoadControlLimitDataType
	Filter model.LoadControlLimitDescriptionDataType
}

type LoadControlLimitDataForID added in v0.8.0

type LoadControlLimitDataForID struct {
	Data model.LoadControlLimitDataType
	Id   model.LoadControlLimitIdType
}

type LoadControlServerInterface added in v0.6.0

type LoadControlServerInterface interface {
	// Add a new description data set and return the limitId
	//
	// NOTE: the limitId may not be provided
	//
	// will return nil if the data set could not be added
	AddLimitDescription(
		description model.LoadControlLimitDescriptionDataType,
	) *model.LoadControlLimitIdType

	// Set or update data set for a limitId
	//
	// Will return an error if the data set could not be updated
	UpdateLimitDataForIds(
		data []LoadControlLimitDataForID,
	) error

	// Set or update data set for a filter
	// deleteSelector will trigger removal of matching items from the data set before the update
	// deleteElement will limit the fields to be removed using Id
	//
	// Will return an error if the data set could not be updated
	UpdateLimitDataForFilter(
		data []LoadControlLimitDataForFilter,
		deleteSelector *model.LoadControlLimitListDataSelectorsType,
		deleteElements *model.LoadControlLimitDataElementsType,
	) error
}

type MeasurementClientInterface added in v0.6.0

type MeasurementClientInterface interface {
	// request FunctionTypeMeasurementDescriptionListData from a remote device
	RequestDescriptions(
		selector *model.MeasurementDescriptionListDataSelectorsType,
		elements *model.MeasurementDescriptionDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeMeasurementConstraintsListData from a remote entity
	RequestConstraints(
		selector *model.MeasurementConstraintsListDataSelectorsType,
		elements *model.MeasurementConstraintsDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeMeasurementListData from a remote entity
	RequestData(
		selector *model.MeasurementListDataSelectorsType,
		elements *model.MeasurementDataElementsType,
	) (*model.MsgCounterType, error)
}

type MeasurementCommonInterface added in v0.6.0

type MeasurementCommonInterface interface {
	// check if spine.EventPayload Data contains data for a given filter
	//
	// data type will be checked for model.MeasurementListDataType,
	// filter type will be checked for model.MeasurementDescriptionDataType
	CheckEventPayloadDataForFilter(payloadData any, filter any) bool

	// Get the description for a given id
	//
	// Returns an error if no matching description is found
	GetDescriptionForId(
		measurementId model.MeasurementIdType,
	) (*model.MeasurementDescriptionDataType, error)

	// Get the description for a given filter
	//
	// Returns an error if no matching description is found
	GetDescriptionsForFilter(
		filter model.MeasurementDescriptionDataType,
	) ([]model.MeasurementDescriptionDataType, error)

	// Get the constraints for a given filter
	//
	// Returns an error if no matching constraint is found
	GetConstraintsForFilter(
		filter model.MeasurementConstraintsDataType,
	) ([]model.MeasurementConstraintsDataType, error)

	// Get the measuement data for a given measurementId
	//
	// Will return nil if no data is available
	GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error)

	// Get measuement data for a given filter
	//
	// Will return nil if no data is available
	GetDataForFilter(filter model.MeasurementDescriptionDataType) (
		[]model.MeasurementDataType, error)
}

Common interface for MeasurementClientInterface and MeasurementServerInterface

type MeasurementDataForFilter added in v0.8.0

type MeasurementDataForFilter struct {
	Data   model.MeasurementDataType
	Filter model.MeasurementDescriptionDataType
}

type MeasurementDataForID added in v0.8.0

type MeasurementDataForID struct {
	Data model.MeasurementDataType
	Id   model.MeasurementIdType
}

type MeasurementServerInterface added in v0.6.0

type MeasurementServerInterface interface {
	// Add a new parameter description data sett and return the measurementId
	//
	// NOTE: the measurementId may not be provided
	//
	// will return nil if the data set could not be added
	AddDescription(
		description model.MeasurementDescriptionDataType,
	) *model.MeasurementIdType

	// Set or update data set for a measurementId
	//
	// Will return an error if the data set could not be updated
	UpdateDataForIds(
		data []MeasurementDataForID,
	) error

	// Set or update data set for a filter
	// deleteSelector will trigger removal of matching items from the data set before the update
	// deleteElement will limit the fields to be removed using Id
	//
	// Will return an error if the data set could not be updated
	UpdateDataForFilters(
		data []MeasurementDataForFilter,
		deleteSelector *model.MeasurementListDataSelectorsType,
		deleteElements *model.MeasurementDataElementsType,
	) error
}

type RemoteEntityScenarios added in v0.6.0

type RemoteEntityScenarios struct {
	Entity    spineapi.EntityRemoteInterface
	Scenarios []uint
}

contains the available scenarios of a remote entity

type ServiceInterface

type ServiceInterface interface {
	// Setup the service
	//
	// Returns error with description of the error that cannot be recovered from
	Setup() error

	// start the service
	//
	// Returns error with description of the error that cannot be recovered from
	Start() error

	// shutdown the service
	Shutdown()

	// return if the service is running
	IsRunning() bool

	// add a use case to the service
	AddUseCase(useCase UseCaseInterface) error

	// set logging interface
	SetLogging(logger logging.LoggingInterface)

	// return the configuration
	Configuration() *Configuration

	// return the local service details
	LocalService() *shipapi.ServiceDetails

	// return the local device
	LocalDevice() spineapi.DeviceLocalInterface

	// Provide the current pairing state for a ServiceIdentity
	PairingDetailFor(identity shipapi.ServiceIdentity) *shipapi.ConnectionStateDetail

	// Return the remote service details for a given ServiceIdentity
	RemoteServiceFor(identity shipapi.ServiceIdentity) *shipapi.ServiceDetails

	// Defines wether incoming pairing requests should be automatically accepted or not
	//
	// Default: false
	SetAutoAccept(value bool)

	// Returns if the service has auto accept enabled or not
	IsAutoAcceptEnabled() bool

	// Generate a QR code string
	//
	// If a pairing config with a secret is set: generates SHIP Pairing Service QR format
	// Otherwise: generates standard SHIP QR format
	//
	// Must be called after Setup() as it requires the hub to be initialized.
	QRCodeText() (string, error)

	// Pair a remote service using ServiceIdentity
	//
	// Parameters:
	// - identity: ServiceIdentity containing SKI, fingerprint, and/or SHIP ID
	//
	// Note: The SHIP ID is optional, but should be provided if available.
	// if provided, it will be used to validate the remote service is
	// providing this SHIP ID during the handshake process and will reject
	// the connection if it does not match.
	RegisterRemoteService(identity shipapi.ServiceIdentity)

	// Unpair a remote service using ServiceIdentity
	UnregisterRemoteService(identity shipapi.ServiceIdentity)

	// Disconnect a connection using ServiceIdentity
	DisconnectService(identity shipapi.ServiceIdentity, reason string)

	// Cancels the pairing process for a ServiceIdentity
	//
	// This should be called while the service is running and the end
	// user wants to cancel/disallow an incoming pairing request
	CancelPairing(identity shipapi.ServiceIdentity)

	// Define wether the user is able to react to an incoming pairing request
	//
	// Call this with `true` e.g. if the user is currently using a web interface
	// where an incoming request can be accepted or denied
	//
	// Default is set to false, meaning every incoming pairing request will be
	// automatically denied
	UserIsAbleToApproveOrCancelPairingRequests(allow bool)

	// Calculate SHA-256 fingerprint of local certificate
	GetLocalCertificateFingerprint() (string, error)

	// Start announcing pairing to a specific target device
	// Used by devZ only.
	//
	// Parameters:
	//  - target: Pairing target
	StartAnnouncementTo(target shipapi.PairingTarget) error

	// Stop announcing pairing to a specific target device
	// Used by devZ only.
	//
	// Parameters:
	//  - shipID: Target SHIP ID
	StopAnnouncementTo(shipID string) error

	// Return true if currently announcing to a specific target device
	// Used by devZ only.
	//
	// Parameters:
	//  - shipID: Target SHIP ID
	IsAnnouncingTo(shipID string) bool

	// SHIP Pairing: Get Active Announcements.
	// Used by devZ only.
	//
	// Returns: List of SHIP IDs currently being announced to
	GetActiveAnnouncements() []string

	// SHIP Pairing: Get the SHIP ID and Fingerprint of controlbox paired via SHIP Pairing
	// Used by devA only.
	//
	// Returns: the ServiceDetails of any trusted AddCu device. Or nil if none
	GetTrustedAddCuDevice() *shipapi.ServiceDetails
}

central service interface

implemented by service, used by the eebus service implementation

type ServiceReaderInterface

type ServiceReaderInterface interface {
	// report a connection to a remote service
	RemoteServiceConnected(service ServiceInterface, identity shipapi.ServiceIdentity)

	// report a disconnection from a remote service
	RemoteServiceDisconnected(service ServiceInterface, identity shipapi.ServiceIdentity)

	// report all currently visible EEBUS services
	VisibleRemoteMdnsServicesUpdated(service ServiceInterface, entries []shipapi.RemoteMdnsService)

	// report that service information has been updated
	// This includes updates to ShipID, fingerprint, or other service details
	// discovered during handshake
	ServiceUpdated(identity shipapi.ServiceIdentity)

	// Provides the current pairing state for the remote service
	// This is called whenever the state changes and can be used to
	// provide user information for the pairing/connection process
	ServicePairingDetailUpdate(identity shipapi.ServiceIdentity, detail *shipapi.ConnectionStateDetail)

	// Called when a device is automatically trusted via SHIP pairing
	ServiceAutoTrusted(service ServiceInterface, identity shipapi.ServiceIdentity)

	// Called when SHIP pairing fails for a device
	ServiceAutoTrustFailed(service ServiceInterface, identity shipapi.ServiceIdentity, reason error)

	// Called when device trust is automatically removed
	// This can happen due to device replacement timeout or new device pairing
	ServiceAutoTrustRemoved(service ServiceInterface, identity shipapi.ServiceIdentity, reason string)
}

interface for receiving data for specific events from Service

some are passthrough readers, because service needs to coordinate everything with SPINE

implemented by the eebus service implementation, used by service

type SmartEnergyManagementPsClientInterface added in v0.6.0

type SmartEnergyManagementPsClientInterface interface {
	// request FunctionTypeSmartEnergyManagementPsData from a remote entity
	RequestData() (*model.MsgCounterType, error)

	// write SmartEnergyManagementPsData
	// returns an error if this failed
	WriteData(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)
}

type SmartEnergyManagementPsCommonInterface added in v0.6.0

type SmartEnergyManagementPsCommonInterface interface {
	// return current data for FunctionTypeSmartEnergyManagementPsData
	GetData() (*model.SmartEnergyManagementPsDataType, error)
}

Common interface for SmartEnergyManagementPsClientInterface and SmartEnergyManagementPsServerInterface

type SmartEnergyManagementPsServerInterface added in v0.6.0

type SmartEnergyManagementPsServerInterface interface {
}

type TimeSeriesClientInterface added in v0.6.0

type TimeSeriesClientInterface interface {
	// request FunctionTypeTimeSeriesDescriptionListData from a remote entity
	RequestDescriptions(
		selector *model.TimeSeriesDescriptionListDataSelectorsType,
		elements *model.TimeSeriesDescriptionDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeTimeSeriesConstraintsListData from a remote entity
	RequestConstraints(
		selector *model.TimeSeriesConstraintsListDataSelectorsType,
		elements *model.TimeSeriesConstraintsDataElementsType,
	) (*model.MsgCounterType, error)

	// request FunctionTypeTimeSeriesListData from a remote device
	RequestData(
		selector *model.TimeSeriesListDataSelectorsType,
		elements *model.TimeSeriesDataElementsType,
	) (*model.MsgCounterType, error)

	// write Time Series values
	// returns an error if this failed
	WriteData(data []model.TimeSeriesDataType) (*model.MsgCounterType, error)
}

type TimeSeriesCommonInterface added in v0.6.0

type TimeSeriesCommonInterface interface {
	// return list of descriptions for a given filter
	GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)

	// return current constraints for Time Series
	GetConstraints() ([]model.TimeSeriesConstraintsDataType, error)

	// return current data for Time Series for a given filter
	GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)
}

Common interface for TimeSeriesClientInterface and TimeSeriesServerInterface

type TimeSeriesServerInterface added in v0.6.0

type TimeSeriesServerInterface interface {
}

type UseCaseBaseInterface added in v0.6.0

type UseCaseBaseInterface interface {
	// add the use case
	AddUseCase()

	// remove the use case
	RemoveUseCase()

	// update availability of the use case
	//
	// NOTE: only allowed to be used for client side implementations
	// of a use case! Otherwise use `RemoveUseCase` and `AddUseCase`.
	UpdateUseCaseAvailability(available bool)

	// check if the entity is compatible with the use case
	IsCompatibleEntityType(entity spineapi.EntityRemoteInterface) bool

	// return the current list of compatible remote entities and their available scenarios of this use case
	RemoteEntitiesScenarios() []RemoteEntityScenarios

	// return the current list of available scenarios of this use case for the remote entity
	AvailableScenariosForEntity(entity spineapi.EntityRemoteInterface) []uint

	// check if the provided scenario are available at the remote entity
	IsScenarioAvailableAtEntity(
		entity spineapi.EntityRemoteInterface,
		scenario uint,
	) bool
}

type UseCaseInterface added in v0.6.0

type UseCaseInterface interface {
	UseCaseBaseInterface

	// add the features described by the Use Case
	//
	// returns an error if any Feature could not be added
	// - errors should not occur during normal usage of eebus-go, and should
	//   generally be considered fatal implementation errors
	// - if an error occurs while adding features to a new Entity, that Entity
	//   will be in an incomplete state and should not be added to the service
	//
	// No cleanup occurs on error, some features may end up partially
	// configured and unused
	AddFeatures() error
}

Implemented by each Use Case

type UseCaseScenario added in v0.6.0

type UseCaseScenario struct {
	Scenario       model.UseCaseScenarioSupportType // the scenario number
	Mandatory      bool                             // if this scenario is mandatory to be supported by the remote entity
	ServerFeatures []model.FeatureTypeType          // the server features required for this scenario on the remote entity
}

details about each use case scenario

Jump to

Keyboard shortcuts

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