lib

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeviceETPrefix          = "$hw/events/device/"
	TwinETUpdateSuffix      = "/twin/update"
	TwinETUpdateDeltaSuffix = "/twin/update/delta"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Type     string `yaml:"type"`
	Model    string `yaml:"model"`
	Launcher string `yaml:"launchers"`
	MQTT     MQTT   `yaml:"broker"`
	Path     string `yaml:"sourcepath"`
	DeviceID string `yaml:"DeviceID"`
	// Channel used to kill a running app
	Stop chan string
	// contains filtered or unexported fields
}

Device Type

func (*Device) GetConfigFromFile

func (d *Device) GetConfigFromFile(filename string)

Function used to parse a yaml file to a Device configuration

func (*Device) Listen

func (d *Device) Listen()

Function that initialise the Mapper and keep it open.

type MQTT

type MQTT struct {
	BrokerHost string `yaml:"host"`
	BrokerPort string `yaml:"port"`
	Topic      string `yaml:"topic"`
	Client     mqtt.Client
	ID         string
	Action     func(mqtt.Message, mqtt.Client, string)
}

func (*MQTT) Connect

func (b *MQTT) Connect()

func (*MQTT) MqttHandlerJSON

func (b *MQTT) MqttHandlerJSON(channel string) func(client mqtt.Client, message mqtt.Message)

Action made when the device receive a message from the specified Topic

func (*MQTT) Subscribe

func (b *MQTT) Subscribe(channel string)

Jump to

Keyboard shortcuts

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