Documentation
¶
Overview ¶
Package kubeClient provide the functionality to initalize a MQTT connection and update the device twin in a feauture version this package should also provide to handle incomming message via a callback function
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Prefix = "$hw/events/device/" StateUpdateSuffix = "/state/update" TwinUpdateSuffix = "/twin/update" TwinCloudUpdateSuffix = "/twin/cloud_updated" TwinGetResultSuffix = "/twin/get/result" TwinGetSuffix = "/twin/get" )
Functions ¶
func Init ¶
func Init(ipAddress, id, user, password string)
Init hit initalise the MQTT connection and set the used ipAddress and deviceID in a feature version this function also register the callback method to handle incomming messages ipAddress and deviceID has to be set! If you don't want to add an user or an password in the MQTT Connection set user and password to nil
Types ¶
type BaseMessage ¶
BaseMessage the base struct of event message
type DeviceStateUpdate ¶
type DeviceStateUpdate struct {
State string `json:"state,omitempty"`
}
DeviceStateUpdate is the structure used in updating the device state
type DeviceTwinUpdate ¶
type DeviceTwinUpdate struct { BaseMessage Twin map[string]*MsgTwin `json:"twin"` }
DeviceTwinUdpdate the struct of device twin update
type DeviceTwinUpdateDelta ¶
type DeviceTwinUpdateDelta struct { BaseMessage Twin map[string]*MsgTwin `json:"twin"` Delta map[string]string `json:"delta"` }
type MsgTwin ¶
type MsgTwin struct { Actual *TwinValue `json:"actual,omitempty"` Expected *TwinValue `json:"expected,omitempty"` Optional *bool `json:"optional,omitempty"` Metadata *TypeMetadata `json:"metadata,omitempty"` ExpectedVersion *TwinValue `json:"expected_version,omitempty"` ActualVersion *TwinVersion `json:"actual_version,omitempty"` }
MsgTwin the structe of device twin
type TwinValue ¶
type TwinValue struct { Value *string `json:"value,omitempty"` Metadata *ValueMetadata `json:"metadata,omitempty"` }
TwinValue the struct of twin value
type TwinVersion ¶
TwinVersion twin version
type TypeMetadata ¶
type TypeMetadata struct {
Type string `json:"type,omitempty"`
}
TypeMetadata the meta of value type
type ValueMetadata ¶
type ValueMetadata struct {
Timestamp int64 `json:"timestamp,omitempty"`
}
ValueMetadata the meta of value