Documentation ¶
Index ¶
- func CreateCertificate(organizationalUnit, organization, country, commonName string) (tls.Certificate, error)
- type Configuration
- func (s *Configuration) Identifier() string
- func (s *Configuration) MdnsServiceName() string
- func (s *Configuration) SetAlternateIdentifier(identifier string)
- func (s *Configuration) SetAlternateMdnsServiceName(name string)
- func (s *Configuration) SetInterfaces(ifaces []string)
- func (s *Configuration) SetRegisterAutoAccept(auto bool)
- func (s *Configuration) Voltage() float64
- type EEBUSService
- func (s *EEBUSService) AddEntity(entity *spine.EntityLocalImpl)
- func (s *EEBUSService) DisconnectSKI(ski string, reason string)
- func (s *EEBUSService) IsRemoteServiceForSKIPaired(ski string) bool
- func (s *EEBUSService) LocalDevice() *spine.DeviceLocalImpl
- func (s *EEBUSService) LocalEntity() *spine.EntityLocalImpl
- func (s *EEBUSService) PairRemoteService(service *ServiceDetails)
- func (s *EEBUSService) RemoteDeviceForSki(ski string) *spine.DeviceRemoteImpl
- func (s *EEBUSService) RemoteDeviceOfType(deviceType model.DeviceTypeType) *spine.DeviceRemoteImpl
- func (s *EEBUSService) RemoteDevices() []*spine.DeviceRemoteImpl
- func (s *EEBUSService) RemoteSKIConnected(ski string)
- func (s *EEBUSService) RemoteSKIDisconnected(ski string)
- func (s *EEBUSService) RemoveEntity(entity *spine.EntityLocalImpl)
- func (s *EEBUSService) ReportServiceShipID(ski string, shipdID string)
- func (s *EEBUSService) SetLogging(logger logging.Logging)
- func (s *EEBUSService) Setup() error
- func (s *EEBUSService) Shutdown()
- func (s *EEBUSService) Start()
- func (s *EEBUSService) UnpairRemoteService(ski string) error
- type EEBUSServiceHandler
- type MdnsEntry
- type MdnsSearch
- type MdnsService
- type ServiceDetails
- func (s *ServiceDetails) DeviceType() model.DeviceTypeType
- func (s *ServiceDetails) IPv4() string
- func (s *ServiceDetails) RegisterAutoAccept() bool
- func (s *ServiceDetails) SKI() string
- func (s *ServiceDetails) SetDeviceType(deviceType model.DeviceTypeType)
- func (s *ServiceDetails) SetIPv4(ipv4 string)
- func (s *ServiceDetails) SetRegisterAutoAccept(auto bool)
- func (s *ServiceDetails) SetShipID(shipId string)
- func (s *ServiceDetails) ShipID() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCertificate ¶
func CreateCertificate(organizationalUnit, organization, country, commonName string) (tls.Certificate, error)
Create a ship compatible self signed certificate organizationalUnit is the OU of the certificate organization is the O of the certificate country is the C of the certificate commonName is the CN of the certificate Example for commonName: "deviceModel-deviceSerialNumber"
Types ¶
type Configuration ¶ added in v0.1.1
type Configuration struct {
// contains filtered or unexported fields
}
defines requires meta information about this service
func NewConfiguration ¶ added in v0.1.1
func NewConfiguration( vendorCode, deviceBrand, deviceModel, serialNumber string, deviceType model.DeviceTypeType, port int, certificate tls.Certificate, voltage float64, ) (*Configuration, error)
Setup a Configuration with the required parameters
func (*Configuration) Identifier ¶ added in v0.1.1
func (s *Configuration) Identifier() string
return the identifier to be used for mDNS and SHIP ID returns in this order: - alternateIdentifier - generateIdentifier
func (*Configuration) MdnsServiceName ¶ added in v0.1.1
func (s *Configuration) MdnsServiceName() string
return the name to be used as the mDNS service name returns in this order: - alternateMdnsServiceName - generateIdentifier
func (*Configuration) SetAlternateIdentifier ¶ added in v0.1.1
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 ¶ added in v0.1.1
func (s *Configuration) SetAlternateMdnsServiceName(name string)
define an alternative mDNS service name this is normally not needed or used
func (*Configuration) SetInterfaces ¶ added in v0.1.1
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) SetRegisterAutoAccept ¶ added in v0.1.1
func (s *Configuration) SetRegisterAutoAccept(auto bool)
define wether this service should announce auto accept TODO: this needs to be redesigned!
func (*Configuration) Voltage ¶ added in v0.1.1
func (s *Configuration) Voltage() float64
return the sites predefined grid voltage
type EEBUSService ¶
type EEBUSService struct { Configuration *Configuration // The local service details LocalService *ServiceDetails // contains filtered or unexported fields }
A service is the central element of an EEBUS service including its websocket server and a zeroconf service.
func NewEEBUSService ¶
func NewEEBUSService(configuration *Configuration, serviceHandler EEBUSServiceHandler) *EEBUSService
creates a new EEBUS service
func (*EEBUSService) AddEntity ¶
func (s *EEBUSService) AddEntity(entity *spine.EntityLocalImpl)
Add a new entity, used for connected EVs Only for EVSE implementations
func (*EEBUSService) DisconnectSKI ¶
func (s *EEBUSService) DisconnectSKI(ski string, reason string)
Close a connection to a remote SKI
func (*EEBUSService) IsRemoteServiceForSKIPaired ¶
func (s *EEBUSService) IsRemoteServiceForSKIPaired(ski string) bool
Returns if the provided SKI is from a registered service
func (*EEBUSService) LocalDevice ¶
func (s *EEBUSService) LocalDevice() *spine.DeviceLocalImpl
func (*EEBUSService) LocalEntity ¶
func (s *EEBUSService) LocalEntity() *spine.EntityLocalImpl
return the local entity 1
func (*EEBUSService) PairRemoteService ¶
func (s *EEBUSService) PairRemoteService(service *ServiceDetails)
Adds a new device to the list of known devices which can be connected to and connect it if it is currently not connected
func (*EEBUSService) RemoteDeviceForSki ¶
func (s *EEBUSService) RemoteDeviceForSki(ski string) *spine.DeviceRemoteImpl
func (*EEBUSService) RemoteDeviceOfType ¶
func (s *EEBUSService) RemoteDeviceOfType(deviceType model.DeviceTypeType) *spine.DeviceRemoteImpl
return a specific remote device of a given DeviceType
func (*EEBUSService) RemoteDevices ¶
func (s *EEBUSService) RemoteDevices() []*spine.DeviceRemoteImpl
return all remote devices
func (*EEBUSService) RemoteSKIConnected ¶
func (s *EEBUSService) RemoteSKIConnected(ski string)
report a connection to a SKI
func (*EEBUSService) RemoteSKIDisconnected ¶
func (s *EEBUSService) RemoteSKIDisconnected(ski string)
report a disconnection to a SKI
func (*EEBUSService) RemoveEntity ¶
func (s *EEBUSService) RemoveEntity(entity *spine.EntityLocalImpl)
Remove an entity, used for disconnected EVs Only for EVSE implementations
func (*EEBUSService) ReportServiceShipID ¶
func (s *EEBUSService) ReportServiceShipID(ski string, shipdID string)
Provides the SHIP ID the remote service reported during the handshake process
func (*EEBUSService) SetLogging ¶
func (s *EEBUSService) SetLogging(logger logging.Logging)
Sets a custom logging implementation By default NoLogging is used, so no logs are printed
func (*EEBUSService) Setup ¶
func (s *EEBUSService) Setup() error
Starts the service by initializeing mDNS and the server.
func (*EEBUSService) Shutdown ¶
func (s *EEBUSService) Shutdown()
Shutdown all services and stop the server.
func (*EEBUSService) UnpairRemoteService ¶
func (s *EEBUSService) UnpairRemoteService(ski string) error
Remove a device from the list of known devices which can be connected to and disconnect it if it is currently connected
type EEBUSServiceHandler ¶
type EEBUSServiceHandler interface { // report a connection to a SKI RemoteSKIConnected(service *EEBUSService, ski string) // report a disconnection to a SKI RemoteSKIDisconnected(service *EEBUSService, ski string) // 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` ReportServiceShipID(ski string, shipdID string) }
interface for receiving data for specific events
type MdnsSearch ¶
implemented by hubConnection, used by mdns
type MdnsService ¶ added in v0.1.2
type MdnsService interface { SetupMdnsService() error ShutdownMdnsService() AnnounceMdnsEntry() error UnannounceMdnsEntry() RegisterMdnsSearch(cb MdnsSearch) UnregisterMdnsSearch(cb MdnsSearch) }
implemented by mdns, used by hubConnection
type ServiceDetails ¶
type ServiceDetails struct {
// contains filtered or unexported fields
}
generic service details about the local or any remote service
func NewServiceDetails ¶ added in v0.1.2
func NewServiceDetails(ski string) *ServiceDetails
create a new ServiceDetails record with a SKI
func (*ServiceDetails) DeviceType ¶ added in v0.1.2
func (s *ServiceDetails) DeviceType() model.DeviceTypeType
func (*ServiceDetails) IPv4 ¶
func (s *ServiceDetails) IPv4() string
func (*ServiceDetails) RegisterAutoAccept ¶ added in v0.1.2
func (s *ServiceDetails) RegisterAutoAccept() bool
func (*ServiceDetails) SetDeviceType ¶ added in v0.1.2
func (s *ServiceDetails) SetDeviceType(deviceType model.DeviceTypeType)
func (*ServiceDetails) SetIPv4 ¶ added in v0.1.2
func (s *ServiceDetails) SetIPv4(ipv4 string)
func (*ServiceDetails) SetRegisterAutoAccept ¶ added in v0.1.2
func (s *ServiceDetails) SetRegisterAutoAccept(auto bool)
func (*ServiceDetails) SetShipID ¶ added in v0.1.2
func (s *ServiceDetails) SetShipID(shipId string)
SHIP ID is the ship identifier of the service
func (*ServiceDetails) ShipID ¶
func (s *ServiceDetails) ShipID() string
Return the services SHIP ID