Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultMQTTClientOptions ¶
func DefaultMQTTClientOptions() *mqtt.ClientOptions
Types ¶
type Client ¶
type Client interface { // Set publishes a set message with the value Set(toplevel, item string, value string) error // Get publishes a get request message. Get(toplevel, item string) (Value, error) // Command publishes a command to the toplevel topic. Command(toplevel string, cmd []byte) error // Subscribe to receive callbacks whenever a status message is received. Subscribe(toplevel, item string) *Subscription // Close disconnects the client. Close() }
type ConnectionState ¶
type ConnectionState int
const ( Connected ConnectionState = iota Disconnected )
type DeviceLookup ¶
type DeviceLookup interface { Device(toplevel, item string) (Device, bool) Find(toplevel string, itemMatch *regexp.Regexp) []Device Close() }
func NewDeviceLookup ¶
func NewDeviceLookup(c Client) DeviceLookup
type Server ¶
type Server interface { // Connect to the MQTT broker. Connect() error // Disconnect from the MQTT broker. Disconnect() // Publish the state of the hardware connection. PublishHWStatus(ConnectionState) error // Publish a status message. PublishStatus(item string, value Value) error // Publish a one-shot message. PublishOneShotStatus(item string, value Value) error // Client returns a client that shares the underlying MQTT connection. // The server must be connected before calling. // Closing the client is required but will not disconnect the underlying MQTT connection. Client() (Client, error) }
type StatusMessage ¶
type Subscription ¶
type Subscription struct { C <-chan StatusMessage // contains filtered or unexported fields }
func (*Subscription) Unsubscribe ¶
func (s *Subscription) Unsubscribe()
Click to show internal directories.
Click to hide internal directories.