Bluetooth mesh devices advertises unprovisioned beacons initially, and once it get provisioned properly by a provisioner, then, all the data packets sent will be encrypted and only understandable by other mesh nodes (which have right netkey, appkey,...) in the network. So if you want to use mesh network for IPS then you will have to create an appropriate model and do mesh communication in the network.
Let me clear my question again.
First, can one device role as mesh node (specifically, Generic Location Server model) and simultaneously as non-mesh IPS beacon, or not? If possible, please let me know the proper starting place sample code to begin.
Second, in provisioned mesh network, the only way Generic Location Server can communicate to other node, is by publication, unless I defined another model, am I right?
If you configure the device as a mesh device then it uses mesh beacons to communicate in the network. It can understand only mesh messages if it has valid Keys (netKey, AppKey,...) and packet format.
BLE Mesh usually works on the publish-subscribe mechanism. Special node such as 'proxy node' can establish GATT connection with non-mesh devices who knows how to format the mesh messages correctly.
Please refer BLE MESH spec for more details: https://www.bluetooth.com/specifications/mesh-specifications/
I think your answer means that a device cannot be a dual roles as mesh and non-mesh simulataneously.
1 of 1 people found this helpful
The device indeed can be a mesh node and regular LE device. For your specific case. There are 2 ways to send advertisement packets. The standard way is to use wiced_bt_ble_set_raw_advertisement_data and wiced_bt_start_advertisements. The second is vendor specific multi advertisement. The mesh code uses multi advertisement, so if your application code uses the same, you may step on each other. If you are using standard set/start advertisements there should be no problems. I would take mesh sample which looks close to the device you want to implement. Then merge advertisement code from any LE sample in the SDK (excluding beacon which is using multi advertisement feature).
In my understanding with your comments, I can do wiced_bt_ble_set_raw_advertisement_data/wiced_bt_start_advertisement within mesh-based codes in the position like timer callback. Am I correct?
But, I am still suspicious about the behaviour of mesh application structure. What happens if some non-mesh device sends connection request? Is it received successfully? Or dropped/ignored? Is there a way to handle such a situation in mesh application framework?
Your understanding is correct, the application can use wiced_bt_ble_set_raw_advertisement_data/wiced_bt_start_advertisement at any time. From the Observer perspective, your device will be sending your advertisement packets as well as other advertisement packets required by the BLE mesh logic, for example, the Unprovisioned device beacons, or Secure Network Beacons and/or GATT Proxy advertisements.
It is responsibility of your application to make sure that your logic does not make device a "bad" mesh device. For example, your device may be configured by the Configuration Manager to be a GATT Proxy, i.e. allow phones to connect to the mesh network through your device. If application logic that you are adding requires some other device to be always connected, the GATT Proxy functionality will be affected. It should be ok if there are other GATT Proxies around, but if the device was the only one, it will cause loss of functionality. Another example is when your device is configured to be a Relay. If additional application logic will be sending and receiving a lot of data, the device's ability to receive and relay mesh packets will be affected, so it will be a "bad" relay.
For the code updates, to manage GATT connection, send and receive GATT data please look at the common/libraries/mesh_app_lib/mesh_app_gatt.c. When the code receives connection up/down events, you can call your application. Make sure that your call is in addition and does not replace original calls to the mesh functionality. When there is a GATT Read/Write request you can check if the GATT handle in the request is yours and call only your application if this is the case. I assume that if you need to support connection you will also need to update GATT database which you can find in the same file to add your service/characteristics.
Thank you, Victor.
I'll try your advice.