




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
版本信 前 總體介 代碼結(jié) 工作模 調(diào)試工 局域網(wǎng)功 通用功 獲取版本信 設(shè)置連接參 連接模式的切 局域網(wǎng)內(nèi)設(shè)備查 插 獲取插座狀 設(shè)置插座狀 獲取燈狀 設(shè)置燈狀 溫濕 廣域網(wǎng)功 espressif服務(wù)器平 激 認(rèn) 服務(wù) 插 溫濕 用戶自定義反向控 本文主要介紹基于EspressifIoTSDK的應(yīng)用開(kāi)發(fā),在該IoTDemo中,向控制以及數(shù)據(jù)。代碼結(jié) IoTDemouser_webserver.c——提供REST的輕量webserver功能;user_json.c——json包處理功能; includeuser_config.h文件,在該文件中可以對(duì)采用平臺(tái),以及具體demo進(jìn)行選擇,具體支持如下例子:LIGHT_DEVIC(SENSOR_DEVIC(;其中SENSOR_DEVICE又分為HUMITURE_SUB_DEVICE() 工作模IoTDemowifisoftAP+stationstation。出廠默sotfAP+stationsoftAPstationsleep)進(jìn)入station模式(指令詳見(jiàn)3.1.2設(shè)置連接參數(shù)。softAP的默認(rèn)為ESP_,其中為設(shè)備MAC地址的后面三個(gè)字節(jié),默認(rèn)加密模式為/2。服務(wù)用調(diào)試工可采用curl命令。的curl指令請(qǐng)參照“Windowscurl”的示例。CurlsoftAPip,stationipesp_iot_sdk\app\include\user_config.hPASSWORD,配置。例如,esp_iot_sdk_v.08定義宏P(guān)ASSWORD為“v*%W>L<@i&Nxe!”,某設(shè)備的softAPMAC地址為:1a:fe:86:90:d5:7b,則連接為:通用功{"Version":{"Version":curl-XGET"Device":"Device":"manufacture","manufacture","Espressif}}碼如前述PC側(cè)發(fā)送curl指令來(lái)控制設(shè)備。PC發(fā)送下述指令,將設(shè)備連入curlcurl-XPOST-H"Content-Type:application/json"-d'{"Request":{"Station":{" ":"tenda","password":"1234567890","token": Windowscurlcurl-XPOST-H"Content-Type:application/json"-d"{\"Request\":{\"Station\ ken\":\" Linux/Cygwincurlcurl-XPOST-HContent-Type:application/json-dken":Windowscurlcurl-XPOST-H"Content-Type:application/json"-d"{\"Request\":{\"Station\ 3536373839\",\"token\":\" 7890\"}}}}"h curl-XGET curl-XGET curlcurl-XPOST curlcurl-XPOST curlcurl-XPOST-H"Content-Type:application/json"-d Windowscurlcurl-XPOST-H"Content-Type:application/json"-d authmode支持如下模式:OPEN、 password長(zhǎng)度需不小于8個(gè)字符。(1)softAPstation(2)APP(或PC)連入ESP8266softAP下指令,讓ESP8266station連接路由。此時(shí)可以查詢station的連接狀態(tài)。softAPstation2由宏定義#defineAP_CACHE控制此功能開(kāi)關(guān)。局域網(wǎng)內(nèi)設(shè)備查1025UDP廣播包的方法進(jìn)行設(shè)備的查找,發(fā)送:I’m:燈:I’m::I’m:::
插curl-Xcurl-XGET {{{:}curlcurl-XPOST-H"Content-Type:application/json"-d' Windowscurlcurl-XPOST-H"Content-Type:application/json"-d":1}}" 燈curlcurl-XGET {{"rgb":{"red":"green":"blue":}}curlcurl-XPOST-H"Content-Type:application/json"-d200,"green":0,"blue":0}}' Windowscurlcurl-XPOST-H"Content-Type:application/json"-d"red\":200,\"green\":0,\"blue\":0}}" 溫濕espressif服務(wù)器平作及API介紹。PCespressifespressif服務(wù)器申請(qǐng)masterdevicekey,燒錄到spiflash0x3e000位置。Bin的燒寫順序:blank.bineagle.app.v6.flash.binmaster-device-key.bin時(shí),可以直接eagle.app.v6.flash.bin->eagle.app.v6.irom0text.bin。根據(jù)設(shè)置去連接路由,station接口連上路由后,會(huì)默認(rèn)向服務(wù)器激活設(shè)備。{"path":"/v1/device/activate/","method":"POST","meta":{"Authorization":"tokenHERE_IS_THE_MASTER_DEVICE_KEY"},"body":{"encrypt_method":"PLAIN","b":"18:fe:34:70:12:00","token":" 激活需要往espressif的服務(wù)器,ip地址為7,端口為{"path":"/v1/device/activate/","method":"POST","meta":{"Authorization":"tokenHERE_IS_THE_MASTER_DEVICE_KEY"},"body":{"encrypt_method":"PLAIN","b":"18:fe:34:70:12:00","token":" HERE_IS_THE_MASTER_DEVICE_KEYspiflashdevice78903.1.2{"status":200,"device":{"status":200,"device":{device},"key":{key},"token":PCPC側(cè)在配置完設(shè)備的、password及token后需要連接到一個(gè)可上的curlcurl-XPOST-H"Authorization:tokenc8922638bb6ec4c18fcf3e44ce9955f19fa3ba12"-d'{"token":" Windowscurlcurl-XPOST-H"Authorization:tokenc8922638bb6ec4c18fcf3e44ce9955f19fa3ba12"-d"{\"token\":\" 7890\"}"http://1{"status":{"status":200,"key":{"updated":"2014-05-1221:22:03","user_id":1,"product_id":0,"name":"deviceactivatesharetoken","created":"2014-05-1221:22:03","source_ip":"*","visibly":1,"id":149,"datastream_tmpl_id":0,"token":"e474bba4b8e11b97b91019e61b7a018cdbaa3246","access_methods":"*","is_owner_key":1,"scope":3,"device_id":29,"activate_status":1,"datastream_id":0,"expired_at":"2288-02-22c8922638bb6ec4c18fcf3e44ce9955f19fa3ba12為用戶的userkey舉例,實(shí)際需要用戶填入自己的userkey值,獲取方式如下:登陸Espressif服務(wù)器 /,用戶名登陸->右上角用戶名->設(shè)置->e474bba4b8e11b97b91019e61b7a018cdbaa3246ownerkey址為7,端口為8000,發(fā)送如下格式的的tcp包。{"nonce":{"nonce":560192812,"path":"/v1/device/identify","method":"GET",{"Authorization":"token這個(gè)tcp的包的作用是確認(rèn)設(shè)備自己的,每次設(shè)備重新連接服務(wù)器后的是設(shè)備的devicekey。{"device":{"productbatch_id":0,"last_active":"2014-06-1910:06:58","ptype":12335,"activate_status":1,"serial":"334a8481","id":130,"b ":"18:fe:34:97:d5:33","last_pull":"2014-06-1910:06:58",{"device":{"productbatch_id":0,"last_active":"2014-06-1910:06:58","ptype":12335,"activate_status":1,"serial":"334a8481","id":130,"b ":"18:fe:34:97:d5:33","last_pull":"2014-06-1910:06:58","last_push":"2014-06-1910:06:58","location":"","metadata":"18:fe:34:97:d5:33temperature","status":2,"updated":"2014-06-1910:06:58","description":"device-description-79eba060","activated_at":"2014-06-1910:06:58","visibly":1,"is_private":1,"product_id":1,"name":"device-me-79eba060","created":"2014-05-2817:43:29","is_frozen":0,"key_id":387},"nonce":560192812,"message":"deviceidentified","status":200}{"path": /","method":"POST","meta":{"Authorization":50s{"path": /","method":"POST","meta":{"Authorization":{"status":{"status":200,"message":":success","datetime":"2014-06-1909:32:28",{"body":{"body":{},"nonce":33377242,"is_query_device":true,"get":{},"token":"e474bba4b8e11b97b91019e61b7a018cdbaa3246","meta":{"Authorization":"tokene474bba4b8e11b97b91019e61b7a018cdbaa3246"},"path":"/v1/datastreams/plug-status/datapoint/","post":{},"method":{"status":{"status":200,"datapoint":{"x":0},"nonce":33377242,"is_query_device":{"body":{"datapoint":{"x":{"body":{"datapoint":{"x":1}},"nonce":620580862,"is_query_device":true,{},"token":"e474bba4b8e11b97b91019e61b7a018cdbaa3246","meta":{"Authorization":"tokene474bba4b8e11b97b91019e61b7a018cdbaa3246"},"path":"/v1/datastreams/plug-status/datapoint/","post":{},{"status":{"status":200,"datapoint":{"x":1},"nonce":620580862,"deliver_to_device":truPCplug-curlplug-curl-XGET-H"Content-Type:application/json"-H"Authorization:token{"status":{"status":200,"nonce":11432809,"datapoint":{"x":1},"deliver_to_device":curlcurl-XPOST-H"Content-Type:application/json"-H"Authorization:token4bba4b8e11b97b91019e61b7a018cdbaa3246"–d'{"datapoint":{"x":1}}'Windowscurlcurl-XPOST-H"Content-Type:application/json"-H"Authorization:tokene474bba4b8e11b97b91019e61b7a018cdbaa3246"–d"{\"datapoint\":{\"x\":1}}"http://7/v1/datastreams/plug-{"status":{"status":200,"nonce":11432809,"datapoint":{"x":1},"deliver_to_device":燈{"body":{},"nonce":8968711,"is_query_device":true,"get":{},"token":"e474bba4b8e11b97b91019e61b7a018cdbaa3246","meta":{"Authorization":{"body":{},"nonce":8968711,"is_query_device":true,"get":{},"token":"e474bba4b8e11b97b91019e61b7a018cdbaa3246","meta":{"Authorization":"tokene474bba4b8e11b97b91019e61b7a018cdbaa3246"},"path":"/v1/datastreams/light/datapoint/","post":{},"method":{"nonce":{"nonce":5619936,"datapoint":{"x":100,"y":200,"z":0,"k":0,"l":o_device":{"body":{"datapoint":{"y":{"body":{"datapoint":{"y":200,"x":100,"k":0,"z":0,"l":50}},"nonce":5619936,"is_query_device":true,"get":{},"token":"e474bba4b8e11b97b91019e61b7a018cdbaa3246"/v1/datastreams/light/datapoint/","post":{},"method":{"nonce":{"nonce":5619936,"datapoint":{"x":100,"y":200,"z":0,"k":0,"l":o_device":Yred、Zgreen、Kblue。L參數(shù)目前保留。PCcurl-Xcurl-XGET-H"Content-Type:application/json"-H"Authorization:token{"nonce":{"nonce":5619936,"datapoint":{"x":100,"y":200,"z":0,"k":0,"l":o_device":curl-XPOST-H"Content-Type:application/json"-Hcurl-XPOST-H"Content-Type:application/json"-H"Authorization:tokene474bba4b8e11b97b91019e61b7a018cdbaa3246"–d'{"datapoint":{"x":100,"y":Windowscurl-XPOST-H"Content-Type:application/json"-H"Authorization:tokencurl-XPOST-H"Content-Type:application/json"-H"Authorization:tokene474bba4b8e11b97b91019e61b7a018cdbaa3246"–d"{\"datapoint\":{\"x\":100,{"nonce":{"nonce":5619936,"datapoint":{"x":100,"y":200,"z":0,"k":0,
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 活動(dòng)預(yù)告片短視頻行業(yè)跨境出海戰(zhàn)略研究報(bào)告
- 2025年風(fēng)電場(chǎng)集中和遠(yuǎn)程監(jiān)控系統(tǒng)項(xiàng)目建議書
- 項(xiàng)目計(jì)劃錦集(3篇)
- 2024年度吉林省護(hù)師類之社區(qū)護(hù)理主管護(hù)師題庫(kù)與答案
- 橋梁建設(shè)階段的甲方協(xié)調(diào)措施
- 高三數(shù)學(xué)第一輪復(fù)習(xí)計(jì)劃:重難點(diǎn)解析
- 金融行業(yè)人才引進(jìn)與成長(zhǎng)路徑
- 環(huán)保政策落實(shí)的有效措施
- 家長(zhǎng)會(huì)反饋及學(xué)校改進(jìn)措施
- 金融行業(yè)客戶服務(wù)的技術(shù)支持措施
- GB/T 15597.2-2024塑料聚甲基丙烯酸甲酯(PMMA)模塑和擠出材料第2部分:試樣制備和性能測(cè)定
- 2024CSCO胃腸間質(zhì)瘤診療指南解讀
- 泛血管疾病抗栓治療中國(guó)專家共識(shí)(2024版)
- 婚內(nèi)忠誠(chéng)協(xié)議書范本電子版
- 2024年安徽省初中(八年級(jí))學(xué)業(yè)水平考試初二會(huì)考生物試卷真題
- 2024CSCO頭頸部腫瘤診療指南解讀
- 國(guó)開(kāi)2024《人文英語(yǔ)4》邊學(xué)邊練參考答案
- 質(zhì)量手冊(cè)(質(zhì)量保證手冊(cè),壓力容器)
- 20210年中考英語(yǔ)復(fù)習(xí):閱讀理解信息歸納摘錄考題匯編(含答案)
- 拒絕早戀主題班會(huì) 課件(34張)2023-2024學(xué)年主題班會(huì)
- 美容美體藝術(shù)專業(yè)人才培養(yǎng)方案(中職)
評(píng)論
0/150
提交評(píng)論