ESP8266_NONOS_MESH_API

Similar documents
About This Guide. Release Notes

ESP8266 Mesh

ESP8266 SSL User Manual

Read the Docs Template Documentation

Content 1. SDK Library Overview API Library Introduction API Data Structure HAL Driver Function Type LIB

IP : Internet Protocol

Packet Header Formats

Ref: A. Leon Garcia and I. Widjaja, Communication Networks, 2 nd Ed. McGraw Hill, 2006 Latest update of this lecture was on

SpiNNaker Application Programming Interface (API)

Chapter 5 OSI Network Layer

Lecture 9: Internetworking

The following structure contains network information about client when command is connect or bind :

6.033 Computer System Engineering

cs144 Midterm Review Fall 2010

Introduction to Internet. Ass. Prof. J.Y. Tigli University of Nice Sophia Antipolis

ECE 461 Internetworking Fall Quiz 1

GIVE W INGS TO YOUR IDEAS

debug ip rtp header-compression through debug ipv6 icmp, page 1

Internet Protocol (IP)

IPv6. IPv4 & IPv6 Header Comparison. Types of IPv6 Addresses. IPv6 Address Scope. IPv6 Header. IPv4 Header. Link-Local

Your Name: Your student ID number:

libnetfilter_log Reference Manual

XC4614 AT Commands Guide

CS 349/449 Internet Protocols Midterm Exam Winter /21/2003

IPv6 Protocols and Networks Hadassah College Spring 2018 Wireless Dr. Martin Land

Lecture 18 Overview. Last Lecture. This Lecture. Next Lecture. Internet Protocol (1) Internet Protocol (2)

tcp6 v1.2 manual pages

Telecom Systems Chae Y. Lee. Contents. Overview. Issues. Addressing ARP. Adapting Datagram Size Notes

CSC 401 Data and Computer Communications Networks

Position of IP and other network-layer protocols in TCP/IP protocol suite

Problem Max. Points Act. Points Grader

Networking Technologies and Applications

Introduction to TCP/IP networking

This resource describes how to program the myrio in C to perform timer interrupts.

Chapter 4: network layer. Network service model. Two key network-layer functions. Network layer. Input port functions. Router architecture overview

Lecture 16: Network Layer Overview, Internet Protocol

416 Distributed Systems. Networks review; Day 2 of 2 Fate sharing, e2e principle And start of RPC Jan 10, 2018

b. Suppose the two packets are to be forwarded to two different output ports. Is it

Network Layer: Router Architecture, IP Addressing

History Page. Barracuda NextGen Firewall F

CS 356: Computer Network Architectures. Lecture 10: IP Fragmentation, ARP, and ICMP. Xiaowei Yang

Lecture 8. Network Layer (cont d) Network Layer 1-1

Quiz. Segment structure and fields Flow control (rwnd) Timeout interval. Phases transition ssthresh setting Cwnd setting

II. Principles of Computer Communications Network and Transport Layer

Table of Contents 1 IP Address Configuration Commands IP Performance Configuration Commands 2-1

Chapter 4 Network Layer: The Data Plane. Part A. Computer Networking: A Top Down Approach

Lesson 4 RPL and 6LoWPAN Protocols. Chapter-4 L04: "Internet of Things ", Raj Kamal, Publs.: McGraw-Hill Education

Network Communication

The Internet Protocol. IP Addresses Address Resolution Protocol: IP datagram format and forwarding: IP fragmentation and reassembly

Bluetooth low energy Protocol Stack

Data Communication & Networks G Session 7 - Main Theme Networks: Part I Circuit Switching, Packet Switching, The Network Layer

IPv6 Stack. 6LoWPAN makes this possible. IPv6 over Low-Power wireless Area Networks (IEEE )

jumbo6 v1.2 manual pages

Table of Contents 1 IP Address Configuration Commands IP Performance Configuration Commands 2-1

COMP211 Chapter 4 Network Layer: The Data Plane

K2289: Using advanced tcpdump filters

Command Manual (For Soliton) IP Address-IP Performance. Table of Contents

ESP8266 SSL. Version 1.4

1. Overview Ethernet FIT Module Outline of the API API Information... 5

Simple-Pair User Guide

Introduction to Internetworking

Managing Rogue Devices

network security s642 computer security adam everspaugh

Configuring attack detection and prevention 1

