Documentation ¶
Index ¶
- Constants
- type Adaptor
- func (a *Adaptor) AutoReconnect() bool
- func (a *Adaptor) CleanSession() bool
- func (a *Adaptor) ClientCert() string
- func (a *Adaptor) ClientKey() string
- func (a *Adaptor) Connect() (err error)
- func (a *Adaptor) Disconnect() (err error)
- func (a *Adaptor) Finalize() (err error)
- func (a *Adaptor) Name() string
- func (a *Adaptor) On(event string, qos byte, f func(msg Message)) bool
- func (a *Adaptor) Port() string
- func (a *Adaptor) Publish(topic string, qos byte, message []byte) bool
- func (a *Adaptor) ServerCert() string
- func (a *Adaptor) SetAutoReconnect(val bool)
- func (a *Adaptor) SetCleanSession(val bool)
- func (a *Adaptor) SetClientCert(val string)
- func (a *Adaptor) SetClientKey(val string)
- func (a *Adaptor) SetName(n string)
- func (a *Adaptor) SetServerCert(val string)
- func (a *Adaptor) SetUseSSL(val bool)
- func (a *Adaptor) UseSSL() bool
- type Driver
- func (m *Driver) Connection() gobot.Connection
- func (m *Driver) Halt() error
- func (m *Driver) Name() string
- func (m *Driver) On(n string, f func(msg interface{}), qos byte) error
- func (m *Driver) Publish(data interface{}, qos byte) bool
- func (m *Driver) SetName(name string)
- func (m *Driver) SetTopic(topic string)
- func (m *Driver) Start() error
- func (m *Driver) Topic() string
- type Message
Constants ¶
const ( // Data event when data is available for Driver Data = "data" // Error event when error occurs in Driver Error = "error" )
const ( QOS_0 = iota QOS_1 QOS_2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶
type Adaptor struct { Host string // contains filtered or unexported fields }
Adaptor is the Gobot Adaptor for MQTT
func NewAdaptor ¶
NewAdaptor creates a new mqtt adaptor with specified host and client id
func NewAdaptorWithAuth ¶
NewAdaptorWithAuth creates a new mqtt adaptor with specified host, client id, username, and password.
func (*Adaptor) AutoReconnect ¶
AutoReconnect returns the MQTT AutoReconnect setting
func (*Adaptor) CleanSession ¶
CleanSession returns the MQTT CleanSession setting
func (*Adaptor) ClientCert ¶
ClientCert returns the MQTT client SSL cert file
func (*Adaptor) Disconnect ¶
Disconnect returns true if connection to mqtt is closed
func (*Adaptor) On ¶
On subscribes to a topic, and then calls the message handler function when data is received
func (*Adaptor) ServerCert ¶
ServerCert returns the MQTT server SSL cert file
func (*Adaptor) SetAutoReconnect ¶
SetAutoReconnect sets the MQTT AutoReconnect setting
func (*Adaptor) SetCleanSession ¶
SetCleanSession sets the MQTT CleanSession setting. Should be false if reconnect is enabled. Otherwise all subscriptions will be lost
func (*Adaptor) SetClientCert ¶
SetClientCert sets the MQTT client SSL cert file
func (*Adaptor) SetClientKey ¶
SetClientKey sets the MQTT client SSL key file
func (*Adaptor) SetServerCert ¶
SetServerCert sets the MQTT server SSL cert file
type Driver ¶
Driver for mqtt
func (*Driver) Connection ¶
func (m *Driver) Connection() gobot.Connection
Connection returns Connections used by the Driver
func (*Driver) On ¶
On subscribes to data updates for the current device topic, and then calls the message handler function when data is received