• 欢迎大家分享资料!前往留言板评论即可!

aliyun的topic说明

合宙 模组资料网 3年前 (2021-05-15) 629次浏览 0个评论 扫描二维码

说在前面,所有的topic都是需要配合物模型使用

https://help.aliyun.com/document_detail/73727.html?spm=a2c4g.11186623.6.566.727b77a1urids6

属性

aliyun的topic说明所有properties下面的都是属性,对应使用

/sys/a1PODPi5ohj/${deviceName}/thing/event/property/post

/sys/a1PODPi5ohj/${deviceName}/thing/service/property/set

aliyun的topic说明


事件

Events下面是事件,对应

/sys/a1HnMJCnqYK/{deviceName}/thing/event/{tsl.event.identifer}/post

 aliyun的topic说明${tsl.event.identifer}字段说明

事件都是上报,默认会添加属性上报的topic

thing.event.property.post

对应topic就是

/sys/a1HnMJCnqYK/${deviceName}/thing/event/property/post

其实也就是我们第一部分属性上报的topic

aliyun的topic说明

 aliyun的topic说明

自己添加的事件说明

事件标识对应identifier,我这里是shijian,上报的topic就是thing.event.shijian.post

/sys/a1HnMJCnqYK/${deviceName}/thing/event/shijian/post

 

服务

 aliyun的topic说明

Services下面是服务对应

/sys/a1PODPi5ohj/{deviceName}/thing/service/{tsl.event.identifer}

和事件相反,服务只能订阅

默认添加thing.service.property.set,和thing.service.property.get

/sys/a1PODPi5ohj/${deviceName}/thing/service/property/set

/sys/a1PODPi5ohj/${deviceName}/thing/service/property/get

可以看到其实还是第一部分的属性获取

第二个topic我没用过不知道干啥的,估计可以通过这个下发属性。

 aliyun的topic说明

aliyun的topic说明

自己添加服务说明,这里选用异步,同步需要rrpc

其实有了上面例子很好理解thing.service.fuwu,也就是

/sys/a1PODPi5ohj/${deviceName}/thing/service/fuwu

 

关于同步rrpc

https://help.aliyun.com/document_detail/90567.html?spm=a2c4g.11186623.6.624.217bf9bc6sgX4I

·        
RRPC请求消息Topic/sys/{YourProductKey}/{YourDeviceName}/rrpc/request/${messageId}

·        
RRPC响应消息Topic/sys/{YourProductKey}/{YourDeviceName}/rrpc/response/${messageId}

·        
RRPC订阅Topic/sys/{YourProductKey}/{YourDeviceName}/rrpc/request/+

关键点就是订阅那个通配符topic,因为每次messageId是不同的,也就是说每次都需要按照发过来的messageId重新组合topic

<

p class=”MsoNormal”> 


转载请注明原文链接:aliyun的topic说明
喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址