Does peripheralManager.updateValue Actually Send Data to the Central?

https://developer.apple.com/documentation/corebluetooth/cbperipheralmanager/updatevalue(_:for:onsubscribedcentrals:)

I want to record the timestamp when an iOS peripheral sends data to a central device. Here’s what I did:

let startDate = Date()
if peripheralManager.updateValue(packet, for: characteristic, onSubscribedCentrals: nil) {
let sentTime = Date().timeIntervalSince(startDate)
}

However, the recorded time is nearly 0.1 ms. If I send 244 bytes per update, this suggests a throughput of 2.44 MB/s, which seems too high.

Did I make a mistake, or is updateValue() not actually sending the data at that moment?

Answered by Scott in 830983022

The documentation isn’t explicit about what “send” means but I think it does imply that the operation is asynchronous:

This [return] value is [...] false if the update isn’t successfully sent because the underlying transmit queue is full.

From this I infer that it just attempts to add the data to a fixed-size transmit buffer, while the actual transmission over the air via the Bluetooth stack happens later.

The documentation isn’t explicit about what “send” means but I think it does imply that the operation is asynchronous:

This [return] value is [...] false if the update isn’t successfully sent because the underlying transmit queue is full.

From this I infer that it just attempts to add the data to a fixed-size transmit buffer, while the actual transmission over the air via the Bluetooth stack happens later.

Does peripheralManager.updateValue Actually Send Data to the Central?
 
 
Q