ESP8266_RTOS_SDK  v1.4.0
mesh.h
1 /*
2  * ESPRSSIF MIT License
3  *
4  * Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5  *
6  * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7  * it is free of charge, to any person obtaining a copy of this software and associated
8  * documentation files (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11  * to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or
14  * substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef __LWIP_API_MESH_H__
26 #define __LWIP_API_MESH_H__
27 
28 #include "lwip/ip_addr.h"
29 #include "espconn.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 typedef void (* espconn_mesh_callback)();
36 
37 enum mesh_type {
38  MESH_CLOSE = 0,
39  MESH_LOCAL,
40  MESH_ONLINE,
41  MESH_NONE = 0xFF
42 };
43 
61 };
62 
67 };
68 
80 bool espconn_mesh_local_addr(struct ip_addr *ip);
81 
93  uint8_t **info, uint8_t *count);
94 
107 bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len);
108 
120 bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len);
121 
132 bool espconn_mesh_set_max_hops(uint8_t max_hops);
133 
145 bool espconn_mesh_group_id_init(uint8_t *grp_id, uint16_t gid_len);
146 
155 bool espconn_mesh_set_dev_type(uint8_t dev_type);
156 
174 sint8 espconn_mesh_connect(struct espconn *usr_esp);
175 
190 sint8 espconn_mesh_disconnect(struct espconn *usr_esp);
191 
200 
218 sint8 espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len);
219 
228 
243 void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type);
244 
255 void espconn_mesh_disable(espconn_mesh_callback disable_cb);
256 
264 void espconn_mesh_init();
265 
270 #ifdef __cplusplus
271 }
272 #endif
273 
274 #endif
bool espconn_mesh_set_dev_type(uint8_t dev_type)
Set the curent device type.
bool espconn_mesh_set_max_hops(uint8_t max_hops)
Set max hop for mesh network.
Definition: mesh.h:57
AUTH_MODE
Definition: esp_wifi.h:59
void espconn_mesh_init()
To print version of mesh.
Definition: mesh.h:66
sint8 espconn_mesh_get_status()
Get current mesh status.
mesh_node_type
Definition: mesh.h:63
Definition: mesh.h:60
sint8 espconn_mesh_disconnect(struct espconn *usr_esp)
Disconnect a mesh connection.
Definition: mesh.h:58
sint8 espconn_mesh_connect(struct espconn *usr_esp)
Try to establish mesh connection to server.
bool espconn_mesh_local_addr(struct ip_addr *ip)
Check whether the IP address is mesh local IP address or not.
void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type)
To enable mesh network.
void espconn_mesh_disable(espconn_mesh_callback disable_cb)
To disable mesh network.
bool espconn_mesh_get_node_info(enum mesh_node_type type, uint8_t **info, uint8_t *count)
Get the information of mesh node.
Definition: mesh.h:65
Definition: mesh.h:56
bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len)
Set prefix of SSID for mesh node.
Definition: espconn.h:150
Definition: mesh.h:59
bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len)
Set WiFi cryption algrithm and password for mesh node.
mesh_status
Definition: mesh.h:55
Definition: mesh.h:64
sint8 espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len)
Send data through mesh network.
bool espconn_mesh_group_id_init(uint8_t *grp_id, uint16_t gid_len)
Set group ID of mesh node.
uint8 espconn_mesh_get_max_hops()
Get max hop of mesh network.