@ovok/native 0.4.8 → 0.4.10
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/LICENSE +8 -667
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +15 -13
- package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js +7 -1
- package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +184 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-frame-parser.js +114 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-frame-parser.js.map +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js +113 -51
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.main-services.js +41 -77
- package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.main-services.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +15 -13
- package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/module/modules/bt-management/services/device-creator.js +7 -1
- package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +180 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-frame-parser.js +110 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01-frame-parser.js.map +1 -0
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js +113 -51
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.main-services.js +41 -77
- package/lib/module/modules/bt-management/services/devices/bc01/bc01.main-services.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +0 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts +53 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts +53 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +33 -13
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts +11 -17
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +0 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts +53 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts +53 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +33 -13
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts +11 -17
- package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,16 +4,43 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BC01Device = void 0;
|
|
7
|
+
var _core = require("@ovok/core");
|
|
7
8
|
var _caseType = require("../../../types/case-type.js");
|
|
9
|
+
var _hexToByte = require("../../../utils/hex-to-byte.js");
|
|
8
10
|
var _btManagedDevice = require("../bt-managed-device.js");
|
|
11
|
+
var _bc01CommandSequencer = require("./bc01-command-sequencer.js");
|
|
12
|
+
var _bc01FrameParser = require("./bc01-frame-parser.js");
|
|
9
13
|
var _bc01MainServices = require("./bc01.main-services.js");
|
|
14
|
+
/** Minimum bytes a complete frame carries, keyed by its opening opcode. */
|
|
15
|
+
const BC01_FRAME_MIN_LENGTH = {
|
|
16
|
+
0xf0: 2,
|
|
17
|
+
// ACK
|
|
18
|
+
0xf2: 8,
|
|
19
|
+
// Version reply (variable — 8 is the minimum PHMS reads before answering)
|
|
20
|
+
0xf3: 3,
|
|
21
|
+
// Time-sync ack
|
|
22
|
+
0xe0: 7,
|
|
23
|
+
// Record-count reply
|
|
24
|
+
0xe1: 16,
|
|
25
|
+
// Stored URS record
|
|
26
|
+
0xe2: 16,
|
|
27
|
+
// Paginated URS record
|
|
28
|
+
0xe3: 3,
|
|
29
|
+
// Finish
|
|
30
|
+
0xe4: 36,
|
|
31
|
+
// Quantitative record (optional path)
|
|
32
|
+
0xe5: 36 // Quantitative record (optional path)
|
|
33
|
+
};
|
|
34
|
+
|
|
10
35
|
/**
|
|
11
36
|
* Contec BC401 (BC01) urine analyzer driver.
|
|
12
37
|
*
|
|
13
|
-
* The BC401 is a
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
38
|
+
* The BC401 is a memory device, not a live stream: every measurement the
|
|
39
|
+
* patient takes is written to onboard 500-slot flash the moment the strip
|
|
40
|
+
* finishes reacting, and the app pulls stored records over BLE only after the
|
|
41
|
+
* host walks the reset → version → set-time → count → get-records handshake
|
|
42
|
+
* documented in `bc01-command-sequencer.ts`. Every record arrives as one
|
|
43
|
+
* 16-byte E1/E2 frame on 0xFF02.
|
|
17
44
|
*/
|
|
18
45
|
class BC01Device extends _btManagedDevice.BTManagedDevice {
|
|
19
46
|
onStreamStart = () => {};
|
|
@@ -21,66 +48,101 @@ class BC01Device extends _btManagedDevice.BTManagedDevice {
|
|
|
21
48
|
|
|
22
49
|
/**
|
|
23
50
|
* 90 s covers the maximum firmware-side reagent-pad settle time on a URS-7
|
|
24
|
-
* strip
|
|
25
|
-
*
|
|
51
|
+
* strip and leaves headroom for a bulk memory dump of every stored record.
|
|
52
|
+
* If the device does not push a frame within that window the data processor
|
|
53
|
+
* times out and the driver surfaces "device unreachable".
|
|
26
54
|
*/
|
|
27
55
|
stuckDataTimeout = 90_000;
|
|
56
|
+
constructor(device, params) {
|
|
57
|
+
super(device, params);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The BC401 answers one command with one frame and picks the next command
|
|
61
|
+
* by the first byte of that frame. The sequencer walks reset → version →
|
|
62
|
+
* set-time → count → records, and acknowledges the last record of every
|
|
63
|
+
* set. The parent's default `pollingSequencerFor` would only re-send the
|
|
64
|
+
* declared reset forever, which the firmware ignores after the first one.
|
|
65
|
+
*/
|
|
66
|
+
this.createCommandSequencer = () => new _bc01CommandSequencer.Bc01CommandSequencer({
|
|
67
|
+
write: {
|
|
68
|
+
serviceUuid: _bc01MainServices.bc01MainServices[0].uuid,
|
|
69
|
+
characteristicUuid: _bc01MainServices.bc01MainServices[0].writeUuid.uuid
|
|
70
|
+
},
|
|
71
|
+
onRefused: reason => this.onError?.(new Error(`BC401 handshake: ${reason}`))
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns true once the notification buffer holds a complete BC401 frame,
|
|
77
|
+
* classified by its opening opcode. Anything else — a heartbeat opcode we
|
|
78
|
+
* do not recognise, or a partial buffer — is held back until enough bytes
|
|
79
|
+
* arrive to make sense of it. There is no aa55 header on this hardware.
|
|
80
|
+
*/
|
|
28
81
|
validatePackage = pkg => {
|
|
29
|
-
|
|
30
|
-
let headIndex = -1;
|
|
31
|
-
for (let i = 0; i < pkg.length - 1; i++) {
|
|
32
|
-
if (pkg[i] === "aa" && pkg[i + 1] === "55") {
|
|
33
|
-
headIndex = i;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (headIndex === -1) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
if (headIndex > 0) {
|
|
41
|
-
pkg = pkg.slice(headIndex);
|
|
42
|
-
}
|
|
43
|
-
if (pkg.length < 5) {
|
|
82
|
+
if (pkg.length === 0) {
|
|
44
83
|
return false;
|
|
45
84
|
}
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
85
|
+
const opcode = (0, _hexToByte.hexToByte)(pkg[0] ?? "");
|
|
86
|
+
const minLength = BC01_FRAME_MIN_LENGTH[opcode];
|
|
87
|
+
if (minLength === undefined) {
|
|
49
88
|
return false;
|
|
50
89
|
}
|
|
51
|
-
return
|
|
90
|
+
return pkg.length >= minLength;
|
|
52
91
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (error) {
|
|
66
|
-
this.onError?.(error);
|
|
67
|
-
return;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The parsing model declares every E1/E2 frame as `DEPENDENT`, so this hook
|
|
95
|
+
* runs for each record. We decode the raw bytes here — the packed 3-bits-per
|
|
96
|
+
* -pad layout is not expressible in the declaration parser — and report the
|
|
97
|
+
* reading directly through `onResult`. The frame is then handed back as
|
|
98
|
+
* `OTHER` so the state machine does not report it a second time and does
|
|
99
|
+
* not dedupe consecutive records that happen to share the same opcode.
|
|
100
|
+
*/
|
|
101
|
+
handleDependentResult = data => {
|
|
102
|
+
if (data.frame) {
|
|
103
|
+
this.reportUrsRecord(data.frame);
|
|
68
104
|
}
|
|
69
|
-
|
|
70
|
-
|
|
105
|
+
return {
|
|
106
|
+
...data,
|
|
107
|
+
parsingCase: {
|
|
108
|
+
...data.parsingCase,
|
|
109
|
+
caseType: _caseType.CaseType.OTHER
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
71
113
|
|
|
72
114
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
115
|
+
* Nothing to do here for the BC401. Every reading arrives through the
|
|
116
|
+
* dependent-result path, and the state machine sees only the `OTHER`-typed
|
|
117
|
+
* echo we return from `handleDependentResult`.
|
|
76
118
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
119
|
+
handleSuccessResult() {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
reportUrsRecord(frame) {
|
|
123
|
+
const parsed = (0, _bc01FrameParser.parseBc01Record)(frame);
|
|
124
|
+
if (!parsed) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const measuredValues = _bc01FrameParser.BC01_ANALYTE_ORDER.reduce((acc, analyte) => {
|
|
128
|
+
const value = parsed.values[analyte];
|
|
129
|
+
if (value !== undefined) {
|
|
130
|
+
acc[analyte] = value;
|
|
131
|
+
}
|
|
132
|
+
return acc;
|
|
133
|
+
}, {});
|
|
134
|
+
if (Object.keys(measuredValues).length === 0) {
|
|
135
|
+
this.onError?.("feedback-messages.measurement.disturb-detected-error");
|
|
136
|
+
return;
|
|
82
137
|
}
|
|
83
|
-
|
|
138
|
+
const reading = {
|
|
139
|
+
caseType: _caseType.CaseType.RESULT,
|
|
140
|
+
measurementTypeKey: _core.MeasurementTypeKey.uricAcid,
|
|
141
|
+
urineValues: [],
|
|
142
|
+
recordedAt: parsed.timestamp,
|
|
143
|
+
...measuredValues
|
|
144
|
+
};
|
|
145
|
+
this.onResult?.(reading);
|
|
84
146
|
}
|
|
85
147
|
}
|
|
86
148
|
exports.BC01Device = BC01Device;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_core","require","_caseType","_hexToByte","_btManagedDevice","_bc01CommandSequencer","_bc01FrameParser","_bc01MainServices","BC01_FRAME_MIN_LENGTH","BC01Device","BTManagedDevice","onStreamStart","mainServices","bc01MainServices","stuckDataTimeout","constructor","device","params","createCommandSequencer","Bc01CommandSequencer","write","serviceUuid","uuid","characteristicUuid","writeUuid","onRefused","reason","onError","Error","validatePackage","pkg","length","opcode","hexToByte","minLength","undefined","handleDependentResult","data","frame","reportUrsRecord","parsingCase","caseType","CaseType","OTHER","handleSuccessResult","parsed","parseBc01Record","measuredValues","BC01_ANALYTE_ORDER","reduce","acc","analyte","value","values","Object","keys","reading","RESULT","measurementTypeKey","MeasurementTypeKey","uricAcid","urineValues","recordedAt","timestamp","onResult","exports"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.device.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AAQA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAEA;AACA,MAAMO,qBAA6C,GAAG;EACpD,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE,CAAC;EAAE;EACT,I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A,CAAAxD,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -9,93 +9,57 @@ var _caseType = require("../../../types/case-type.js");
|
|
|
9
9
|
/**
|
|
10
10
|
* Contec BC401 (a.k.a. BC01) urine analyzer — GATT profile.
|
|
11
11
|
*
|
|
12
|
-
* The BC401 uses Contec's proprietary FF12 service, shared across their
|
|
13
|
-
* medical devices.
|
|
14
|
-
*
|
|
12
|
+
* The BC401 uses Contec's proprietary FF12 service, shared across their
|
|
13
|
+
* consumer medical devices. Every stored URS-7 measurement is pushed as a
|
|
14
|
+
* 16-byte record on 0xFF02 after the host has walked the handshake documented
|
|
15
|
+
* in `bc01-command-sequencer.ts`.
|
|
15
16
|
*
|
|
16
17
|
* Service 0xFF12
|
|
17
|
-
* Notify (result)
|
|
18
|
-
* Write (command)
|
|
18
|
+
* Notify (result) 0xFF02 — CCCD 0x2902 must be written 01 00 to enable
|
|
19
|
+
* Write (command) 0xFF01 — RESET / SET_TIME / GET_COUNT / GET_RECORDS
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* [5..15] values one byte per analyte, encoding the discrete
|
|
26
|
-
* level index into diagnosticResults[key]
|
|
27
|
-
* [16] checksum xor over [2..15]
|
|
28
|
-
*
|
|
29
|
-
* Byte positions calibrated against PHMS 3.0.03 Android app; older firmware
|
|
30
|
-
* (< 1.2.x) uses a different command byte and is not supported by this driver
|
|
31
|
-
* (the validator will reject those frames).
|
|
21
|
+
* On the wire a stored URS record opens with 0xE1 (single) or 0xE2 (paginated).
|
|
22
|
+
* The remaining fifteen bytes carry the flags nibble, timestamp, seven bytes of
|
|
23
|
+
* packed 3-bit analyte indices, and a checksum. `bc01-frame-parser.ts` decodes
|
|
24
|
+
* them; this file just declares the GATT surface and hands every E1/E2 frame
|
|
25
|
+
* to the driver's dependent-result path so the parser can run.
|
|
32
26
|
*/
|
|
33
27
|
const bc01MainServices = exports.bc01MainServices = [{
|
|
34
28
|
uuid: "0000ff12-0000-1000-8000-00805f9b34fb",
|
|
35
|
-
|
|
29
|
+
/**
|
|
30
|
+
* PHMS 3.0.03 writes `[0x80, 0x00]` to 0xFF01 the moment its GATT
|
|
31
|
+
* subscription is up — decompiled at L1/f.java:694 ("发送复位命令" — "send
|
|
32
|
+
* reset command"). The device answers nothing until this reset lands. The
|
|
33
|
+
* `Bc01CommandSequencer` returns the same reset from `initialCommands()`
|
|
34
|
+
* so the SDK sends it whether or not the polling default is in play.
|
|
35
|
+
*/
|
|
36
|
+
writeUuid: {
|
|
36
37
|
uuid: "0000ff01-0000-1000-8000-00805f9b34fb",
|
|
38
|
+
mainCommandUuid: "8000"
|
|
39
|
+
},
|
|
40
|
+
monitorUuids: [{
|
|
41
|
+
uuid: "0000ff02-0000-1000-8000-00805f9b34fb",
|
|
42
|
+
/**
|
|
43
|
+
* We key on the first byte only. A `DEPENDENT` case fires
|
|
44
|
+
* `handleDependentResult` in the driver, which runs the real decoder
|
|
45
|
+
* (`parseBc01Record`) against the raw frame bytes and calls
|
|
46
|
+
* `onResult` directly. The parsing case itself carries no field
|
|
47
|
+
* definitions — the packed 3-bits-per-pad layout is not expressible
|
|
48
|
+
* with the ordinary declaration parser and would need the vendor's
|
|
49
|
+
* own decoding table pinned in a declaration to be so.
|
|
50
|
+
*/
|
|
37
51
|
parsingModel: {
|
|
38
|
-
caseValuePosition: [0
|
|
52
|
+
caseValuePosition: [0],
|
|
39
53
|
cases: [{
|
|
40
54
|
measurementTypeKey: _core.MeasurementTypeKey.uricAcid,
|
|
41
|
-
caseType: _caseType.CaseType.
|
|
42
|
-
caseValue: "
|
|
43
|
-
parseDefinitions: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
name: "bld",
|
|
50
|
-
parseType: "number",
|
|
51
|
-
byteIndexes: [6],
|
|
52
|
-
parseReference: 16
|
|
53
|
-
}, {
|
|
54
|
-
name: "bil",
|
|
55
|
-
parseType: "number",
|
|
56
|
-
byteIndexes: [7],
|
|
57
|
-
parseReference: 16
|
|
58
|
-
}, {
|
|
59
|
-
name: "ket",
|
|
60
|
-
parseType: "number",
|
|
61
|
-
byteIndexes: [8],
|
|
62
|
-
parseReference: 16
|
|
63
|
-
}, {
|
|
64
|
-
name: "glu",
|
|
65
|
-
parseType: "number",
|
|
66
|
-
byteIndexes: [9],
|
|
67
|
-
parseReference: 16
|
|
68
|
-
}, {
|
|
69
|
-
name: "pro",
|
|
70
|
-
parseType: "number",
|
|
71
|
-
byteIndexes: [10],
|
|
72
|
-
parseReference: 16
|
|
73
|
-
}, {
|
|
74
|
-
name: "ph",
|
|
75
|
-
parseType: "number",
|
|
76
|
-
byteIndexes: [11],
|
|
77
|
-
parseReference: 16
|
|
78
|
-
}, {
|
|
79
|
-
name: "nit",
|
|
80
|
-
parseType: "number",
|
|
81
|
-
byteIndexes: [12],
|
|
82
|
-
parseReference: 16
|
|
83
|
-
}, {
|
|
84
|
-
name: "leu",
|
|
85
|
-
parseType: "number",
|
|
86
|
-
byteIndexes: [13],
|
|
87
|
-
parseReference: 16
|
|
88
|
-
}, {
|
|
89
|
-
name: "sg",
|
|
90
|
-
parseType: "number",
|
|
91
|
-
byteIndexes: [14],
|
|
92
|
-
parseReference: 16
|
|
93
|
-
}, {
|
|
94
|
-
name: "vc",
|
|
95
|
-
parseType: "number",
|
|
96
|
-
byteIndexes: [15],
|
|
97
|
-
parseReference: 16
|
|
98
|
-
}]
|
|
55
|
+
caseType: _caseType.CaseType.DEPENDENT,
|
|
56
|
+
caseValue: "e1",
|
|
57
|
+
parseDefinitions: []
|
|
58
|
+
}, {
|
|
59
|
+
measurementTypeKey: _core.MeasurementTypeKey.uricAcid,
|
|
60
|
+
caseType: _caseType.CaseType.DEPENDENT,
|
|
61
|
+
caseValue: "e2",
|
|
62
|
+
parseDefinitions: []
|
|
99
63
|
}]
|
|
100
64
|
}
|
|
101
65
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","_caseType","bc01MainServices","exports","uuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","MeasurementTypeKey","uricAcid","caseType","CaseType","
|
|
1
|
+
{"version":3,"names":["_core","require","_caseType","bc01MainServices","exports","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","MeasurementTypeKey","uricAcid","caseType","CaseType","DEPENDENT","caseValue","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.main-services.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,gBAA4B,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CAC1C;EACEE,IAAI,EAAE,sCAAsC;EAE5C;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,SAAS,EAAE;IACTD,IAAI,EAAE,sCAAsC;IAC5CE,eAAe,EAAE;EACnB,CAAC;EACDC,YAAY,EAAE,CACZ;IACEH,IAAI,EAAE,sCAAsC;IAE5C;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACQI,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,CAAC;MACtBC,KAAK,EAAE,CACL;QACEC,kBAAkB,EAAEC,wBAAkB,CAACC,QAAQ;QAC/CC,QAAQ,EAAEC,kBAAQ,CAACC,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC,EACD;QACEP,kBAAkB,EAAEC,wBAAkB,CAACC,QAAQ;QAC/CC,QAAQ,EAAEC,kBAAQ,CAACC,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
|
|
@@ -10,7 +10,6 @@ export class BTManager {
|
|
|
10
10
|
static MAX_DEVICES = 15; // Safety limit to prevent unbounded growth
|
|
11
11
|
devices = new Map();
|
|
12
12
|
eventSubscriptions = [];
|
|
13
|
-
lastScanTimestamp = 0;
|
|
14
13
|
constructor(bleManager, acceptedDevices) {
|
|
15
14
|
this.bleManager = bleManager;
|
|
16
15
|
this.acceptedDevices = acceptedDevices;
|
|
@@ -25,7 +24,6 @@ export class BTManager {
|
|
|
25
24
|
this.stateChangeListener.remove();
|
|
26
25
|
this.stateChangeListener = undefined;
|
|
27
26
|
}
|
|
28
|
-
this.lastScanTimestamp = 0;
|
|
29
27
|
|
|
30
28
|
// Then clear all callbacks
|
|
31
29
|
this.onErrorCallback = undefined;
|
|
@@ -39,12 +37,6 @@ export class BTManager {
|
|
|
39
37
|
this.deviceCreator.destroy();
|
|
40
38
|
};
|
|
41
39
|
startScan = () => {
|
|
42
|
-
if (Date.now() - this.lastScanTimestamp < 60_000) {
|
|
43
|
-
sentryLogger("warning", "BT_MANAGER: startScan called too frequently, skipping (within 1 min window)");
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
this.lastScanTimestamp = Date.now();
|
|
47
|
-
|
|
48
40
|
// Remove previous state change listener to prevent accumulation
|
|
49
41
|
if (this.stateChangeListener) {
|
|
50
42
|
this.stateChangeListener.remove();
|
|
@@ -67,12 +59,14 @@ export class BTManager {
|
|
|
67
59
|
}
|
|
68
60
|
sentryLogger("warning", "BT_MANAGER: State is not PoweredOn, sending intent to enable Bluetooth");
|
|
69
61
|
|
|
70
|
-
// Only send intent on Android
|
|
62
|
+
// Only send intent on Android — iOS has no programmatic way to power on
|
|
63
|
+
// Bluetooth, and `bleManager.enable()` there returns an unsupported-op
|
|
64
|
+
// promise that would surface as an unhandled rejection.
|
|
71
65
|
if (Platform.OS === "android") {
|
|
72
66
|
Linking.sendIntent("android.bluetooth.adapter.action.REQUEST_ENABLE");
|
|
73
|
-
|
|
74
|
-
this.bleManager.enable();
|
|
67
|
+
return;
|
|
75
68
|
}
|
|
69
|
+
sentryLogger("warning", "BT_MANAGER: Bluetooth is off; on iOS the user must enable it from Settings");
|
|
76
70
|
}, true);
|
|
77
71
|
|
|
78
72
|
// Track subscription for proper cleanup
|
|
@@ -131,13 +125,21 @@ export class BTManager {
|
|
|
131
125
|
});
|
|
132
126
|
return;
|
|
133
127
|
}
|
|
134
|
-
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* On iOS the advertised name arrives as `localName` while `name` stays null until the
|
|
131
|
+
* device is connected. Dropping every ad without a `name` therefore hides real BC401
|
|
132
|
+
* and other Contec hardware from the scan list. Fall back to `localName` so the same
|
|
133
|
+
* matcher runs against the string the peripheral actually advertised.
|
|
134
|
+
*/
|
|
135
|
+
const advertisedName = device?.name?.trim() || device?.localName?.trim() || "";
|
|
136
|
+
if (!device || !advertisedName) {
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
139
|
if (this.devices.has(device.id)) {
|
|
138
140
|
return;
|
|
139
141
|
}
|
|
140
|
-
const deviceName = this.deviceCreator.getDeviceName(
|
|
142
|
+
const deviceName = this.deviceCreator.getDeviceName(advertisedName);
|
|
141
143
|
if (!deviceName) {
|
|
142
144
|
return;
|
|
143
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Linking","Platform","ScanMode","State","slog","sentryLogger","DeviceCreator","BTManager","MAX_DEVICES","devices","Map","eventSubscriptions","
|
|
1
|
+
{"version":3,"names":["Linking","Platform","ScanMode","State","slog","sentryLogger","DeviceCreator","BTManager","MAX_DEVICES","devices","Map","eventSubscriptions","constructor","bleManager","acceptedDevices","deviceCreator","destroy","stopScan","stateChangeListener","remove","undefined","onErrorCallback","onDeviceFoundCallback","onResultCallback","onDeviceStatusChangedCallback","forEach","device","clear","startScan","onStateChange","state","PoweredOn","index","indexOf","splice","startDeviceScan","scanMode","Balanced","onScanResult","OS","sendIntent","push","stopDeviceScan","sub","onDeviceFound","callback","onError","onDeviceStatusChanged","onResult","error","Error","message","advertisedName","name","trim","localName","has","id","deviceName","getDeviceName","size","deviceId","currentSize","deviceClass","createDevice","bind","onDeviceDisconnected","removeDeviceFromFoundedDevices","set","get","delete"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/bt-manager.ts"],"mappings":";;AAAA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,cAAc;AAChD,SAIEC,QAAQ,EACRC,KAAK,QAEA,sBAAsB;AAE7B,SAASC,IAAI,QAAQ,wBAAe;AACpC,SAASC,YAAY,QAAQ,sCAAmC;AAOhE,SAASC,aAAa,QAAQ,qBAAkB;AAGhD,OAAO,MAAMC,SAAS,CAAsC;EAC1D,OAAwBC,WAAW,GAAG,EAAE,CAAC,CAAC;EAClCC,OAAO,GAAG,IAAIC,GAAG,CAA0C,CAAC;EAG5DC,kBAAkB,GAAmB,EAAE;EAI/CC,WAAWA,CACQC,UAAsB,EACtBC,eAAkB,EACnC;IAAA,KAFiBD,UAAsB,GAAtBA,UAAsB;IAAA,KACtBC,eAAkB,GAAlBA,eAAkB;IAEnC,IAAI,CAACC,aAAa,GAAG,IAAIT,aAAa,CAAC,IAAI,CAACQ,eAAe,CAAC;EAC9D;EAEOE,OAAO,GAAGA,CAAA,KAAM;IACrBX,YAAY,CAAC,MAAM,EAAE,kCAAkC,CAAC;IAExD,IAAI,CAACY,QAAQ,CAAC,CAAC;;IAEf;IACA,IAAI,IAAI,CAACC,mBAAmB,EAAE;MAC5B,IAAI,CAACA,mBAAmB,CAACC,MAAM,CAAC,CAAC;MACjC,IAAI,CAACD,mBAAmB,GAAGE,SAAS;IACtC;;IAEA;IACA,IAAI,CAACC,eAAe,GAAGD,SAAS;IAChC,IAAI,CAACE,qBAAqB,GAAGF,SAAS;IACtC,IAAI,CAACG,gBAAgB,GAAGH,SAAS;IACjC,IAAI,CAACI,6BAA6B,GAAGJ,SAAS;IAE9C,IAAI,CAACX,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CAACR,QAAQ,CAAC,EAAEnC,MAAM,EAAE2B;IAClD,CACF,CAAC;IACD,IAAI,CAAC5C,OAAO,CAAC6D,MAAM,CAACT,QAAQ,CAAC;EAC/B,CAAC;AACH","ignoreList":[]}
|
|
@@ -74,7 +74,13 @@ export class DeviceCreator {
|
|
|
74
74
|
if (!params.device) {
|
|
75
75
|
throw new Error("Device is required");
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* On iOS the peripheral's `name` is null in scan callbacks until it is connected —
|
|
80
|
+
* `localName` carries the advertised name instead. Accept either so a scan-time
|
|
81
|
+
* `createDevice` call for a real iOS ad is not rejected before it can connect.
|
|
82
|
+
*/
|
|
83
|
+
if (!params.device.name?.trim() && !params.device.localName?.trim()) {
|
|
78
84
|
throw new Error("Device name is required");
|
|
79
85
|
}
|
|
80
86
|
if (!params.device.id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["integratedDevicesMap","IntegratedDevices","isCustomDeviceDefinition","BC01Device","BP2Device","CustomDevice","F4Device","SPO2Device","VerovalDuoControlDevice","VerovalEcgDevice","DEVICE_CLASSES","BP2","F4","PC60WF","BC01","VEROVAL_DUO_CONTROL","VEROVAL_ECG","collectCustomDevices","acceptedDevices","customDevices","Map","matchers","Set","forEach","entry","index","Error","has","id","nameMatch","source","set","add","DeviceCreator","deviceNameCache","CACHE_MAX_SIZE","constructor","acceptedDeviceNames","getDeviceName","foundName","undefined","get","matched","matchDeviceName","cacheDeviceName","createDevice","params","String","deviceName","trim","device","name","custom","deviceClass","Object","keys","join","destroy","clear","regex","deviceType","test","some","values","size","firstKey","next","value","delete"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/device-creator.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,wCAAqC;AAM1E,SAASC,iBAAiB,QAAQ,gCAA6B;AAC/D,SAASC,wBAAwB,QAAQ,yCAAsC;AAE/E,SAASC,UAAU,QAAQ,+B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BC01Device","BP2Device","CustomDevice","F4Device","SPO2Device","VerovalDuoControlDevice","VerovalEcgDevice","DEVICE_CLASSES","BP2","F4","PC60WF","BC01","VEROVAL_DUO_CONTROL","VEROVAL_ECG","collectCustomDevices","acceptedDevices","customDevices","Map","matchers","Set","forEach","entry","index","Error","has","id","nameMatch","source","set","add","DeviceCreator","deviceNameCache","CACHE_MAX_SIZE","constructor","acceptedDeviceNames","getDeviceName","foundName","undefined","get","matched","matchDeviceName","cacheDeviceName","createDevice","params","String","deviceName","trim","device","name","localName","custom","deviceClass","Object","keys","join","destroy","clear","regex","deviceType","test","some","values","size","firstKey","next","value","delete"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/device-creator.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,wCAAqC;AAM1E,SAASC,iBAAiB,QAAQ,gCAA6B;AAC/D,SAASC,wBAAwB,QAAQ,yCAAsC;AAE/E,SAASC,UAAU,QAAQ,+BAA4B;AACvD,SAASC,SAAS,QAAQ,6BAA0B;AAEpD,SAASC,YAAY,QAAQ,mCAAgC;AAC7D,SAASC,QAAQ,QAAQ,2BAAwB;AACjD,SAASC,UAAU,QAAQ,8BAA2B;AACtD,SAASC,uBAAuB,QAAQ,iDAA8C;AACtF,SAASC,gBAAgB,QAAQ,yCAAsC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG;EACrB,CAACT,iBAAiB,CAACU,GAAG,GAAGP,SAAS;EAClC,CAACH,iBAAiB,CAACW,EAAE,GAAGN,QAAQ;EAChC,CAACL,iBAAiB,CAACY,MAAM,GAAGN,UAAU;EACtC,CAACN,iBAAiB,CAACa,IAAI,GAAGX,UAAU;EACpC,CAACF,iBAAiB,CAACc,mBAAmB,GAAGP,uBAAuB;EAChE,CAACP,iBAAiB,CAACe,WAAW,GAAGP;AACnC,CAAC;AAID,MAAMQ,oBAAoB,GACxBC,eAA0C,IACF;EACxC,MAAMC,aAAa,GAAG,IAAIC,G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