ble
ble copied to clipboard
Time unit inconsistencies in GapScanningParams
GapScanningParams tries to expose the user to a comprehensible API to set different scan parameters such as scan window, scan interval, etc. The user can set the scan window and interval in terms of milliseconds, but internally these values get converted to units of 0.625 milliseconds. There are a few issues with the time units in the API:
- The constructor is supposed to accept scan interval and window arguments in units of milliseconds and internally it converts them. However, the default is to set the arguments to SCAN_INTERVAL_MAX and SCAN_WINDOW_MAX that already are in units of 0.625ms.
- The following
const
values are all in units of 0.625 milliseconds. This effectively makes them completely unusable since all the setter functions take arguments in milliseconds. Therefore, if you want to set the max possible interval then you need to computesetInterval(SCAN_INTERVAL_MAX * 0.625)
:- SCAN_INTERVAL_MIN
- SCAN_INTERVAL_MAX
- SCAN_WINDOW_MIN
- SCAN_WINDOW_MAX
- Despite the majority of the API being in terms of milliseconds, the getter functions return scan window and timeout in units of 0.625ms rather than plain milliseconds.
ARM Internal Ref: IOTSFW-1810