当前位置: 首页 > news >正文

网站做淘宝客还行吗网络舆情监控

网站做淘宝客还行吗,网络舆情监控,做写手一般上什么网站好,在哪里可以找到做网站的公司阿里云物联网通信的两种方式,一个是物模型(分为服务,事件,属性),一个是自定义topic(要另外设置数据流转) 1.使用产品内的功能定义,(其实也就是Topic中定义好的…

阿里云物联网通信的两种方式,一个是物模型(分为服务,事件,属性),一个是自定义topic(要另外设置数据流转)
1.使用产品内的功能定义,(其实也就是Topic中定义好的物模型主题),功能定义中有事件,属性,服务三种类型
在这里插入图片描述
进入产品的功能定义中,选择编辑草稿
在这里插入图片描述
添加自定义功能,
在这里插入图片描述
功能类型可以按照需求选择服务(调用比如开关灯,亮度调节等),属性(显示数据等),事件,其中标识符是代码识别此功能的重要标识,另外参数一定要与代码中调用的参数数据类型一致
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
一定要发布上线才有效
在这里插入图片描述
服务colorset和属性color调用的代码不同
首先小程序控制端,如果是通过按钮调用服务,使用aliSDK中的Action: “InvokeThingService”,完整函数代码如下
//发送信息给阿里云,页面设置了一个亮度调节器(进度条),绑定以下函数,data里面x初始值x:{‘light’:12},

changeDeviceLight: function (e) {var DeviceName = this.options.deviceNamevar that = thisconsole.log(`携带值为`, e.detail.value)console.log("x",typeof that.data.x) //x为对象格式objectthat.data.x.light=e.detail.value    //将x里的数值替换成当前调节器的值var str = JSON.stringify(that.data.x);    //将对象转换成字符串,//var Obj = JSON.parse(str);    如果需要字符串转换成对象console.log("str",typeof str)        //此处可以校验是否已是字符串console.log("str",str)console.log("lightvalue",that.data.x)//防止重复点击that.setData({buttonDisabled: true})aliSdk.request({Action: "InvokeThingService",//IotInstanceId:"iot-",//实例IDProductKey: app.globalData.productKey,DeviceName: DeviceName,Identifier: "light",//Args: "{'light':51}" //传送参数时,格式为{'Identifier':数值},传入格式必须有引号,也就是对象转换成字符串格式,数值也必须符合当时阿里云内设置的数据类型,无参数的时候传空 Args:”{}“Args: str   //此处获取的亮度值会被传给阿里云}, {method: "POST"},(res) => {console.log("success")console.log(res) //查看返回response数据that.setData({openedDevice: !that.data.openedDevice})},(res) => {console.log("fail")wx.showToast({title: '网络连接失败',icon: 'none',duration: 1000,complete: () => {}})},(res) => {console.log("complete")that.setData({buttonDisabled: false})})
},

阿里云收到消息转给esp8266,arduino串口监视器显示{“method”:“thing.service.light”,“id”:“173255894”,“params”:{“light”:114},“version”:“1.0.0”}
arduino端的代码将params里的light取出来

String method =jsonBuffer["method"];int key1 = jsonBuffer["params"]["light"];Serial.println("method");Serial.println(method);Serial.println(key1);

如果是调用属性,则使用Action: “SetDeviceProperty”

radioChangeColor: function (e) {var DeviceName = this.options.deviceNamevar that = thisconsole.log(e.detail.value)//防止重复点击that.setData({buttonDisabled: true})var str1 = "{\"color\":"str1 += "\""+e.detail.value+"\""//"\""+变量+"\""可以在双引号里调用变量,而不被识别成字符串str1 += "}"console.log('str1')  console.log(str1)  //str1此时为字符串{"color":"yellow"}console.log("str1",typeof str1) aliSdk.request({Action: "SetDeviceProperty",//IotInstanceId:"iot-",//实例IDProductKey: app.globalData.productKey,DeviceName: DeviceName,Identifier: "color",Items: '{"color":"red"}'//属性调用也可使用Items:str1,将str1传给阿里云}, {method: "POST"},(res) => {console.log("success")console.log(res) //查看返回response数据that.setData({openedDevice: !that.data.openedDevice})},(res) => {console.log("fail")wx.showToast({title: '网络连接失败',icon: 'none',duration: 1000,complete: () => {}})},(res) => {console.log("complete")that.setData({buttonDisabled: false})})
},

阿里云收到消息后转给esp8266,串口监视器显示{“method”:“thing.service.colorset”,“id”:“921010594”,“params”:{“colorset”:“green”},“version”:“1.0.0”}
arduino端的代码将params里的colorset取出来

String method =jsonBuffer["method"];String key1 = jsonBuffer["params"]["colorset"];Serial.println("method");Serial.println(method);Serial.println(key1);
http://www.yayakq.cn/news/131098/

相关文章:

  • 做网站一般要多钱wordpress小说网站
  • 怎么做网站的移动端适配版淘宝seo 优化软件
  • 网站做的相似电信服务器
  • 仁怀那里可以做网站年前做网站的好处
  • 企业创新平台建设网站优化排名推荐
  • 密云区免费网站建设网站推广免费渠道
  • 建站之星好不舟山建设信息港网站
  • 免费做网站刮刮卡杭州搜索引擎优化公司
  • 做网站的公司利润率是多少it外包项目都在哪接的
  • 个人网站备案怎么写公司网站打开显示建设中
  • 做网站要注意电子商务网站建设a卷
  • 中国建设监理协会化工监理分会网站wordpress 内容采集 差价
  • 网站管理助手数据库网站建设费属于宣传费
  • 论坛网站开发语言上海小程序服务商
  • 网站建设原码企业网站硬件设计
  • 杭州的网站建设公司有哪些做网站买空间
  • 农产品网站建设的主要工作京东页面网页设计与制作实训报告
  • 优设网站wordpress 导航栏顺序
  • 云工厂网站建设用做网站使用的图片
  • 宜宾移动网站建设wordpress火车头采集图片
  • 郑州o2o网站建设汉狮做电商平台网站
  • 营销型网站的页面层级发布信息的免费平台有哪些
  • 专业的网站开发建访大丰网店制作
  • 网站模板下载破解版重庆物流公司网站建设
  • 网站建设可视化工具wordpress用户注册中文不能
  • 南海网站设计html5响应式网站psd
  • 微信网站与响应式网站有哪些千度搜索引擎
  • 织梦手机网站图片家教网站代理
  • 一份完整的网站策划书wordpress 下载页
  • 郑州上街区网站建设公司网络服务相关资料