Mwifi API

Mwifi (Wi-Fi Mesh) is the encapsulation of ESP-WIFI-MESH APIs, and it adds to ESP-WIFI-MESH the retransmission filter, data compression, fragmented transmission, and P2P multicast features.

Features

  1. Retransmission filter: As ESP-WIFI-MESH won’t perform data flow control when transmitting data downstream, there will be redundant fragments in case of unstable network or wireless interference. For this, Mwifi adds a 16-bit ID to each fragment, and the redundant fragments with the same ID will be discarded.
  2. Fragmented transmission: When the data packet exceeds the limit of the maximum packet size, Mwifi splits it into fragments before they are transmitted to the target device for reassembly.
  3. Data compression: When the packet of data is in Json and other similar formats, this feature can help reduce the packet size and therefore increase the packet transmitting speed.
  4. P2P multicast: As the multicasting in ESP-WIFI-MESH may cause packet loss, Mwifi uses a P2P (peer-to-peer) multicasting method to ensure a much more reliable delivery of data packets.

Writing Applications

Mwifi supports using ESP-WIFI-MESH under self-organized mode, where only the root node that serves as a gateway of Mesh network can require the LwIP stack to transmit/receive data to/from an external IP network.

Mwifi also supports the way to fix the root node. In this case, the nodes in the entire ESP-WIFI-MESH network cannot communicate with the external IP network through wifi. If you need to communicate with the external IP network, you need to use other methods.

If you want to call Wi-Fi API to connect/disconnect/scan, please pause Mwifi first. Self organized networking must be disabled before the application calls any Wi-Fi driver APIs.

Initialization

Wi-Fi Initialization

Prior to the use of Mwifi, Wi-Fi must be initialized. esp_wifi_set_ps (indicates whether Mesh network enters into sleep mode) and esp_mesh_set_6m_rate (indicates the minimum packet transmittig speed) must be set before esp_wifi_start.

The following code snippet demonstrates how to initialize Wi-Fi.

wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();

MDF_ERROR_ASSERT(nvs_flash_init());

tcpip_adapter_init();
MDF_ERROR_ASSERT(esp_event_loop_init(NULL, NULL));
MDF_ERROR_ASSERT(esp_wifi_init(&cfg));
MDF_ERROR_ASSERT(esp_wifi_set_storage(WIFI_STORAGE_RAM));
MDF_ERROR_ASSERT(esp_wifi_set_mode(WIFI_MODE_STA));
MDF_ERROR_ASSERT(esp_wifi_set_ps(WIFI_PS_NONE));
MDF_ERROR_ASSERT(esp_mesh_set_6m_rate(false));
MDF_ERROR_ASSERT(esp_wifi_start());

Mwifi Initialization

In general, you don’t need to modify Mwifi and just use its default configuration. But if you want to modify it, you may use make menuconfig. See the detailed configuration below:

  1. ROOT

    Parameters Description
    vote_percentage Vote percentage threshold above which the node becoms a root
    vote_max_count Max multiple voting each device can have for the self-healing of a MESH network
    backoff_rssi RSSI threshold below which connections to the root node are not allowed
    scan_min_count The minimum number of times a device should scan the beacon frames from other devices before it becomes a root node
    root_conflicts_enable Allow more than one root in one network
    root_healing_ms Time lag between the moment a root node is disconnected from the network and the moment the devices start electing another root node
  2. Capacity
    Parameters Description
    capacity_num Network capacity, defining max number of devices allowed in the MESH network
    max_layer Max number of allowed layers
    max_connection Max number of MESH softAP connections
  3. Stability
    Parameters Description
    assoc_expire_ms Period of time after which a MESH softAP breaks its association with inactive leaf nodes
    beacon_interval_ms Mesh softAP beacon interval
    passive_scan_ms Mesh station passive scan duration
    monitor_duration_ms Period (ms) for monitoring the parent’s RSSI. If the signal stays weak throughout the period, the node will find another parent offering more stable connection
    cnx_rssi RSSI threshold above which the connection with a parent is considered strong
    select_rssi RSSI threshold for parent selection. Its value should be greater than SWITCH_RSSI
    switch_rssi RSSI threshold below which a node selects a parent with better RSSI
    attempt_count Parent selection fail times, if the scan times reach this value, device will disconnect with associated children and join self-healing
    monitor_ie_count Allowed number of changes a parent node can introduce into its information element (IE), before the leaf nodes must update their own IEs accordingly
  4. Transmission
    Parameters Description
    xon_qsize Number of MESH buffer queues
    retransmit_enable Enable retransmission on mesh stack
    data_drop_enable If a root is changed, enable the new root to drop the previous packet

