@ovok/native 1.17.0-dev.2211 → 1.17.0-dev.2215

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/lib/commonjs/modules/next/bluetooth/adapters/ble-plx-central.js +45 -24
  2. package/lib/commonjs/modules/next/bluetooth/adapters/ble-plx-central.js.map +1 -1
  3. package/lib/commonjs/modules/next/bluetooth/adapters/web-bluetooth-central.js +9 -1
  4. package/lib/commonjs/modules/next/bluetooth/adapters/web-bluetooth-central.js.map +1 -1
  5. package/lib/commonjs/modules/next/bluetooth/core/device-link.js +2 -1
  6. package/lib/commonjs/modules/next/bluetooth/core/device-link.js.map +1 -1
  7. package/lib/commonjs/modules/next/bluetooth/families/built-in.js +3 -2
  8. package/lib/commonjs/modules/next/bluetooth/families/built-in.js.map +1 -1
  9. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/am5.js +32 -0
  10. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/am5.js.map +1 -0
  11. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/bind.js +67 -0
  12. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/bind.js.map +1 -0
  13. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/block-reader.js +48 -0
  14. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/block-reader.js.map +1 -0
  15. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/block.js +57 -0
  16. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/block.js.map +1 -0
  17. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/commands.js +105 -0
  18. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/commands.js.map +1 -0
  19. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/connection.js +27 -0
  20. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/connection.js.map +1 -0
  21. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/device-info.js +39 -0
  22. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/device-info.js.map +1 -0
  23. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/frame.js +71 -0
  24. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/frame.js.map +1 -0
  25. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/history.js +69 -0
  26. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/history.js.map +1 -0
  27. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/ihealth-band.js +17 -0
  28. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/ihealth-band.js.map +1 -0
  29. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/live.js +42 -0
  30. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/live.js.map +1 -0
  31. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/models.js +18 -0
  32. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/models.js.map +1 -0
  33. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/records.js +99 -0
  34. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/records.js.map +1 -0
  35. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/replies.js +94 -0
  36. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/replies.js.map +1 -0
  37. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/session.js +71 -0
  38. package/lib/commonjs/modules/next/bluetooth/families/ihealth-band/session.js.map +1 -0
  39. package/lib/module/modules/next/bluetooth/adapters/ble-plx-central.js +45 -24
  40. package/lib/module/modules/next/bluetooth/adapters/ble-plx-central.js.map +1 -1
  41. package/lib/module/modules/next/bluetooth/adapters/web-bluetooth-central.js +9 -1
  42. package/lib/module/modules/next/bluetooth/adapters/web-bluetooth-central.js.map +1 -1
  43. package/lib/module/modules/next/bluetooth/core/device-link.js +2 -1
  44. package/lib/module/modules/next/bluetooth/core/device-link.js.map +1 -1
  45. package/lib/module/modules/next/bluetooth/families/built-in.js +3 -2
  46. package/lib/module/modules/next/bluetooth/families/built-in.js.map +1 -1
  47. package/lib/module/modules/next/bluetooth/families/ihealth-band/am5.js +30 -0
  48. package/lib/module/modules/next/bluetooth/families/ihealth-band/am5.js.map +1 -0
  49. package/lib/module/modules/next/bluetooth/families/ihealth-band/bind.js +63 -0
  50. package/lib/module/modules/next/bluetooth/families/ihealth-band/bind.js.map +1 -0
  51. package/lib/module/modules/next/bluetooth/families/ihealth-band/block-reader.js +44 -0
  52. package/lib/module/modules/next/bluetooth/families/ihealth-band/block-reader.js.map +1 -0
  53. package/lib/module/modules/next/bluetooth/families/ihealth-band/block.js +52 -0
  54. package/lib/module/modules/next/bluetooth/families/ihealth-band/block.js.map +1 -0
  55. package/lib/module/modules/next/bluetooth/families/ihealth-band/commands.js +92 -0
  56. package/lib/module/modules/next/bluetooth/families/ihealth-band/commands.js.map +1 -0
  57. package/lib/module/modules/next/bluetooth/families/ihealth-band/connection.js +24 -0
  58. package/lib/module/modules/next/bluetooth/families/ihealth-band/connection.js.map +1 -0
  59. package/lib/module/modules/next/bluetooth/families/ihealth-band/device-info.js +33 -0
  60. package/lib/module/modules/next/bluetooth/families/ihealth-band/device-info.js.map +1 -0
  61. package/lib/module/modules/next/bluetooth/families/ihealth-band/frame.js +64 -0
  62. package/lib/module/modules/next/bluetooth/families/ihealth-band/frame.js.map +1 -0
  63. package/lib/module/modules/next/bluetooth/families/ihealth-band/history.js +67 -0
  64. package/lib/module/modules/next/bluetooth/families/ihealth-band/history.js.map +1 -0
  65. package/lib/module/modules/next/bluetooth/families/ihealth-band/ihealth-band.js +9 -0
  66. package/lib/module/modules/next/bluetooth/families/ihealth-band/ihealth-band.js.map +1 -0
  67. package/lib/module/modules/next/bluetooth/families/ihealth-band/live.js +39 -0
  68. package/lib/module/modules/next/bluetooth/families/ihealth-band/live.js.map +1 -0
  69. package/lib/module/modules/next/bluetooth/families/ihealth-band/models.js +16 -0
  70. package/lib/module/modules/next/bluetooth/families/ihealth-band/models.js.map +1 -0
  71. package/lib/module/modules/next/bluetooth/families/ihealth-band/records.js +94 -0
  72. package/lib/module/modules/next/bluetooth/families/ihealth-band/records.js.map +1 -0
  73. package/lib/module/modules/next/bluetooth/families/ihealth-band/replies.js +85 -0
  74. package/lib/module/modules/next/bluetooth/families/ihealth-band/replies.js.map +1 -0
  75. package/lib/module/modules/next/bluetooth/families/ihealth-band/session.js +68 -0
  76. package/lib/module/modules/next/bluetooth/families/ihealth-band/session.js.map +1 -0
  77. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ble-plx-central.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts +4 -0
  79. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/built-in.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/am5.d.ts +6 -0
  82. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/am5.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/bind.d.ts +6 -0
  84. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/bind.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/block-reader.d.ts +6 -0
  86. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/block-reader.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/block.d.ts +18 -0
  88. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/block.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/commands.d.ts +43 -0
  90. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/commands.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/connection.d.ts +15 -0
  92. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/connection.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/device-info.d.ts +10 -0
  94. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/device-info.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/frame.d.ts +31 -0
  96. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/frame.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/history.d.ts +6 -0
  98. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/history.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/ihealth-band.d.ts +6 -0
  100. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/ihealth-band.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/live.d.ts +6 -0
  102. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/live.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/models.d.ts +5 -0
  104. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/models.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/records.d.ts +8 -0
  106. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/records.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/replies.d.ts +29 -0
  108. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/replies.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/session.d.ts +21 -0
  110. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/ihealth-band/session.d.ts.map +1 -0
  111. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ble-plx-central.d.ts.map +1 -1
  112. package/lib/typescript/module/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts +4 -0
  113. package/lib/typescript/module/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts.map +1 -1
  114. package/lib/typescript/module/src/modules/next/bluetooth/families/built-in.d.ts.map +1 -1
  115. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/am5.d.ts +6 -0
  116. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/am5.d.ts.map +1 -0
  117. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/bind.d.ts +6 -0
  118. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/bind.d.ts.map +1 -0
  119. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/block-reader.d.ts +6 -0
  120. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/block-reader.d.ts.map +1 -0
  121. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/block.d.ts +18 -0
  122. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/block.d.ts.map +1 -0
  123. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/commands.d.ts +43 -0
  124. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/commands.d.ts.map +1 -0
  125. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/connection.d.ts +15 -0
  126. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/connection.d.ts.map +1 -0
  127. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/device-info.d.ts +10 -0
  128. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/device-info.d.ts.map +1 -0
  129. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/frame.d.ts +31 -0
  130. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/frame.d.ts.map +1 -0
  131. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/history.d.ts +6 -0
  132. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/history.d.ts.map +1 -0
  133. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/ihealth-band.d.ts +6 -0
  134. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/ihealth-band.d.ts.map +1 -0
  135. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/live.d.ts +6 -0
  136. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/live.d.ts.map +1 -0
  137. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/models.d.ts +5 -0
  138. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/models.d.ts.map +1 -0
  139. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/records.d.ts +8 -0
  140. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/records.d.ts.map +1 -0
  141. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/replies.d.ts +29 -0
  142. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/replies.d.ts.map +1 -0
  143. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/session.d.ts +21 -0
  144. package/lib/typescript/module/src/modules/next/bluetooth/families/ihealth-band/session.d.ts.map +1 -0
  145. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ import { u16leBytes } from "../../codec/bytes.js";