CS 421: COMPUTER NETWORKS SPRING FINAL May 24, minutes. Name: Student No: TOT

Chapter 2 - Part 1. The TCP/IP Protocol: The Language of the Internet

Network and Security: Introduction

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Lecture 2: Basic routing, ARP, and basic IP

Layered Networking and Port Scanning

EP2120 Internetworking/Internetteknik IK2218 Internets Protokoll och Principer

Veryx ATTEST TM. Sample Test cases Overview. Conformance Test Suite. Internet Protocol version 4 (IPv4) Part Number: T / TCLS IPv /1.

CSE 422 Jeopardy. Sockets TCP/UDP IP Routing Link $100 $200 $300 $400. Sockets - $100

CSCI-GA Operating Systems. Networking. Hubertus Franke

internet technologies and standards

Network layer: Overview. Network layer functions IP Routing and forwarding NAT ARP IPv6 Routing

Appendix A Pseudocode of the wlan_mac Process Model in OPNET

Operation Manual AAA RADIUS HWTACACS H3C S5500-EI Series Ethernet Switches. Table of Contents

Internetwork Protocols

Computer Networks (Introduction to TCP/IP Protocols)

Network layer: Overview. Network Layer Functions

CS168 Programming Assignment 2: IP over UDP

Question Score 1 / 19 2 / 19 3 / 16 4 / 29 5 / 17 Total / 100

I Commands. iping, page 2 iping6, page 4 itraceroute, page 5 itraceroute6 vrf, page 6. itraceroute vrf encap vxlan, page 12

IPv4 addressing, NAT. Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley.

Lesson 3. IPv4 and IPv6 Protocols. Chapter-4 L03: "Internet of Things ", Raj Kamal, Publs.: McGraw-Hill Education

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

Lecture 17 Overview. Last Lecture. Wide Area Networking (2) This Lecture. Internet Protocol (1) Source: chapters 2.2, 2.3,18.4, 19.1, 9.

MIDTERM EXAMINATION #2 OPERATING SYSTEM CONCEPTS U N I V E R S I T Y O F W I N D S O R S C H O O L O F C O M P U T E R S C I E N C E

Configuring attack detection and prevention 1

ECPE / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

ET4254 Communications and Networking 1

Total Access 600R (P/N L1#TDM) Menu Tree - System Info Branch. Total Access 600R (P/N L1#TDM) Menu Tree - System Utility Branch

Internet Networking recitation #2 IP Checksum, Fragmentation

Espressif IOT Demo. Smart Light/Plug/Sensor. Version 1.0.1

Vive Input Utility Developer Guide

Adding a Second Ethernet Driver to NET+OS

Network Layer PREPARED BY AHMED ABDEL-RAOUF

Dynamic Routing and Network Monitoring for the Polywog Protocol

CS 3516: Advanced Computer Networks

Transcription:

ESP8266_NONOS_MESH_API V1.0.0 Generated by Doxygen 1.8.10 Wed Feb 3 2016 17:06:45

Contents 1 Module Index 1 1.1 Modules................................................ 1 2 Data Structure Index 3 2.1 Data Structures............................................ 3 3 Module Documentation 5 3.1 mesh APIs............................................... 5 3.1.1 Detailed Description..................................... 7 3.1.2 Function Documentation................................... 7 3.1.2.1 espconn_mesh_add_option( mesh_header_format head, mesh_ - header_option_format option).......................... 7 3.1.2.2 espconn_mesh_connect( espconn usr_esp)................ 7 3.1.2.3 espconn_mesh_create_option( otype, ovalue, val_len).. 7 3.1.2.4 espconn_mesh_create_packet( dst_addr, src_addr, bool p2p, bool piggyback_cr, enum mesh_usr_proto_type proto, uint16_t data_len, bool option, uint16_t ot_len, bool frag, enum mesh_option_type frag_type, bool mf, uint16_t frag_idx, uint16_t frag_id)......................... 8 3.1.2.5 espconn_mesh_deauth_all()............................ 8 3.1.2.6 espconn_mesh_disable(espconn_mesh_callback disable_cb).......... 9 3.1.2.7 espconn_mesh_disconnect( espconn usr_esp).............. 9 3.1.2.8 espconn_mesh_disp_route_table()........................ 9 3.1.2.9 espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type)........................................ 10 3.1.2.10 espconn_mesh_encrypt_init(auth_mode mode, passwd, pw - _len)........................................ 10 3.1.2.11 espconn_mesh_get_dst_addr( mesh_header_format head, uint8_ - t dst_addr).................................... 10 3.1.2.12 espconn_mesh_get_max_hops()......................... 10 3.1.2.13 espconn_mesh_get_node_info(enum mesh_node_type type, info, uint16_t count).................................. 11 3.1.2.14 espconn_mesh_get_option( mesh_header_format head, enum mesh_ - option_type otype, uint16_t oidx, mesh_header_option_format option). 11 3.1.2.15 espconn_mesh_get_router( station_config router)............. 11

