版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
版本信 前 總體介 代碼結(jié) 工作模 調(diào)試工 局域網(wǎng)功 通用功 獲取版本信 設(shè)置連接參 連接模式的切 局域網(wǎng)內(nèi)設(shè)備查 插 獲取插座狀 設(shè)置插座狀 獲取燈狀 設(shè)置燈狀 溫濕 廣域網(wǎng)功 espressif服務(wù)器平 激 認(rèn) 服務(wù) 插 溫濕 用戶自定義反向控 本文主要介紹基于EspressifIoTSDK的應(yīng)用開發(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模式(指令詳見3.1.2設(shè)置連接參數(shù)。softAP的默認(rèn)為ESP_,其中為設(shè)備MAC地址的后面三個(gè)字節(jié),默認(rèn)加密模式為/2。服務(wù)用調(diào)試工可采用curl命令。的curl指令請參照“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指令來控制設(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長度需不小于8個(gè)字符。(1)softAPstation(2)APP(或PC)連入ESP8266softAP下指令,讓ESP8266station連接路由。此時(shí)可以查詢station的連接狀態(tài)。softAPstation2由宏定義#defineAP_CACHE控制此功能開關(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ù)器申請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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度文化產(chǎn)品出口代理協(xié)議模板3篇
- 2025年度征收補(bǔ)償與安置補(bǔ)償協(xié)議執(zhí)行監(jiān)督辦法4篇
- 2024年04月湖南國家開發(fā)銀行湖南分行暑期實(shí)習(xí)生招考筆試歷年參考題庫附帶答案詳解
- 個(gè)人汽車租借協(xié)議2024年標(biāo)準(zhǔn)格式樣張版B版
- 2025年度文化創(chuàng)意產(chǎn)業(yè)園區(qū)場地租賃管理協(xié)議4篇
- 個(gè)人與公司買賣合同范本完整版
- 2025年度文化產(chǎn)業(yè)園區(qū)場地合作開發(fā)合同協(xié)議書4篇
- 2024版室外房屋墻面裝修合同書版B版
- 2025年度化妝品全球包銷代理合同范本4篇
- 2024裝飾裝修合同的法律適用
- 2025年河南鶴壁市政務(wù)服務(wù)和大數(shù)據(jù)管理局招聘12345市長熱線人員10人高頻重點(diǎn)提升(共500題)附帶答案詳解
- 建設(shè)項(xiàng)目安全設(shè)施施工監(jiān)理情況報(bào)告
- 春節(jié)期間安全施工措施
- 2025年大唐集團(tuán)招聘筆試參考題庫含答案解析
- 建筑工地春節(jié)期間安全保障措施
- 2025山東水發(fā)集團(tuán)限公司招聘管理單位筆試遴選500模擬題附帶答案詳解
- 2024-2030年中國建筑玻璃行業(yè)市場深度調(diào)研及競爭格局與投資價(jià)值預(yù)測研究報(bào)告
- 泌尿:膀胱腫瘤病人的護(hù)理查房王雪-課件
- 企業(yè)短期中期長期規(guī)劃
- 中華民族共同體概論講稿專家版《中華民族共同體概論》大講堂之第一講:中華民族共同體基礎(chǔ)理論
- 《商務(wù)溝通-策略、方法與案例》課件 第一章 商務(wù)溝通概論
評(píng)論
0/150
提交評(píng)論