Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Add(dev *device.Device) error
- func (c *Client) Connect() error
- func (c *Client) Disconnect()
- func (c *Client) Get(identifier string) *device.Device
- func (c *Client) Logger() *logr.Logger
- func (c *Client) Publish(topic string, qos byte, retained bool, payload interface{}) mqtt.Token
- func (c *Client) Subscribe(topic string, qos byte, callback mqtt.MessageHandler) mqtt.Token
- func (c *Client) Unsubscribe(topics ...string) mqtt.Token
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoDeviceFound = fmt.Errorf("no device found")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
NodeID string
OnConnect func(client mqtt.Client)
// contains filtered or unexported fields
}
func NewClientWithLogger ¶ added in v0.2.2
func (*Client) Disconnect ¶
func (c *Client) Disconnect()
type Config ¶
type Config struct {
NodeID string `json:"node_id" yaml:"node_id"`
MQTT struct {
Host string `json:"host" yaml:"host"`
Port int `json:"port" yaml:"port"`
SSL bool `json:"ssl" yaml:"ssl"`
UserName *string `json:"user_name,omitempty" yaml:"user_name"`
Password *string `json:"password,omitempty" yaml:"password"`
} `json:"MQTT" yaml:"mqtt"`
}
Click to show internal directories.
Click to hide internal directories.