iv CONTENTS 3.1.2.16 espconn_mesh_get_src_addr( mesh_header_format head, uint8_ - t src_addr).................................... 12 3.1.2.17 espconn_mesh_get_status()............................ 12 3.1.2.18 espconn_mesh_get_sub_dev_count()....................... 12 3.1.2.19 espconn_mesh_get_usr_data( mesh_header_format head, uint8_ - t usr_data, uint16_t data_len)......................... 13 3.1.2.20 espconn_mesh_get_usr_data_proto( mesh_header_format head, enum mesh_usr_proto_type proto)........................... 14 3.1.2.21 espconn_mesh_group_id_init( grp_id, uint16_t gid_len)......... 14 3.1.2.22 espconn_mesh_layer( ip_addr ip)..................... 14 3.1.2.23 espconn_mesh_local_addr( ip_addr ip).................. 15 3.1.2.24 espconn_mesh_print_ver()............................ 15 3.1.2.25 espconn_mesh_regist_conn_ready_cb(espconn_mesh_usr_callback cb).... 15 3.1.2.26 espconn_mesh_regist_usr_cb(espconn_mesh_usr_callback cb)......... 16 3.1.2.27 espconn_mesh_release_congest()........................ 17 3.1.2.28 espconn_mesh_scan( mesh_scan_para_type para)............ 17 3.1.2.29 espconn_mesh_sent( espconn usr_esp, uint8 pdata, uint16 len)..... 17 3.1.2.30 espconn_mesh_server_init( ip_addr ip, uint16_t port)........... 18 3.1.2.31 espconn_mesh_set_dst_addr( mesh_header_format head, dst - _addr)....................................... 18 3.1.2.32 espconn_mesh_set_max_hops( max_hops)................ 18 3.1.2.33 espconn_mesh_set_router( station_config router)............. 19 3.1.2.34 espconn_mesh_set_scan_retries( retries)................. 19 3.1.2.35 espconn_mesh_set_src_addr( mesh_header_format head, src - _addr)....................................... 19 3.1.2.36 espconn_mesh_set_ssid_prefix( prefix, prefix_len)........ 20 3.1.2.37 espconn_mesh_set_usr_data( mesh_header_format head, usr - _data, uint16_t data_len)............................. 20 3.1.2.38 espconn_mesh_set_usr_data_proto( mesh_header_format head, enum mesh_usr_proto_type proto)............................ 20 3.1.2.39 espconn_mesh_setup_timer(os_timer_t timer, uint32_t time, os_timer_func_ - t cb, void arg, bool repeat)............................ 20 4 Data Structure Documentation 23 4.1 mesh_header_format Struct Reference................................ 23 4.1.1 Field Documentation..................................... 23 4.1.1.1 cp......................................... 23 4.1.1.2 cr.......................................... 23 4.1.1.3 d.......................................... 23 4.1.1.4 dst_addr...................................... 23 4.1.1.5 len......................................... 24 4.1.1.6 oe......................................... 24 4.1.1.7 option....................................... 24

CONTENTS v 4.1.1.8 p2p......................................... 24 4.1.1.9 protocol...................................... 24 4.1.1.10 rsv......................................... 24 4.1.1.11 src_addr...................................... 24 4.1.1.12 ver......................................... 24 4.2 mesh_header_option_format Struct Reference............................ 24 4.2.1 Field Documentation..................................... 24 4.2.1.1 olen........................................ 24 4.2.1.2 otype........................................ 25 4.2.1.3 ovalue....................................... 25 4.3 mesh_header_option_frag_format Struct Reference......................... 25 4.3.1 Field Documentation..................................... 25 4.3.1.1 id.......................................... 25 4.3.1.2 idx......................................... 25 4.3.1.3 mf......................................... 25 4.3.1.4 resv........................................ 25 4.4 mesh_header_option_header_type Struct Reference......................... 25 4.4.1 Field Documentation..................................... 26 4.4.1.1 olist......................................... 26 4.4.1.2 ot_len....................................... 26 4.5 mesh_scan_para_type Struct Reference............................... 26 4.5.1 Field Documentation..................................... 26 4.5.1.1 grp_id....................................... 26 4.5.1.2 grp_set....................................... 26 4.5.1.3 usr_scan_cb.................................... 26 4.6 mesh_sub_node_info Struct Reference................................ 26 4.6.1 Field Documentation..................................... 26 4.6.1.1 mac........................................ 26 4.6.1.2 sub_count..................................... 27

