labapart / gattlib

Library to access GATT information from BLE (Bluetooth Low Energy) devices
http://labapart.com/
436 stars 157 forks source link

Frequency decrease in notification example #232

Open FrancoisTeyssere opened 2 years ago

FrancoisTeyssere commented 2 years ago

I'm using the notification example on a BLE sensor streaming a value at 25Hz (I verified this value was correct by other means).

The connection and printing works alright, but when I measure time between two notifications, I'm only reaching 22Hz.

Any idea on where that would come from?

I'm measuring time between the end of the notification function, and the start of the next one, with that function : `uint64_t get_posix_clock_time () { struct timespec ts;

if (clock_gettime (CLOCK_MONOTONIC, &ts) == 0)
    return (uint64_t) (ts.tv_sec * 1000000 + ts.tv_nsec / 1000);
else
    return 0;

}`

And I also experienced the issue when encapsulating it in a C++ program and measuring with , so I'm quite sure about my frequency measurement.