Documentation ¶
Index ¶
- func EqualDeviceDesc(old DeviceDescription, topic DeviceDescription) bool
- func EqualTopicDesc(old TopicDescription, topic TopicDescription) bool
- type Connector
- func (this *Connector) CommandHandler(deviceId string, serviceId string, command mgw.Command)
- func (this *Connector) EventHandler(topic string, retained bool, payload []byte)
- func (this *Connector) RefreshDeviceInfo()
- func (this *Connector) ResponseHandler(topic string, retained bool, payload []byte)
- type CorrelationId
- type DeviceDescription
- type GenericMgwFactory
- type GenericMqttFactory
- type GenericTopicDescriptionProvider
- type MgwClient
- type MgwFactory
- type MqttClient
- type MqttFactory
- type OnlineChecker
- type TopicDescription
- type TopicDescriptionProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualDeviceDesc ¶
func EqualDeviceDesc(old DeviceDescription, topic DeviceDescription) bool
func EqualTopicDesc ¶
func EqualTopicDesc(old TopicDescription, topic TopicDescription) bool
Types ¶
type Connector ¶
type Connector struct { MaxCorrelationIdAge time.Duration // contains filtered or unexported fields }
func NewWithFactories ¶
func NewWithFactories(ctx context.Context, config configuration.Config, topicDescProvider TopicDescriptionProvider, mgwFactory MgwFactory, mqttFactory MqttFactory) (result *Connector, err error)
func (*Connector) CommandHandler ¶
func (*Connector) EventHandler ¶
func (*Connector) RefreshDeviceInfo ¶
func (this *Connector) RefreshDeviceInfo()
type CorrelationId ¶
type CorrelationId struct {
// contains filtered or unexported fields
}
type DeviceDescription ¶
type GenericMgwFactory ¶
type GenericMqttFactory ¶
type GenericTopicDescriptionProvider ¶
type GenericTopicDescriptionProvider[T TopicDescription] func(config configuration.Config, deviceRepo *devicerepo.DeviceRepo) ([]T, error)
type MgwClient ¶
type MgwClient interface { ListenToDeviceCommands(deviceId string, commandHandler mgw.DeviceCommandHandler) error StopListenToDeviceCommands(deviceId string) error SetDevice(deviceId string, name string, deviceTypeid string, state string) error RemoveDevice(deviceId string) error SendEvent(deviceId string, serviceId string, value []byte) error Respond(deviceId string, serviceId string, response mgw.Command) error SendClientError(message string) SendDeviceError(localDeviceId string, message string) SendCommandError(correlationId string, message string) }
type MgwFactory ¶
type MgwFactory = GenericMgwFactory[MgwClient]
func NewMgwFactory ¶
func NewMgwFactory[MgwClientType MgwClient](f GenericMgwFactory[MgwClientType]) (result MgwFactory)
type MqttClient ¶
type MqttFactory ¶
type MqttFactory = GenericMqttFactory[MqttClient]
func NewMqttFactory ¶
func NewMqttFactory[MqttClientType MqttClient](f GenericMqttFactory[MqttClientType]) (result MqttFactory)
type OnlineChecker ¶
type OnlineChecker interface { Preprocess(events []TopicDescription) error LoadState(desc TopicDescription) (state mgw.State, found bool) CheckAndStoreState(desc TopicDescription, retained bool, payload []byte) (state mgw.State, ignore bool) }
type TopicDescription ¶
type TopicDescription interface { DeviceDescription GetEventTopic() string GetCmdTopic() string GetResponseTopic() string GetLocalServiceId() string }
func TopicDescriptionsConverter ¶
func TopicDescriptionsConverter[T TopicDescription](from []T) []TopicDescription
type TopicDescriptionProvider ¶
type TopicDescriptionProvider = GenericTopicDescriptionProvider[TopicDescription]
func NewTopicDescriptionProvider ¶
func NewTopicDescriptionProvider[T TopicDescription](f GenericTopicDescriptionProvider[T]) (result TopicDescriptionProvider)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.