Chapter 1 Module Index 1.1 Modules Here is a list of all modules: mesh APIs.................................................. 5

2 Module Index

Chapter 2 Data Structure Index 2.1 Data Structures Here are the data ures with brief descriptions: mesh_header_format............................................ 23 mesh_header_option_format........................................ 24 mesh_header_option_frag_format..................................... 25 mesh_header_option_header_type..................................... 25 mesh_scan_para_type........................................... 26 mesh_sub_node_info............................................ 26

4 Data Structure Index

Chapter 3 Module Documentation 3.1 mesh APIs Mesh APIs. Functions void espconn_mesh_create_packet ( dst_addr, src_addr, bool p2p, bool piggyback_cr, enum mesh_usr_proto_type proto, uint16_t data_len, bool option, uint16_t ot_len, bool frag, enum mesh_ - option_type frag_type, bool mf, uint16_t frag_idx, uint16_t frag_id) The function is used to create mesh packet. void espconn_mesh_create_option ( otype, ovalue, val_len) The function is used to create mesh option. bool espconn_mesh_add_option ( mesh_header_format head, mesh_header_option_format option) The function is used to add mesh option in mesh packet. bool espconn_mesh_get_option ( mesh_header_format head, uint16_t oidx, mesh_header_option_format option) The function is used to get mesh option in mesh packet.. enum mesh_option_type otype, bool espconn_mesh_get_usr_data ( mesh_header_format head, usr_data, uint16_t data - _len) The function is used to get user data in mesh packet.. bool espconn_mesh_set_usr_data ( mesh_header_format head, usr_data, uint16_t data_len) The function is used to set user data in mesh packet.. bool espconn_mesh_get_src_addr ( mesh_header_format head, src_addr) The function is used to get source address of mesh packet. bool espconn_mesh_get_dst_addr ( mesh_header_format head, dst_addr) The function is used to get destination address of mesh packet. bool espconn_mesh_set_src_addr ( mesh_header_format head, src_addr) The function is used to set source address of mesh packet. bool espconn_mesh_set_dst_addr ( mesh_header_format head, dst_addr) The function is used to set destination address of mesh packet. bool espconn_mesh_get_usr_data_proto ( mesh_header_format head, enum mesh_usr_proto_type proto) The function is used to get protocol used by user data in mesh packet. bool espconn_mesh_set_usr_data_proto ( mesh_header_format head, enum mesh_usr_proto_type proto) The function is used to set protocol used by user data in mesh packet.

