api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 9 Imported by: 31

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 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,
	deviceType model.DeviceTypeType,
	entityTypes []model.EntityTypeType,
	port int,
	certificate tls.Certificate,
	voltage float64,
	heartbeatTimeout time.Duration,
) (*Configuration, error)

Setup a Configuration with the required parameters

func (*Configuration) Certificate

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

func (*Configuration) DeviceBrand

func (s *Configuration) DeviceBrand() string

func (*Configuration) DeviceModel

func (s *Configuration) DeviceModel() string

func (*Configuration) DeviceSerialNumber

func (s *Configuration) DeviceSerialNumber() string

func (*Configuration) DeviceType

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

func (*Configuration) EntityTypes

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

func (*Configuration) FeatureSet

func (*Configuration) HeartbeatTimeout

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

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

func (*Configuration) MdnsProviderSelection

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

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) Port

func (s *Configuration) Port() int

func (*Configuration) SetAlternateIdentifier

func (s *Configuration) SetAlternateIdentifier(identifier string)

define 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)

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

func (*Configuration) SetCertificate

func (s *Configuration) SetCertificate(cert tls.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)

func (*Configuration) VendorCode

func (s *Configuration) VendorCode() string

func (*Configuration) Voltage

func (s *Configuration) Voltage() float64

return the sites predefined grid voltage

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 diagnosis state of the device
	SetLocalState(operatingState *model.DeviceDiagnosisStateDataType)
}

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 []float64, resultMax []float64, resultDefault []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 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
}

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

type for cem and usecase specfic 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 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
	// 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
	UpdateLimitDataForId(
		data model.LoadControlLimitDataType,
		deleteElements *model.LoadControlLimitDataElementsType,
		limitId model.LoadControlLimitIdType,
	) 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
	UpdateLimitDataForFilter(
		data model.LoadControlLimitDataType,
		deleteElements *model.LoadControlLimitDataElementsType,
		filter model.LoadControlLimitDescriptionDataType,
	) error
}

type ManufacturerData added in v0.6.0

type ManufacturerData struct {
	DeviceName                     string `json:"deviceName,omitempty"`
	DeviceCode                     string `json:"deviceCode,omitempty"`
	SerialNumber                   string `json:"serialNumber,omitempty"`
	SoftwareRevision               string `json:"softwareRevision,omitempty"`
	HardwareRevision               string `json:"hardwareRevision,omitempty"`
	VendorName                     string `json:"vendorName,omitempty"`
	VendorCode                     string `json:"vendorCode,omitempty"`
	BrandName                      string `json:"brandName,omitempty"`
	PowerSource                    string `json:"powerSource,omitempty"`
	ManufacturerNodeIdentification string `json:"manufacturerNodeIdentification,omitempty"`
	ManufacturerLabel              string `json:"manufacturerLabel,omitempty"`
	ManufacturerDescription        string `json:"manufacturerDescription,omitempty"`
}

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 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
	// 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
	UpdateDataForId(
		data model.MeasurementDataType,
		deleteElements *model.MeasurementDataElementsType,
		measurementId model.MeasurementIdType,
	) 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
	UpdateDataForFilter(
		data model.MeasurementDataType,
		deleteElements *model.MeasurementDataElementsType,
		filter model.MeasurementDescriptionDataType,
	) 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
	Setup() error

	// start the service
	Start()

	// shutdown the service
	Shutdown()

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

	// 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 SKI
	PairingDetailForSki(ski string) *shipapi.ConnectionStateDetail

	// 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

	// Returns the Service detail of a remote SKI
	RemoteServiceForSKI(ski string) *shipapi.ServiceDetails

	// Sets the SKI as being paired
	RegisterRemoteSKI(ski string)

	// Sets the SKI as not being paired
	UnregisterRemoteSKI(ski string)

	// Disconnect from a connected remote SKI
	DisconnectSKI(ski string, reason string)

	// Cancels the pairing process for a SKI
	//
	// This should be called while the service is running and the end
	// user wants to cancel/disallow an incoming pairing request
	CancelPairingWithSKI(ski string)

	// 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)
}

central service interface

implemented by service, used by the eebus service implementation

type ServiceReaderInterface

type ServiceReaderInterface interface {
	// report a connection to a SKI
	RemoteSKIConnected(service ServiceInterface, ski string)

	// report a disconnection to a SKI
	RemoteSKIDisconnected(service ServiceInterface, ski string)

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

	// Provides the SHIP ID the remote service reported during the handshake process
	// This needs to be persisted and passed on for future remote service connections
	// when using `PairRemoteService`
	ServiceShipIDUpdate(ski string, shipdID string)

	// 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(ski string, detail *shipapi.ConnectionStateDetail)
}

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
	AddFeatures()
}

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