Hello,
Is there a way to multicast messages from BLE client to multiple servers? I know mesh does the same job but we are exploring a possibility to do the same using standard BLE SDK.
Regards.
Hello,
Is there a way to multicast messages from BLE client to multiple servers? I know mesh does the same job but we are exploring a possibility to do the same using standard BLE SDK.
Regards.
The only sort of multicast in BLE is advertisement, which really doesn't work well with transferring data if it is more than 31 bytes. Also, it doesn't have any sort of Acking.
So if you want to transfer the same data to many devices, you have to send it to all your connections separately.
BR,
Edvin
We have a client (a mobile device running an app) and multiple servers (with nRF52840 chips). The client is sending commands to servers to perform certain tasks. The data is mostly less than 31 bytes. Is it possible that mobile "advertise" this data to nodes? How reliable the communication will be compared to a GATT connection.
A GATT Connection has Acknowledgements, and retransmissions if the packet is lost on air. Advertisements doesn't have this, and typically phones doesn't allow you to scan 100% of the time either. So the reliability of advertisements reaching the phones depends heavily on how long (how many times) you advertise with the same message, the advertising interval of the peripheral and the scan settings on the phone (which you do not have full access to).
Can a central device broadcast the advertisement messages? Or it has to be a peripheral and central only listens to the packets?
Edvin said:A GATT Connection has Acknowledgements, and retransmissions if the packet is lost on air. Advertisements doesn't have this, and typically phones doesn't allow you to scan 100% of the time either. So the reliability of advertisements reaching the phones depends heavily on how long (how many times) you advertise with the same message, the advertising interval of the peripheral and the scan settings on the phone (which you do not have full access to).
I don't think the type of broadcast you are looking for is possible in BLE.
Aftab said:Can a central device broadcast the advertisement messages? Or it has to be a peripheral and central only listens to the packets?
A central can advertise, if that is what you are asking, but then the advertisements are as a peripheral/advertiser role. Any device can scan and advertise, but it is not reliable for data transfer.
One case where it can be applied:
You have a temperature sensor, and this device can advertise the current temperature in it's advertisements.
One case where it will not work:
You want to transfer a file that is too large to fit in an advertisement. The reason this doesn't work is that you would need to update the advertising data, but you don't know if/when the scanner has received the advertising packet, and when it is safe to update to the next advertising packet containing the next dataset. You can of course wait some seconds before you update, but that would be very slow.
What you can do is to send the data that you want to send to all connected devices. Something like this (pseudo code):
static void send_to_all(uint8_t *data) { for (int i=0; i< connected_devices; i++) { send_data(data, connected_device[i]); } }
Edvin said:A GATT Connection has Acknowledgements, and retransmissions if the packet is lost on air. Advertisements doesn't have this, and typically phones doesn't allow you to scan 100% of the time either. So the reliability of advertisements reaching the phones depends heavily on how long (how many times) you advertise with the same message, the advertising interval of the peripheral and the scan settings on the phone (which you do not have full access to).
I don't think the type of broadcast you are looking for is possible in BLE.
Aftab said:Can a central device broadcast the advertisement messages? Or it has to be a peripheral and central only listens to the packets?
A central can advertise, if that is what you are asking, but then the advertisements are as a peripheral/advertiser role. Any device can scan and advertise, but it is not reliable for data transfer.
One case where it can be applied:
You have a temperature sensor, and this device can advertise the current temperature in it's advertisements.
One case where it will not work:
You want to transfer a file that is too large to fit in an advertisement. The reason this doesn't work is that you would need to update the advertising data, but you don't know if/when the scanner has received the advertising packet, and when it is safe to update to the next advertising packet containing the next dataset. You can of course wait some seconds before you update, but that would be very slow.
What you can do is to send the data that you want to send to all connected devices. Something like this (pseudo code):
static void send_to_all(uint8_t *data) { for (int i=0; i< connected_devices; i++) { send_data(data, connected_device[i]); } }