6 Module Documentation bool espconn_mesh_local_addr ( ip_addr ip) Check whether the IP address is mesh local IP address or not. bool espconn_mesh_get_node_info (enum mesh_node_type type, info, uint16_t count) The function is used to get the information of mesh node.. bool espconn_mesh_get_router ( station_config router) The function is used to get router AP information used by mesh node. bool espconn_mesh_set_router ( station_config router) The function is used to set router AP information for mesh node. bool espconn_mesh_encrypt_init (AUTH_MODE mode, passwd, pw_len) The function is used to init encrypt algorithm and password for mesh AP. bool espconn_mesh_group_id_init ( grp_id, uint16_t gid_len) The function is used to init group id for mesh node. bool espconn_mesh_regist_conn_ready_cb (espconn_mesh_usr_callback cb) The function is used to register user callback. If TCP connection with parent node is ready, mesh will call the user callback.. bool espconn_mesh_regist_usr_cb (espconn_mesh_usr_callback cb) The function is used to register user callback. If child node joins parent, parent will trigger the callback to indicate user. bool espconn_mesh_server_init ( ip_addr ip, uint16_t port) The function is used to set server ip and port for mesh node. bool espconn_mesh_set_max_hops ( max_hops) The function is used to set max_hops for mesh network.. bool espconn_mesh_set_ssid_prefix ( prefix, prefix_len) The function is used to set SSID prefix for mesh AP. bool espconn_mesh_set_scan_retries ( retries) The function is used to set scan retries if no available AP to been found. int8_t espconn_mesh_connect ( espconn usr_esp) Try to establish mesh connection to server. int8_t espconn_mesh_disconnect ( espconn usr_esp) Disconnect a mesh connection. int8_t espconn_mesh_get_status () The function is used to get current status of mesh node. int8_t espconn_mesh_sent ( espconn usr_esp, uint8 pdata, uint16 len) Send data through mesh network. espconn_mesh_get_max_hops () The function is used to get current max hop of mesh network. espconn_mesh_layer ( ip_addr ip) The function is used to get current max hop of mesh network. uint16_t espconn_mesh_get_sub_dev_count () The function is used to get the number of all the sub nodes of current node. 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. void espconn_mesh_deauth_all () The function is used to reject all the child node. void espconn_mesh_disp_route_table () The function is used to display route table of current node. void espconn_mesh_print_ver () The function is used to print version of mesh. void espconn_mesh_release_congest ()

3.1 mesh APIs 7 TThe function is used to discard all the packet to parent. void espconn_mesh_scan ( mesh_scan_para_type para) The function is used to scan AP around current node. void espconn_mesh_setup_timer (os_timer_t timer, uint32_t time, os_timer_func_t cb, void arg, bool repeat) The function is used setup timer with callback function. 3.1.1 Detailed Description Mesh APIs. 3.1.2 Function Documentation 3.1.2.1 bool espconn_mesh_add_option ( mesh_header_format head, mesh_header_option_format option ) The function is used to add mesh option in mesh packet. mesh_header_format head : mesh packet header mesh_header_option_format option : option 3.1.2.2 int8_t espconn_mesh_connect ( espconn usr_esp ) Try to establish mesh connection to server. 1. If espconn_mesh_connect fail, returns non-0 value, there is no connection, so it won't enter any espconn callback. espconn usr_esp : the network connection ure, the usr_esp to listen to the connection 0 : succeed Non-0 : error code ESPCONN_RTE - Routing Problem ESPCONN_MEM - Out of memory ESPCONN_ISCONN - Already connected ESPCONN_ARG - Illegal argument, can't find the corresponding connection according to ure espconn 3.1.2.3 void espconn_mesh_create_option ( otype, ovalue, val_len ) The function is used to create mesh option.

8 Module Documentation otype : option type ovalue : option value val_len : length of option value NULL: create mesh option fail. addr: the start address of option. 3.1.2.4 void espconn_mesh_create_packet ( dst_addr, src_addr, bool p2p, bool piggyback_cr, enum mesh_usr_proto_type proto, uint16_t data_len, bool option, uint16_t ot_len, bool frag, enum mesh_option_type frag_type, bool mf, uint16_t frag_idx, uint16_t frag_id ) The function is used to create mesh packet. 1. If the destination of packet is server or mobile, the dst_addr is the combination of IP address and port of server or mobile. 2. If the destination of packet is node, the dst_addr is the mac address of destination device. 3. If mobile or server try to sent packet to device, mobile or server needs to fill the src_addr with combination of its IP address and port. Mobile or server can fill src_addr with default value which is zero. 4. If the packet is produced by device, device need to fill src_addr with its mac address. 5. Device and mobile should set the piggyback_cr. bool bool enum uint16_t bool uint16_t bool enum bool uint16_t uint16_t dst_addr : destination address (6 Bytes) src_addr : source address (6 Bytes) p2p : node-to-node packet piggyback_cr : piggyback flow request mesh_usr_proto_type proto : protocol used by user data data_len : length of user data option : option flag ot_len : option total length frag : fragmentation flag mesh_option_type frag_type : fragmentation type mf : more fragmentation frag_idx : fragmentation index frag_id : fragmentation id NULL: create mesh packet fail. addr: the start address of mesh packet. 3.1.2.5 void espconn_mesh_deauth_all ( ) The function is used to reject all the child node.

