api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 9 Imported by: 19

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

type ServiceInterface interface {
	// setup the service
	Setup() error

	// start the service
	Start()

	// shutdown the service
	Shutdown()

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

Jump to

Keyboard shortcuts

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