Able to connect to multiple iOS devices via Bluetooth, working as 1 master and 4 slave devices.
Data transfers from central to peripheral through the following code
[peripheral.peripheral writeValue:currentData forCharacteristic:peripheral.characteristic type:CBCharacteristicWriteWithoutResponse];
But this made hugs data loss, but was faster.
then tried with the following code for not losing data
[peripheral.peripheral writeValue:currentData forCharacteristic:peripheral.characteristic type:CBCharacteristicWriteWithResponse];
Trying to transfer data to multiple peripheral at a same time (concurrently)
for (Peripheral * peripheral in self.connectedPeripherals) {
[peripheral.peripheral writeValue:currentData forCharacteristic:peripheral.characteristic type:CBCharacteristicWriteWithResponse];
}
Data transfers one by one it seems like a delay once 1st peripheral is received the data then 2nd peripheral gets the data and go on.
Want to transfer data simultaneously and reflect at same time to all the peripherals.
When you transfer data with response, you have to wait for the acknowledgement of its receipt each time you send a packet. When you transfer data without response, the acknowledgement is not being sent back, so the throughput is higher. However, as you correctly point out, when transferring data without response there can be data loss. This data loss happens because of the overflow of internal iOS buffer that holds the data between your call to - writeValue:forCharacteristic:type:
and its actual departure. If you want to prevent data loss, you can do either of the following things.
- writeValue:forCharacteristic:type:
, you'll definitely face data loss.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.