3.1 mesh APIs 9 null null 3.1.2.6 void espconn_mesh_disable ( espconn_mesh_callback disable_cb ) To disable mesh network. When mesh network is disabed, the system will trigger disable_cb. espconn_ - mesh_callback disable_cb : callback function of mesh-disable null 3.1.2.7 int8_t espconn_mesh_disconnect ( espconn usr_esp ) Disconnect a mesh connection. Do not call this API in any espconn callback. If needed, please use system task to trigger espconn_mesh_ - disconnect. espconn usr_esp : the network connection ure 0 : succeed Non-0 : error code ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according to ure espconn 3.1.2.8 void espconn_mesh_disp_route_table ( ) The function is used to display route table of current node. null. null.

10 Module Documentation 3.1.2.9 void espconn_mesh_enable ( espconn_mesh_callback enable_cb, enum mesh_type type ) To enable mesh network. 1. the function should be called in user_init. 2. Therefore, after enable mesh, user should wait for the enable_cb to be triggered. espconn_ - mesh_callback enum enable_cb : callback function of mesh-enable mesh_type type : type of mesh, local or online. null 3.1.2.10 bool espconn_mesh_encrypt_init ( AUTH_MODE mode, passwd, pw_len ) The function is used to init encrypt algorithm and password for mesh AP. 1. The API should be called before enable mesh.. AUTH_MODE mode : encrypt algorithm (WPA_PSK, WPA2_PSK, WPA_WPA2_PSK) passwd : password pw_len : length of password 3.1.2.11 bool espconn_mesh_get_dst_addr ( mesh_header_format head, dst_addr ) The function is used to get destination address of mesh packet. mesh_header_format head : mesh packet header dst_addr : destination address 3.1.2.12 espconn_mesh_get_max_hops ( ) The function is used to get current max hop of mesh network.

3.1 mesh APIs 11 null. the current max hop of mesh 3.1.2.13 bool espconn_mesh_get_node_info ( enum mesh_node_type type, info, uint16_t count ) The function is used to get the information of mesh node.. 1. Before enable mesh, you must not use the API. 2. If type is MESH_NODE_PARENT, count is the number of parent (always 1), info is the mac address of paren. 3. If type is MESH_NODE_CHILD, count is the number of children whose hop away from current node is one. Info is the collection of sub node information enum uint16_t mesh_node_type type : mesh node type info : the information will be saved in info count : the node count in inf 3.1.2.14 bool espconn_mesh_get_option ( mesh_header_format head, enum mesh_option_type otype, uint16_t oidx, mesh_header_option_format option ) The function is used to get mesh option in mesh packet.. enum uint16_t mesh_header_format head : mesh packet header mesh_option_type otype : option type oidx : option index mesh_header_option_format option : option true : sucess, option is pointered to the destination option 3.1.2.15 bool espconn_mesh_get_router ( station_config router ) The function is used to get router AP information used by mesh node. 1. The API should be called after user receives the first user packet from parent. 2. User should provide the router buffer to save router AP information

12 Module Documentation station_config router : if success, the router AP information will be saved in router 3.1.2.16 bool espconn_mesh_get_src_addr ( mesh_header_format head, src_addr ) The function is used to get source address of mesh packet. mesh_header_format head : mesh packet header src_addr : source address 3.1.2.17 int8_t espconn_mesh_get_status ( ) The function is used to get current status of mesh node. 1. The API should be called after enable mesh. null MESH_DISABLE: mesh is disabled. MESH_WIFI_CONN: node is trying to connect parent WIFI AP. MESH_NET_CONN: node has got its IP address and tries to establish TCP connect with parent. MESH_ONLINE_AVAIL: online mesh is available. MESH_ONLINE_AVAIL: online mesh is available. MESH_LOCAL_AVAIL: local mesh is available. 3.1.2.18 uint16_t espconn_mesh_get_sub_dev_count ( ) The function is used to get the number of all the sub nodes of current node. null. the number of sub nodes

3.1 mesh APIs 13 3.1.2.19 bool espconn_mesh_get_usr_data ( mesh_header_format head, usr_data, uint16_t data_len ) The function is used to get user data in mesh packet..

