mgw

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DeviceManagerTopic = "device-manager/device"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(config configuration.Config, ctx context.Context, refreshNotifier func()) (*Client, error)

func (*Client) ListenToDeviceCommands

func (this *Client) ListenToDeviceCommands(deviceId string, commandHandler DeviceCommandHandler) error

func (*Client) MarshalAndSendEvent

func (this *Client) MarshalAndSendEvent(deviceId string, serviceId string, value interface{}) error

func (*Client) NotifyDeviceManagerRefresh

func (this *Client) NotifyDeviceManagerRefresh(f func())

func (*Client) RemoveDevice

func (this *Client) RemoveDevice(deviceId string) error

func (*Client) Respond

func (this *Client) Respond(deviceId string, serviceId string, response Command) error

func (*Client) SendClientError

func (this *Client) SendClientError(message string)

func (*Client) SendCommandError

func (this *Client) SendCommandError(correlationId string, message string)

func (*Client) SendDeviceError

func (this *Client) SendDeviceError(localDeviceId string, message string)

func (*Client) SendDeviceUpdate

func (this *Client) SendDeviceUpdate(info DeviceInfoUpdate) error

func (*Client) SendEvent

func (this *Client) SendEvent(deviceId string, serviceId string, msg []byte) error

func (*Client) SetDevice

func (this *Client) SetDevice(deviceId string, info DeviceInfo) error

func (*Client) StopListenToDeviceCommands

func (this *Client) StopListenToDeviceCommands(deviceId string) error

type Command

type Command struct {
	CommandId string `json:"command_id"`
	Data      string `json:"data"`
}

{"command_id": "senergy-connector-client-connector-b8b6f84c-6be2-4b87-aca2-a4696bf069ae", "data": ""}

type DeviceCommandHandler

type DeviceCommandHandler func(deviceId string, serviceId string, command Command)

type DeviceInfo

type DeviceInfo struct {
	Name       string `json:"name"`
	State      State  `json:"state"`
	DeviceType string `json:"device_type"`
}

{"name": "airSensor", "state": "online", "device_type": "urn:infai:ses:device-type:a8cbd322-9d8c-4f4c-afec-ae4b7986b6ed"}

type DeviceInfoUpdate

type DeviceInfoUpdate struct {
	Method   string     `json:"method"`
	DeviceId string     `json:"device_id"`
	Data     DeviceInfo `json:"data"`
}

{"method": "set", "device_id": "x2gHd2fwdxjUR_lmee3bLw-5ecf7fb0bf6d", "data": {"name": "airSensor", "state": "online", "device_type": "urn:infai:ses:device-type:a8cbd322-9d8c-4f4c-afec-ae4b7986b6ed"}}

type State

type State string
const Offline State = "offline"
const Online State = "online"

type Subscription

type Subscription struct {
	Topic   string
	Handler paho.MessageHandler
}

Jump to

Keyboard shortcuts

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