@ovok/native 1.17.0-dev.2252 → 1.17.0-dev.2256
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.
- package/README.md +5 -4
- package/lib/commonjs/index.js +1 -199
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/history.js +19 -2
- package/lib/commonjs/modules/next/bluetooth/families/trasense/history.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/models.js +15 -2
- package/lib/commonjs/modules/next/bluetooth/families/trasense/models.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/protocol.js +15 -11
- package/lib/commonjs/modules/next/bluetooth/families/trasense/protocol.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/replies.js +26 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/replies.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/requests.js +22 -3
- package/lib/commonjs/modules/next/bluetooth/families/trasense/requests.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/s9.js +102 -0
- package/lib/commonjs/modules/next/bluetooth/families/trasense/s9.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/trasense/session.js +32 -19
- package/lib/commonjs/modules/next/bluetooth/families/trasense/session.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/trasense.js +3 -2
- package/lib/commonjs/modules/next/bluetooth/families/trasense/trasense.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/trasense/variants.js +2 -2
- package/lib/commonjs/modules/next/bluetooth/families/trasense/variants.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/README.md +2 -2
- package/lib/module/index.js +2 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/history.js +19 -3
- package/lib/module/modules/next/bluetooth/families/trasense/history.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/models.js +15 -2
- package/lib/module/modules/next/bluetooth/families/trasense/models.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/protocol.js +15 -12
- package/lib/module/modules/next/bluetooth/families/trasense/protocol.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/replies.js +25 -2
- package/lib/module/modules/next/bluetooth/families/trasense/replies.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/requests.js +17 -1
- package/lib/module/modules/next/bluetooth/families/trasense/requests.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/s9.js +100 -0
- package/lib/module/modules/next/bluetooth/families/trasense/s9.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/trasense/session.js +30 -19
- package/lib/module/modules/next/bluetooth/families/trasense/session.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/trasense.js +3 -2
- package/lib/module/modules/next/bluetooth/families/trasense/trasense.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/variants.js +1 -1
- package/lib/module/modules/next/bluetooth/families/trasense/variants.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/README.md +2 -2
- package/lib/typescript/commonjs/src/index.d.ts +1 -19
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/history.d.ts +4 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/history.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/models.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/models.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/protocol.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/protocol.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/replies.d.ts +5 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/replies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/requests.d.ts +9 -3
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/requests.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/s9.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/s9.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/session.d.ts +12 -5
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/session.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/trasense.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/trasense.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/variants.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/trasense/variants.d.ts.map +1 -1
- package/lib/typescript/commonjs/type-tests/result-callback.d.ts +1 -1
- package/lib/typescript/commonjs/type-tests/result-callback.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -19
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/history.d.ts +4 -2
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/history.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/models.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/models.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/protocol.d.ts +4 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/protocol.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/replies.d.ts +5 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/replies.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/requests.d.ts +9 -3
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/requests.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/s9.d.ts +10 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/s9.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/session.d.ts +12 -5
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/session.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/trasense.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/trasense.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/variants.d.ts +2 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/trasense/variants.d.ts.map +1 -1
- package/lib/typescript/module/type-tests/result-callback.d.ts +1 -1
- package/lib/typescript/module/type-tests/result-callback.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,10 +34,11 @@ with the same @ovok/core channel, for example
|
|
|
34
34
|
|
|
35
35
|
The SDK uses native modules. Expo Go is not sufficient; add the required config plugins,
|
|
36
36
|
build a development client, and follow the [installation and native setup guide](https://docs.ovok.com/native-sdk/getting-started).
|
|
37
|
-
Install `@ovok/core` alongside the native package. The root `@ovok/native` import
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
Install `@ovok/core` alongside the native package. The root `@ovok/native` import is
|
|
38
|
+
the `Ovok` client: the `@ovok/core` client API with sessions in the device's secure
|
|
39
|
+
store (`@ovok/native/next` is the same entry). Bluetooth is `@ovok/native/next/bluetooth`;
|
|
40
|
+
UI, authentication, theme, health import, PDF viewing, background services and
|
|
41
|
+
themeable UI flows are available through documented subpaths. Install the peer
|
|
41
42
|
peer packages documented in the [getting started guide](https://docs.ovok.com/native-sdk/getting-started)
|
|
42
43
|
for the entry points they use. Apps integrating one feature or device can use a
|
|
43
44
|
subpath export and install only that import graph. Use `npx expo install` for Expo
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _index = require("./modules/
|
|
6
|
+
var _index = require("./modules/next/index.js");
|
|
7
7
|
Object.keys(_index).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
9
|
if (key in exports && exports[key] === _index[key]) return;
|
|
@@ -14,202 +14,4 @@ Object.keys(_index).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var _index2 = require("./modules/theme/index.js");
|
|
18
|
-
Object.keys(_index2).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _index2[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _index2[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _index3 = require("./modules/tile/index.js");
|
|
29
|
-
Object.keys(_index3).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _index3[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _index3[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _index4 = require("./modules/auth/index.js");
|
|
40
|
-
Object.keys(_index4).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _index4[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _index4[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _index5 = require("./modules/helpers/index.js");
|
|
51
|
-
Object.keys(_index5).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _index5[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _index5[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
var _index6 = require("./modules/diary/index.js");
|
|
62
|
-
Object.keys(_index6).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _index6[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _index6[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
var _index7 = require("./modules/measurement/index.js");
|
|
73
|
-
Object.keys(_index7).forEach(function (key) {
|
|
74
|
-
if (key === "default" || key === "__esModule") return;
|
|
75
|
-
if (key in exports && exports[key] === _index7[key]) return;
|
|
76
|
-
Object.defineProperty(exports, key, {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function () {
|
|
79
|
-
return _index7[key];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
var _index8 = require("./modules/tab/index.js");
|
|
84
|
-
Object.keys(_index8).forEach(function (key) {
|
|
85
|
-
if (key === "default" || key === "__esModule") return;
|
|
86
|
-
if (key in exports && exports[key] === _index8[key]) return;
|
|
87
|
-
Object.defineProperty(exports, key, {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function () {
|
|
90
|
-
return _index8[key];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
var _index9 = require("./modules/observation-detail/index.js");
|
|
95
|
-
Object.keys(_index9).forEach(function (key) {
|
|
96
|
-
if (key === "default" || key === "__esModule") return;
|
|
97
|
-
if (key in exports && exports[key] === _index9[key]) return;
|
|
98
|
-
Object.defineProperty(exports, key, {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function () {
|
|
101
|
-
return _index9[key];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
var _index0 = require("./modules/content/index.js");
|
|
106
|
-
Object.keys(_index0).forEach(function (key) {
|
|
107
|
-
if (key === "default" || key === "__esModule") return;
|
|
108
|
-
if (key in exports && exports[key] === _index0[key]) return;
|
|
109
|
-
Object.defineProperty(exports, key, {
|
|
110
|
-
enumerable: true,
|
|
111
|
-
get: function () {
|
|
112
|
-
return _index0[key];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
var _index1 = require("./modules/cms/index.js");
|
|
117
|
-
Object.keys(_index1).forEach(function (key) {
|
|
118
|
-
if (key === "default" || key === "__esModule") return;
|
|
119
|
-
if (key in exports && exports[key] === _index1[key]) return;
|
|
120
|
-
Object.defineProperty(exports, key, {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return _index1[key];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
var _index10 = require("./modules/bt-management/index.js");
|
|
128
|
-
Object.keys(_index10).forEach(function (key) {
|
|
129
|
-
if (key === "default" || key === "__esModule") return;
|
|
130
|
-
if (key in exports && exports[key] === _index10[key]) return;
|
|
131
|
-
Object.defineProperty(exports, key, {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
get: function () {
|
|
134
|
-
return _index10[key];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
var _index11 = require("./polyfills/index.js");
|
|
139
|
-
Object.keys(_index11).forEach(function (key) {
|
|
140
|
-
if (key === "default" || key === "__esModule") return;
|
|
141
|
-
if (key in exports && exports[key] === _index11[key]) return;
|
|
142
|
-
Object.defineProperty(exports, key, {
|
|
143
|
-
enumerable: true,
|
|
144
|
-
get: function () {
|
|
145
|
-
return _index11[key];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
var _index12 = require("./modules/language-switcher/index.js");
|
|
150
|
-
Object.keys(_index12).forEach(function (key) {
|
|
151
|
-
if (key === "default" || key === "__esModule") return;
|
|
152
|
-
if (key in exports && exports[key] === _index12[key]) return;
|
|
153
|
-
Object.defineProperty(exports, key, {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
get: function () {
|
|
156
|
-
return _index12[key];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
var _index13 = require("./modules/journal/index.js");
|
|
161
|
-
Object.keys(_index13).forEach(function (key) {
|
|
162
|
-
if (key === "default" || key === "__esModule") return;
|
|
163
|
-
if (key in exports && exports[key] === _index13[key]) return;
|
|
164
|
-
Object.defineProperty(exports, key, {
|
|
165
|
-
enumerable: true,
|
|
166
|
-
get: function () {
|
|
167
|
-
return _index13[key];
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
var _index14 = require("./modules/progress-bar/index.js");
|
|
172
|
-
Object.keys(_index14).forEach(function (key) {
|
|
173
|
-
if (key === "default" || key === "__esModule") return;
|
|
174
|
-
if (key in exports && exports[key] === _index14[key]) return;
|
|
175
|
-
Object.defineProperty(exports, key, {
|
|
176
|
-
enumerable: true,
|
|
177
|
-
get: function () {
|
|
178
|
-
return _index14[key];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
var _index15 = require("./modules/progress-ring/index.js");
|
|
183
|
-
Object.keys(_index15).forEach(function (key) {
|
|
184
|
-
if (key === "default" || key === "__esModule") return;
|
|
185
|
-
if (key in exports && exports[key] === _index15[key]) return;
|
|
186
|
-
Object.defineProperty(exports, key, {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
get: function () {
|
|
189
|
-
return _index15[key];
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
var _index16 = require("./modules/patient/index.js");
|
|
194
|
-
Object.keys(_index16).forEach(function (key) {
|
|
195
|
-
if (key === "default" || key === "__esModule") return;
|
|
196
|
-
if (key in exports && exports[key] === _index16[key]) return;
|
|
197
|
-
Object.defineProperty(exports, key, {
|
|
198
|
-
enumerable: true,
|
|
199
|
-
get: function () {
|
|
200
|
-
return _index16[key];
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
var _index17 = require("./modules/questionnaire-response-form/index.js");
|
|
205
|
-
Object.keys(_index17).forEach(function (key) {
|
|
206
|
-
if (key === "default" || key === "__esModule") return;
|
|
207
|
-
if (key in exports && exports[key] === _index17[key]) return;
|
|
208
|
-
Object.defineProperty(exports, key, {
|
|
209
|
-
enumerable: true,
|
|
210
|
-
get: function () {
|
|
211
|
-
return _index17[key];
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_index","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"
|
|
1
|
+
{"version":3,"names":["_index","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.storedSteps = storedSteps;
|
|
7
|
+
exports.storedStepsThenFinish = storedStepsThenFinish;
|
|
7
8
|
var _replies = require("./replies.js");
|
|
8
9
|
var _requests = require("./requests.js");
|
|
9
10
|
/** The hours a day slot is read from, six at a time. */
|
|
@@ -39,8 +40,19 @@ const finishedHours = (block, now) => block.steps.flatMap((steps, index) => {
|
|
|
39
40
|
const endsAt = new Date(block.year, block.month - 1, block.day, hour).getTime() + HOUR_MS;
|
|
40
41
|
return steps === null || steps === 0 || endsAt > now.getTime() ? [] : [recordOf(block, hour, steps)];
|
|
41
42
|
});
|
|
43
|
+
const DATE_DIGITS = 100;
|
|
44
|
+
const dateNumberOf = ({
|
|
45
|
+
year,
|
|
46
|
+
month,
|
|
47
|
+
day
|
|
48
|
+
}) => (year * DATE_DIGITS + month) * DATE_DIGITS + day;
|
|
42
49
|
|
|
43
|
-
/**
|
|
50
|
+
/** A block dated before the firmware was built comes from a clock that reset after a power loss, so its hours have no real date. */
|
|
51
|
+
const datedBeforeFirmware = (block, {
|
|
52
|
+
date
|
|
53
|
+
}) => date !== null && dateNumberOf(block) < date;
|
|
54
|
+
|
|
55
|
+
/** The step counts of every day slot, an hour each. */
|
|
44
56
|
async function* storedSteps(connection) {
|
|
45
57
|
const {
|
|
46
58
|
newestSlot,
|
|
@@ -49,11 +61,16 @@ async function* storedSteps(connection) {
|
|
|
49
61
|
for (const slot of slotsOldestFirst(newestSlot, slotCount)) {
|
|
50
62
|
for (const firstHour of BLOCK_FIRST_HOURS) {
|
|
51
63
|
const block = (0, _replies.stepBlockOf)(await connection.request((0, _requests.activityRequest)(slot, firstHour)));
|
|
52
|
-
if (block !== null) {
|
|
64
|
+
if (block !== null && !datedBeforeFirmware(block, connection.firmware)) {
|
|
53
65
|
yield* finishedHours(block, connection.now());
|
|
54
66
|
}
|
|
55
67
|
}
|
|
56
68
|
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The step counts of every day slot, then the end-of-sync marker the wristbands expect. */
|
|
72
|
+
async function* storedStepsThenFinish(connection) {
|
|
73
|
+
yield* storedSteps(connection);
|
|
57
74
|
await connection.send((0, _requests.finishSyncRequest)()).catch(() => connection.logger.warn("trasense.finish-sync.failed"));
|
|
58
75
|
}
|
|
59
76
|
//# sourceMappingURL=history.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_replies","require","_requests","BLOCK_FIRST_HOURS","HOUR_MS","slotsOldestFirst","newestSlot","slotCount","Array","from","length","_","offset","recordOf","year","month","day","hour","steps","id","join","reading","type","takenAt","Date","values","value","unit","deviceFlags","finishedHours","block","now","flatMap","index","firstHour","endsAt","getTime","storedSteps","connection","activityCountOf","request","activityCountRequest","slot","stepBlockOf","activityRequest","send","finishSyncRequest","catch","logger","warn"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/history.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_replies","require","_requests","BLOCK_FIRST_HOURS","HOUR_MS","slotsOldestFirst","newestSlot","slotCount","Array","from","length","_","offset","recordOf","year","month","day","hour","steps","id","join","reading","type","takenAt","Date","values","value","unit","deviceFlags","finishedHours","block","now","flatMap","index","firstHour","endsAt","getTime","DATE_DIGITS","dateNumberOf","datedBeforeFirmware","date","storedSteps","connection","activityCountOf","request","activityCountRequest","slot","stepBlockOf","activityRequest","firmware","storedStepsThenFinish","send","finishSyncRequest","catch","logger","warn"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/history.ts"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAGA;AACA,MAAME,iBAAiB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAU;AAEjD,MAAMC,OAAO,GAAG,SAAS;;AAEzB;AACA,MAAMC,gBAAgB,GAAGA,CAACC,UAAkB,EAAEC,SAAiB,KAC7DC,KAAK,CAACC,IAAI,CA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CAAC,6BAA6B,CAAC,CAAC;AAC/G","ignoreList":[]}
|
|
@@ -6,15 +6,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.TRASENSE_MODELS = exports.SH_SERIES_PROTOCOL = exports.SH_SERIES_BY_FIRMWARE_PROTOCOL = exports.H_SERIES_PROTOCOL = void 0;
|
|
7
7
|
var _modelRow = require("../sig/model-row.js");
|
|
8
8
|
var _protocol = require("./protocol.js");
|
|
9
|
+
var _s = require("./s9.js");
|
|
9
10
|
var _variants = require("./variants.js");
|
|
10
11
|
const H_SERIES_PROTOCOL = exports.H_SERIES_PROTOCOL = (0, _protocol.wristbandProtocol)(_variants.H_SERIES);
|
|
11
12
|
const SH_SERIES_PROTOCOL = exports.SH_SERIES_PROTOCOL = (0, _protocol.wristbandProtocol)(_variants.SH_SERIES);
|
|
12
13
|
const SH_SERIES_BY_FIRMWARE_PROTOCOL = exports.SH_SERIES_BY_FIRMWARE_PROTOCOL = (0, _protocol.wristbandProtocol)(_variants.SH_SERIES_BY_FIRMWARE);
|
|
13
14
|
const ACTIVITY = ["activity"];
|
|
15
|
+
const WATCH_MEASURES = ["activity", "heart_rate", "temperature"];
|
|
16
|
+
|
|
17
|
+
/** Other watches advertise `S9` too, so the S9's own manufacturer data must be there: company 0x0A0A, byte 5 always `01`. */
|
|
18
|
+
const S9_ADVERTISEMENT = {
|
|
19
|
+
kind: "manufacturer",
|
|
20
|
+
company: 0x0a0a,
|
|
21
|
+
at: 5,
|
|
22
|
+
equals: "01"
|
|
23
|
+
};
|
|
14
24
|
const hSeries = (0, _modelRow.modelRows)(_variants.H_SERIES.id, ACTIVITY);
|
|
15
25
|
const shSeries = (0, _modelRow.modelRows)(_variants.SH_SERIES.id, ACTIVITY);
|
|
16
26
|
const shSeriesByFirmware = (0, _modelRow.modelRows)(_variants.SH_SERIES_BY_FIRMWARE.id, ACTIVITY);
|
|
27
|
+
const watch = (0, _modelRow.modelRows)(_s.S9_PROTOCOL.id, WATCH_MEASURES);
|
|
17
28
|
|
|
18
|
-
/** The wristbands in catalog order: four
|
|
19
|
-
const TRASENSE_MODELS = exports.TRASENSE_MODELS = [hSeries("Trasense", "TS-H01", ["Wristband"]), hSeries("Trasense", "TS-H03", ["Wristband"]), hSeries("Trasense", "TS-H03 PRO", ["H03Pro", "WristbandH03*"]), shSeriesByFirmware("Trasense", "SH06", ["Wristband"]), shSeriesByFirmware("Movement", "SH08", ["Wristband"]), shSeries("Movement", "SH05 Waterfalls", ["SH05*"]), shSeries("Trasense", "SH09", ["SH09*"]), shSeries("Trasense", "SH09U", ["Wristband9U*"])]
|
|
29
|
+
/** The wristbands in catalog order, then the S9 watch: four wristbands advertise the plain name "Wristband", so the first of those is the default. */
|
|
30
|
+
const TRASENSE_MODELS = exports.TRASENSE_MODELS = [hSeries("Trasense", "TS-H01", ["Wristband"]), hSeries("Trasense", "TS-H03", ["Wristband"]), hSeries("Trasense", "TS-H03 PRO", ["H03Pro", "WristbandH03*"]), shSeriesByFirmware("Trasense", "SH06", ["Wristband"]), shSeriesByFirmware("Movement", "SH08", ["Wristband"]), shSeries("Movement", "SH05 Waterfalls", ["SH05*"]), shSeries("Trasense", "SH09", ["SH09*"]), shSeries("Trasense", "SH09U", ["Wristband9U*"]), watch("Trasense", "S9", ["S9"], {
|
|
31
|
+
requires: [S9_ADVERTISEMENT]
|
|
32
|
+
})];
|
|
20
33
|
//# sourceMappingURL=models.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_modelRow","require","_protocol","_variants","H_SERIES_PROTOCOL","exports","wristbandProtocol","H_SERIES","SH_SERIES_PROTOCOL","SH_SERIES","SH_SERIES_BY_FIRMWARE_PROTOCOL","SH_SERIES_BY_FIRMWARE","ACTIVITY","hSeries","modelRows","id","shSeries","shSeriesByFirmware","TRASENSE_MODELS"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/models.ts"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,
|
|
1
|
+
{"version":3,"names":["_modelRow","require","_protocol","_s","_variants","H_SERIES_PROTOCOL","exports","wristbandProtocol","H_SERIES","SH_SERIES_PROTOCOL","SH_SERIES","SH_SERIES_BY_FIRMWARE_PROTOCOL","SH_SERIES_BY_FIRMWARE","ACTIVITY","WATCH_MEASURES","S9_ADVERTISEMENT","kind","company","at","equals","hSeries","modelRows","id","shSeries","shSeriesByFirmware","watch","S9_PROTOCOL","TRASENSE_MODELS","requires"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/models.ts"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,EAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,MAAMI,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAAE,2BAAiB,EAACC,kBAAQ,CAAC;AACrD,MAAMC,kBAAkB,GAAAH,OAAA,CAAAG,kBAAA,GAAG,IAAAF,2BAAiB,EAACG,mBAAS,CAAC;AACvD,MAAMC,8BAA8B,GAAAL,OAAA,CAAAK,8BAAA,GAAG,IAAAJ,2BAAiB,EAACK,+BAAqB,CAAC;AAE/E,MAAMC,QAAoC,GAAG,CAAC,UAAU,CAAC;AACzD,MAAMC,cAA0C,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC;;AAE5F;AACA,MAAMC,gBAAmC,GAAG;EAAEC,IAAI,EAAE,cAAc;EAAEC,OAAO,EAAE,MAAM;EAAEC,EAAE,EAAE,CAAC;EAAEC,MAAM,EAAE;AAAK,CAAC;AAE1G,MAAMC,OAAO,GAAG,IAAAC,mBAAS,EAACb,kBAAQ,CAACc,EAAE,EAAET,QAAQ,CAAC;AAChD,MAAMU,QAAQ,GAAG,IAAAF,mBAAS,EAACX,mBAAS,CAACY,EAAE,EAAET,QAAQ,CAAC;AAClD,MAAMW,kBAAkB,GAAG,IAAAH,mBAAS,EAACT,+BAAqB,CAACU,EAAE,EAAET,QAAQ,CAAC;AACxE,MAAMY,KAAK,GAAG,IAAAJ,mBAAS,EAACK,cAAW,CAACJ,EAAE,EAAER,cAAc,CAAC;;AAEvD;AACA,MAAMa,eAAuC,GAAArB,OAAA,CAAAqB,eAAA,GAAG,CAC9CP,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC,EAC5CA,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC,EAC5CA,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,EAC9DI,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC,EACrDA,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC,EACrDD,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC,EAClDA,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,EACvCA,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,EAC/CE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE;EAAEG,QAAQ,EAAE,CAACb,gBAAgB;AAAE,CAAC,CAAC,CAClE","ignoreList":[]}
|
|
@@ -3,26 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.wristbandProtocol = void 0;
|
|
6
|
+
exports.wristbandProtocol = exports.identityOf = void 0;
|
|
7
7
|
var _deviceInformation = require("../sig/device-information.js");
|
|
8
8
|
var _battery = require("./battery.js");
|
|
9
9
|
var _history = require("./history.js");
|
|
10
10
|
var _requests = require("./requests.js");
|
|
11
11
|
var _session = require("./session.js");
|
|
12
|
+
/** What a band says about itself: only its firmware version. */
|
|
13
|
+
const identityOf = async ({
|
|
14
|
+
firmware
|
|
15
|
+
}) => ({
|
|
16
|
+
manufacturer: null,
|
|
17
|
+
model: null,
|
|
18
|
+
serial: null,
|
|
19
|
+
firmware: firmware.version || null,
|
|
20
|
+
hardware: null
|
|
21
|
+
});
|
|
22
|
+
|
|
12
23
|
/** A wristband of one variant: its firmware, a clock, its battery, and the steps it stores an hour at a time as history. */
|
|
24
|
+
exports.identityOf = identityOf;
|
|
13
25
|
const wristbandProtocol = variant => ({
|
|
14
26
|
id: variant.id,
|
|
15
27
|
services: variant.serviceBatteryOnOldFirmware ? [_session.WRISTBAND_SERVICE, _deviceInformation.BATTERY_SERVICE] : [_session.WRISTBAND_SERVICE],
|
|
16
28
|
open: _session.openConnection,
|
|
17
|
-
identify:
|
|
18
|
-
firmware
|
|
19
|
-
}) => ({
|
|
20
|
-
manufacturer: null,
|
|
21
|
-
model: null,
|
|
22
|
-
serial: null,
|
|
23
|
-
firmware: firmware.version || null,
|
|
24
|
-
hardware: null
|
|
25
|
-
}),
|
|
29
|
+
identify: identityOf,
|
|
26
30
|
setClock: async ({
|
|
27
31
|
request,
|
|
28
32
|
firmware
|
|
@@ -30,7 +34,7 @@ const wristbandProtocol = variant => ({
|
|
|
30
34
|
await request((0, _requests.clockRequest)(now, variant.dayWindow(firmware)));
|
|
31
35
|
},
|
|
32
36
|
battery: connection => (0, _battery.readBattery)(variant, connection),
|
|
33
|
-
history: _history.
|
|
37
|
+
history: _history.storedStepsThenFinish,
|
|
34
38
|
close: async ({
|
|
35
39
|
stop
|
|
36
40
|
}) => stop()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deviceInformation","require","_battery","_history","_requests","_session","
|
|
1
|
+
{"version":3,"names":["_deviceInformation","require","_battery","_history","_requests","_session","identityOf","firmware","manufacturer","model","serial","version","hardware","exports","wristbandProtocol","variant","id","services","serviceBatteryOnOldFirmware","WRISTBAND_SERVICE","BATTERY_SERVICE","open","openConnection","identify","setClock","request","now","clockRequest","dayWindow","battery","connection","readBattery","history","storedStepsThenFinish","close","stop"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/protocol.ts"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAGA;AACA,MAAMK,UAAU,GAAG,MAAAA,CAAO;EAAEC;AAA8B,CAAC,MAA2C;EACpGC,YAAY,EAAE,IAAI;EAClBC,KAAK,EAAE,IAAI;EACXC,MAAM,EAAE,IAAI;EACZH,QAAQ,EAAEA,QAAQ,CAACI,OAAO,IAAI,IAAI;EAClCC,QAAQ,EAAE;AACZ,CAAC,CAAC;;AAEF;AAAAC,OAAA,CAAAP,UAAA,GAAAA,UAAA;AACA,MAAMQ,iBAAiB,GAAIC,OAAyB,KAA2C;EAC7FC,EAAE,EAAED,OAAO,CAACC,EAAE;EACdC,QAAQ,EAAEF,OAAO,CAACG,2BAA2B,GAAG,CAACC,0BAAiB,EAAEC,kCAAe,CAAC,GAAG,CAACD,0BAAiB,CAAC;EAC1GE,IAAI,EAAEC,uBAAc;EACpBC,QAAQ,EAAEjB,UAAU;EACpBkB,QAAQ,EAAE,MAAAA,CAAO;IAAEC,OAAO;IAAElB;EAAS,CAAC,EAAEmB,GAAG,KAAK;IAC9C,MAAMD,OAAO,CAAC,IAAAE,sBAAY,EAACD,GAAG,EAAEX,OAAO,CAACa,SAAS,CAACrB,QAAQ,CAAC,CAAC,CAAC;EAC/D,CAAC;EACDsB,OAAO,EAAGC,UAAU,IAAK,IAAAC,oBAAW,EAAChB,OAAO,EAAEe,UAAU,CAAC;EACzDE,OAAO,EAAEC,8BAAqB;EAC9BC,KAAK,EAAE,MAAAA,CAAO;IAAEC;EAAK,CAAC,KAAKA,IAAI,CAAC;AAClC,CAAC,CAAC;AAACtB,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -3,13 +3,26 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.stepBlockOf = exports.firmwareOfReply = exports.batteryLevelOf = exports.activityCountOf = void 0;
|
|
6
|
+
exports.temperatureOf = exports.stepBlockOf = exports.heartRateOf = exports.firmwareOfReply = exports.batteryLevelOf = exports.activityCountOf = void 0;
|
|
7
7
|
var _bytes = require("../../codec/bytes.js");
|
|
8
8
|
var _firmware = require("./firmware.js");
|
|
9
9
|
const VERSION_AT = 1;
|
|
10
10
|
const NEWEST_SLOT_AT = 1;
|
|
11
11
|
const SLOT_COUNT_AT = 2;
|
|
12
12
|
const BATTERY_LEVEL_AT = 1;
|
|
13
|
+
const HEART_RATE_AT = 2;
|
|
14
|
+
const TEMPERATURE_AT = 3;
|
|
15
|
+
const HUNDREDTHS = 100;
|
|
16
|
+
|
|
17
|
+
/** The watch's documented valid ranges; anything outside, 0 included, is no reading yet. */
|
|
18
|
+
const HEART_RATE_RANGE = {
|
|
19
|
+
low: 40,
|
|
20
|
+
high: 200
|
|
21
|
+
};
|
|
22
|
+
const TEMPERATURE_RANGE = {
|
|
23
|
+
low: 35,
|
|
24
|
+
high: 42
|
|
25
|
+
};
|
|
13
26
|
const YEAR_HIGH_AT = 1;
|
|
14
27
|
const YEAR_LOW_AT = 2;
|
|
15
28
|
const MONTH_AT = 3;
|
|
@@ -45,6 +58,18 @@ const activityCountOf = frame => ({
|
|
|
45
58
|
exports.activityCountOf = activityCountOf;
|
|
46
59
|
const batteryLevelOf = frame => frame[BATTERY_LEVEL_AT] ?? 0;
|
|
47
60
|
exports.batteryLevelOf = batteryLevelOf;
|
|
61
|
+
const within = (value, {
|
|
62
|
+
low,
|
|
63
|
+
high
|
|
64
|
+
}) => value >= low && value <= high ? value : null;
|
|
65
|
+
|
|
66
|
+
/** The heart rate in bpm a heart-rate read reply carries; `null` while the watch has none. */
|
|
67
|
+
const heartRateOf = frame => within(frame[HEART_RATE_AT] ?? 0, HEART_RATE_RANGE);
|
|
68
|
+
|
|
69
|
+
/** The temperature in °C a temperature read reply carries; `null` while the watch has none. */
|
|
70
|
+
exports.heartRateOf = heartRateOf;
|
|
71
|
+
const temperatureOf = frame => within((0, _bytes.u16le)(frame, TEMPERATURE_AT) / HUNDREDTHS, TEMPERATURE_RANGE);
|
|
72
|
+
exports.temperatureOf = temperatureOf;
|
|
48
73
|
const stepsOf = (frame, hour) => {
|
|
49
74
|
const count = (0, _bytes.u16be)(frame, STEPS_AT + hour * STEPS_BYTES);
|
|
50
75
|
return count > LAST_STEP_COUNT ? null : count;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bytes","require","_firmware","VERSION_AT","NEWEST_SLOT_AT","SLOT_COUNT_AT","BATTERY_LEVEL_AT","YEAR_HIGH_AT","YEAR_LOW_AT","MONTH_AT","DAY_AT","FIRST_HOUR_AT","STEPS_AT","STEPS_BYTES","HOURS_PER_BLOCK","CENTURY_YEARS","EMPTY_SLOT","LAST_STEP_COUNT","LAST_MONTH","LAST_DAY","LAST_FIRST_HOUR","firmwareOfReply","frame","firmwareOf","ascii","subarray","filter","byte","exports","activityCountOf","newestSlot","slotCount","batteryLevelOf","stepsOf","hour","count","u16be","isPlausible","month","day","firstHour","stepBlockOf","year","steps","Array","from","length","_"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/replies.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,MAAME,UAAU,GAAG,CAAC;AAEpB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,aAAa,GAAG,CAAC;AAEvB,MAAMC,gBAAgB,GAAG,CAAC;
|
|
1
|
+
{"version":3,"names":["_bytes","require","_firmware","VERSION_AT","NEWEST_SLOT_AT","SLOT_COUNT_AT","BATTERY_LEVEL_AT","HEART_RATE_AT","TEMPERATURE_AT","HUNDREDTHS","HEART_RATE_RANGE","low","high","TEMPERATURE_RANGE","YEAR_HIGH_AT","YEAR_LOW_AT","MONTH_AT","DAY_AT","FIRST_HOUR_AT","STEPS_AT","STEPS_BYTES","HOURS_PER_BLOCK","CENTURY_YEARS","EMPTY_SLOT","LAST_STEP_COUNT","LAST_MONTH","LAST_DAY","LAST_FIRST_HOUR","firmwareOfReply","frame","firmwareOf","ascii","subarray","filter","byte","exports","activityCountOf","newestSlot","slotCount","batteryLevelOf","within","value","heartRateOf","temperatureOf","u16le","stepsOf","hour","count","u16be","isPlausible","month","day","firstHour","stepBlockOf","year","steps","Array","from","length","_"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/replies.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,MAAME,UAAU,GAAG,CAAC;AAEpB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,aAAa,GAAG,CAAC;AAEvB,MAAMC,gBAAgB,GAAG,CAAC;AAC1B,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,UAAU,GAAG,GAAG;;AAEtB;AACA,MAAMC,gBAAgB,GAAG;EAAEC,GAAG,EAAE,EAAE;EAAEC,IAAI,EAAE;AAAI,CAAU;AACxD,MAAMC,iBAAiB,GAAG;EAAEF,GAAG,EAAE,EAAE;EAAEC,IAAI,EAAE;AAAG,CAAU;AAExD,MAAME,YAAY,GAAG,CAAC;AACtB,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,QAAQ,GAAG,CAAC;AAClB,MAAMC,MAAM,GAAG,CAAC;AAChB,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,QAAQ,GAAG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AAI,CAAC;MAAEC,MAAM,EAAErC;IAAgB,CAAC,EAAE,CAACsC,CAAC,EAAEb,IAAI,KAAKD,OAAO,CAAChB,KAAK,EAAEiB,IAAI,CAAC;EAClF,CAAC;AACH,CAAC;AAACX,OAAA,CAAAkB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.versionRequest = exports.
|
|
6
|
+
exports.versionRequest = exports.temperatureRequest = exports.heartRateRequest = exports.finishSyncRequest = exports.clockRequest = exports.bindRequest = exports.batteryRequest = exports.answersSubcommand = exports.answers = exports.activityRequest = exports.activityCountRequest = exports.FRAME_BYTES = void 0;
|
|
7
7
|
/** Every frame is this long in both directions, zero padded. */
|
|
8
8
|
const FRAME_BYTES = exports.FRAME_BYTES = 20;
|
|
9
9
|
|
|
@@ -15,10 +15,14 @@ const OPCODE = {
|
|
|
15
15
|
activityCount: 0x10,
|
|
16
16
|
activity: 0x13,
|
|
17
17
|
battery: 0x30,
|
|
18
|
+
temperature: 0x3f,
|
|
19
|
+
heartRate: 0x56,
|
|
18
20
|
version: 0x70,
|
|
19
21
|
finishSync: 0x71
|
|
20
22
|
};
|
|
21
23
|
const BIND_SUBCOMMAND = 0x02;
|
|
24
|
+
const HEART_RATE_READ = 0x02;
|
|
25
|
+
const TEMPERATURE_READ = [0x01, 0x01];
|
|
22
26
|
const BOUND = 0x01;
|
|
23
27
|
const CENTURY_YEARS = 100;
|
|
24
28
|
const frameOf = (opcode, payload = []) => {
|
|
@@ -30,8 +34,15 @@ const frameOf = (opcode, payload = []) => {
|
|
|
30
34
|
/** The opcode a reply to this request carries. */
|
|
31
35
|
const replyOpcodeOf = request => (request[0] ?? 0) | REPLY_BIT;
|
|
32
36
|
|
|
37
|
+
/** Whether a reply answers this request: its opcode with the reply bit set. */
|
|
38
|
+
const answers = request => reply => reply[0] === replyOpcodeOf(request);
|
|
39
|
+
|
|
40
|
+
/** Whether a reply answers this request and repeats its sub-command, as heart-rate and temperature replies do. */
|
|
41
|
+
exports.answers = answers;
|
|
42
|
+
const answersSubcommand = request => reply => answers(request)(reply) && reply[1] === request[1];
|
|
43
|
+
|
|
33
44
|
/** Asks for the firmware version string. */
|
|
34
|
-
exports.
|
|
45
|
+
exports.answersSubcommand = answersSubcommand;
|
|
35
46
|
const versionRequest = () => frameOf(OPCODE.version);
|
|
36
47
|
|
|
37
48
|
/** Asks for the battery level. */
|
|
@@ -46,8 +57,16 @@ const activityCountRequest = () => frameOf(OPCODE.activityCount);
|
|
|
46
57
|
exports.activityCountRequest = activityCountRequest;
|
|
47
58
|
const activityRequest = (slot, firstHour) => frameOf(OPCODE.activity, [slot, firstHour]);
|
|
48
59
|
|
|
49
|
-
/**
|
|
60
|
+
/** Asks for the heart rate the watch measures right now. */
|
|
50
61
|
exports.activityRequest = activityRequest;
|
|
62
|
+
const heartRateRequest = () => frameOf(OPCODE.heartRate, [HEART_RATE_READ]);
|
|
63
|
+
|
|
64
|
+
/** Asks for the temperature the watch measures right now. */
|
|
65
|
+
exports.heartRateRequest = heartRateRequest;
|
|
66
|
+
const temperatureRequest = () => frameOf(OPCODE.temperature, [...TEMPERATURE_READ]);
|
|
67
|
+
|
|
68
|
+
/** Marks the end of a sync. */
|
|
69
|
+
exports.temperatureRequest = temperatureRequest;
|
|
51
70
|
const finishSyncRequest = () => frameOf(OPCODE.finishSync);
|
|
52
71
|
|
|
53
72
|
/** Locks the band to this phone. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FRAME_BYTES","exports","REPLY_BIT","OPCODE","setClock","bind","activityCount","activity","battery","version","finishSync","BIND_SUBCOMMAND","BOUND","CENTURY_YEARS","frameOf","opcode","payload","frame","Uint8Array","set","replyOpcodeOf","request","versionRequest","batteryRequest","activityCountRequest","activityRequest","slot","firstHour","finishSyncRequest","bindRequest","clockRequest","now","start","end","Math","floor","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/requests.ts"],"mappings":";;;;;;AAEA;AACA,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,EAAE;;AAEtB;AACA,MAAME,SAAS,GAAG,IAAI;AAEtB,MAAMC,MAAM,GAAG;EACbC,QAAQ,EAAE,IAAI;EACdC,IAAI,EAAE,IAAI;EACVC,aAAa,EAAE,IAAI;EACnBC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,IAAI;EACbC,OAAO,EAAE,IAAI;EACbC,UAAU,EAAE;AACd,CAAU;AAEV,MAAMC,eAAe,GAAG,IAAI;AAC5B,MAAMC,KAAK,GAAG,IAAI;AAClB,MAAMC,aAAa,GAAG,GAAG;AAEzB,MAAMC,OAAO,GAAGA,CAACC,MAAc,EAAEC,OAA0B,GAAG,EAAE,KAAiB;EAC/E,MAAMC,KAAK,GAAG,IAAIC,UAAU,
|
|
1
|
+
{"version":3,"names":["FRAME_BYTES","exports","REPLY_BIT","OPCODE","setClock","bind","activityCount","activity","battery","temperature","heartRate","version","finishSync","BIND_SUBCOMMAND","HEART_RATE_READ","TEMPERATURE_READ","BOUND","CENTURY_YEARS","frameOf","opcode","payload","frame","Uint8Array","set","replyOpcodeOf","request","answers","reply","answersSubcommand","versionRequest","batteryRequest","activityCountRequest","activityRequest","slot","firstHour","heartRateRequest","temperatureRequest","finishSyncRequest","bindRequest","clockRequest","now","start","end","Math","floor","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/trasense/requests.ts"],"mappings":";;;;;;AAEA;AACA,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,EAAE;;AAEtB;AACA,MAAME,SAAS,GAAG,IAAI;AAEtB,MAAMC,MAAM,GAAG;EACbC,QAAQ,EAAE,IAAI;EACdC,IAAI,EAAE,IAAI;EACVC,aA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