Documentation ¶
Index ¶
- type Controller
- type Service
- func (srv *Service) ActionHandler(client MQTT.Client, msg MQTT.Message)
- func (srv *Service) ActionList(orgID, clientID string) ([]domain.Action, error)
- func (srv *Service) DeviceGet(orgID, clientID string) (domain.Device, error)
- func (srv *Service) DeviceList(orgID string) ([]domain.Device, error)
- func (srv *Service) DeviceSnapConf(orgID, clientID, snap, settings string) error
- func (srv *Service) DeviceSnapInstall(orgID, clientID, snap string) error
- func (srv *Service) DeviceSnapList(orgID, clientID string) error
- func (srv *Service) DeviceSnapRemove(orgID, clientID, snap string) error
- func (srv *Service) DeviceSnapUpdate(orgID, clientID, snap, action string) error
- func (srv *Service) DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, error)
- func (srv *Service) GroupCreate(orgID, name string) error
- func (srv *Service) GroupGet(orgID, name string) (domain.Group, error)
- func (srv *Service) GroupGetDevices(orgID, name string) ([]domain.Device, error)
- func (srv *Service) GroupGetExcludedDevices(orgID, name string) ([]domain.Device, error)
- func (srv *Service) GroupLinkDevice(orgID, name, clientID string) error
- func (srv *Service) GroupList(orgID string) ([]domain.Group, error)
- func (srv *Service) GroupUnlinkDevice(orgID, name, clientID string) error
- func (srv *Service) HealthHandler(client MQTT.Client, msg MQTT.Message)
- func (srv *Service) SubscribeToActions() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { // MQTT handlers HealthHandler(client MQTT.Client, msg MQTT.Message) ActionHandler(client MQTT.Client, msg MQTT.Message) // Passthrough to the device twin service DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, error) DeviceList(orgID string) ([]domain.Device, error) DeviceGet(orgID, clientID string) (domain.Device, error) GroupCreate(orgID, name string) error GroupList(orgID string) ([]domain.Group, error) GroupGet(orgID, name string) (domain.Group, error) GroupLinkDevice(orgID, name, clientID string) error GroupUnlinkDevice(orgID, name, clientID string) error GroupGetDevices(orgID, name string) ([]domain.Device, error) GroupGetExcludedDevices(orgID, name string) ([]domain.Device, error) // Actions on a device DeviceSnapList(orgID, clientID string) error DeviceSnapInstall(orgID, clientID, snap string) error DeviceSnapRemove(orgID, clientID, snap string) error DeviceSnapUpdate(orgID, clientID, snap, action string) error DeviceSnapConf(orgID, clientID, snap, settings string) error ActionList(orgID, clientID string) ([]domain.Action, error) }
Controller interface for the service
type Service ¶
type Service struct { Settings *config.Settings MQTT mqtt.Connect DeviceTwin devicetwin.DeviceTwin }
Service implementation of the devicetwin service use cases
func NewService ¶
func NewService(settings *config.Settings, m mqtt.Connect, twin devicetwin.DeviceTwin) *Service
NewService creates an implementation of the devicetwin use cases
func (*Service) ActionHandler ¶
ActionHandler is the handler for the main subscription topic
func (*Service) ActionList ¶
ActionList gets the action log for a device
func (*Service) DeviceList ¶
DeviceList gets the devices from the database cache
func (*Service) DeviceSnapConf ¶
DeviceSnapConf triggers a snap settings update on a device
func (*Service) DeviceSnapInstall ¶
DeviceSnapInstall triggers installing a snap on a device
func (*Service) DeviceSnapList ¶
DeviceSnapList triggers listing snaps on a device
func (*Service) DeviceSnapRemove ¶
DeviceSnapRemove triggers uninstalling a snap on a device
func (*Service) DeviceSnapUpdate ¶
DeviceSnapUpdate triggers a snap update on a device
func (*Service) DeviceSnaps ¶
func (srv *Service) DeviceSnaps(orgID, clientID string) ([]domain.DeviceSnap, error)
DeviceSnaps gets the device's snaps from the database cache
func (*Service) GroupCreate ¶
GroupCreate creates a device group
func (*Service) GroupGetDevices ¶
GroupGetDevices retrieves the devices from a group
func (*Service) GroupGetExcludedDevices ¶
GroupGetExcludedDevices retrieves the devices not in a group
func (*Service) GroupLinkDevice ¶
GroupLinkDevice links a device to a group
func (*Service) GroupUnlinkDevice ¶
GroupUnlinkDevice unlinks a device from a group
func (*Service) HealthHandler ¶
HealthHandler is the handler for the devices health messages
func (*Service) SubscribeToActions ¶
SubscribeToActions subscribes to the published topics from the devices