The following code snippet demonstrates how to initialize Mwifi.

/*  Mwifi initialization */
wifi_init_config_t cfg = MWIFI_INIT_CONFIG_DEFAULT();
MDF_ERROR_ASSERT(mwifi_init(&cfg));

Configuration

The modified Mwifi configuration will only be effective after Mwifi is rebooted.

You may configure Mwifi by using the struct mwifi_config_t. See the configuration parameters below:

Parameters Description
router_ssid SSID of the router
router_password Router password
router_bssid BSSID is equal to the router’s MAC address. This field must be configured if more than one router shares the same SSID. You can avoid using BSSIDs by setting up a unique SSID for each router. This field must also be configured if the router is hidden
mesh_id Mesh network ID. Nodes sharing the same MESH ID can communicate with one another
mesh_password Password for secure communication between devices in a MESH network
mesh_type Only MESH_IDLE, MESH_ROOT, and MESH_NODE device types are supported. MESH_ROOT and MESH_NODE are only used for routerless solutions
channel Mesh network and the router will be on the same channel
channel_switch_disable If this value is not set, when “attempt” (mwifi_init_config_t) times is reached, device will change to a full channel scan for a network that could join.
router_switch_disable If the BSSID is specified and this value is not also set, when the router of this specified BSSID fails to be found after “attempt” (mwifi_init_config_t) times, the whole network is allowed to switch to another router with the same SSID.

The following code snippet demonstrates how to configure Mwifi.

mwifi_config_t config = {
    .router_ssid     = CONFIG_ROUTER_SSID,
    .router_password = CONFIG_ROUTER_PASSWORD,
    .mesh_id         = CONFIG_MESH_ID,
    .mesh_password   = CONFIG_MESH_PASSWORD,
    .mesh_type       = CONFIG_MESH_TYPE,
    .channel         = CONFIG_ROUTER_CHANNEL,
};

MDF_ERROR_ASSERT(mwifi_set_config(&config));

Start Mwifi

After starting Mwifi, the application should check for Mwifi events to determine when it has connected to the network.

  1. MDF_EVENT_MWIFI_ROOT_GOT_IP: the root node gets the IP address and can communicate with the external network;
  2. MDF_EVENT_MWIFI_PARENT_CONNECTED: connects with the parent node for data communication between devices.
MDF_ERROR_ASSERT(mdf_event_loop_init(event_loop_cb));
MDF_ERROR_ASSERT(mwifi_start());

Application Examples

For ESP-MDF examples, please refer to the directory function_demo/mwifi, which includes:

  • Connect to the external network: This can be achieved by the root node via TCP.
  • Routerless: It involves a fixed root node which communicates with the external devices via UART.
  • MQTT example: Implement each node to communicate with the MQTT broker by the root node via MQTT.
  • Channel switching: When the router channel changes, Mesh switches its channel accordingly.(In development)
  • Low power consumption: The leaf nodes stop functioning as softAP and enter into sleep mode.(In development)

API Reference

Functions

esp_err_t esp_wifi_vnd_mesh_get(mesh_assoc_t *mesh_assoc, mesh_chain_layer_t *mesh_chain)

Get mesh networking IE.

Return
  • ESP_OK
  • ESP_FAIL
Parameters
  • mesh_assoc: pointer mesh networking IE.
  • mesh_chain: pointer mesh chain layer infomation.

mdf_err_t mwifi_init(const mwifi_init_config_t *config)

Mwifi initialization.

Attention
1. This API should be called after WiFi is started.
Attention
2. This API must be called before all other Mwifi API can be called.
Attention
3. Always use WIFI_INIT_CONFIG_DEFAULT macro to init the config to default values, this can guarantee all the fields got correct value when more fields are added into wifi_init_config_t in future release. If you want to set your owner initial values, overwrite the default values which are set by WIFI_INIT_CONFIG_DEFAULT.
Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_INIT
  • MDF_ERR_MWIFI_INITED
Parameters
  • config: Mwifi initialization configuration.

mdf_err_t mwifi_deinit(void)

Deinit mwifi Free all resource allocated in mwifi_init and stop Mwifi task.

Attention
This API should be called if you want to remove Mwifi from the system.
Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_INIT