14 Module Documentation uint16_t mesh_header_format head : mesh packet header usr_data : user data data_len : length of user data 3.1.2.20 bool espconn_mesh_get_usr_data_proto ( mesh_header_format head, enum mesh_usr_proto_type proto ) The function is used to get protocol used by user data in mesh packet. enum mesh_header_format head : mesh packet header mesh_usr_proto_type proto : protocol of user data 3.1.2.21 bool espconn_mesh_group_id_init ( grp_id, uint16_t gid_len ) The function is used to init group id for mesh node. 1. The API should be called before enable mesh. 2. The current group id length must be 6. uint16_t grp_id : group id gid_len : length of group id 3.1.2.22 espconn_mesh_layer ( ip_addr ip ) The function is used to get current max hop of mesh network. 1. If ip is not local IP address, the layer will be one.. 2. ip should not be NULL. If the ip is NULL, the layer will be one.

3.1 mesh APIs 15 ip_addr ip : IP address hop away from router 3.1.2.23 bool espconn_mesh_local_addr ( ip_addr ip ) Check whether the IP address is mesh local IP address or not. 1. The range of mesh local IP address is 2.255.255. max_hop.255.255.. 2. IP pointer should not be NULL. If the IP pointer is NULL, it will return false. ip_addr ip : IP address true : the IP address is mesh local IP address false : the IP address is not mesh local IP address 3.1.2.24 void espconn_mesh_print_ver ( ) The function is used to print version of mesh. null. null. 3.1.2.25 bool espconn_mesh_regist_conn_ready_cb ( espconn_mesh_usr_callback cb ) The function is used to register user callback. If TCP connection with parent node is ready, mesh will call the user callback.. espconn_ - mesh_usr_ - callback cb : user callback function

16 Module Documentation 3.1.2.26 bool espconn_mesh_regist_usr_cb ( espconn_mesh_usr_callback cb ) The function is used to register user callback. If child node joins parent, parent will trigger the callback to indicate user. /

3.1 mesh APIs 17 espconn_ - mesh_usr_ - callback cb : user callback function 3.1.2.27 void espconn_mesh_release_congest ( ) TThe function is used to discard all the packet to parent. null. null. 3.1.2.28 void espconn_mesh_scan ( mesh_scan_para_type para ) The function is used to scan AP around current node. 1. user can scan all the AP or mesh node AP. 2. If you plan to scan all the AP, please clear grp_id and grp_set in para. 3. If you just plan to scan mesh node AP, you should set grp_id and grp_set in para. mesh_scan_para_type para : parameter of scan null. 3.1.2.29 int8_t espconn_mesh_sent ( espconn usr_esp, uint8 pdata, uint16 len ) Send data through mesh network. Please call espconn_mesh_sent after espconn_sent_callback of the pre-packet. espconn usr_esp : the network connection ure

18 Module Documentation uint8 uint16 pdata : pointer of data len : data length 0 : succeed Non-0 : error code ESPCONN_MEM - out of memory ESPCONN_ARG - illegal argument, can't find the corresponding network transmission according to ure espconn ESPCONN_MAXNUM - buffer of sending data is full ESPCONN_IF - send UDP data fail 3.1.2.30 bool espconn_mesh_server_init ( ip_addr ip, uint16_t port ) The function is used to set server ip and port for mesh node. 1. The API should be called before enable mesh. uint16_t ip_addr ip : IP address port : port 3.1.2.31 bool espconn_mesh_set_dst_addr ( mesh_header_format head, dst_addr ) The function is used to set destination address of mesh packet. mesh_header_format head : mesh packet header dst_addr : destination address 3.1.2.32 bool espconn_mesh_set_max_hops ( max_hops ) The function is used to set max_hops for mesh network.. 1. The API should be called before enable mesh.

3.1 mesh APIs 19 max_hops : max hops of mesh network 3.1.2.33 bool espconn_mesh_set_router ( station_config router ) The function is used to set router AP information for mesh node. 1. The API should be called before enable mesh.. station_config router : router AP information (ssid, password, bssid (optional)) 3.1.2.34 bool espconn_mesh_set_scan_retries ( retries ) The function is used to set scan retries if no available AP to been found. 1. If no available AP mesh node, the scan retries will works. 2. If retries should be larger than zero (zero will be failed). 3. One scan will take about 15 retries seconds at most. If retries is 2, the scan will take 30 seconds at most. retries : scan retry count 3.1.2.35 bool espconn_mesh_set_src_addr ( mesh_header_format head, src_addr ) The function is used to set source address of mesh packet. mesh_header_format head : mesh packet header

