Documentation ¶
Overview ¶
Package aiot imp aliyun dm
Index ¶
- Constants
- Variables
- func FormatKey(pk, dn string) string
- func ProcExtCombineBatchLoginReply(c *Client, rawURI string, payload []byte) error
- func ProcExtCombineBatchLogoutReply(c *Client, rawURI string, payload []byte) error
- func ProcExtCombineLoginReply(c *Client, rawURI string, payload []byte) error
- func ProcExtCombineLogoutReply(c *Client, rawURI string, payload []byte) error
- func ProcExtErrorResponse(c *Client, rawURI string, payload []byte) error
- func ProcExtNetworkProbeRequest(c *Client, rawURI string, _ []byte) error
- func ProcExtNtpResponse(c *Client, rawURI string, payload []byte) error
- func ProcExtRRPCRequest(c *Client, rawURI string, payload []byte) error
- func ProcOtaUpgrade(c *Client, rawURI string, payload []byte) error
- func ProcRRPCRequest(c *Client, rawURI string, payload []byte) error
- func ProcThingConfigGetReply(c *Client, rawURI string, payload []byte) error
- func ProcThingConfigLogGetReply(c *Client, rawURI string, payload []byte) error
- func ProcThingConfigLogPush(c *Client, rawURI string, payload []byte) error
- func ProcThingConfigPush(c *Client, rawURI string, payload []byte) error
- func ProcThingDelete(c *Client, rawURI string, payload []byte) error
- func ProcThingDesiredPropertyDeleteReply(c *Client, rawURI string, payload []byte) error
- func ProcThingDesiredPropertyGetReply(c *Client, rawURI string, payload []byte) error
- func ProcThingDeviceInfoDeleteReply(c *Client, rawURI string, payload []byte) error
- func ProcThingDeviceInfoUpdateReply(c *Client, rawURI string, payload []byte) error
- func ProcThingDialPostReply(c *Client, rawURI string, payload []byte) error
- func ProcThingDisable(c *Client, rawURI string, payload []byte) error
- func ProcThingDsltemplateGetReply(c *Client, rawURI string, payload []byte) error
- func ProcThingDynamictslGetReply(c *Client, rawURI string, payload []byte) error
- func ProcThingEnable(c *Client, rawURI string, payload []byte) error
- func ProcThingEventPostReply(c *Client, rawURI string, payload []byte) error
- func ProcThingEventPropertyHistoryPostReply(c *Client, rawURI string, payload []byte) error
- func ProcThingEventPropertyPackPostReply(c *Client, rawURI string, payload []byte) error
- func ProcThingListFoundReply(c *Client, rawURI string, payload []byte) error
- func ProcThingLogPostReply(c *Client, rawURI string, payload []byte) error
- func ProcThingModelDownRaw(c *Client, rawURI string, payload []byte) error
- func ProcThingModelUpRawReply(c *Client, rawURI string, payload []byte) error
- func ProcThingOtaFirmwareGetReply(c *Client, rawURI string, payload []byte) error
- func ProcThingServiceRequest(c *Client, rawURI string, payload []byte) error
- func ProcThingSubRegisterReply(c *Client, rawURI string, payload []byte) error
- func ProcThingTopoAddNotify(c *Client, rawURI string, payload []byte) error
- func ProcThingTopoAddReply(c *Client, rawURI string, payload []byte) error
- func ProcThingTopoChange(c *Client, rawURI string, payload []byte) error
- func ProcThingTopoDeleteReply(c *Client, rawURI string, payload []byte) error
- func ProcThingTopoGetReply(c *Client, rawURI string, payload []byte) error
- type Callback
- type Client
- func (sf *Client) AddSubDevice(meta infra.MetaTriad) error
- func (sf *Client) Connect() error
- func (sf *Client) ExtNtpRequest() error
- func (sf *Client) ExtRRPCResponse(messageID, topic string, payload interface{}) error
- func (sf *Client) LinkExtCombineBatchLogin(pairs []CombinePair, timeout time.Duration) error
- func (sf *Client) LinkExtCombineBatchLogout(pairs []infra.MetaPair, timeout time.Duration) error
- func (sf *Client) LinkExtCombineLogin(cp CombinePair, timeout time.Duration) error
- func (sf *Client) LinkExtCombineLogout(pk, dn string, timeout time.Duration) error
- func (sf *Client) LinkThingConfigGet(pk, dn string, timeout time.Duration) (ConfigParamsData, error)
- func (sf *Client) LinkThingConfigLogGet(pk, dn string, clp ConfigLogParam, timeout time.Duration) (ConfigLogParamData, error)
- func (sf *Client) LinkThingDesiredPropertyDelete(pk, dn string, params interface{}, timeout time.Duration) error
- func (sf *Client) LinkThingDesiredPropertyGet(pk, dn string, params []string, timeout time.Duration) (json.RawMessage, error)
- func (sf *Client) LinkThingDeviceInfoDelete(pk, dn string, params []DeviceLabelKey, timeout time.Duration) error
- func (sf *Client) LinkThingDeviceInfoUpdate(pk, dn string, params []DeviceInfoLabel, timeout time.Duration) error
- func (sf *Client) LinkThingDiagHistoryPost(pk, dn string, p []P, timeout time.Duration) error
- func (sf *Client) LinkThingDiagPost(pk, dn string, p P, timeout time.Duration) error
- func (sf *Client) LinkThingDsltemplateGet(pk, dn string, timeout time.Duration) (json.RawMessage, error)
- func (sf *Client) LinkThingDynamictslGet(pk, dn string, timeout time.Duration) (json.RawMessage, error)
- func (sf *Client) LinkThingEventPost(pk, dn, eventID string, params interface{}, timeout time.Duration) error
- func (sf *Client) LinkThingEventPropertyHistoryPost(params interface{}, timeout time.Duration) error
- func (sf *Client) LinkThingEventPropertyPackPost(params interface{}, timeout time.Duration) error
- func (sf *Client) LinkThingEventPropertyPost(pk, dn string, params interface{}, timeout time.Duration) error
- func (sf *Client) LinkThingListFound(pairs []infra.MetaPair, timeout time.Duration) error
- func (sf *Client) LinkThingLogPost(pk, dn string, lp []LogParam, timeout time.Duration) error
- func (sf *Client) LinkThingOtaFirmwareGet(pk, dn string, param OtaFirmwareParam, timeout time.Duration) (OtaFirmwareData, error)
- func (sf *Client) LinkThingSubRegister(pk, dn string, timeout time.Duration) ([]SubRegisterData, error)
- func (sf *Client) LinkThingTopoAdd(pk, dn string, timeout time.Duration) error
- func (sf *Client) LinkThingTopoDelete(pk, dn string, timeout time.Duration) error
- func (sf *Client) LinkThingTopoGet(timeout time.Duration) ([]infra.MetaPair, error)
- func (sf *Client) OtaInform(pk, dn string, params OtaInformParams) error
- func (sf *Client) OtaProgress(pk, dn string, params OtaProgressParams) error
- func (sf *Client) RRPCResponse(pk, dn, messageID string, rsp Response) error
- func (sf *Client) Request(_uri string, requestID uint, method string, params interface{}) error
- func (sf *Client) Response(_uri string, rsp Response) error
- func (sf *Client) SendRequest(_uri, method string, params interface{}) (*Token, error)
- func (sf *Client) SubDeviceConnect(pk, dn string, cleanSession bool, timeout time.Duration) error
- func (sf *Client) SubscribeAllTopic(productKey, deviceName string, isSub bool) error
- func (sf *Client) ThingConfigGet(pk, dn string) (*Token, error)
- func (sf *Client) ThingConfigLogGet(pk, dn string, _ ConfigLogParam) (*Token, error)
- func (sf *Client) ThingDesiredPropertyDelete(pk, dn string, params interface{}) (*Token, error)
- func (sf *Client) ThingDesiredPropertyGet(pk, dn string, params []string) (*Token, error)
- func (sf *Client) ThingDeviceInfoDelete(pk, dn string, params []DeviceLabelKey) (*Token, error)
- func (sf *Client) ThingDeviceInfoUpdate(pk, dn string, params []DeviceInfoLabel) (*Token, error)
- func (sf *Client) ThingDiagHistoryPost(pk, dn string, ps []P) (*Token, error)
- func (sf *Client) ThingDiagPost(pk, dn string, p P) (*Token, error)
- func (sf *Client) ThingDsltemplateGet(pk, dn string) (*Token, error)
- func (sf *Client) ThingDynamictslGet(pk, dn string) (*Token, error)
- func (sf *Client) ThingEventPost(pk, dn, eventID string, params interface{}) (*Token, error)
- func (sf *Client) ThingEventPropertyHistoryPost(params interface{}) (*Token, error)
- func (sf *Client) ThingEventPropertyPackPost(params interface{}) (*Token, error)
- func (sf *Client) ThingEventPropertyPost(pk, dn string, params interface{}) (*Token, error)
- func (sf *Client) ThingListFound(pairs []infra.MetaPair) (*Token, error)
- func (sf *Client) ThingLogPost(pk, dn string, lp []LogParam) (*Token, error)
- func (sf *Client) ThingModelUpRaw(pk, dn string, payload interface{}) error
- func (sf *Client) ThingOtaFirmwareGet(pk, dn string, param OtaFirmwareParam) (*Token, error)
- func (sf *Client) ThingTopoGet() (*Token, error)
- func (sf *Client) URIGateway(prefix, name string) string
- func (sf *Client) UnSubscribeAllTopic(productKey, deviceName string, isSub bool) error
- type CombineBatchLoginParams
- type CombineBatchLoginResponse
- type CombineBatchLogoutResponse
- type CombineLoginParams
- type CombineLoginResponse
- type CombineLogoutResponse
- type CombinePair
- type ConfigGetParams
- type ConfigGetResponse
- type ConfigLogMode
- type ConfigLogParam
- type ConfigLogParamData
- type ConfigLogPush
- type ConfigLogResponse
- type ConfigParamsData
- type ConfigPushRequest
- type Conn
- type DevMgr
- func (sf *DevMgr) Add(meta infra.MetaTriad) error
- func (sf *DevMgr) Delete(pk, dn string)
- func (sf *DevMgr) DeviceAvail(pk, dn string) (bool, error)
- func (sf *DevMgr) DeviceSecret(pk, dn string) (string, error)
- func (sf *DevMgr) DeviceStatus(pk, dn string, status DevStatus) error
- func (sf *DevMgr) IsActive(pk, dn string) bool
- func (sf *DevMgr) Len() int
- func (sf *DevMgr) Search(pk, dn string) (*DevNode, error)
- func (sf *DevMgr) SearchAvail(pk, dn string) (*DevNode, error)
- func (sf *DevMgr) SetDeviceAvail(pk, dn string, enable bool) error
- func (sf *DevMgr) SetDeviceSecret(pk, dn, ds string) error
- func (sf *DevMgr) SetDeviceStatus(pk, dn string, status DevStatus) error
- type DevNode
- type DevStatus
- type DeviceInfoLabel
- type DeviceLabelKey
- type DiagParam
- type DiagRequest
- type ExtErrorResponse
- type GwCallback
- type LogParam
- type MQTTClient
- type Message
- type Mode
- type NopCb
- func (NopCb) ExtNtpResponse(*Client, string, string, time.Time) error
- func (NopCb) ExtRRPCRequest(*Client, string, string, []byte) error
- func (NopCb) OtaUpgrade(*Client, string, string, *OtaFirmwareResponse) error
- func (NopCb) RRPCRequest(*Client, string, string, string, []byte) error
- func (NopCb) ThingConfigGetReply(*Client, error, string, string, ConfigParamsData) error
- func (NopCb) ThingConfigLogGetReply(*Client, error, string, string, ConfigLogParamData) error
- func (NopCb) ThingConfigLogPush(*Client, string, string, ConfigLogParamData) error
- func (NopCb) ThingConfigPush(*Client, string, string, ConfigParamsData) error
- func (NopCb) ThingDesiredPropertyDeleteReply(*Client, error, string, string) error
- func (NopCb) ThingDesiredPropertyGetReply(*Client, error, string, string, json.RawMessage) error
- func (NopCb) ThingDeviceInfoDeleteReply(*Client, error, string, string) error
- func (NopCb) ThingDeviceInfoUpdateReply(*Client, error, string, string) error
- func (NopCb) ThingDialPostReply(*Client, error, string, string) error
- func (NopCb) ThingDsltemplateGetReply(*Client, error, string, string, json.RawMessage) error
- func (NopCb) ThingDynamictslGetReply(*Client, error, string, string, json.RawMessage) error
- func (NopCb) ThingEventPostReply(*Client, error, string, string, string) error
- func (NopCb) ThingEventPropertyHistoryPostReply(*Client, error, string, string) error
- func (NopCb) ThingEventPropertyPackPostReply(*Client, error, string, string) error
- func (NopCb) ThingEventPropertyPostReply(*Client, error, string, string) error
- func (NopCb) ThingLogPostReply(*Client, error, string, string) error
- func (NopCb) ThingModelDownRaw(*Client, string, string, []byte) error
- func (NopCb) ThingModelUpRawReply(*Client, string, string, []byte) error
- func (NopCb) ThingOtaFirmwareGetReply(*Client, string, string, OtaFirmwareData) error
- func (NopCb) ThingServicePropertySet(*Client, string, string, []byte) error
- func (NopCb) ThingServiceRequest(*Client, string, string, string, []byte) error
- type NopGwCb
- func (NopGwCb) ExtErrorResponse(*Client, error, string, string) error
- func (NopGwCb) ThingDelete(*Client, string, string) error
- func (NopGwCb) ThingDisable(*Client, string, string) error
- func (NopGwCb) ThingEnable(*Client, string, string) error
- func (NopGwCb) ThingListFoundReply(*Client, error) error
- func (NopGwCb) ThingTopoAddNotify(*Client, []infra.MetaPair) error
- func (NopGwCb) ThingTopoChange(*Client, TopoChangeParams) error
- func (NopGwCb) ThingTopoGetReply(*Client, error, []infra.MetaPair) error
- type NtpRequest
- type NtpResponse
- type Option
- func WithCache(expiration, cleanupInterval time.Duration) Option
- func WithCallback(cb Callback) Option
- func WithEnableDesired() Option
- func WithEnableDiag() Option
- func WithEnableExtRRPC() Option
- func WithEnableGateway() Option
- func WithEnableModelRaw() Option
- func WithEnableNTP() Option
- func WithEnableOTA() Option
- func WithGwCallback(cb GwCallback) Option
- func WithLogger(l logger.Logger) Option
- func WithMode(m Mode) Option
- func WithVersion(ver string) Option
- type OtaFirmwareData
- type OtaFirmwareParam
- type OtaFirmwareResponse
- type OtaInformParams
- type OtaProgressParams
- type OtaRequest
- type P
- type ProcDownStream
- type Request
- type Response
- type ResponseRawData
- type SubRegisterData
- type SubRegisterResponse
- type Token
- type TopoAddNotifyRequest
- type TopoAddParams
- type TopoAddResponse
- type TopoChangeParams
- type TopoChangeRequest
- type TopoDeleteResponse
- type TopoGetResponse
- type Wifi
Constants ¶
const ( DefaultCacheExpiration = time.Second * 10 DefaultCacheCleanupInterval = time.Second * 30 )
缓存默认值
const ( OtaProgressStepUpgradeFailed = -1 OtaProgressStepDownloadFailed = -2 OtaProgressStepVerifyFailed = -3 OtaProgressStepProgramFailed = -4 )
OTA下载进度比
const ( LogFatal = "FATAL" LogError = "ERROR" LogWarn = "WARN" LogInfo = "INFO" LogDebug = "DEBUG" LogOther = "OTHER" )
Log level,从高到低
const DefaultVersion = "1.0"
DefaultVersion 平台通信版本
const DevInfoLabelCoordinateKey = "coordinate"
DevInfoLabelCoordinateKey 地理位置标签
Variables ¶
var ( ErrInvalidURI = errors.New("invalid URI") ErrNotFound = errors.New("not found") ErrInvalidParameter = errors.New("invalid parameter") ErrNotSupportFeature = errors.New("not support feature") ErrWaitTimeout = errors.New("wait timeout") ErrEntryClosed = errors.New("entry has closed") ErrDeviceHasExist = errors.New("device has exist") ErrNotPermit = errors.New("not permit") ErrNotActive = errors.New("device not active") ErrNotAvail = errors.New("device not avail") )
错误相关定义
Functions ¶
func ProcExtCombineBatchLoginReply ¶
ProcExtCombineBatchLoginReply 子设备批量上线应答处理 request: /ext/session/{productKey}/{deviceName}/combine/batch_login response: /ext/session/{productKey}/{deviceName}/combine/batch_login_reply subscribe: /ext/session/{productKey}/{deviceName}/combine/batch_login_reply
func ProcExtCombineBatchLogoutReply ¶
ProcExtCombineBatchLogoutReply 子设备批量下线应答处理 上行 request: /ext/session/{productKey}/{deviceName}/combine/batch_logout response: /ext/session/{productKey}/{deviceName}/combine/batch_logout_reply subscribe: /ext/session/{productKey}/{deviceName}/combine/batch_logout_reply
func ProcExtCombineLoginReply ¶
ProcExtCombineLoginReply 处理子设备上线应答 request: /ext/session/{productKey}/{deviceName}/combine/login response: /ext/session/{productKey}/{deviceName}/combine/login_reply subscribe: /ext/session/{productKey}/{deviceName}/combine/login_reply
func ProcExtCombineLogoutReply ¶
ProcExtCombineLogoutReply 子设备下线应答处理 上行 request: /ext/session/{productKey}/{deviceName}/combine/logout response: /ext/session/{productKey}/{deviceName}/combine/logout_reply subscribe: /ext/session/{productKey}/{deviceName}/combine/logout_reply
func ProcExtErrorResponse ¶
ProcExtErrorResponse 处理错误的回复,仅与子设备 response: ext/error/{productKey}/{deviceName} subscribe: ext/error/{productKey}/{deviceName}
func ProcExtNetworkProbeRequest ¶
ProcExtNetworkProbeRequest 处理平台测试延迟请求 request: /ext/network/probe/${messageId} subscribe: /ext/network/probe/+
func ProcExtNtpResponse ¶
ProcExtNtpResponse 处理ntp请求的应答 上行 request: /ext/ntp/${YourProductKey}/${YourDeviceName}/request response: /ext/ntp/${YourProductKey}/${YourDeviceName}/response subscribe: /ext/ntp/${YourProductKey}/${YourDeviceName}/response
func ProcExtRRPCRequest ¶
ProcExtRRPCRequest 处理扩展RRPC请求 ${topic} 不为空,设备建立要求clientID传ext = 1 request: /ext/rrpc/${messageId}/${topic} response: /ext/rrpc/${messageId}/${topic} subscribe: /ext/rrpc/+/${topic}
/ext/rrpc/#
func ProcOtaUpgrade ¶
ProcOtaUpgrade 处理物联网平台推送固件信息 request: /ota/device/upgrade/${YourProductKey}/${YourDeviceName} subscribe:/ota/device/upgrade/${YourProductKey}/${YourDeviceName}
func ProcRRPCRequest ¶
ProcRRPCRequest 处理RRPC请求 request: /sys/${YourProductKey}/${YourDeviceName}/rrpc/request/${messageId} response: /sys/${YourProductKey}/${YourDeviceName}/rrpc/response/${messageId} subscribe: /sys/${YourProductKey}/${YourDeviceName}/rrpc/request/+
func ProcThingConfigGetReply ¶
ProcThingConfigGetReply 处理获取配置的应答 上行 request: /sys/{productKey}/{deviceName}/thing/config/get response: /sys/{productKey}/{deviceName}/thing/config/get_reply subscribe: /sys/{productKey}/{deviceName}/thing/config/get_reply
func ProcThingConfigLogGetReply ¶
ProcThingConfigLogGetReply 处理获取日志配置应答 request: /sys/${productKey}/${deviceName}/thing/config/Log/get response: /sys/${productKey}/${deviceName}/thing/config/Log/get_reply subscribe: /sys/${productKey}/${deviceName}/thing/config/Log/get_reply
func ProcThingConfigLogPush ¶
ProcThingConfigLogPush 处理日志配置推送 subscribe: /sys/${productKey}/${deviceName}/thing/config/Log/push
func ProcThingConfigPush ¶
ProcThingConfigPush 处理配置推送,已做回复 下行 request: /sys/{productKey}/{deviceName}/thing/config/push response: /sys/{productKey}/{deviceName}/thing/config/push_reply subscribe: /sys/{productKey}/{deviceName}/thing/config/push
func ProcThingDelete ¶
ProcThingDelete 子设备删除,网关类型设备 下行 request: /sys/{productKey}/{deviceName}/thing/delete response: /sys/{productKey}/{deviceName}/thing/delete_reply subscribe: /sys/{productKey}/{deviceName}/thing/delete
func ProcThingDesiredPropertyDeleteReply ¶
ProcThingDesiredPropertyDeleteReply 处理清空期望属性值的应答 request: /sys/{productKey}/{deviceName}/thing/property/desired/delete response: /sys/{productKey}/{deviceName}/thing/property/desired/delete_reply subscribe: /sys/{productKey}/{deviceName}/thing/property/desired/delete_reply
func ProcThingDesiredPropertyGetReply ¶
ProcThingDesiredPropertyGetReply 处理获取期望属性值的应答 上行 request: /sys/{productKey}/{deviceName}/thing/property/desired/get response: /sys/{productKey}/{deviceName}/thing/property/desired/get_reply subscribe: /sys/{productKey}/{deviceName}/thing/property/desired/get_reply
func ProcThingDeviceInfoDeleteReply ¶
ProcThingDeviceInfoDeleteReply 处理设备信息删除的应答 request: /sys/{productKey}/{deviceName}/thing/deviceinfo/delete response: /sys/{productKey}/{deviceName}/thing/deviceinfo/delete_reply subscribe: /sys/{productKey}/{deviceName}/thing/deviceinfo/delete_reply
func ProcThingDeviceInfoUpdateReply ¶
ProcThingDeviceInfoUpdateReply 处理设备信息更新应答 request: /sys/{productKey}/{deviceName}/thing/deviceinfo/update response: /sys/{productKey}/{deviceName}/thing/deviceinfo/update_reply subscribe: /sys/{productKey}/{deviceName}/thing/deviceinfo/update_reply
func ProcThingDialPostReply ¶
ProcThingDialPostReply 处理设备主动上报网络状态回复 request: /sys/{productKey}/{deviceName}/_thing/diag/post response: /sys/{productKey}/{deviceName}/_thing/diag/post_reply subscribe: /sys/{productKey}/{deviceName}/_thing/diag/post_reply
func ProcThingDisable ¶
ProcThingDisable 禁用子设备 request: /sys/{productKey}/{deviceName}/thing/disable response: /sys/{productKey}/{deviceName}/thing/disable_reply subscribe: /sys/{productKey}/{deviceName}/thing/disable
func ProcThingDsltemplateGetReply ¶
ProcThingDsltemplateGetReply 处理dsltemplate获取的应答 request: /sys/{productKey}/{deviceName}/thing/dsltemplate/get response: /sys/{productKey}/{deviceName}/thing/dsltemplate/get_reply subscribe: /sys/{productKey}/{deviceName}/thing/dsltemplate/get_reply
func ProcThingDynamictslGetReply ¶
ProcThingDynamictslGetReply 处理获取动态tsl应答 request: /sys/${YourProductKey}/${YourDeviceName}/thing/dynamicTsl/get response: /sys/${YourProductKey}/${YourDeviceName}/thing/dynamicTsl/get_reply subscribe: /sys/${YourProductKey}/${YourDeviceName}/thing/dynamicTsl/get_reply
func ProcThingEnable ¶
ProcThingEnable 启用子设备 下行 request: /sys/{productKey}/{deviceName}/thing/enable response: /sys/{productKey}/{deviceName}/thing/enable_reply subscribe: /sys/{productKey}/{deviceName}/thing/enable
func ProcThingEventPostReply ¶
ProcThingEventPostReply 处理ThingEvent XXX上行的应答 上行 request: /sys/{productKey}/{deviceName}/thing/event/[{tsl.event.identifier},property]/post response: /sys/{productKey}/{deviceName}/thing/event/[{tsl.event.identifier},property]/post_reply subscribe: /sys/{productKey}/{deviceName}/thing/event/+/post_reply
func ProcThingEventPropertyHistoryPostReply ¶
ProcThingEventPropertyHistoryPostReply 物模型历史数据上报应答 request: /sys/{productKey}/{deviceName}/thing/event/property/history/post response: /sys/{productKey}/{deviceName}/thing/event/property/history/post_reply subscribe: /sys/{productKey}/{deviceName}/thing/event/property/history/post_reply
func ProcThingEventPropertyPackPostReply ¶
ProcThingEventPropertyPackPostReply 网关批量上报数据 上行,仅网关支持 request: /sys/{productKey}/{deviceName}/thing/event/property/pack/post response: /sys/{productKey}/{deviceName}/thing/event/property/pack/post_reply subscribe: /sys/{productKey}/{deviceName}/thing/event/property/pack/post_reply
func ProcThingListFoundReply ¶
ProcThingListFoundReply 处理发现设备列表上报应答 request: /sys/{productKey}/{deviceName}/thing/list/found response: /sys/{productKey}/{deviceName}/thing/list/found_reply subscribe: /sys/{productKey}/{deviceName}/thing/list/found_reply
func ProcThingLogPostReply ¶
ProcThingLogPostReply 处理日志上报应答 request: /sys/${productKey}/${deviceName}/thing/Log/post response:/sys/${productKey}/${deviceName}/thing/Log/post_reply
func ProcThingModelDownRaw ¶
ProcThingModelDownRaw 处理透传下行数据 下行 request: /sys/{productKey}/{deviceName}/thing/model/down_raw response: /sys/{productKey}/{deviceName}/thing/model/down_raw_reply subscribe: /sys/{productKey}/{deviceName}/thing/model/down_raw
func ProcThingModelUpRawReply ¶
ProcThingModelUpRawReply 处理透传上行的应答 request: /sys/{productKey}/{deviceName}/thing/model/up_raw response: /sys/{productKey}/{deviceName}/thing/model/up_raw_reply subscribe: /sys/{productKey}/{deviceName}/thing/model/up_raw_reply
func ProcThingOtaFirmwareGetReply ¶
ProcThingOtaFirmwareGetReply 处理请求固件信息应答 request: /sys/{productKey}/{deviceName}/thing/ota/firmware/get response: /sys/{productKey}/{deviceName}/thing/ota/firmware/get_reply subscribe:/sys/{productKey}/{deviceName}/thing/ota/firmware/get_reply
func ProcThingServiceRequest ¶
ProcThingServiceRequest 处理设备服务调用(异步) 下行 request: /sys/{productKey}/{deviceName}/thing/service/[{tsl.service.identifier},property/set] response: /sys/{productKey}/{deviceName}/thing/service/[{tsl.service.identifier}_reply,property/set_reply subscribe: /sys/{productKey}/{deviceName}/thing/service/[+,#]
func ProcThingSubRegisterReply ¶
ProcThingSubRegisterReply 处理子设备动态注册回复 request: /sys/{productKey}/{deviceName}/thing/sub/register response: /sys/{productKey}/{deviceName}/thing/sub/register_reply subscribe: /sys/{productKey}/{deviceName}/thing/sub/register_reply
func ProcThingTopoAddNotify ¶
ProcThingTopoAddNotify 通知网关添加设备拓扑关系 request: /sys/{productKey}/{deviceName}/thing/topo/add/notify response: /sys/{productKey}/{deviceName}/thing/topo/add/notify_reply subscribe: /sys/{productKey}/{deviceName}/thing/topo/add/notify
func ProcThingTopoAddReply ¶
ProcThingTopoAddReply 处理网络拓扑添加 request: /sys/{productKey}/{deviceName}/thing/topo/add response: /sys/{productKey}/{deviceName}/thing/topo/add_reply subscribe: /sys/{productKey}/{deviceName}/thing/topo/add_reply
func ProcThingTopoChange ¶
ProcThingTopoChange 通知网关拓扑关系变化 request: /sys/{productKey}/{deviceName}/thing/topo/change response: /sys/{productKey}/{deviceName}/thing/topo/change_reply subscribe: /sys/{productKey}/{deviceName}/thing/topo/change
func ProcThingTopoDeleteReply ¶
ProcThingTopoDeleteReply 处理删除网络拓扑 request: /sys/{productKey}/{deviceName}/thing/topo/delete response: /sys/{productKey}/{deviceName}/thing/topo/delete_reply subscribe: /sys/{productKey}/{deviceName}/thing/topo/delete_reply
func ProcThingTopoGetReply ¶
ProcThingTopoGetReply 处理获取该网关和子设备的拓扑关系 request: /sys/{productKey}/{deviceName}/thing/topo/get response: /sys/{productKey}/{deviceName}/thing/topo/get_reply subscribe: /sys/{productKey}/{deviceName}/thing/topo/get_reply
Types ¶
type Callback ¶
type Callback interface { // 透传应答 ThingModelUpRawReply(c *Client, productKey, deviceName string, payload []byte) error // 透传请求,需要用户自己处理及应答 ThingModelDownRaw(c *Client, productKey, deviceName string, payload []byte) error // event ThingEventPropertyPostReply(c *Client, err error, productKey, deviceName string) error ThingEventPostReply(c *Client, err error, eventID, productKey, deviceName string) error ThingEventPropertyPackPostReply(c *Client, err error, productKey, deviceName string) error ThingEventPropertyHistoryPostReply(c *Client, err error, productKey, deviceName string) error // device info ThingDeviceInfoUpdateReply(c *Client, err error, productKey, deviceName string) error ThingDeviceInfoDeleteReply(c *Client, err error, productKey, deviceName string) error // desired property ThingDesiredPropertyGetReply(c *Client, err error, productKey, deviceName string, data json.RawMessage) error ThingDesiredPropertyDeleteReply(c *Client, err error, productKey, deviceName string) error // template ThingDsltemplateGetReply(c *Client, err error, productKey, deviceName string, data json.RawMessage) error ThingDynamictslGetReply(c *Client, err error, productKey, deviceName string, data json.RawMessage) error // config ThingConfigGetReply(c *Client, err error, productKey, deviceName string, data ConfigParamsData) error // 配置推送,已做默认回复 ThingConfigPush(c *Client, productKey, deviceName string, params ConfigParamsData) error // Log ThingConfigLogGetReply(c *Client, err error, productKey, deviceName string, data ConfigLogParamData) error ThingConfigLogPush(c *Client, productKey, deviceName string, param ConfigLogParamData) error ThingLogPostReply(c *Client, err error, productKey, deviceName string) error // diag ThingDialPostReply(c *Client, err error, productKey, deviceName string) error // service // 设置设备属性, 需用户自行做回复 ThingServicePropertySet(c *Client, productKey, deviceName string, payload []byte) error // 设备服务调用,需用户自行做回复 ThingServiceRequest(c *Client, srvID, productKey, deviceName string, payload []byte) error // ntp ExtNtpResponse(c *Client, productKey, deviceName string, exact time.Time) error // 系统RRPC调用, 仅支持设备端Qos = 0的回复,需用户自行做回复 RRPCRequest(c *Client, messageID, productKey, deviceName string, payload []byte) error // 自定义RRPC调用,仅支持设备端Qos = 0的回复, 需用户自行做回复 ExtRRPCRequest(c *Client, messageID, topic string, payload []byte) error // ota OtaUpgrade(c *Client, productKey, deviceName string, rsp *OtaFirmwareResponse) error ThingOtaFirmwareGetReply(c *Client, productKey, deviceName string, data OtaFirmwareData) error }
Callback 事件回调接口
type Client ¶
Client 客户端
func (*Client) AddSubDevice ¶
AddSubDevice 增加一个一个子设备
func (*Client) ExtNtpRequest ¶
ExtNtpRequest ntp请求 发送一条Qos = 0的消息,并带上设备当前的时间戳,平台将回复 设备的发送时间,平台的接收时间, 平台的发送时间. 设备计算当前精确时间 = (平台接收时间 + 平台发送时间 + 设备接收时间 - 设备发送时间) / 2 请求Topic:/ext/ntp/${YourProductKey}/${YourDeviceName}/request 响应Topic:/ext/ntp/${YourProductKey}/${YourDeviceName}/response
func (*Client) ExtRRPCResponse ¶
ExtRRPCResponse ext rrpc回复 NOTE: 只支持Qos=0回复 response: /ext/rrpc/${messageId}/${topic} see https://help.aliyun.com/document_detail/90570.html?spm=a2c4g.11186623.6.656.64076175n5VFHO#title-0r5-s8c-t1c
func (*Client) LinkExtCombineBatchLogin ¶
func (sf *Client) LinkExtCombineBatchLogin(pairs []CombinePair, timeout time.Duration) error
LinkExtCombineBatchLogin 子设备批量上线,同步
func (*Client) LinkExtCombineBatchLogout ¶
LinkExtCombineBatchLogout 子设备批量下线,同步
func (*Client) LinkExtCombineLogin ¶
func (sf *Client) LinkExtCombineLogin(cp CombinePair, timeout time.Duration) error
LinkExtCombineLogin 子设备上线,同步
func (*Client) LinkExtCombineLogout ¶
LinkExtCombineLogout 子设备下线,同步
func (*Client) LinkThingConfigGet ¶
func (sf *Client) LinkThingConfigGet(pk, dn string, timeout time.Duration) (ConfigParamsData, error)
LinkThingConfigGet 获取配置参数,同步
func (*Client) LinkThingConfigLogGet ¶
func (sf *Client) LinkThingConfigLogGet(pk, dn string, clp ConfigLogParam, timeout time.Duration) (ConfigLogParamData, error)
LinkThingConfigLogGet 获取日志配置,同步
func (*Client) LinkThingDesiredPropertyDelete ¶
func (sf *Client) LinkThingDesiredPropertyDelete(pk, dn string, params interface{}, timeout time.Duration) error
LinkThingDesiredPropertyDelete 清空期望属性值,同步
func (*Client) LinkThingDesiredPropertyGet ¶
func (sf *Client) LinkThingDesiredPropertyGet(pk, dn string, params []string, timeout time.Duration) (json.RawMessage, error)
LinkThingDesiredPropertyGet 获取期望属性值,同步
func (*Client) LinkThingDeviceInfoDelete ¶
func (sf *Client) LinkThingDeviceInfoDelete(pk, dn string, params []DeviceLabelKey, timeout time.Duration) error
LinkThingDeviceInfoDelete 删除标签信息.同步
func (*Client) LinkThingDeviceInfoUpdate ¶
func (sf *Client) LinkThingDeviceInfoUpdate(pk, dn string, params []DeviceInfoLabel, timeout time.Duration) error
LinkThingDeviceInfoUpdate 设备信息上传(如厂商,设备型号等,可以保存为设备标签),同步
func (*Client) LinkThingDiagHistoryPost ¶
LinkThingDiagHistoryPost 设备主动上报历史网络状态,同步
func (*Client) LinkThingDiagPost ¶
LinkThingDiagPost 设备主动上报当前网络状态,同步
func (*Client) LinkThingDsltemplateGet ¶
func (sf *Client) LinkThingDsltemplateGet(pk, dn string, timeout time.Duration) (json.RawMessage, error)
LinkThingDsltemplateGet 设备可以通过上行请求获取设备的TSL模板(包含属性、服务和事件的定义),同步
func (*Client) LinkThingDynamictslGet ¶
func (sf *Client) LinkThingDynamictslGet(pk, dn string, timeout time.Duration) (json.RawMessage, error)
LinkThingDynamictslGet 获取动态tsl,同步
func (*Client) LinkThingEventPost ¶
func (sf *Client) LinkThingEventPost(pk, dn, eventID string, params interface{}, timeout time.Duration) error
LinkThingEventPost 设备事件上报,同步
func (*Client) LinkThingEventPropertyHistoryPost ¶
func (sf *Client) LinkThingEventPropertyHistoryPost(params interface{}, timeout time.Duration) error
LinkThingEventPropertyHistoryPost 物模型历史数据上报,同步
func (*Client) LinkThingEventPropertyPackPost ¶
LinkThingEventPropertyPackPost 网关批量上报数据,同步
func (*Client) LinkThingEventPropertyPost ¶
func (sf *Client) LinkThingEventPropertyPost(pk, dn string, params interface{}, timeout time.Duration) error
LinkThingEventPropertyPost 设备上报属性数据,同步
func (*Client) LinkThingListFound ¶
LinkThingListFound 发现设备列表上报,同步
func (*Client) LinkThingLogPost ¶
LinkThingLogPost 设备上报日志内容,同步
func (*Client) LinkThingOtaFirmwareGet ¶
func (sf *Client) LinkThingOtaFirmwareGet(pk, dn string, param OtaFirmwareParam, timeout time.Duration) (OtaFirmwareData, error)
LinkThingOtaFirmwareGet 请求固件信息,同步
func (*Client) LinkThingSubRegister ¶
func (sf *Client) LinkThingSubRegister(pk, dn string, timeout time.Duration) ([]SubRegisterData, error)
LinkThingSubRegister 同步子设备注册,
func (*Client) LinkThingTopoAdd ¶
LinkThingTopoAdd 添加设备拓扑关系,同步
func (*Client) LinkThingTopoDelete ¶
LinkThingTopoDelete 删除网关与子设备的拓扑关系
func (*Client) LinkThingTopoGet ¶
LinkThingTopoGet 获取该网关和子设备的拓扑关系,同步
func (*Client) OtaInform ¶
func (sf *Client) OtaInform(pk, dn string, params OtaInformParams) error
OtaInform 上报固件版本 request:/ota/device/inform/${YourProductKey}/${YourDeviceName}。
func (*Client) OtaProgress ¶
func (sf *Client) OtaProgress(pk, dn string, params OtaProgressParams) error
OtaProgress 固件升级过程中,设备可以通过这个Topic上报固件升级的进度百分比 request:/ota/device/progress/${YourProductKey}/${YourDeviceName
func (*Client) RRPCResponse ¶
RRPCResponse rrcpc 回复 response: /sys/${YourProductKey}/${YourDeviceName}/rrpc/response/${messageId}
func (*Client) Request ¶
Request 发送请求,API内部已实现json序列化 _uri 唯一定位服务器或(topic) requestID: 请求ID method: 方法 params: 消息体Request的params
func (*Client) SendRequest ¶
SendRequest 发送请求,API内部已实现json序列化,requestID内部生成 _uri 唯一定位服务器或(topic) method: 方法 params: 消息体Request的params
func (*Client) SubDeviceConnect ¶
SubDeviceConnect 子设备连接注册并添加到网关拓扑关系 子设备上线流程: (确保网关已接入物联网平台)
- 子设备发起动态注册,返回成功注册的子设备的设备证书(当平台使能动态注册子设备时)
- 子设备身份注册后,通过网关向平台上报网关与子设备的拓扑关系
- 子设备进行上线(此时平台会校验子设备的身份和与网关的拓扑关系。所有校验通过,才会建立并绑定子设备逻辑通道至网关物理通道上)
- 子设备与物联网平台的数据上下行通信与直连设备的通信协议一致,协议上不需要露出网关信息
- 删除拓扑关系后,子设备不能再通过网关上线
func (*Client) SubscribeAllTopic ¶
SubscribeAllTopic 对某个设备类型订阅相关所有主题
func (*Client) ThingConfigGet ¶
ThingConfigGet 获取配置参数 request: /sys/{productKey}/{deviceName}/thing/config/get response: /sys/{productKey}/{deviceName}/thing/config/get_reply
func (*Client) ThingConfigLogGet ¶
func (sf *Client) ThingConfigLogGet(pk, dn string, _ ConfigLogParam) (*Token, error)
ThingConfigLogGet 获取日志配置 request: /sys/${productKey}/${deviceName}/thing/config/Log/get response:/sys/${productKey}/${deviceName}/thing/config/Log/get_reply
func (*Client) ThingDesiredPropertyDelete ¶
ThingDesiredPropertyDelete 清空期望属性值 request: /sys/{productKey}/{deviceName}/thing/property/desired/delete response: /sys/{productKey}/{deviceName}/thing/property/desired/delete_reply
func (*Client) ThingDesiredPropertyGet ¶
ThingDesiredPropertyGet 获取期望属性值 request: /sys/{productKey}/{deviceName}/thing/property/desired/get response: /sys/{productKey}/{deviceName}/thing/property/desired/get_reply
func (*Client) ThingDeviceInfoDelete ¶
func (sf *Client) ThingDeviceInfoDelete(pk, dn string, params []DeviceLabelKey) (*Token, error)
ThingDeviceInfoDelete 删除标签信息 request: /sys/{productKey}/{deviceName}/thing/deviceinfo/delete response: /sys/{productKey}/{deviceName}/thing/deviceinfo/delete_reply
func (*Client) ThingDeviceInfoUpdate ¶
func (sf *Client) ThingDeviceInfoUpdate(pk, dn string, params []DeviceInfoLabel) (*Token, error)
ThingDeviceInfoUpdate 设备信息上传(如厂商、设备型号等,可以保存为设备标签) request: /sys/{productKey}/{deviceName}/thing/deviceinfo/update response: /sys/{productKey}/{deviceName}/thing/deviceinfo/update_reply
func (*Client) ThingDiagHistoryPost ¶
ThingDiagHistoryPost 设备主动上报历史网络状态
func (*Client) ThingDiagPost ¶
ThingDiagPost 设备主动上报当前网络状态 request: /sys/{productKey}/{deviceName}/_thing/diag/post response: /sys/{productKey}/{deviceName}/_thing/diag/post_reply
func (*Client) ThingDsltemplateGet ¶
ThingDsltemplateGet 设备可以通过上行请求获取设备的TSL模板(包含属性、服务和事件的定义) see https://help.aliyun.com/document_detail/89305.html?spm=a2c4g.11186623.6.672.5d3d70374hpPcx request: /sys/{productKey}/{deviceName}/thing/dsltemplate/get response: /sys/{productKey}/{deviceName}/thing/dsltemplate/get_reply
func (*Client) ThingDynamictslGet ¶
ThingDynamictslGet 获取动态tsl
func (*Client) ThingEventPost ¶
ThingEventPost 设备事件上报 request: /sys/{productKey}/{deviceName}/thing/event/{tsl.event.identifier}/post response: /sys/{productKey}/{deviceName}/thing/event/{tsl.event.identifier}/post_reply
func (*Client) ThingEventPropertyHistoryPost ¶
ThingEventPropertyHistoryPost 物模型历史数据上报 直连设备仅能上报自己的物模型历史数据,网关设备可以上报其子设备的物模型历史数据 request: /sys/{productKey}/{deviceName}/thing/event/property/history/post response:/sys/{productKey}/{deviceName}/thing/event/property/history/post_reply
func (*Client) ThingEventPropertyPackPost ¶
ThingEventPropertyPackPost 网关批量上报数据 NOTE: 仅网关支持,一次最多200个属性,20个事件,一次最多为20个子设备上报数据 request: /sys/{productKey}/{deviceName}/thing/event/property/pack/post response: /sys/{productKey}/{deviceName}/thing/event/property/pack/post_reply
func (*Client) ThingEventPropertyPost ¶
ThingEventPropertyPost 设备上报属性数据 request: /sys/{productKey}/{deviceName}/thing/event/property/post response: /sys/{productKey}/{deviceName}/thing/event/property/post_reply
func (*Client) ThingListFound ¶
ThingListFound 发现设备列表上报 场景,网关可以发现新接入的子设备,发现后,需将新接入的子设备的信息上报云端, 然后转到第三方应用,选择哪些子设备可以接入该网关 request: /sys/{productKey}/{deviceName}/thing/list/found response:/sys/{productKey}/{deviceName}/thing/list/found_reply
func (*Client) ThingLogPost ¶
ThingLogPost 设备上报日志内容 request: /sys/${productKey}/${deviceName}/thing/config/Log/post response:/sys/${productKey}/${deviceName}/thing/config/Log/post_reply
func (*Client) ThingModelUpRaw ¶
ThingModelUpRaw 上传透传数据 request: /sys/{productKey}/{deviceName}/thing/model/up_raw response: /sys/{productKey}/{deviceName}/thing/model/up_raw_reply
func (*Client) ThingOtaFirmwareGet ¶
func (sf *Client) ThingOtaFirmwareGet(pk, dn string, param OtaFirmwareParam) (*Token, error)
ThingOtaFirmwareGet 请求固件信息 module: 不指定则表示请求默认(default)模块的固件信息 request: /sys/{productKey}/{deviceName}/thing/ota/firmware/get response:/sys/{productKey}/{deviceName}/thing/ota/firmware/get_reply
func (*Client) ThingTopoGet ¶
ThingTopoGet 获取该网关和子设备的拓扑关系 request: /sys/{productKey}/{deviceName}/thing/topo/get response: /sys/{productKey}/{deviceName}/thing/topo/get_reply
func (*Client) URIGateway ¶
URIGateway 获得本设备网关URI
type CombineBatchLoginParams ¶
type CombineBatchLoginParams struct {
DeviceList []CombineLoginParams `json:"deviceList"`
}
CombineBatchLoginParams 子设备上线请求参数域
type CombineBatchLoginResponse ¶
type CombineBatchLoginResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data []infra.MetaPair `json:"data"` Message string `json:"message,omitempty"` }
CombineBatchLoginResponse 子设备批量上线回复
type CombineBatchLogoutResponse ¶
type CombineBatchLogoutResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data []infra.MetaPair `json:"data"` Message string `json:"message,omitempty"` }
CombineBatchLogoutResponse 子设备批量下线回复
type CombineLoginParams ¶
type CombineLoginParams struct { ProductKey string `json:"productKey"` // 子设备的产品key DeviceName string `json:"deviceName"` // 子设备的设备名称 ClientID string `json:"clientId"` // 设备端标识 Timestamp int64 `json:"timestamp,string"` // 时间戳,单位ms SignMethod string `json:"signMethod"` // 签名方法,支持hmacSha1、hmacSha256、hmacMd5和Sha256。 Sign string `json:"sign"` // 如果取值是true,则清理所有子设备离线时的消息,即所有未接收的QoS1消息将被清除。 // 如果取值是false,则不清理子设备离线时的消息 CleanSession bool `json:"cleanSession,string"` }
CombineLoginParams 子设备上线参数域
type CombineLoginResponse ¶
type CombineLoginResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data infra.MetaPair `json:"data"` Message string `json:"message,omitempty"` }
CombineLoginResponse 子设备上线回复
type CombineLogoutResponse ¶
type CombineLogoutResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data infra.MetaPair `json:"data"` Message string `json:"message,omitempty"` }
CombineLogoutResponse 子设备上线回复
type CombinePair ¶
CombinePair combine pair
type ConfigGetParams ¶
type ConfigGetParams struct { ConfigScope string `json:"configScope"` // 配置范围, 目前只支持产品维度配置. 取值: product GetType string `json:"getType"` // 获取配置类型. 目前支持文件类型,取值: file }
ConfigGetParams 获取配置的参数域
type ConfigGetResponse ¶
type ConfigGetResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data ConfigParamsData `json:"data"` Message string `json:"message,omitempty"` }
ConfigGetResponse 配置获取的回复
type ConfigLogMode ¶
type ConfigLogMode struct {
Mode int `json:"mode"` // 0 表示不上报, 1 表示上报
}
ConfigLogMode 日志配置的日志上报模式
type ConfigLogParam ¶
type ConfigLogParam struct { // 配置范围,目前日志只有设备维度配置,默认为device ConfigScope string `json:"configScope"` // 获取内容类型,默认为content.因日志配置内容较少,默认直接返回内容 GetType string `json:"getType"` }
ConfigLogParam 设备获取日志配置参数域
type ConfigLogParamData ¶
type ConfigLogParamData struct { GetType string `json:"getType"` Content ConfigLogMode `json:"content"` }
ConfigLogParamData 日志配置的参数域或配置域
type ConfigLogPush ¶
type ConfigLogPush struct { ID uint `json:"id,string"` Version string `json:"version"` Params ConfigLogParamData `json:"params"` }
ConfigLogPush 日志配置推送
type ConfigLogResponse ¶
type ConfigLogResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data ConfigLogParamData `json:"data"` Message string `json:"message,omitempty"` }
ConfigLogResponse 日志配置回复
type ConfigParamsData ¶
type ConfigParamsData struct { ConfigID string `json:"configId"` // 配置文件的ID ConfigSize int64 `json:"configSize"` // 配置文件大小,按字节计算 Sign string `json:"sign"` // 签名 SignMethod string `json:"signMethod"` // 签名方法,仅支持Sha256 URL string `json:"url"` // 存储配置文件的对象存储(OSS)地址 GetType string `json:"getType"` // 同ConfigGetParams.GetType }
ConfigParamsData 配置获取回复数据域或配置推送参数域
type ConfigPushRequest ¶
type ConfigPushRequest struct { ID uint `json:"id,string"` Version string `json:"version"` Params ConfigParamsData `json:"params"` Method string `json:"method"` }
ConfigPushRequest 配置推送的请求
type Conn ¶
type Conn interface { // Publish will publish a Message with the specified QoS and content Publish(topic string, qos byte, payload interface{}) error Subscribe(topic string, callback ProcDownStream) error UnSubscribe(topic ...string) error io.Closer }
Conn conn接口
type DevMgr ¶
type DevMgr struct {
// contains filtered or unexported fields
}
DevMgr 设备管理
func (*DevMgr) DeviceAvail ¶
DeviceAvail 获取avail
func (*DevMgr) DeviceSecret ¶
DeviceSecret 设备DeviceSecret
func (*DevMgr) DeviceStatus ¶
DeviceStatus 获取设备的状态
func (*DevMgr) SearchAvail ¶
SearchAvail 使用productKey deviceName查找一个设备节点信息且avail = true 如果设备avail=false返回ErrNotAvail
func (*DevMgr) SetDeviceAvail ¶
SetDeviceAvail 设置avail
func (*DevMgr) SetDeviceSecret ¶
SetDeviceSecret 设置设备的密钥
type DevStatus ¶
type DevStatus byte
DevStatus 设备状态
const ( DevStatusAuthorized // Receive Topo Add Notify DevStatusRegistered // Receive Subdev Registered DevStatusAttached // Receive Subdev Topo Add Reply DevStatusLogined // Receive Subdev Login Reply DevStatusOnline // After All Topic Subscribed )
设备状态
type DeviceInfoLabel ¶
DeviceInfoLabel 更新设备标签的键值对
type DeviceLabelKey ¶
type DeviceLabelKey struct {
AttrKey string `json:"attrKey"`
}
DeviceLabelKey 删除设备标答的键
type DiagParam ¶
type DiagParam struct { P interface{} `json:"p"` // format:数据格式.仅支持simple,表示数据为精简格式。 // quantity:数量。取值: // single:表示上报单条数据。 // batch:表示上报多条数据,仅用于上报历史数据。 // time:时间.取值: // now: 表示上报当前数据。 // history: 表示上报历史数据 Model string `json:"model"` }
DiagParam diag参数域
type DiagRequest ¶
type DiagRequest struct { ID uint `json:"id,string"` Version string `json:"version"` Params DiagParam `json:"params"` }
DiagRequest 设备主动上报网络状态请求
type ExtErrorResponse ¶
type ExtErrorResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data infra.MetaPair `json:"data"` Message string `json:"message,omitempty"` }
ExtErrorResponse 子设备错误回复
type GwCallback ¶
type GwCallback interface { // 520错误已做自动登陆回复 ExtErrorResponse(c *Client, err error, productKey, deviceName string) error ThingTopoGetReply(c *Client, err error, params []infra.MetaPair) error ThingListFoundReply(c *Client, err error) error ThingTopoAddNotify(c *Client, params []infra.MetaPair) error ThingTopoChange(c *Client, params TopoChangeParams) error ThingDisable(c *Client, productKey, deviceName string) error ThingEnable(c *Client, productKey, deviceName string) error ThingDelete(c *Client, productKey, deviceName string) error }
GwCallback 网关事件接口
type LogParam ¶
type LogParam struct { // 日志的采集时间,为设备本地UTC时间, // 包含时区信息,以毫秒计,格式为 yyyy-MM-dd'T'HH:mm:ss.SSSZ UtcTime string `json:"utcTime"` // FATAL,ERROR,WARN,INFO,DEBUG LogLevel string `json:"logLevel"` // 当设备端使用Android SDK时,模块名称为ALK-LK. // 当设备端使用C SDK时,需自定义模块名称. // 当设备端使用自行开发的SDK时,需自定义模块名称 Module string `json:"module"` // 当设备端使用Android SDK时,请参见Android SDK错误码. // 当设备端使用C SDK时,请参见C SDK状态码. // 当设备端使用自行开发的SDK时,可以自定义结果状态码,也可以为空. Code string `json:"code"` // 可选参数,上下文跟踪内容,设备端使用Alink协议消息的id,App端使用TraceId(追踪ID) TraceContext string `json:"traceContext,omitempty"` // 日志详细内容 LogContent string `json:"logContent"` }
LogParam 日志内容参数域
type MQTTClient ¶
type MQTTClient struct { *Client // contains filtered or unexported fields }
MQTTClient MQTT客户端
func NewWithMQTT ¶
NewWithMQTT 新建MQTTClient
func (*MQTTClient) Publish ¶
func (sf *MQTTClient) Publish(topic string, qos byte, payload interface{}) error
Publish 实现dm.Conn接口
func (*MQTTClient) Subscribe ¶
func (sf *MQTTClient) Subscribe(topic string, streamFunc ProcDownStream) error
Subscribe 实现dm.Conn接口
func (*MQTTClient) UnSubscribe ¶
func (sf *MQTTClient) UnSubscribe(topic ...string) error
UnSubscribe 实现dm.Conn接口
func (*MQTTClient) Underlying ¶
func (sf *MQTTClient) Underlying() mqtt.Client
Underlying 获得底层的Client
type Message ¶
type Message struct { ID uint Data interface{} // contains filtered or unexported fields }
Message 回复的消息
type NopCb ¶
type NopCb struct{}
NopCb 实现Callback接口的空实现
func (NopCb) ExtNtpResponse ¶
ExtNtpResponse see interface Callback
func (NopCb) ExtRRPCRequest ¶
ExtRRPCRequest see interface Callback
func (NopCb) OtaUpgrade ¶
OtaUpgrade see interface Callback
func (NopCb) RRPCRequest ¶
RRPCRequest see interface Callback
func (NopCb) ThingConfigGetReply ¶
ThingConfigGetReply see interface Callback
func (NopCb) ThingConfigLogGetReply ¶
ThingConfigLogGetReply see interface Callback
func (NopCb) ThingConfigLogPush ¶
ThingConfigLogPush see interface Callback
func (NopCb) ThingConfigPush ¶
ThingConfigPush see interface Callback
func (NopCb) ThingDesiredPropertyDeleteReply ¶
ThingDesiredPropertyDeleteReply see interface Callback
func (NopCb) ThingDesiredPropertyGetReply ¶
ThingDesiredPropertyGetReply see interface Callback
func (NopCb) ThingDeviceInfoDeleteReply ¶
ThingDeviceInfoDeleteReply see interface Callback
func (NopCb) ThingDeviceInfoUpdateReply ¶
ThingDeviceInfoUpdateReply see interface Callback
func (NopCb) ThingDialPostReply ¶
ThingDialPostReply see interface Callback
func (NopCb) ThingDsltemplateGetReply ¶
ThingDsltemplateGetReply see interface Callback
func (NopCb) ThingDynamictslGetReply ¶
ThingDynamictslGetReply see interface Callback
func (NopCb) ThingEventPostReply ¶
ThingEventPostReply see interface Callback
func (NopCb) ThingEventPropertyHistoryPostReply ¶
ThingEventPropertyHistoryPostReply see interface Callback
func (NopCb) ThingEventPropertyPackPostReply ¶
ThingEventPropertyPackPostReply see interface Callback
func (NopCb) ThingEventPropertyPostReply ¶
ThingEventPropertyPostReply see interface Callback
func (NopCb) ThingLogPostReply ¶
ThingLogPostReply see interface Callback
func (NopCb) ThingModelDownRaw ¶
ThingModelDownRaw see interface Callback
func (NopCb) ThingModelUpRawReply ¶
ThingModelUpRawReply see interface Callback
func (NopCb) ThingOtaFirmwareGetReply ¶
ThingOtaFirmwareGetReply see interface Callback
func (NopCb) ThingServicePropertySet ¶
ThingServicePropertySet see interface Callback
type NopGwCb ¶
type NopGwCb struct{}
NopGwCb 实现EventGwProc接口的空实现
func (NopGwCb) ExtErrorResponse ¶
ExtErrorResponse see interface GwCallback
func (NopGwCb) ThingDelete ¶
ThingDelete see interface GwCallback
func (NopGwCb) ThingDisable ¶
ThingDisable see interface GwCallback
func (NopGwCb) ThingEnable ¶
ThingEnable see interface GwCallback
func (NopGwCb) ThingListFoundReply ¶
ThingListFoundReply see interface GwCallback
func (NopGwCb) ThingTopoAddNotify ¶
ThingTopoAddNotify see interface GwCallback
func (NopGwCb) ThingTopoChange ¶
func (NopGwCb) ThingTopoChange(*Client, TopoChangeParams) error
ThingTopoChange see interface GwCallback
type NtpRequest ¶
type NtpRequest struct {
DeviceSendTime int64 `json:"deviceSendTime,string"`
}
NtpRequest ntp请求payload
type NtpResponse ¶
type NtpResponse struct { DeviceSendTime int64 `json:"deviceSendTime,string"` // 设备发送时间,单位ms ServerRecvTime int64 `json:"serverRecvTime,string"` // 平台接收时间,单位ms ServerSendTime int64 `json:"serverSendTime,string"` // 平台发送时间,单位ms }
NtpResponse ntp回复payload
type OtaFirmwareData ¶
type OtaFirmwareData struct { Size int64 `json:"size"` Sign string `json:"sign"` Version string `json:"version"` IsDiff int `json:"isDiff"` URL string `json:"url"` SignMethod string `json:"signMethod"` MD5 string `json:"md5"` Module string `json:"module"` }
OtaFirmwareData 请求固件信息回复数据域
type OtaFirmwareParam ¶
type OtaFirmwareParam struct {
Module string `json:"module"`
}
OtaFirmwareParam 请求固件信息参数域
type OtaFirmwareResponse ¶
type OtaFirmwareResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data OtaFirmwareData `json:"data"` Message string `json:"message"` }
OtaFirmwareResponse ota firmware response
type OtaInformParams ¶
type OtaInformParams struct { Version string `json:"version"` // 上报默认(default)模块的固件版本号时,可以不上报module参数. // 设备的默认(default)模块的固件版本号等同于整个设备的固件版本号. Module string `json:"module"` }
OtaInformParams OTA固件参数域
type OtaProgressParams ¶
type OtaProgressParams struct { Step int `json:"step,string"` // 固件升级进度信息 [1,100] 之间的数字:表示升级进度百分比,其它见上 Desc string `json:"desc"` Module string `json:"module"` }
OtaProgressParams 下载过程上报参数域
type OtaRequest ¶
type OtaRequest struct { ID uint `json:"id,string"` Params interface{} `json:"params"` }
OtaRequest OTA请求体
type P ¶
type P struct { Wifi Wifi `json:"wifi"` // 设备的连网方式为Wi-Fi,该参数值由网络状态的四个指标组成 Time int64 `json:"_time"` // 时间戳可以为空,当为空时,控制台上设备网络状态不展现采集时间,单位ms }
P 包含wifi状态和时间戳
type ProcDownStream ¶
ProcDownStream 处理下行数据
type Request ¶
type Request struct { ID uint `json:"id,string"` Version string `json:"version"` Params interface{} `json:"params"` Method string `json:"method"` }
Request 请求
type Response ¶
type Response struct { ID uint `json:"id,string"` Code int `json:"code"` Data interface{} `json:"data"` Message string `json:"message,omitempty"` }
Response 应答
type ResponseRawData ¶
type ResponseRawData struct { ID uint `json:"id,string"` Code int `json:"code"` Data json.RawMessage `json:"data"` Message string `json:"message,omitempty"` }
ResponseRawData 应答, data域为 json.RawMessage
type SubRegisterData ¶
type SubRegisterData struct { IotID string `json:"iotId"` ProductKey string `json:"productKey"` DeviceName string `json:"deviceName"` DeviceSecret string `json:"deviceSecret"` }
SubRegisterData 子设备注册应答数据域
type SubRegisterResponse ¶
type SubRegisterResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data []SubRegisterData `json:"data"` Message string `json:"message,omitempty"` }
SubRegisterResponse 子设备注册应答
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token defines the interface for the tokens used to indicate when actions have completed.
type TopoAddNotifyRequest ¶
type TopoAddNotifyRequest struct { ID uint `json:"id,string"` Version string `json:"version"` Params []infra.MetaPair `json:"params"` Method string `json:"method"` }
TopoAddNotifyRequest 添加设备拓扑关系通知请求
type TopoAddParams ¶
type TopoAddParams struct { ProductKey string `json:"productKey"` DeviceName string `json:"deviceName"` ClientID string `json:"clientId"` Timestamp int64 `json:"timestamp,string"` // 时间戳 SignMethod string `json:"signmethod"` // 支持hmacsha1、hmacsha256、hmacmd5、sha256(not used) Sign string `json:"sign"` }
TopoAddParams 添加设备拓扑关系参数域
type TopoAddResponse ¶
type TopoAddResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data []infra.MetaPair `json:"Data"` Message string `json:"message,omitempty"` }
TopoAddResponse 添加网络拓扑应答
type TopoChangeParams ¶
type TopoChangeParams struct { Status int `json:"status"` // 0: 创建 1:删除 2: 启用 8: 禁用 SubList []infra.MetaPair `json:"subList"` }
TopoChangeParams 网络拓扑关系变化请求参数域
type TopoChangeRequest ¶
type TopoChangeRequest struct { ID uint `json:"id,string"` Version string `json:"version"` Params TopoChangeParams `json:"params"` Method string `json:"method"` }
TopoChangeRequest 网络拓扑关系变化请求
type TopoDeleteResponse ¶
type TopoDeleteResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data []infra.MetaPair `json:"Data"` Message string `json:"message,omitempty"` }
TopoDeleteResponse 删除网络拓扑应答
type TopoGetResponse ¶
type TopoGetResponse struct { ID uint `json:"id,string"` Code int `json:"code"` Data []infra.MetaPair `json:"Data"` Message string `json:"message,omitempty"` }
TopoGetResponse 获取网关和子设备的拓扑关系应答
type Wifi ¶
type Wifi struct { Rssi int `json:"rssi"` // 无线信号接收强度 Snr int `json:"snr"` // 无线信号信噪比 Per int `json:"per"` // 数据丢包率 // 错误信息。仅当设备检测到网络异常后,上报数据包含该参数。 // 格式:"type,code,count;type,code,count" // type: 错误类型 // code: 错误原因 // count: 错误数量 // @see https://help.aliyun.com/document_detail/140585.html?spm=a2c4g.11186623.6.715.36f1791fcf3FJI#table-fvv-k8u-som ErrStats string `json:"err_stats"` }
Wifi wifi status
Source Files ¶
- api.go
- api_link.go
- api_option.go
- client.go
- client_mqtt.go
- error.go
- ext_error.go
- ext_ntp.go
- ext_ota.go
- ext_probe.go
- ext_rrpc.go
- ext_session_combine.go
- helper.go
- manager.go
- nop_callback.go
- sync.go
- thing.go
- thing_config.go
- thing_desired.go
- thing_diag.go
- thing_event.go
- thing_label.go
- thing_log.go
- thing_network.go
- thing_raw.go
- thing_service.go
- thing_sub_config.go
- thing_sub_manage.go
- thing_sub_register.go
- thing_template.go
Directories ¶
Path | Synopsis |
---|---|
_examples
|
|
Package ahttp 实现http client 上传数据.
|
Package ahttp 实现http client 上传数据. |
Package dataflow 阿里云iot服务器订阅数据流 Package dataflow 定义数据流转的数据格式 实现iot转发的解析以及相关 客户端将获得一个messageBody,解析到message, payload承载着真实的dataflow数据流 根据不同的主题,解析不同的payload,see https://help.aliyun.com/document_detail/73736.html?spm=a2c4g.11186623.6.630.1ce25a10TgnylI
|
Package dataflow 阿里云iot服务器订阅数据流 Package dataflow 定义数据流转的数据格式 实现iot转发的解析以及相关 客户端将获得一个messageBody,解析到message, payload承载着真实的dataflow数据流 根据不同的主题,解析不同的payload,see https://help.aliyun.com/document_detail/73736.html?spm=a2c4g.11186623.6.630.1ce25a10TgnylI |
Package dynamic 实现动态注册,只限直连设备动态注册,阿里云目前限制激活过的设备不可再注册
|
Package dynamic 实现动态注册,只限直连设备动态注册,阿里云目前限制激活过的设备不可再注册 |
Package sign 实现MQTT设备签名 see https://help.aliyun.com/document_detail/73742.html?spm=a2c4g.11186623.6.599.76216eebzbvrYq
|
Package sign 实现MQTT设备签名 see https://help.aliyun.com/document_detail/73742.html?spm=a2c4g.11186623.6.599.76216eebzbvrYq |