mdf_err_t mwifi_set_init_config(const mwifi_init_config_t *init_config)

Set Mwifi configuration.

Attention
This API shall be called between esp_mesh_init() and esp_mesh_start().
Return
  • MDF_OK
  • MDF_ERR_MWIFI_ARGUMENT
Parameters
  • init_config: Use MWIFI_INIT_CONFIG_DEFAULT() to initialize the default values.

mdf_err_t mwifi_get_init_config(mwifi_init_config_t *init_config)

Get Mwifi init configuration.

Return
[description]
Parameters
  • init_config: pointer to Mwifi init configuration.

mdf_err_t mwifi_set_config(const mwifi_config_t *config)

Set the configuration of the AP.

Attention
This API shall be called between esp_mesh_init() and esp_mesh_start().
Return
  • MDF_OK
  • MDF_ERR_MWIFI_ARGUMENT
Parameters
  • config: pointer to AP configuration

mdf_err_t mwifi_get_config(mwifi_config_t *config)

Get the configuration of the AP.

Return
  • MDF_OK
  • MDF_ERR_MWIFI_ARGUMENT
Parameters
  • config: pointer to AP configuration

mdf_err_t mwifi_start(void)

Start Mwifi according to current configuration.

Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_INIT

mdf_err_t mwifi_stop(void)

Stop mwifi.

Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_INIT

mdf_err_t mwifi_restart()

restart mwifi

Attention
This API should be called when the Mwifi configuration is modified.
Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_INIT

bool mwifi_is_started(void)

whether wifi_mesh is running

Return
  • true
  • flase

bool mwifi_is_connected(void)

Whether the node is already connected to the parent node.

Return
  • true
  • flase

void mwifi_print_config()

Print mesh configuration information.

mdf_err_t mwifi_write(const uint8_t *dest_addrs, const mwifi_data_type_t *data_type, const void *data, size_t size, bool block)

Send a packet to any node in the mesh network.

Attention
1. If data encryption is enabled, you must ensure that the task that calls this function is greater than 4KB.
  1. When sending data to the root node, if the destination address is NULL, the root node receives it using mwifi_root_read(). If the destination address is the mac address of the root node or MWIFI_ADDR_ROOT, the root node receives it using mwifi_read()
Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_START
Parameters
  • dest_addrs: The address of the final destination of the packet If the packet is to the root and “dest_addr” parameter is NULL
  • data_type: The type of the data If the default configuration is used, this parameter is NULL
  • data: Pointer to a sending wifi mesh packet
  • size: The length of the data
  • block: Whether to block waiting for data transmission results

mdf_err_t __mwifi_read(uint8_t *src_addr, mwifi_data_type_t *data_type, void *data, size_t *size, TickType_t wait_ticks, uint8_t type)

Receive a packet targeted to self over the mesh network.

Attention
Judging the allocation of buffers by the type of the parameter ‘data’ The memory of data is externally allocated, and the memory is larger than the total length expected to be received. The memory of data is allocated internally by mwifi_read, which needs to be released after the call.
Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_START
  • ESP_ERR_MESH_ARGUMENT
  • ESP_ERR_MESH_NOT_START
  • ESP_ERR_MESH_TIMEOUT
  • ESP_ERR_MESH_DISCARD
Parameters
  • src_addr: The address of the original source of the packet
  • data_type: The type of the data
  • data: Pointer to the received mesh packet To apply for buffer space externally, set the type of the data parameter to be (char *) or (uint8_t *) To apply for buffer space internally, set the type of the data parameter to be (char **) or (uint8_t **)
  • size: A non-zero pointer to the variable holding the length of out_value. In case out_value is not zero, will be set to the actual length of the value written.
  • wait_ticks: Wait time if a packet isn’t immediately available
  • type: Buffer space when reading data

mdf_err_t mwifi_root_write(const uint8_t *dest_addrs, size_t dest_addrs_num, const mwifi_data_type_t *data_type, const void *data, size_t size, bool block)

The root sends a packet to the device in the mesh.

Attention
1. If data encryption is enabled, you must ensure that the task that calls this function is greater than 8KB
  1. This API is only used at the root node
  2. Can send data to multiple devices at the same time
  3. Packets are only transmitted down
Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_START
  • ESP_ERR_MESH_ARGUMENT
  • ESP_ERR_MESH_NOT_START
  • ESP_ERR_MESH_DISCONNECTED
  • ESP_ERR_MESH_OPT_UNKNOWN
  • ESP_ERR_MESH_EXCEED_MTU
  • ESP_ERR_MESH_NO_MEMORY
  • ESP_ERR_MESH_TIMEOUT
  • ESP_ERR_MESH_QUEUE_FULL
  • ESP_ERR_MESH_NO_ROUTE_FOUND
  • ESP_ERR_MESH_DISCARD