20 Module Documentation src_addr : source address 3.1.2.36 bool espconn_mesh_set_ssid_prefix ( prefix, prefix_len ) The function is used to set SSID prefix for mesh AP. 1. The API should be called before enable mesh. prefix : prefix of SSID prefix_len : length of prefix 3.1.2.37 bool espconn_mesh_set_usr_data ( mesh_header_format head, usr_data, uint16_t data_len ) The function is used to set user data in mesh packet.. uint16_t mesh_header_format head : mesh packet header usr_data : user data data_len : length of user data 3.1.2.38 bool espconn_mesh_set_usr_data_proto ( mesh_header_format head, enum mesh_usr_proto_type proto ) The function is used to set protocol used by user data in mesh packet. enum mesh_header_format head : mesh packet header mesh_usr_proto_type proto : protocol of user data 3.1.2.39 void espconn_mesh_setup_timer ( os_timer_t timer, uint32_t time, os_timer_func_t cb, void arg, bool repeat ) The function is used setup timer with callback function.

3.1 mesh APIs 21 os_timer_t uint32_t os_timer_func - _t void bool timer : timer time: timeout time cb : callback function arg : argment repeat: repeat flag null.

22 Module Documentation

Chapter 4 Data Structure Documentation 4.1 mesh_header_format Struct Reference Data Fields ver:2 oe: 1 cp: 1 cr: 1 rsv:3 { d: 1 p2p:1 protocol:6 } proto uint16_t len dst_addr [ESP_MESH_ADDR_LEN] src_addr [ESP_MESH_ADDR_LEN] mesh_header_option_header_type option [0] 4.1.1 Field Documentation 4.1.1.1 cp piggyback congest permit in packet 4.1.1.2 cr piggyback congest request in packet 4.1.1.3 d direction, 1:upwards, 0:downwards 4.1.1.4 dst_addr[esp_mesh_addr_len] destination address

24 Data Structure Documentation 4.1.1.5 uint16_t len packet total length (include mesh header) 4.1.1.6 oe option flag 4.1.1.7 mesh_header_option_header_type option[0] mesh option 4.1.1.8 p2p node to node packet 4.1.1.9 protocol protocol used by user data; 4.1.1.10 rsv reserved 4.1.1.11 src_addr[esp_mesh_addr_len] source address 4.1.1.12 ver version of mesh The documentation for this was generated from the following file: include/espressif/mesh.h 4.2 mesh_header_option_format Struct Reference Data Fields otype olen ovalue [0] 4.2.1 Field Documentation 4.2.1.1 olen current option length

4.3 mesh_header_option_frag_format Struct Reference 25 4.2.1.2 otype option type 4.2.1.3 ovalue[0] option value The documentation for this was generated from the following file: include/espressif/mesh.h 4.3 mesh_header_option_frag_format Struct Reference Data Fields uint16_t id { uint16_t resv:1 uint16_t mf:1 uint16_t idx:14 } offset 4.3.1 Field Documentation 4.3.1.1 uint16_t id identify of fragment 4.3.1.2 uint16_t idx fragment offset 4.3.1.3 uint16_t mf more fragment 4.3.1.4 uint16_t resv reserved The documentation for this was generated from the following file: include/espressif/mesh.h 4.4 mesh_header_option_header_type Struct Reference Data Fields uint16_t ot_len mesh_header_option_format olist [0]

26 Data Structure Documentation 4.4.1 Field Documentation 4.4.1.1 mesh_header_option_format olist[0] option list 4.4.1.2 uint16_t ot_len option total length The documentation for this was generated from the following file: include/espressif/mesh.h 4.5 mesh_scan_para_type Struct Reference Data Fields espconn_mesh_scan_callback usr_scan_cb grp_id [ESP_MESH_GROUP_ID_LEN] bool grp_set 4.5.1 Field Documentation 4.5.1.1 grp_id[esp_mesh_group_id_len] group id 4.5.1.2 bool grp_set group set 4.5.1.3 espconn_mesh_scan_callback usr_scan_cb scan done callback The documentation for this was generated from the following file: include/espressif/mesh.h 4.6 mesh_sub_node_info Struct Reference Data Fields uint16_t sub_count mac [ESP_MESH_ADDR_LEN] 4.6.1 Field Documentation 4.6.1.1 mac[esp_mesh_addr_len] mac address of child

4.6 mesh_sub_node_info Struct Reference 27 4.6.1.2 uint16_t sub_count the count of sub-node The documentation for this was generated from the following file: include/espressif/mesh.h

28 Data Structure Documentation