新手学Mesh组网,求前辈指导!
新手学Mesh组网,求前辈指导!
Postby Duke » Tue May 31, 2016 4:33 pm
Description Resource Path Location Type
Symbol 'M_PROTO_JSON' could not be resolved mesh_demo.c /ESP8266_MESH_DEMO-master/mesh_demo/demo line 217 Semantic Error
我是刚解除MESH网络,之前看了几遍MESh用户手册,也是把握不懂。我现在的问题是不知道怎么把程序跑起来。我想向乐鑫描述的那样能进行组网,控制更多的8266设备。还想问一下,有没有肖老师QQ号,或相关QQ群,可以学习。
很想实现组网功能!
Re: 新手学Mesh组网,求前辈指导!
Postby ESP_Alen » Wed Jun 01, 2016 3:03 pm
https://github.com/esp8266/esp8266-wiki/wiki/Toolchain
2. Download Tools
viewforum.php?f=57
Re: 新手学Mesh组网,求前辈指导!
Postby Duke » Wed Jun 08, 2016 10:04 am
我发现在mesh网络发送数据是通过
espconn_mesh_create_packet(***)
espconn_mesh_set_usr_data(header, tst_data, MESH_DEMO_STRLEN(tst_data))和
espconn_mesh_sent(&g_ser_conn, (uint8_t *)header, header->len)。
来实现发送用户数据的。而接受用户数据是通过下面的这个函数,
if(!espconn_mesh_get_usr_data(header,&usr_data,&usr_data_len))
return;
os_printf("\r\n收到用户数据:%s\r\n",usr_data);
当我通过os_printf打印出usr_data,我发现是一个mac地址。那我怎么获取,其他节点发来的数据包里的具体用户数据呢?
Thanks xiao.
Re: 新手学Mesh组网,求前辈指导!
Postby ESP_Alen » Wed Jun 08, 2016 2:43 pm
Duke wrote:您好,肖工
我发现在mesh网络发送数据是通过
espconn_mesh_create_packet(***)
espconn_mesh_set_usr_data(header, tst_data, MESH_DEMO_STRLEN(tst_data))和
espconn_mesh_sent(&g_ser_conn, (uint8_t *)header, header->len)。
来实现发送用户数据的。而接受用户数据是通过下面的这个函数,
if(!espconn_mesh_get_usr_data(header,&usr_data,&usr_data_len))
return;
os_printf("\r\n收到用户数据:%s\r\n",usr_data);
当我通过os_printf打印出usr_data,我发现是一个mac地址。那我怎么获取,其他节点发来的数据包里的具体用户数据呢?
Thanks xiao.
其他节点需要给目的节点发送数据,发送的什么数据,espconn_mesh_get_usr_data获取的就是什么数据。
Re: 新手学Mesh组网,求前辈指导!
Postby Duke » Tue Jun 14, 2016 10:03 am
espconn_mesh_get_usr_data_proto(header,&proto);和 espconn_mesh_get_usr_data(header,&usr_data,&header->len);这样就可以获取数据usr-data;但是,我要在STM32中做一个server ,接收的网络数据buff,如何通过函数,解析出usr_data呢?
或者,bool espconn_mesh_get_usr_data_proto(struct mesh_header_format *head,
enum mesh_usr_proto_type *proto);
这个函数是具体怎么实现获取Packet Body的呢?
Alen老师,麻烦帮忙解答一下。
Re: 新手学Mesh组网,求前辈指导!
Postby ESP_Alen » Fri Jun 17, 2016 4:47 pm
Duke wrote:我遇到了新的问题,目前我想用STM32做server,在解析数据包的时候有点问题,我知道在MESH的那个demo中,解析包可以根据*header请求出具体的Packet Body,用的是两个API函数:
espconn_mesh_get_usr_data_proto(header,&proto);和 espconn_mesh_get_usr_data(header,&usr_data,&header->len);这样就可以获取数据usr-data;但是,我要在STM32中做一个server ,接收的网络数据buff,如何通过函数,解析出usr_data呢?
或者,bool espconn_mesh_get_usr_data_proto(struct mesh_header_format *head,
enum mesh_usr_proto_type *proto);
这个函数是具体怎么实现获取Packet Body的呢?
Alen老师,麻烦帮忙解答一下。
请你描述一下你的具体的数据包?
Re: 新手学Mesh组网,求前辈指导!
Postby ESP_Alen » Fri Jun 17, 2016 5:39 pm
Duke wrote:我用的是demo里的JSON数据包,上个问题暂时不用了,我遇到的新问题,我有一个json数据:
char *tst_data = "{\"timestamp\":\"2013-11-19T08:50:11\",\"value\":1}";
我想咨询一下,这个键值对应该怎么修改,比如我想修改,让value等于2?
要怎么操作呢?
这是json解析的具体问题,你可以看一下github上的cjson.
我们也可以把cjson作为一个单独的lib提供出来,不过还是建议你自己把cjson拿过来。
Re: 新手学Mesh组网,求前辈指导!
Postby Duke » Mon Jun 20, 2016 10:01 am
Code: Select all
Description Resource Path Location Type
undefined reference to `pow' cJSON.c /ESP8266_MESH_DEMO-master/mesh_demo/demo line 44 C/C++ Problem
我知道MESH网络中的数据也是用JSON封装的,如果我想用root节点与server进行TCP通信应该怎么使用JSON呢?
Who is online
Users browsing this forum: No registered users and 15 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.