Parameters
  • dest_addrs: The address of the final destination of the packet
  • dest_addrs_num: Number of destination addresses
  • data_type: The type of the data
  • data: Pointer to a sending wifi mesh packet
  • size: The length of the data
  • block: Whether to block waiting for data transmission results

mdf_err_t __mwifi_root_read(uint8_t *src_addr, mwifi_data_type_t *data_type, void *data, size_t *size, TickType_t wait_ticks, uint8_t type)

receive a packet targeted to external IP network root uses this API to receive packets destined to external IP network root forwards the received packets to the final destination via socket. This API is only used at the root node

Attention
1. This API is only used at the root node
  1. Judging the allocation of buffers by the type of the parameter ‘data’ The memory of data is externally allocated, and the memory is larger than the total length expected to be received. The memory of data is allocated internally by mwifi_read, which needs to be released after the call.
Return
  • MDF_OK
  • MDF_ERR_MWIFI_NOT_START
  • ESP_ERR_MESH_ARGUMENT
  • ESP_ERR_MESH_NOT_START
  • ESP_ERR_MESH_TIMEOUT
  • ESP_ERR_MESH_DISCARD
Parameters
  • src_addr: the address of the original source of the packet
  • data_type: the type of the data
  • data: Pointer to the received mesh packet To apply for buffer space externally, set the type of the data parameter to be (char *) or (uint8_t *) To apply for buffer space internally, set the type of the data parameter to be (char **) or (uint8_t **)
  • size: The length of the data
  • wait_ticks: wait time if a packet isn’t immediately available(0:no wait, portMAX_DELAY:wait forever)
  • type: Buffer space when reading data

mdf_err_t mwifi_post_root_status(bool status)

Post the toDS state to the mesh stack, Usually used to notify the child node, whether the root is successfully connected to the server.

Attention
This API is only for the root.
Return
  • ESP_OK
  • ESP_FAIL
Parameters
  • status: this state represents whether the root is able to access external IP network

bool mwifi_get_root_status()

Get the toDS state from the mesh stack, Whether the root is successfully connected to the server.

Return
  • true
  • flase

int8_t mwifi_get_parent_rssi()

Get the RSSI of the parent node.

Return
RSSI of the parent_cplusplus MWIFI_H

Structures

struct mwifi_init_config_t

Mwifi initialization configuration.

Public Members

uint8_t vote_percentage

Mesh root configuration.

Vote percentage threshold above which the node becoms a root

uint8_t vote_max_count

Max multiple voting each device can have for the self-healing of a MESH network

int8_t backoff_rssi

RSSI threshold below which connections to the root node are not allowed

uint8_t scan_min_count

Minimum scan times before being a root

bool root_conflicts_enable

Allow more than one root in one network

uint16_t root_healing_ms

Time lag between the moment a root node is disconnected from the network and the moment the devices start electing another root node

uint16_t capacity_num

Mesh network capacity configuration.

Network capacity, defining max number of devices allowed in the MESH network

uint8_t max_layer_deprecated

Deprecated, shouldn’t use it

uint8_t max_connection

Max number of MESH softAP connections

uint16_t assoc_expire_ms

Mesh network stability configuration.

Period of time after which a MESH softAP breaks its association with inactive leaf nodes

uint16_t beacon_interval_ms

Mesh softAP beacon interval

uint16_t passive_scan_ms

Mesh station passive scan duration

uint16_t monitor_duration_ms

Period (ms) for monitoring the parent’s RSSI. If the signal stays weak throughout the period, the node will find another parent offering more stable connection

int8_t cnx_rssi

RSSI threshold above which the connection with a parent is considered strong

int8_t select_rssi

RSSI threshold for parent selection. Its value should be greater than switch_rssi

int8_t switch_rssi

RSSI threshold below which a node selects a parent with better RSSI

uint8_t attempt_count

Parent selection fail times, if the scan times reach this value, device will disconnect with associated children and join self-healing

uint8_t monitor_ie_count

Allowed number of changes a parent node can introduce into its information element (IE), before the leaf nodes must update their own IEs accordingly

