ble icon indicating copy to clipboard operation
ble copied to clipboard

Time unit inconsistencies in GapScanningParams

Open andresag01 opened this issue 9 years ago • 1 comments

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:

  1. 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.
  2. 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 compute setInterval(SCAN_INTERVAL_MAX * 0.625):
    • SCAN_INTERVAL_MIN
    • SCAN_INTERVAL_MAX
    • SCAN_WINDOW_MIN
    • SCAN_WINDOW_MAX
  3. 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.

andresag01 avatar Jan 14 '16 11:01 andresag01

ARM Internal Ref: IOTSFW-1810

ciarmcom avatar Jan 14 '16 13:01 ciarmcom