ESP8266 Centre + NB
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 #ifndef __LWIP_API_MESH_H__
25 #define __LWIP_API_MESH_H__
26 
27 #include "ip_addr.h"
28 #include "user_interface.h"
29 #include "espconn.h"
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define ESP_MESH_GROUP_ID_LEN (6)
35 
36 typedef void (* espconn_mesh_callback)();
37 typedef void (* espconn_mesh_scan_callback)(void *arg, int8_t status);
38 
39 enum mesh_type {
43  MESH_NONE = 0xFF
44 };
62 };
63 
68 };
69 
71  espconn_mesh_scan_callback usr_scan_cb; // scan done callback
73  bool grp_set; // group set
74 };
75 
76 
88 bool espconn_mesh_local_addr(struct ip_addr *ip);
89 
100 bool espconn_mesh_get_router(struct station_config *router);
101 
113 bool espconn_mesh_set_router(struct station_config *router);
114 
128 bool espconn_mesh_server_init(struct ip_addr *ip, uint16_t port);
129 
141  uint8_t **info, uint8_t *count);
142 
155 bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len);
167 bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len);
168 
179 bool espconn_mesh_set_max_hops(uint8_t max_hops);
180 
192 bool espconn_mesh_group_id_init(uint8_t *grp_id, uint16_t gid_len);
193 
202 bool espconn_mesh_set_dev_type(uint8_t dev_type);
211 
229 int8_t espconn_mesh_connect(struct espconn *usr_esp);
230 
245 int8_t espconn_mesh_disconnect(struct espconn *usr_esp);
246 
255 
273 int8_t espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len);
274 
283 
298 void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type);
299 
311 
320 
332 void espconn_mesh_scan(struct mesh_scan_para_type *para);
337 #ifdef __cplusplus
338 }
339 #endif
340 
341 #endif
void espconn_mesh_print_ver()
To print version of mesh.
signed char int8_t
Definition: c_types.h:30
uint8_t grp_id[ESP_MESH_GROUP_ID_LEN]
Definition: mesh.h:72
mesh_node_type
Definition: mesh.h:64
Definition: mesh.h:43
#define ESP_MESH_GROUP_ID_LEN
Definition: mesh.h:34
bool espconn_mesh_get_router(struct station_config *router)
Get the information of router used by mesh network.
Definition: user_interface.h:215
unsigned short uint16
Definition: c_types.h:48
void(* espconn_mesh_scan_callback)(void *arg, int8_t status)
Definition: mesh.h:37
Definition: ip_addr.h:30
int8_t espconn_mesh_get_status()
Get current mesh status.
bool espconn_mesh_group_id_init(uint8_t *grp_id, uint16_t gid_len)
Set group ID of mesh node.
void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type)
To enable mesh network.
bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len)
Set WiFi cryption algrithm and password for mesh node.
Definition: mesh.h:66
Definition: mesh.h:61
Definition: mesh.h:57
bool espconn_mesh_local_addr(struct ip_addr *ip)
Check whether the IP address is mesh local IP address or not.
espconn_mesh_scan_callback usr_scan_cb
Definition: mesh.h:71
mesh_type
Definition: mesh.h:39
unsigned char uint8_t
Definition: c_types.h:28
unsigned char uint8
Definition: c_types.h:43
void espconn_mesh_disable(espconn_mesh_callback disable_cb)
To disable mesh network.
int8_t espconn_mesh_disconnect(struct espconn *usr_esp)
Disconnect a mesh connection.
uint8_t espconn_mesh_get_max_hops()
Get max hop of mesh network.
Definition: mesh.h:59
Definition: mesh.h:70
Definition: mesh.h:41
void espconn_mesh_scan(struct mesh_scan_para_type *para)
To get AP around node.
Definition: mesh.h:65
bool espconn_mesh_server_init(struct ip_addr *ip, uint16_t port)
Set server setup by user.
Definition: mesh.h:60
Definition: mesh.h:58
Definition: espconn.h:104
uint8_t espconn_mesh_get_dev_type()
Get the curent device type.
bool grp_set
Definition: mesh.h:73
bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len)
Set prefix of SSID for mesh node.
mesh_status
Definition: mesh.h:56
void(* espconn_mesh_callback)()
Definition: mesh.h:36
Definition: mesh.h:40
int8_t espconn_mesh_connect(struct espconn *usr_esp)
Try to establish mesh connection to server.
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:42
int8_t espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len)
Send data through mesh network.
Definition: mesh.h:67
bool espconn_mesh_set_max_hops(uint8_t max_hops)
Set max hop for mesh network.
bool espconn_mesh_set_router(struct station_config *router)
Set the information of router used by mesh network.
enum _auth_mode AUTH_MODE
unsigned short uint16_t
Definition: c_types.h:31
bool espconn_mesh_set_dev_type(uint8_t dev_type)
Set the curent device type.