This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I get the number of nodes (or devices) in the mesh network?

Hi there.

This is my first time to utilize BLE mesh of NRF5.

I just wonder that the library supports getting the number of nodes in the mesh network.

When utilizing the ble central and ble peripheral, getting rssi or physical address can be easily done

by using library for example, sd_ble_gap_rssi_get(m_conn_handle,&p_rssi,&p_ch_index)

Is there a fuction getting the number of existing nodes in the mesh network?

Parents Reply Children
  • Thanks, BinderT

    As you stated, I understand that only the provisioned device in the mesh network knows which devices have been configured into the mesh network.

    Then, which function or structure includes the number of devices?

    /**
     * Retrieves stored device state manager configuration.
     * The number of provisioned devices is calculated from the number of device keys stored. The device
     * key for each server is stored on provisioning complete in the `provisioner_prov_complete_cb()`.
     *
     * @returns Number of provisioned devices.
     */
    static uint16_t provisioned_device_handles_load(void)
    {
        uint16_t provisioned_devices = 0;
    }

    I was not able to find the function provisioned_device_handles_load(void) in the mesh example and

    the code above seems returns 0 all the time. 

  • Hi,

    You can find the number of devices provisioned in this struct: network_stats_data_stored_t.

    /** Structure to store the state of the provisioning process of the network nodes */
    typedef struct
    {
        uint16_t provisioned_devices;
        uint16_t configured_devices;
        uint16_t last_device_address;
        uint16_t next_device_address;
        const char * p_client_uri;
    
        uint8_t  netkey[NRF_MESH_KEY_SIZE];
        uint8_t  appkey[NRF_MESH_KEY_SIZE];
        uint8_t  self_devkey[NRF_MESH_KEY_SIZE];
    } network_stats_data_stored_t;
    
    #endif /* NETWORK_SETUP_H__ */

  • Thanks Mttrinh

    To my knowledge, only provisioner can know how many nodes and states of nodes in a network whereas provisionee can't.

    Then, Is it possible to make single device works as provisonee and provisioner at the same time?

    In my guess there is two categories in the nodes; provisioner and provisionee(the client and server in the light_switch example and the beaconing in the beaconing example).

    Thanks.

    For your information, I'd like to inform you our background.

    We' d like to install multiple BLE device of the same type in specific zones. Since it is hard to check whether each device is working by pairing individually, we' d like to use BLE mesh for checking it.
    Our idea is simple. If we install five devices in the same space, we periodically check the number of the nodes in the network for maintenance. If one of the devices are broken or runned out of its internal battery, the number of the nodes will change. Due to operational limitation, same types of devices can be installed in a zone rather than multiple kinds of devices.  

  • Hi,

    Yes, only the provisioner know how many nodes there is in the network. It is possible to have a single device be both a provisioner and a provisonee. We had an example where we combined the provsioner with client in Mesh SDK v1.0.1. I assume you want to combine them so that the node knows how many nodes there are in the network?

    I would suggest you have a look at the Heartbeat message for your use-case. It can be used to supervise the network. Heartbeat messages are transmitted by nodes periodically. A heartbeat message indicates to other nodes in the network that the node sending the heartbeat is still active. Also have a look at this post, it is a good starting point.

Related