4
+ import { COMMAND_CLASS, command } from "./frame.js";
5
+ const BIND_KEY = {
6
+ bind: 0x01,
7
+ auth: 0x03,
8
+ rejected: 0x04
9
+ };
10
+ const READ_KEY = {
11
+ basicInfo: 0x01,
12
+ functionTable: 0x02,
13
+ liveData: 0xa0
14
+ };
15
+ const SET_TIME_KEY = 0x01;
16
+
17
+ /** Keys of the health class: the sync's own, then the block of each kind of stored day, then the end of a block. */
18
+ const HEALTH_KEY = {
19
+ start: 0x01,
20
+ stop: 0x02,
21
+ sportToday: 0x03,
22
+ sportHistory: 0x05,
23
+ heartRateToday: 0x07,
24
+ heartRateHistory: 0x08,
25
+ blockEnd: 0xee
26
+ };
27
+
28
+ /** The byte after a health key: 1 asks for a block and starts its first header, 2 ends a block and starts its second header. */
29
+ const BLOCK_PHASE = {
30
+ first: 0x01,
31
+ second: 0x02
32
+ };
33
+ const BIND_MARKER = [0xf1, 0x01];
34
+
35
+ /** What the phone says about itself when it binds, as the band's own app does. */
36
+ const BIND_PARAMETERS = {
37
+ version: 1,
38
+ osType: 2,
39
+ osVersion: 2,
40
+ cleanData: 1
41
+ };
42
+
43
+ /** What the phone says about itself when it sends the pairing code, as the band's own app does. */
44
+ const AUTH_PARAMETERS = {
45
+ osType: 1,
46
+ osVersion: 2,
47
+ cleanData: 1
48
+ };
49
+
50
+ /** The pairing code has one byte per digit, zero padded to this many. */
51
+ const AUTH_CODE_BYTES = 8;
52
+ const SYNC_MODE = 0x01;
53
+ const RESERVED = 0x00;
54
+ const FROM_THE_FIRST_ITEM = 0;
55
+ const DAYS_PER_WEEK = 7;
56
+
57
+ /** Monday is 0 and Sunday 6, as the band's own app counts. */
58
+ const weekdayOf = date => (date.getDay() + DAYS_PER_WEEK - 1) % DAYS_PER_WEEK;
59
+
60
+ /** Starts a bind; the band answers, or asks for the pairing code. */
61
+ const bindCommand = () => command(COMMAND_CLASS.bind, BIND_KEY.bind, [...BIND_MARKER, BIND_PARAMETERS.version, BIND_PARAMETERS.osType, BIND_PARAMETERS.osVersion, BIND_PARAMETERS.cleanData]);
62
+
63
+ /** Sends the pairing code the band shows, one byte per digit. */
64
+ const authCommand = digits => command(COMMAND_CLASS.bind, BIND_KEY.auth, [AUTH_PARAMETERS.osType, AUTH_PARAMETERS.osVersion, AUTH_PARAMETERS.cleanData, digits.length, ...Array.from({
65
+ length: AUTH_CODE_BYTES
66
+ }, (_, index) => digits[index] ?? 0)]);
67
+
68
+ /** Sets the band's clock to the local time of `now`. */
69
+ const setTimeCommand = now => command(COMMAND_CLASS.setting, SET_TIME_KEY, [...u16leBytes(now.getFullYear()), now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds(), weekdayOf(now)]);
70
+
71
+ /** Asks for the basic info: firmware, battery and whether the band is bound. */
72
+ const basicInfoCommand = () => command(COMMAND_CLASS.read, READ_KEY.basicInfo);
73
+
74
+ /** Asks for the table of features the band has. */
75
+ const functionTableCommand = () => command(COMMAND_CLASS.read, READ_KEY.functionTable);
76
+
77
+ /** Asks for the running counters. */
78
+ const liveDataCommand = () => command(COMMAND_CLASS.read, READ_KEY.liveData);
79
+
80
+ /** Starts a health sync; the band answers with how many days of each kind it holds. */
81
+ const startSyncCommand = () => command(COMMAND_CLASS.health, HEALTH_KEY.start, [SYNC_MODE, RESERVED]);
82
+
83
+ /** Ends a health sync. */
84
+ const stopSyncCommand = () => command(COMMAND_CLASS.health, HEALTH_KEY.stop, [RESERVED]);
85
+
86
+ /** Asks for one block, from its first item. */
87
+ const blockRequestCommand = key => command(COMMAND_CLASS.health, key, [BLOCK_PHASE.first, ...u16leBytes(FROM_THE_FIRST_ITEM)]);
88
+
89
+ /** Tells the band the block of `key` arrived. */
90
+ const blockAckCommand = key => command(COMMAND_CLASS.health, key, [BLOCK_PHASE.second]);
91
+ export { authCommand, basicInfoCommand, BIND_KEY, bindCommand, BLOCK_PHASE, blockAckCommand, blockRequestCommand, functionTableCommand, HEALTH_KEY, liveDataCommand, setTimeCommand, startSyncCommand, stopSyncCommand };
92
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["u16leBytes","COMMAND_CLASS","command","BIND_KEY","bind","auth","rejected","READ_KEY","basicInfo","functionTable","liveData","SET_TIME_KEY","HEALTH_KEY","start","stop","sportToday","sportHistory","heartRateToday","heartRateHistory","blockEnd","BLOCK_PHASE","first","second","BIND_MARKER","BIND_PARAMETERS","version","osType","osVersion","cleanData","AUTH_PARAMETERS","AUTH_CODE_BYTES","SYNC_MODE","RESERVED","FROM_THE_FIRST_ITEM","DAYS_PER_WEEK","weekdayOf","date","getDay","bindCommand","authCommand","digits","length","Array","from","_","index","setTimeCommand","now","setting","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","basicInfoCommand","read","functionTableCommand","liveDataCommand","startSyncCommand","health","stopSyncCommand","blockRequestCommand","key","blockAckCommand"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/commands.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,sBAAmB;AAE9C,SAASC,aAAa,EAAEC,OAAO,QAAe,YAAS;AAEvD,MAAMC,QAAQ,GAAG;EAAEC,IAAI,EAAE,IAAI;EAAEC,IAAI,EAAE,IAAI;EAAEC,QAAQ,EAAE;AAAK,CAAU;AACpE,MAAMC,QAAQ,GAAG;EAAEC,SAAS,EAAE,IAAI;EAAEC,aAAa,EAAE,IAAI;EAAEC,QAAQ,EAAE;AAAK,CAAU;AAClF,MAAMC,YAAY,GAAG,IAAI;;AAEzB;AACA,MAAMC,UAAU,GAAG;EACjBC,KAAK,EAAE,IAAI;EACXC,IAAI,EAAE,IAAI;EACVC,UAAU,EAAE,IAAI;EAChBC,YAAY,EAAE,IAAI;EAClBC,cAAc,EAAE,IAAI;EACpBC,gBAAgB,EAAE,IAAI;EACtBC,QAAQ,EAAE;AACZ,CAAU;;AAEV;AACA,MAAMC,WAAW,GAAG;EAAEC,KAAK,EAAE,IAAI;EAAEC,MAAM,EAAE;AAAK,CAAU;AAE1D,MAAMC,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;;AAEhC;AACA,MAAMC,eAAe,GAAG;EAAEC,OAAO,EAAE,CAAC;EAAEC,MAAM,EAAE,CAAC;EAAEC,SAAS,EAAE,CAAC;EAAEC,SAAS,EAAE;AAAE,CAAU;;AAEtF;AACA,MAAMC,eAAe,GAAG;EAAEH,MAAM,EAAE,CAAC;EAAEC,SAAS,EAAE,CAAC;EAAEC,SAAS,EAAE;AAAE,CAAU;;AAE1E;AACA,MAAME,eAAe,GAA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1,24 @@
1
+ "use strict";
2
+
3
+ import { bindIfUnbound } from "./bind.js";
4
+ import { openSession } from "./session.js";
5
+
6
+ /** What a protocol keeps of an open link to a band. */
7
+
8
+ /** Opens the session and binds a band that is not yet bound. */
9
+ const openBand = async context => {
10
+ const session = await openSession(context);
11
+ try {
12
+ await bindIfUnbound(session, context.secret);
13
+ } catch (error) {
14
+ session.stop();
15
+ throw error;
16
+ }
17
+ return {
18
+ ...session,
19
+ logger: context.logger,
20
+ now: context.now
21
+ };
22
+ };
23
+ export { openBand };
24
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["bindIfUnbound","openSession","openBand","context","session","secret","error","stop","logger","now"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/connection.ts"],"mappings":";;AAGA,SAASA,aAAa,QAAQ,WAAQ;AACtC,SAASC,WAAW,QAAiB,cAAW;;AAEhD;;AAUA;AACA,MAAMC,QAAQ,GAAG,MAAOC,OAAwB,IAA8B;EAC5E,MAAMC,OAAO,GAAG,MAAMH,WAAW,CAACE,OAAO,CAAC;EAE1C,IAAI;IACF,MAAMH,aAAa,CAACI,OAAO,EAAED,OAAO,CAACE,MAAM,CAAC;EAC9C,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdF,OAAO,CAACG,IAAI,CAAC,CAAC;IACd,MAAMD,KAAK;EACb;EAEA,OAAO;IAAE,GAAGF,OAAO;IAAEI,MAAM,EAAEL,OAAO,CAACK,MAAM;IAAEC,GAAG,EAAEN,OAAO,CAACM;EAAI,CAAC;AACjE,CAAC;AAED,SAASP,QAAQ","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ import { basicInfoCommand } from "./commands.js";
4
+ import { isEchoOf } from "./frame.js";
5
+ import { basicInfoOf } from "./replies.js";
6
+ /** Asks the band for its basic info. */
7
+ const readBasicInfo = async ({
8
+ request
9
+ }) => {
10
+ const asked = basicInfoCommand();
11
+ return basicInfoOf(await request(asked, isEchoOf(asked)));
12
+ };
13
+
14
+ /** The firmware number the band reports; it gives no serial, hardware, maker or model. */
15
+ const identify = async session => ({
16
+ serial: null,
17
+ firmware: String((await readBasicInfo(session)).firmware),
18
+ hardware: null,
19
+ manufacturer: null,
20
+ model: null
21
+ });
22
+ const battery = async session => {
23
+ const {
24
+ percent,
25
+ charging
26
+ } = await readBasicInfo(session);
27
+ return {
28
+ percent,
29
+ charging
30
+ };
31
+ };
32
+ export { battery, identify, readBasicInfo };
33
+ //# sourceMappingURL=device-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["basicInfoCommand","isEchoOf","basicInfoOf","readBasicInfo","request","asked","identify","session","serial","firmware","String","hardware","manufacturer","model","battery","percent","charging"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/device-info.ts"],"mappings":";;AAEA,SAASA,gBAAgB,QAAQ,eAAY;AAC7C,SAASC,QAAQ,QAAQ,YAAS;AAClC,SAAoBC,WAAW,QAAQ,cAAW;AAGlD;AACA,MAAMC,aAAa,GAAG,MAAAA,CAAO;EAAEC;AAAiB,CAAC,KAAyB;EACxE,MAAMC,KAAK,GAAGL,gBAAgB,CAAC,CAAC;EAEhC,OAAOE,WAAW,CAAC,MAAME,OAAO,CAACC,KAAK,EAAEJ,QAAQ,CAACI,KAAK,CAAC,CAAC,CAAC;AAC3D,CAAC;;AAED;AACA,MAAMC,QAAQ,GAAG,MAAOC,OAAgB,KAA2C;EACjFC,MAAM,EAAE,IAAI;EACZC,QAAQ,EAAEC,MAAM,CAAC,CAAC,MAAMP,aAAa,CAACI,OAAO,CAAC,EAAEE,QAAQ,CAAC;EACzDE,QAAQ,EAAE,IAAI;EACdC,YAAY,EAAE,IAAI;EAClBC,KAAK,EAAE;AACT,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,MAAOP,OAAgB,IAAmC;EACxE,MAAM;IAAEQ,OAAO;IAAEC;EAAS,CAAC,GAAG,MAAMb,aAAa,CAACI,OAAO,CAAC;EAE1D,OAAO;IAAEQ,OAAO;IAAEC;EAAS,CAAC;AAC9B,CAAC;AAED,SAASF,OAAO,EAAER,QAAQ,EAAEH,aAAa","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ import { fullUuid } from "../../core/advertisement.js";
4
+ import { DeviceError } from "../../core/errors.js";
5
+
6
+ /** The service every frame travels on. */
7
+ const BAND_SERVICE = fullUuid("0AF0");
8
+ const COMMAND_CHARACTERISTIC = fullUuid("0AF6");
9
+ const HEALTH_CHARACTERISTIC = fullUuid("0AF1");
10
+
11
+ /** The characteristics the band notifies on, in the order it wants them enabled. */
12
+ const NOTIFY_CHARACTERISTICS = [fullUuid("0AF7"), fullUuid("0AF2")];
13
+ const MAX_FRAME_BYTES = 20;
14
+ const MAX_INCOMING_BYTES = 100;
15
+ const HEADER_BYTES = 2;
16
+
17
+ /** The first byte of a frame: what kind of exchange it belongs to. */
18
+ const COMMAND_CLASS = {
19
+ read: 0x02,
20
+ setting: 0x03,
21
+ bind: 0x04,
22
+ health: 0x08,
23
+ workout: 0x09
24
+ };
25
+ const OWN_CHARACTERISTIC_CLASSES = [COMMAND_CLASS.health, COMMAND_CLASS.workout];
26
+
27
+ /** One packet: its command class, its key, and the payload after them; payload offsets count from there. */
28
+
29
+ /** A frame to send, from the bytes after its key. */
30
+ const command = (commandClass, key, payload = []) => ({
31
+ commandClass,
32
+ key,
33
+ payload: Uint8Array.from(payload)
34
+ });
35
+
36
+ /** The bytes to write; fails for a frame the band would refuse as too long. */
37
+ const frameBytes = ({
38
+ commandClass,
39
+ key,
40
+ payload
41
+ }) => {
42
+ const bytes = Uint8Array.of(commandClass, key, ...payload);
43
+ if (bytes.length > MAX_FRAME_BYTES) {
44
+ throw new DeviceError("protocol", "A frame is longer than the band takes");
45
+ }
46
+ return bytes;
47
+ };
48
+
49
+ /** The frame a notification carries; `null` when it is too short or too long to be one. */
50
+ const frameOf = bytes => bytes.length < HEADER_BYTES || bytes.length > MAX_INCOMING_BYTES ? null : {
51
+ commandClass: bytes[0] ?? 0,
52
+ key: bytes[1] ?? 0,
53
+ payload: bytes.subarray(HEADER_BYTES)
54
+ };
55
+
56
+ /** Where a frame is written: health and workout data have a characteristic of their own. */
57
+ const characteristicOf = ({
58
+ commandClass
59
+ }) => OWN_CHARACTERISTIC_CLASSES.includes(commandClass) ? HEALTH_CHARACTERISTIC : COMMAND_CHARACTERISTIC;
60
+
61
+ /** Accepts the reply that echoes the class and key of `request`, which is how the band acknowledges it. */
62
+ const isEchoOf = request => reply => reply.commandClass === request.commandClass && reply.key === request.key;
63
+ export { BAND_SERVICE, characteristicOf, COMMAND_CLASS, command, frameBytes, frameOf, isEchoOf, NOTIFY_CHARACTERISTICS };
64
+ //# sourceMappingURL=frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fullUuid","DeviceError","BAND_SERVICE","COMMAND_CHARACTERISTIC","HEALTH_CHARACTERISTIC","NOTIFY_CHARACTERISTICS","MAX_FRAME_BYTES","MAX_INCOMING_BYTES","HEADER_BYTES","COMMAND_CLASS","read","setting","bind","health","workout","OWN_CHARACTERISTIC_CLASSES","command","commandClass","key","payload","Uint8Array","from","frameBytes","bytes","of","length","frameOf","subarray","characteristicOf","includes","isEchoOf","request","reply"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/frame.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,6BAA0B;AACnD,SAASC,WAAW,QAAQ,sBAAmB;;AAE/C;AACA,MAAMC,YAAY,GAAGF,QAAQ,CAAC,MAAM,CAAC;AAErC,MAAMG,sBAAsB,GAAGH,QAAQ,CAAC,MAAM,CAAC;AAC/C,MAAMI,qBAAqB,GAAGJ,QAAQ,CAAC,MAAM,CAAC;;AAE9C;AACA,MAAMK,sBAAyC,GAAG,CAACL,QAAQ,CAAC,MAAM,CAAC,EAAEA,QAAQ,CAAC,MAAM,CAAC,CAAC;AAEtF,MAAMM,eAAe,GAAG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,KAC/CF,0BAA0B,CAACc,QAAQ,CAACZ,YAAY,CAAC,GAAGb,qBAAqB,GAAGD,sBAAsB;;AAEpG;AACA,MAAM2B,QAAQ,GACXC,OAAc,IACdC,KAAY,IACXA,KAAK,CAACf,YAAY,KAAKc,OAAO,CAACd,YAAY,IAAIe,KAAK,CAACd,GAAG,KAAKa,OAAO,CAACb,GAAG;AAE5E,SAAShB,YAAY,EAAE0B,gBAAgB,EAAEnB,aAAa,EAAEO,OAAO,EAAEM,UAAU,EAAEI,OAAO,EAAEI,QAAQ,EAAEzB,sBAAsB","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ import { readBlock } from "./block-reader.js";
4
+ import { functionTableCommand, HEALTH_KEY, startSyncCommand, stopSyncCommand } from "./commands.js";
5
+ import { isEchoOf } from "./frame.js";
6
+ import { heartRateRecords, stepsRecords } from "./records.js";
7
+ import { measuresHeartRate, storedDaysOf } from "./replies.js";
8
+
9
+ /** One kind of stored day: the block for today, the block for each earlier day, and what a block of it holds. */
10
+
11
+ const SPORT = {
12
+ todayKey: HEALTH_KEY.sportToday,
13
+ historyKey: HEALTH_KEY.sportHistory,
14
+ storedDays: ({
15
+ sport
16
+ }) => sport,
17
+ recordsOf: stepsRecords
18
+ };
19
+ const HEART_RATE = {
20
+ todayKey: HEALTH_KEY.heartRateToday,
21
+ historyKey: HEALTH_KEY.heartRateHistory,
22
+ storedDays: ({
23
+ heartRate
24
+ }) => heartRate,
25
+ recordsOf: heartRateRecords
26
+ };
27
+
28
+ /** Today's block, then one history block for each earlier day the band holds. */
29
+ const blockKeysOf = (kind, days) => [kind.todayKey, ...Array(kind.storedDays(days)).fill(kind.historyKey)];
30
+
31
+ /** Sleep and blood pressure are left on the band; heart rate is read only when the band says it measures it. */
32
+ const kindsToRead = async ({
33
+ request
34
+ }) => {
35
+ const asked = functionTableCommand();
36
+ return measuresHeartRate(await request(asked, isEchoOf(asked))) ? [SPORT, HEART_RATE] : [SPORT];
37
+ };
38
+ const startSync = async ({
39
+ request
40
+ }) => {
41
+ const start = startSyncCommand();
42
+ return storedDaysOf(await request(start, isEchoOf(start)));
43
+ };
44
+ const stopSync = async ({
45
+ request,
46
+ logger
47
+ }) => {
48
+ const stop = stopSyncCommand();
49
+ await request(stop, isEchoOf(stop)).catch(() => logger.warn("ihealth-band.stop-sync.failed"));
50
+ };
51
+
52
+ /** The steps of each 15-minute slot and each heart-rate sample the band stores, as the band's blocks come. */
53
+ async function* storedRecords(connection) {
54
+ const kinds = await kindsToRead(connection);
55
+ const days = await startSync(connection);
56
+ for (const kind of kinds) {
57
+ for (const key of blockKeysOf(kind, days)) {
58
+ const block = await readBlock(connection, key);
59
+ if (block !== null) {
60
+ yield* kind.recordsOf(block, connection.now());
61
+ }
62
+ }
63
+ }
64
+ await stopSync(connection);
65
+ }
66
+ export { storedRecords };
67
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["readBlock","functionTableCommand","HEALTH_KEY","startSyncCommand","stopSyncCommand","isEchoOf","heartRateRecords","stepsRecords","measuresHeartRate","storedDaysOf","SPORT","todayKey","sportToday","historyKey","sportHistory","storedDays","sport","recordsOf","HEART_RATE","heartRateToday","heartRateHistory","heartRate","blockKeysOf","kind","days","Array","fill","kindsToRead","request","asked","startSync","start","stopSync","logger","stop","catch","warn","storedRecords","connection","kinds","key","block","now"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/history.ts"],"mappings":";;AAGA,SAASA,SAAS,QAAQ,mBAAgB;AAC1C,SAASC,oBAAoB,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,eAAY;AAEhG,SAASC,QAAQ,QAAQ,YAAS;AAClC,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,cAAW;AAC1D,SAASC,iBAAiB,EAAcC,YAAY,QAAQ,cAAW;;AAEvE;;AAQA,MAAMC,KAAiB,GAAG;EACxBC,QAAQ,EAAET,UAAU,CAACU,U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AE7B,QAAQ,CAAC6B,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,MAAMF,MAAM,CAACG,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAC/F,CAAC;;AAED;AACA,gBAAgBC,aAAaA,CAACC,UAA0B,EAAiC;EACvF,MAAMC,KAAK,GAAG,MAAMZ,WAAW,CAACW,UAAU,CAAC;EAC3C,MAAMd,IAAI,GAAG,MAAMM,SAAS,CAACQ,UAAU,CAAC;EAExC,KAAK,MAAMf,IAAI,IAAIgB,KAAK,EAAE;IACxB,KAAK,MAAMC,GAAG,IAAIlB,WAAW,CAACC,IAAI,EAAEC,IAAI,CAAC,EAAE;MACzC,MAAMiB,KAAK,GAAG,MAAMzC,SAAS,CAACsC,UAAU,EAAEE,GAAG,CAAC;MAE9C,IAAIC,KAAK,KAAK,IAAI,EAAE;QAClB,OAAOlB,IAAI,CAACN,SAAS,CAACwB,KAAK,EAAEH,UAAU,CAACI,GAAG,CAAC,CAAC,CAAC;MAChD;IACF;EACF;EAEA,MAAMV,QAAQ,CAACM,UAAU,CAAC;AAC5B;AAEA,SAASD,aAAa","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ import { AM5 } from "./am5.js";
4
+ import { IHEALTH_BAND_MODELS } from "./models.js";
5
+
6
+ /** The protocols of the iHealth fitness bands: the AM5. */
7
+ const IHEALTH_BAND_PROTOCOLS = [AM5];
8
+ export { IHEALTH_BAND_MODELS, IHEALTH_BAND_PROTOCOLS };
9
+ //# sourceMappingURL=ihealth-band.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AM5","IHEALTH_BAND_MODELS","IHEALTH_BAND_PROTOCOLS"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/ihealth-band.ts"],"mappings":";;AAEA,SAASA,GAAG,QAAQ,UAAO;AAC3B,SAASC,mBAAmB,QAAQ,aAAU;;AAE9C;AACA,MAAMC,sBAAiD,GAAG,CAACF,GAAG,CAAC;AAE/D,SAASC,mBAAmB,EAAEC,sBAAsB","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ import { pause, untilAborted } from "../sig/waiting.js";
4
+ import { liveDataCommand } from "./commands.js";
5
+ import { isEchoOf } from "./frame.js";
6
+ import { liveHeartRateOf } from "./replies.js";
7
+
8
+ /** The band gives its counters when asked and sends none by itself, so the phone asks this often. */
9
+ const LIVE_POLL_MS = 1_000;
10
+ const NO_HEART_RATE = 0;
11
+ const heartRateFrame = (heartRate, at) => ({
12
+ values: {
13
+ at,
14
+ values: {
15
+ heart_rate: {
16
+ value: heartRate,
17
+ unit: "/min"
18
+ }
19
+ },
20
+ deviceFlags: []
21
+ }
22
+ });
23
+
24
+ /** Asks for the heart rate once a second until `signal` aborts; a reading of 0 is left out. */
25
+ const pollHeartRate = async ({
26
+ request,
27
+ now
28
+ }, onFrame, signal) => {
29
+ const asked = liveDataCommand();
30
+ while (!signal.aborted) {
31
+ const heartRate = liveHeartRateOf(await request(asked, isEchoOf(asked)));
32
+ if (heartRate !== NO_HEART_RATE) {
33
+ onFrame(heartRateFrame(heartRate, now()));
34
+ }
35
+ await Promise.race([pause(LIVE_POLL_MS), untilAborted(signal)]);
36
+ }
37
+ };
38
+ export { pollHeartRate };
39
+ //# sourceMappingURL=live.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pause","untilAborted","liveDataCommand","isEchoOf","liveHeartRateOf","LIVE_POLL_MS","NO_HEART_RATE","heartRateFrame","heartRate","at","values","heart_rate","value","unit","deviceFlags","pollHeartRate","request","now","onFrame","signal","asked","aborted","Promise","race"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/live.ts"],"mappings":";;AACA,SAASA,KAAK,EAAEC,YAAY,QAAQ,mBAAgB;AAEpD,SAASC,eAAe,QAAQ,eAAY;AAE5C,SAASC,QAAQ,QAAQ,YAAS;AAClC,SAASC,eAAe,QAAQ,cAAW;;AAE3C;AACA,MAAMC,YAAY,GAAG,KAAK;AAE1B,MAAMC,aAAa,GAAG,CAAC;AAEvB,MAAMC,cAAc,GAAGA,CAACC,SAAiB,EAAEC,EAAQ,MAAiB;EAClEC,MAAM,EAAE;IAAED,EAAE;IAAEC,MAAM,EAAE;MAAEC,UAAU,EAAE;QAAEC,KAAK,EAAEJ,SAAS;QAAEK,IAAI,EAAE;MAAO;IAAE,CAAC;IAAEC,WAAW,EAAE;EAAG;AAC5F,CAAC,CAAC;;AAEF;AACA,MAAMC,aAAa,GAAG,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAoB,CAAC,EAAEC,OAAmC,EAAEC,MAAmB,KAAoB;EACzI,MAAMC,KAAK,GAAGlB,eAAe,CAAC,CAAC;EAE/B,OAAO,CAACiB,MAAM,CAACE,OAAO,EAAE;IACtB,MAAMb,SAAS,GAAGJ,eAAe,CAAC,MAAMY,OAAO,CAACI,KAAK,EAAEjB,QAAQ,CAACiB,KAAK,CAAC,CAAC,CAAC;IAExE,IAAIZ,SAAS,KAAKF,aAAa,EAAE;MAC/BY,OAAO,CAACX,cAAc,CAACC,SAAS,EAAES,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3C;IACA,MAAMK,OAAO,CAACC,IAAI,CAAC,CAACvB,KAAK,CAACK,YAAY,CAAC,EAAEJ,YAAY,CAACkB,MAAM,CAAC,CAAC,CAAC;EACjE;AACF,CAAC;AAED,SAASJ,aAAa","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import { modelRows } from "../sig/model-row.js";
4
+ import { AM5 } from "./am5.js";
5
+ import { BAND_SERVICE } from "./frame.js";
6
+
7
+ /** The one band; it has no advertised name, so the service it advertises is what finds it. */
8
+ const IHEALTH_BAND_MODELS = [modelRows(AM5.id, ["activity", "blood_pressure", "heart_rate", "sleep"])("iHealth", "AM5", [], {
9
+ services: [BAND_SERVICE],
10
+ requires: [{
11
+ kind: "service",
12
+ uuid: BAND_SERVICE
13
+ }]
14
+ })];
15
+ export { IHEALTH_BAND_MODELS };
16
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["modelRows","AM5","BAND_SERVICE","IHEALTH_BAND_MODELS","id","services","requires","kind","uuid"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/models.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,GAAG,QAAQ,UAAO;AAC3B,SAASC,YAAY,QAAQ,YAAS;;AAEtC;AACA,MAAMC,mBAA2C,GAAG,CAClDH,SAAS,CAACC,GAAG,CAACG,EAAE,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;EAC7FC,QAAQ,EAAE,CAACH,YAAY,CAAC;EACxBI,QAAQ,EAAE,CAAC;IAAEC,IAAI,EAAE,SAAS;IAAEC,IAAI,EAAEN;EAAa,CAAC;AACpD,CAAC,CAAC,CACH;AAED,SAASC,mBAAmB","ignoreList":[]}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ import { u16le } from "../../codec/bytes.js";
4
+ const MS_PER_MINUTE = 60_000;
5
+
6
+ /** Every stored sport item covers this many minutes, from local midnight of its day. */
7
+ const SLOT_MINUTES = 15;
8
+ const SPORT_ITEM_BYTES = 5;
9
+ const STEPS_SHIFT = 2;
10
+ const STEPS_MASK = 0xfff;
11
+ const STEPS_UNIT = "{steps}";
12
+ const HEART_RATE_ITEM_BYTES = 2;
13
+ const NO_SAMPLE_OFFSET = 255;
14
+ const HEART_RATE_UNIT = "/min";
15
+ const midnightOf = ({
16
+ year,
17
+ month,
18
+ day
19
+ }) => new Date(year, month - 1, day);
20
+
21
+ /** The same sample read again, however the phone's zone has changed, gets the same id: it names the day by its parts. */
22
+ const idOf = (kind, {
23
+ year,
24
+ month,
25
+ day
26
+ }, minutes, value) => [kind, year, month, day, minutes, value].join("-");
27
+
28
+ /** The steps of the item at `at`: bits 2 to 13 of its 40-bit little-endian value. */
29
+ const stepsAt = (data, at) => u16le(data, at) >> STEPS_SHIFT & STEPS_MASK;
30
+ const stepsRecord = (day, slot, steps, takenAt) => ({
31
+ id: idOf("steps", day, slot * SLOT_MINUTES, steps),
32
+ reading: {
33
+ type: "activity",
34
+ takenAt,
35
+ values: {
36
+ steps: {
37
+ value: steps,
38
+ unit: STEPS_UNIT
39
+ }
40
+ },
41
+ deviceFlags: []
42
+ }
43
+ });
44
+
45
+ /** The steps of each 15-minute slot of the day that has ended by `now` and holds steps; a slot still counting would come back under another id. */
46
+ const stepsRecords = ({
47
+ day,
48
+ data
49
+ }, now) => {
50
+ const midnight = midnightOf(day).getTime();
51
+ const slots = Array.from({
52
+ length: Math.floor(data.length / SPORT_ITEM_BYTES)
53
+ }, (_, slot) => slot);
54
+ return slots.flatMap(slot => {
55
+ const steps = stepsAt(data, slot * SPORT_ITEM_BYTES);
56
+ const takenAt = new Date(midnight + slot * SLOT_MINUTES * MS_PER_MINUTE);
57
+ const endedAt = takenAt.getTime() + SLOT_MINUTES * MS_PER_MINUTE;
58
+ return steps === 0 || endedAt > now.getTime() ? [] : [stepsRecord(day, slot, steps, takenAt)];
59
+ });
60
+ };
61
+ const heartRateRecord = (day, minutes, rate) => ({
62
+ id: idOf("heart-rate", day, minutes, rate),
63
+ reading: {
64
+ type: "heart_rate",
65
+ takenAt: new Date(day.year, day.month - 1, day.day, 0, minutes),
66
+ values: {
67
+ heart_rate: {
68
+ value: rate,
69
+ unit: HEART_RATE_UNIT
70
+ }
71
+ },
72
+ deviceFlags: []
73
+ }
74
+ });
75
+
76
+ /** The samples of a heart-rate day: each item gives the minutes since the one before, which add up from local midnight. */
77
+ const heartRateRecords = ({
78
+ day,
79
+ data
80
+ }) => {
81
+ const records = [];
82
+ let minutes = 0;
83
+ for (let at = 0; at + HEART_RATE_ITEM_BYTES <= data.length; at += HEART_RATE_ITEM_BYTES) {
84
+ const offset = data[at] ?? 0;
85
+ const rate = data[at + 1] ?? 0;
86
+ minutes += offset;
87
+ if (offset !== NO_SAMPLE_OFFSET && rate !== 0) {
88
+ records.push(heartRateRecord(day, minutes, rate));
89
+ }
90
+ }
91
+ return records;
92
+ };
93
+ export { heartRateRecords, stepsRecords };
94
+ //# sourceMappingURL=records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["u16le","MS_PER_MINUTE","SLOT_MINUTES","SPORT_ITEM_BYTES","STEPS_SHIFT","STEPS_MASK","STEPS_UNIT","HEART_RATE_ITEM_BYTES","NO_SAMPLE_OFFSET","HEART_RATE_UNIT","midnightOf","year","month","day","Date","idOf","kind","minutes","value","join","stepsAt","data","at","stepsRecord","slot","steps","takenAt","id","reading","type","values","unit","deviceFlags","stepsRecords","now","midnight","getTime","slots","Array","from","length","Math","floor","_","flatMap","endedAt","heartRateRecord","rate","heart_rate","heartRateRecords","records","offset","push"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/records.ts"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,sBAAmB;AAKzC,MAAMC,aAAa,GAAG,MAAM;;AAE5B;AACA,MAAMC,YAAY,GAAG,EAAE;AAEvB,MAAMC,gBAAgB,GAAG,CAAC;AAC1B,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,UAAU,GAAG,KAAK;AACxB,MAAMC,UAAU,GAAG,SAAS;AAE5B,MAAMC,qBAAqB,GAAG,CAAC;AAC/B,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,eAAe,GAAG,MAAM;AAE9B,MAAMC,UAAU,GAAGA,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC;AAAe,CAAC,KAAW,IAAIC,IAAI,CAACH,IAAI,EAAEC,KAAK,GAAG,CAAC,EAAEC,GAAG,CAAC;;AAE5F;AACA,MAAME,IAAI,GAAGA,CAACC,IAAY,EAAE;EAAEL,IAAI;EAAEC,KAAK;EAAEC;AAAe,CAAC,EAAEI,OAAe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AACC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;IAE9BL,OAAO,IAAIkC,MAAM;IACjB,IAAIA,MAAM,KAAK3C,gBAAgB,IAAIuC,IAAI,KAAK,CAAC,EAAE;MAC7CG,OAAO,CAACE,IAAI,CAACN,eAAe,CAACjC,GAAG,EAAEI,OAAO,EAAE8B,IAAI,CAAC,CAAC;IACnD;EACF;EAEA,OAAOG,OAAO;AAChB,CAAC;AAED,SAASD,gBAAgB,EAAEhB,YAAY","ignoreList":[]}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ import { DeviceError } from "../../core/errors.js";
4
+ /** The most days of one kind the band reports; a larger count is read as this. */
5
+ const MAX_STORED_DAYS = 40;
6
+ const FULL_CHARGE_PERCENT = 100;
7
+ const BOUND = 1;
8
+ const HEART_RATE_FLAG = 0x20;
9
+ const BIND_AT = {
10
+ result: 0,
11
+ codeLength: 1
12
+ };
13
+ const BASIC_INFO_AT = {
14
+ firmware: 2,
15
+ chargeState: 4,
16
+ percent: 5,
17
+ bound: 6
18
+ };
19
+ const STORED_DAYS_AT = {
20
+ sport: 2,
21
+ heartRate: 4
22
+ };
23
+ const FUNCTION_FLAGS_AT = 0;
24
+ const LIVE_HEART_RATE_AT = 16;
25
+
26
+ /** The states the band reports for its charge; only some say whether it is charging. */
27
+ const CHARGE_STATE = {
28
+ normal: 0,
29
+ charging: 1,
30
+ low: 3
31
+ };
32
+ const CHARGING_BY_STATE = {
33
+ [CHARGE_STATE.normal]: false,
34
+ [CHARGE_STATE.charging]: true,
35
+ [CHARGE_STATE.low]: false
36
+ };
37
+
38
+ /** The basic info reply: the firmware number, the charge, and whether the band is bound to a phone. */
39
+
40
+ /** How many days of each kind the sync reads; the band holds more kinds, which this does not read. */
41
+
42
+ const payloadOf = ({
43
+ payload
44
+ }, atLeastBytes) => {
45
+ if (payload.length < atLeastBytes) {
46
+ throw new DeviceError("protocol", "The band sent a reply that is too short");
47
+ }
48
+ return payload;
49
+ };
50
+
51
+ /** The bind reply: its result code, and how many digits of pairing code the band wants, none when 0. */
52
+ const bindAnswerOf = reply => {
53
+ const payload = payloadOf(reply, BIND_AT.codeLength + 1);
54
+ return {
55
+ result: payload[BIND_AT.result] ?? 0,
56
+ codeLength: payload[BIND_AT.codeLength] ?? 0
57
+ };
58
+ };
59
+
60
+ /** The result code of the reply to the pairing code. */
61
+ const authResultOf = reply => payloadOf(reply, 1)[0] ?? 0;
62
+ const basicInfoOf = reply => {
63
+ const payload = payloadOf(reply, BASIC_INFO_AT.bound + 1);
64
+ return {
65
+ firmware: payload[BASIC_INFO_AT.firmware] ?? 0,
66
+ percent: Math.min(payload[BASIC_INFO_AT.percent] ?? 0, FULL_CHARGE_PERCENT),
67
+ charging: CHARGING_BY_STATE[payload[BASIC_INFO_AT.chargeState] ?? 0] ?? null,
68
+ bound: payload[BASIC_INFO_AT.bound] === BOUND
69
+ };
70
+ };
71
+
72
+ /** Whether the band says it measures heart rate; without it the band has no heart-rate blocks. */
73
+ const measuresHeartRate = reply => ((payloadOf(reply, 1)[FUNCTION_FLAGS_AT] ?? 0) & HEART_RATE_FLAG) !== 0;
74
+ const storedDaysOf = reply => {
75
+ const payload = payloadOf(reply, STORED_DAYS_AT.heartRate + 1);
76
+ return {
77
+ sport: Math.min(payload[STORED_DAYS_AT.sport] ?? 0, MAX_STORED_DAYS),
78
+ heartRate: Math.min(payload[STORED_DAYS_AT.heartRate] ?? 0, MAX_STORED_DAYS)
79
+ };
80
+ };
81
+
82
+ /** The heart rate of a live data reply, in beats per minute. */
83
+ const liveHeartRateOf = reply => payloadOf(reply, LIVE_HEART_RATE_AT + 1)[LIVE_HEART_RATE_AT] ?? 0;
84
+ export { authResultOf, basicInfoOf, bindAnswerOf, liveHeartRateOf, measuresHeartRate, storedDaysOf };
85
+ //# sourceMappingURL=replies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DeviceError","MAX_STORED_DAYS","FULL_CHARGE_PERCENT","BOUND","HEART_RATE_FLAG","BIND_AT","result","codeLength","BASIC_INFO_AT","firmware","chargeState","percent","bound","STORED_DAYS_AT","sport","heartRate","FUNCTION_FLAGS_AT","LIVE_HEART_RATE_AT","CHARGE_STATE","normal","charging","low","CHARGING_BY_STATE","payloadOf","payload","atLeastBytes","length","bindAnswerOf","reply","authResultOf","basicInfoOf","Math","min","measuresHeartRate","storedDaysOf","liveHeartRateOf"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/ihealth-band/replies.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,sBAAmB;AAI/C;AACA,MAAMC,eAAe,GAAG,EAAE;AAE1B,MAAMC,mBAAmB,GAAG,GAAG;AAC/B,MAAMC,KAAK,GAAG,CAAC;AACf,MAAMC,eAAe,GAAG,IAAI;AAE5B,MAAMC,OAAO,GAAG;EAAEC,MAAM,EAAE,CAAC;EAAEC,UAAU,EAAE;AAAE,CAAU;AACrD,MAAMC,aAAa,GAAG;EAAEC,QAAQ,EAAE,CAAC;EAAEC,WAAW,EAAE,CAAC;EAAEC,OAAO,EAAE,CAAC;EAAEC,KAAK,EAAE;AAAE,CAAU;AACpF,MAAMC,cAAc,GAAG;EAAEC,KAAK,EAAE,CAAC;EAAEC,SAAS,EAAE;AAAE,CAAU;AAC1D,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA,MAAMC,YAAY,GAAG;EAAEC,MAAM,EAAE,CAAC;EAAEC,QAAQ,EAAE,CAAC;EAAEC,GAAG,EAAE;AAAE,CAAU;AAEhE,MAAMC,iBAAoD,GAAG;EAC3D,CAACJ,YAAY,CAACC,MAAM,GAAG,KAAK;EAC5B,CAACD,YAAY,CAACE,QAAQ,GAAG,IAAI;EAC7B,CAACF,YAAY,CAACG,GAAG,GAAG;AACtB,CAAC;;AAED;;AAQA;;AAMA,MAAME,SAAS,GAAGA,CAAC;EAAEC;AAAe,CAAC,EAAEC,YAAoB,KAAiB;EAC1E,IAAID,OAAO,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