uint8_t xon_qsize

Mesh network data transmission configuration.

Number of MESH buffer queues

bool retransmit_enable

Enable a source node to retransmit data to the node from which it failed to receive ACK

bool data_drop_enable

If a root is changed, enable the new root to drop the previous packet

uint16_t max_layer

Max number of allowed layers

uint8_t topology

Topology of mesh network, can be tree or chain

struct mwifi_config_t

Mwifi AP configuration.

Public Members

char router_ssid[32]

Information about the router connected to the root. This item does not need to be set in the routerless scheme.

SSID of the router

char router_password[64]

Password of router

uint8_t router_bssid[6]

BSSID, if this value is specified, users should also specify “router_switch_disable”

uint8_t mesh_id[6]

Information about the mesh internal connected.

Mesh network ID. Nodes sharing the same MESH ID can communicate with one another

char mesh_password[64]

Password for secure communication between devices in a MESH network

mwifi_node_type_t mesh_type

Only MWIFI_MESH_IDLE, MWIFI_MESH_ROOT, MWIFI_MESH_NODE and MWIFI_MESH_LEAF device types are supported. Routerless solutions must be configured as MWIFI_MESH_ROOT or MWIFI_MESH_NODE MWIFI_MESH_IDLE: The node type is selected by MESH according to the network conditions. MWIFI_MESH_ROOT: The Device is the root node MWIFI_MESH_NODE: The device is a non-root node and contains intermediate nodes and leaf nodes. MWIFI_MESH_LEAF: The device is a leaf node, closes the softap, and is used in a low-power solutions.

uint8_t channel

Channel, mesh and router will be on the same channel

uint8_t channel_switch_disable

If this value is not set, when “attempt” (mwifi_init_config_t) times is reached, device will change to a full channel scan for a network that could join.

uint8_t router_switch_disable

If the BSSID is specified and this value is not also set, when the router of this specified BSSID fails to be found after “attempt” (mwifi_init_config_t) times, the whole network is allowed to switch to another router with the same SSID. The new router might also be on a different channel. There is a risk that if the password is different between the new switched router and the previous one, the mesh network could be established but the root will never connect to the new switched router.

struct mwifi_data_type_t

Mwifi packet type.

Public Members

bool compression

Enable data compression. If the data sent is json format or string, use data compression to increase the data transmission rate.

bool upgrade

Upgrade packet flag

uint8_t communicate

Mesh data communication method, There are three types: MWIFI_COMMUNICATE_UNICAST, MWIFI_COMMUNICATE_MULTICAST, MWIFI_COMMUNICATE_BROADCAST

bool group

Send a package as a group

uint8_t reserved

reserved

uint8_t protocol

Type of transmitted application protocol

uint32_t custom

Type of transmitted application data

Macros

MWIFI_PAYLOAD_LEN

< _cplusplus Max payload size(in bytes)

MWIFI_ADDR_LEN

Length of MAC address

MWIFI_ADDR_NONE
MWIFI_ADDR_ROOT
MWIFI_ADDR_ANY

All node in the mesh network

MWIFI_ADDR_BROADCAST

Other node except the root

MWIFI_ADDR_IS_EMPTY(addr)
MWIFI_ADDR_IS_ANY(addr)
MWIFI_ADDR_IS_BROADCAST(addr)
MDF_ERR_MWIFI_NOT_INIT

Mwifi error code definition.

Mwifi isn’t initialized

MDF_ERR_MWIFI_INITED

Mwifi has been initialized

MDF_ERR_MWIFI_NOT_START

Mwifi isn’t started

MDF_ERR_MWIFI_ARGUMENT

Illegal argument

MDF_ERR_MWIFI_EXCEED_PAYLOAD

Packet size exceeds payload

MDF_ERR_MWIFI_TIMEOUT

Timeout

MDF_ERR_MWIFI_DISCONNECTED

Disconnected with parent on station interface

MDF_ERR_MWIFI_NO_CONFIG

Router not configured

MDF_ERR_MWIFI_NO_FOUND

Routes or devices not found

MDF_ERR_MWIFI_NO_ROOT

Routes or devices not found

MDF_EVENT_MWIFI_STARTED

enumerated list of Mwifi event id

Mwifi is started

MDF_EVENT_MWIFI_STOPPED

Mwifi is stopped

MDF_EVENT_MWIFI_CHANNEL_SWITCH

Channel switch

