Radko
Radko

Reputation: 13

Does BLE support pinging?

Is BLE supporting pinging, i.e. sending a message to other devices and receiving their status?

I want to write an app on Android, which will ping each of the nearby devices and calculate the time between sending time and receiving answer, is it possible?

Upvotes: 1

Views: 2226

Answers (2)

SoroushA
SoroushA

Reputation: 2121

You can easily see the timestamp of discovery for each device in your onScanResult method:

@Override
public void onScanResult(int callbackType, ScanResult result){

Long lastSeen = result.getTimestampNanos();
//rest of your code

}

See the Android Documentation. You can use this timestamp and the time that you started your scan to get an approximate response time for each device.

Upvotes: 0

woley
woley

Reputation: 221

As you pointed out in your comment you like to use as time-of-arrival or time-difference-of-arrival algorithm to calculate the distance based on bluetooth.

To my knowledge this is currently more a theoretical approach in a bluetooth environment. As radio signals travel at light speed (~29.979 cm in one nanosecond) you will need a high sampling resolution to get a accurate result. Each nanosecound deviation will cause an error of roughly 30 cm.

With WiFi this is accomplished with a specalized chipset. To my knowledge this is currently not possibile with android as it would need a lot of low level support (Chipset and OS)

Hope this helps!

here are some sources

Upvotes: 3

Related Questions