Documentation
¶
Index ¶
Constants ¶
const ( DefaultRegionID = "cn-shanghai" BrokerURL = "%s%s.iot-as-mqtt.%s.aliyuncs.com:%d" )
const ( DefaultProtocol = ProtocolWS ProtocolWS = "ws://" ProtocolTCP = "tcp://" ProtocolTLS = "tls://" ProtocolWSS = "wss://" )
const ( ServiceTopic = "/sys/%s/%s/thing/service/%s" PropertyPostTopic = "/sys/%s/%s/thing/event/property/post" PropertyPostReplyTopic = "/sys/%s/%s/thing/event/property/post_reply" EventPostTopic = "/sys/%s/%s/thing/event/%s/post" EventPostReplyTopic = "/sys/%s/%s/thing/event/%s/post_reply" )
const ( DefaultSignAlgorithm = HMACSHA1 HMACSHA1 = "sha1" HMACSHA256 = "sha256" )
Variables ¶
var ( PostProperty = "thing.event.property.post" PostEvent = "thing.event.%s.post" ThingServiceMethodPrefix = "thing.service." )
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device interface { Connect() error // SendProperty send property message to aliyun // params maybe struct or map[string]interface{} SendProperty(params interface{}) error SubscribePropertyMessage(callback mqtt.MessageHandler) error Publish(topic string, qos byte, retained bool, message string) error Subscribe(topic string, qos byte, callback mqtt.MessageHandler) error }
func NewDevice ¶
func NewDevice(conf DeviceConfig) Device
NewDevice create new aliyun iot device from device config
type DeviceConfig ¶
type Logger ¶
type Logger interface {
Log(keyvals ...interface{}) error
}
Logger is the fundamental interface for all log operations. Log creates a log event from keyvals, a variadic sequence of alternating keys and values. Implementations must be safe for concurrent use by multiple goroutines. In particular, any implementation of Logger that appends to keyvals or modifies or retains any of its elements must make a copy first. from github.com/go-kit/kit/log
var ( Error Logger = &NOOPLogger{} Critical Logger = &NOOPLogger{} Warning Logger = &NOOPLogger{} Debug Logger = &NOOPLogger{} )
Internal levels of library output that are initialised to not print anything but can be overridden by programmer
type NOOPLogger ¶
type NOOPLogger struct{}
NOOPLogger implements the logger that does not perform any operation by default. This allows us to efficiently discard the unwanted messages.