MDF_EVENT_MWIFI_CHILD_CONNECTED

A child is connected on softAP interface

MDF_EVENT_MWIFI_CHILD_DISCONNECTED

A child is disconnected on softAP interface

MDF_EVENT_MWIFI_ROUTING_TABLE_ADD

Routing table is changed by adding newly joined children

MDF_EVENT_MWIFI_ROUTING_TABLE_REMOVE

Routing table is changed by removing leave children

MDF_EVENT_MWIFI_PARENT_CONNECTED

Parent is connected on station interface

MDF_EVENT_MWIFI_PARENT_DISCONNECTED

Parent is disconnected on station interface

MDF_EVENT_MWIFI_NO_PARENT_FOUND

No parent found

MDF_EVENT_MWIFI_LAYER_CHANGE

Layer changes over the Mwifi network

MDF_EVENT_MWIFI_TODS_STATE

State represents if root is able to access external IP network

MDF_EVENT_MWIFI_VOTE_STARTED

The process of voting a new root is started either by children or by root

MDF_EVENT_MWIFI_VOTE_STOPPED

The process of voting a new root is stopped

MDF_EVENT_MWIFI_ROOT_ADDRESS

The root address is obtained. It is posted by Mwifi stack automatically.

MDF_EVENT_MWIFI_ROOT_SWITCH_REQ

Root switch request sent from a new voted root candidate

MDF_EVENT_MWIFI_ROOT_SWITCH_ACK

Root switch acknowledgment responds the above request sent from current root

MDF_EVENT_MWIFI_ROOT_ASKED_YIELD

Root is asked yield by a more powerful existing root.

MDF_EVENT_MWIFI_SCAN_DONE

if self-organized networking is disabled

MDF_EVENT_MWIFI_NETWORK_STATE

network state, such as whether current mesh network has a root.

MDF_EVENT_MWIFI_STOP_RECONNECTION

the root stops reconnecting to the router and non-root devices stop reconnecting to their parents.

MDF_EVENT_MWIFI_FIND_NETWORK

when the channel field in mesh configuration is set to zero, mesh stack will perform a full channel scan to find a mesh network that can join, and return the channel value after finding it.

MDF_EVENT_MWIFI_ROUTER_SWITCH

if users specify BSSID of the router in mesh configuration, when the root connects to another router with the same SSID, this event will be posted and the new router information is attached.

MDF_EVENT_MWIFI_CHANNEL_NO_FOUND

The router’s channel is not set.

MDF_EVENT_MWIFI_ROOT_GOT_IP
MDF_EVENT_MWIFI_ROOT_LOST_IP
MDF_EVENT_MWIFI_EXCEPTION

Some abnormal situations happen, eg. disconnected too many times

CONFIG_MWIFI_ROOT_CONFLICTS_ENABLE

CONFIG_MWIFI_ROOT_CONFLICTS_ENABLE

CONFIG_MWIFI_RETRANSMIT_ENABLE

CONFIG_MWIFI_RETRANSMIT_ENABLE

MWIFI_INIT_CONFIG_DEFAULT()
MWIFI_RSSI_THRESHOUD_DEFAULT()
mwifi_read(src_addr, data_type, data, size, wait_ticks)
mwifi_root_read(src_addr, data_type, data, size, wait_ticks)

Type Definitions

typedef uint8_t mwifi_node_type_t

Enumerations

enum node_type_t

Device type.

Values:

MWIFI_MESH_IDLE

hasn’t joined the mesh network yet

MWIFI_MESH_ROOT

the only sink of the mesh network. Has the ability to access external IP network

MWIFI_MESH_NODE

intermediate device. Has the ability to forward packets over the mesh network

MWIFI_MESH_LEAF

has no forwarding ability

MWIFI_MESH_STA

connect to router with a standlone Wi-Fi station mode, no network expansion capability

enum mwifi_communication_method

Mesh network internal data transmission method.

Values:

MWIFI_COMMUNICATE_UNICAST

Send data by unicast.

MWIFI_COMMUNICATE_MULTICAST

Send data by multicast.

MWIFI_COMMUNICATE_BROADCAST

Send data by broadcast.

enum mwifi_data_memory_t

Buffer space when reading data.

Values:

MWIFI_DATA_MEMORY_MALLOC_INTERNAL = 1

Buffer space is requested by internal when reading data

MWIFI_DATA_MEMORY_MALLOC_EXTERNAL = 2

Buffer space is requested by external when reading data