@ovok/native 1.17.0-dev.2293 → 1.17.0-dev.2297
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/lib/commonjs/modules/next/bluetooth/{families/finicare/crc.js → codec/crc8-maxim.js} +1 -1
- package/lib/commonjs/modules/next/bluetooth/codec/crc8-maxim.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js +4 -2
- package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-state.js +2 -0
- package/lib/commonjs/modules/next/bluetooth/core/device-state.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/device.js +3 -0
- package/lib/commonjs/modules/next/bluetooth/core/device.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/live-session.js +7 -1
- package/lib/commonjs/modules/next/bluetooth/core/live-session.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/built-in.js +3 -2
- package/lib/commonjs/modules/next/bluetooth/families/built-in.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.js +17 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/frame.js +116 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/frame.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/models.js +14 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/models.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.js +34 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/replies.js +86 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/replies.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/session.js +112 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/session.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/settings.js +121 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/settings.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/status.js +153 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/status.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/values.js +44 -0
- package/lib/commonjs/modules/next/bluetooth/families/famidoc-hearing-aid/values.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/families/finicare/frame.js +3 -3
- package/lib/commonjs/modules/next/bluetooth/families/finicare/frame.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/shared.js.map +1 -1
- package/lib/module/modules/next/bluetooth/{families/finicare/crc.js → codec/crc8-maxim.js} +1 -1
- package/lib/module/modules/next/bluetooth/codec/crc8-maxim.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/device-snapshot.js +4 -2
- package/lib/module/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/device-state.js +2 -0
- package/lib/module/modules/next/bluetooth/core/device-state.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/device.js +3 -0
- package/lib/module/modules/next/bluetooth/core/device.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/live-session.js +7 -1
- package/lib/module/modules/next/bluetooth/core/live-session.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/built-in.js +3 -2
- package/lib/module/modules/next/bluetooth/families/built-in.js.map +1 -1
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.js +9 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/frame.js +110 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/frame.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/models.js +12 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/models.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.js +32 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/replies.js +78 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/replies.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/session.js +109 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/session.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/settings.js +116 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/settings.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/status.js +148 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/status.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/values.js +34 -0
- package/lib/module/modules/next/bluetooth/families/famidoc-hearing-aid/values.js.map +1 -0
- package/lib/module/modules/next/bluetooth/families/finicare/frame.js +1 -1
- package/lib/module/modules/next/bluetooth/families/finicare/frame.js.map +1 -1
- package/lib/module/modules/next/bluetooth/shared.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/{families/finicare/crc.d.ts → codec/crc8-maxim.d.ts} +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/codec/crc8-maxim.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-state.d.ts +108 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-session.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-session.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/protocol.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/protocol.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/built-in.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/frame.d.ts +63 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/frame.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/models.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/models.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/replies.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/replies.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/session.d.ts +31 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/session.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/settings.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/settings.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/status.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/status.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/values.d.ts +18 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/famidoc-hearing-aid/values.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/finicare/frame.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/{families/finicare/crc.d.ts → codec/crc8-maxim.d.ts} +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/codec/crc8-maxim.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts +4 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-state.d.ts +108 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-state.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts +3 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/live-session.d.ts +2 -2
- package/lib/typescript/module/src/modules/next/bluetooth/core/live-session.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/protocol.d.ts +3 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/protocol.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts +3 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/built-in.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/famidoc-hearing-aid.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/frame.d.ts +63 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/frame.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/models.d.ts +5 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/models.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/protocol.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/replies.d.ts +23 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/replies.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/session.d.ts +31 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/session.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/settings.d.ts +14 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/settings.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/status.d.ts +14 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/status.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/values.d.ts +18 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/famidoc-hearing-aid/values.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/families/finicare/frame.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/commonjs/modules/next/bluetooth/families/finicare/crc.js.map +0 -1
- package/lib/module/modules/next/bluetooth/families/finicare/crc.js.map +0 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/families/finicare/crc.d.ts.map +0 -1
- package/lib/typescript/module/src/modules/next/bluetooth/families/finicare/crc.d.ts.map +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { SETTING } from "./frame.js";
|
|
4
|
+
import { clampedVolume, LANGUAGES, MAX_VOLUME, MODES, noiseByte } from "./values.js";
|
|
5
|
+
|
|
6
|
+
/** The command a change is sent with and its data. */
|
|
7
|
+
|
|
8
|
+
const BIT_ON = 1;
|
|
9
|
+
const BIT_OFF = 0;
|
|
10
|
+
|
|
11
|
+
/** What the phone sends for each change. */
|
|
12
|
+
const REQUESTS = {
|
|
13
|
+
volume: ({
|
|
14
|
+
level
|
|
15
|
+
}) => ({
|
|
16
|
+
command: SETTING.volume,
|
|
17
|
+
data: [clampedVolume(level)]
|
|
18
|
+
}),
|
|
19
|
+
mode: ({
|
|
20
|
+
mode
|
|
21
|
+
}) => ({
|
|
22
|
+
command: SETTING.mode,
|
|
23
|
+
data: [MODES.indexOf(mode)]
|
|
24
|
+
}),
|
|
25
|
+
"noise-reduction": ({
|
|
26
|
+
on,
|
|
27
|
+
scene
|
|
28
|
+
}) => ({
|
|
29
|
+
command: SETTING.noiseReduction,
|
|
30
|
+
data: [noiseByte(on, scene)]
|
|
31
|
+
}),
|
|
32
|
+
microphone: ({
|
|
33
|
+
direction
|
|
34
|
+
}) => ({
|
|
35
|
+
command: SETTING.microphone,
|
|
36
|
+
data: [direction === "front" ? BIT_ON : BIT_OFF]
|
|
37
|
+
}),
|
|
38
|
+
"in-ear-detection": ({
|
|
39
|
+
on
|
|
40
|
+
}) => ({
|
|
41
|
+
command: SETTING.inEarDetection,
|
|
42
|
+
data: [on ? BIT_ON : BIT_OFF]
|
|
43
|
+
}),
|
|
44
|
+
"prompt-language": ({
|
|
45
|
+
language
|
|
46
|
+
}) => ({
|
|
47
|
+
command: SETTING.promptLanguage,
|
|
48
|
+
data: [LANGUAGES.indexOf(language)]
|
|
49
|
+
}),
|
|
50
|
+
"factory-reset": () => ({
|
|
51
|
+
command: SETTING.factoryReset,
|
|
52
|
+
data: []
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** How each change the aid took moves the status; a factory reset is read again instead. */
|
|
57
|
+
const UPDATES = {
|
|
58
|
+
volume: (state, {
|
|
59
|
+
level
|
|
60
|
+
}) => ({
|
|
61
|
+
...state,
|
|
62
|
+
volume: {
|
|
63
|
+
level: clampedVolume(level),
|
|
64
|
+
max: MAX_VOLUME
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
mode: (state, {
|
|
68
|
+
mode
|
|
69
|
+
}) => ({
|
|
70
|
+
...state,
|
|
71
|
+
mode
|
|
72
|
+
}),
|
|
73
|
+
"noise-reduction": (state, {
|
|
74
|
+
on,
|
|
75
|
+
scene
|
|
76
|
+
}) => ({
|
|
77
|
+
...state,
|
|
78
|
+
noiseReduction: on,
|
|
79
|
+
noiseScene: scene
|
|
80
|
+
}),
|
|
81
|
+
microphone: (state, {
|
|
82
|
+
direction
|
|
83
|
+
}) => ({
|
|
84
|
+
...state,
|
|
85
|
+
microphone: direction
|
|
86
|
+
}),
|
|
87
|
+
"in-ear-detection": (state, {
|
|
88
|
+
on
|
|
89
|
+
}) => ({
|
|
90
|
+
...state,
|
|
91
|
+
inEarDetection: on
|
|
92
|
+
}),
|
|
93
|
+
"prompt-language": (state, {
|
|
94
|
+
language
|
|
95
|
+
}) => ({
|
|
96
|
+
...state,
|
|
97
|
+
promptLanguage: language
|
|
98
|
+
}),
|
|
99
|
+
"factory-reset": state => state
|
|
100
|
+
};
|
|
101
|
+
const requestOf = change => REQUESTS[change.kind](change);
|
|
102
|
+
|
|
103
|
+
/** The status after a change the aid took. */
|
|
104
|
+
const withChange = (state, change) => UPDATES[change.kind](state, change);
|
|
105
|
+
|
|
106
|
+
/** Sends one change to the aid, then tells the live status once the aid took it. */
|
|
107
|
+
const applyChange = async (connection, change) => {
|
|
108
|
+
const {
|
|
109
|
+
command,
|
|
110
|
+
data
|
|
111
|
+
} = requestOf(change);
|
|
112
|
+
await connection.write(command, data);
|
|
113
|
+
connection.changed(change);
|
|
114
|
+
};
|
|
115
|
+
export { applyChange, requestOf, withChange };
|
|
116
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SETTING","clampedVolume","LANGUAGES","MAX_VOLUME","MODES","noiseByte","BIT_ON","BIT_OFF","REQUESTS","volume","level","command","data","mode","indexOf","noise-reduction","on","scene","noiseReduction","microphone","direction","in-ear-detection","inEarDetection","prompt-language","language","promptLanguage","factory-reset","factoryReset","UPDATES","state","max","noiseScene","requestOf","change","kind","withChange","applyChange","connection","write","changed"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/famidoc-hearing-aid/settings.ts"],"mappings":";;AAEA,SAASA,OAAO,QAAQ,YAAS;AAEjC,SAASC,aAAa,EAAEC,SAAS,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,QAAQ,aAAU;;AAKjF;;AAGA,MAAMC,MAAM,GAAG,CAAC;AAChB,MAAMC,OAAO,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EC;EAAK,CAAC,GAAGoB,SAAS,CAACC,MAAM,CAAC;EAE3C,MAAMI,UAAU,CAACC,KAAK,CAAC3B,OAAO,EAAEC,IAAI,CAAC;EACrCyB,UAAU,CAACE,OAAO,CAACN,MAAM,CAAC;AAC5B,CAAC;AAED,SAASG,WAAW,EAAEJ,SAAS,EAAEG,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { untilAborted } from "../sig/waiting.js";
|
|
4
|
+
import { COMMAND, EAR, REPORT } from "./frame.js";
|
|
5
|
+
import { batteryOf, linkedEars } from "./replies.js";
|
|
6
|
+
import { withChange } from "./settings.js";
|
|
7
|
+
import { flagOf, languageOf, modeOf, sceneOf, volumeOf } from "./values.js";
|
|
8
|
+
|
|
9
|
+
/** A battery drains slowly and the aid reports only a low one by itself, so it is read again this often. */
|
|
10
|
+
const BATTERY_REFRESH_MS = 60_000;
|
|
11
|
+
const SIDE = {
|
|
12
|
+
[EAR.left]: "left",
|
|
13
|
+
[EAR.right]: "right"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** A linked ear is always the left or the right one; only reads to the pair go to the main ear. */
|
|
17
|
+
const sideOf = ear => ear === EAR.left ? "left" : "right";
|
|
18
|
+
const readBattery = async ({
|
|
19
|
+
read
|
|
20
|
+
}, ear) => {
|
|
21
|
+
const {
|
|
22
|
+
percent,
|
|
23
|
+
charging
|
|
24
|
+
} = batteryOf(await read(ear, COMMAND.battery));
|
|
25
|
+
return {
|
|
26
|
+
battery: percent,
|
|
27
|
+
charging
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const readEar = async (connection, ear) => ({
|
|
31
|
+
...(await readBattery(connection, ear)),
|
|
32
|
+
inEar: flagOf(await connection.read(ear, COMMAND.inEar)),
|
|
33
|
+
inCase: flagOf(await connection.read(ear, COMMAND.inCase))
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/** The prompt language is the one read not yet answered on hardware, so a silent aid leaves it unknown. */
|
|
37
|
+
const readLanguage = connection => connection.read(EAR.main, COMMAND.promptLanguage).then(languageOf, () => null);
|
|
38
|
+
|
|
39
|
+
/** Reads what the status shows: per ear its battery, in-ear and in-case; for the pair its settings. */
|
|
40
|
+
const readStatus = async connection => {
|
|
41
|
+
const ears = {};
|
|
42
|
+
for (const ear of linkedEars(connection.ears)) {
|
|
43
|
+
ears[sideOf(ear)] = await readEar(connection, ear);
|
|
44
|
+
}
|
|
45
|
+
const noise = await connection.read(EAR.main, COMMAND.noiseReduction);
|
|
46
|
+
return {
|
|
47
|
+
kind: "hearing-aid",
|
|
48
|
+
mainEar: sideOf(connection.ears.main),
|
|
49
|
+
ears,
|
|
50
|
+
volume: volumeOf(await connection.read(EAR.main, COMMAND.volume)),
|
|
51
|
+
mode: modeOf(await connection.read(EAR.main, COMMAND.mode)),
|
|
52
|
+
noiseReduction: flagOf(noise),
|
|
53
|
+
noiseScene: sceneOf(noise),
|
|
54
|
+
microphone: null,
|
|
55
|
+
inEarDetection: flagOf(await connection.read(EAR.main, COMMAND.inEarDetection)),
|
|
56
|
+
promptLanguage: await readLanguage(connection)
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const withEar = (state, side, change) => {
|
|
60
|
+
const current = side ? state.ears[side] : undefined;
|
|
61
|
+
return side && current ? {
|
|
62
|
+
...state,
|
|
63
|
+
ears: {
|
|
64
|
+
...state.ears,
|
|
65
|
+
[side]: {
|
|
66
|
+
...current,
|
|
67
|
+
...change
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} : state;
|
|
71
|
+
};
|
|
72
|
+
/** How each report the status shows changes it. */
|
|
73
|
+
const REPORT_UPDATES = {
|
|
74
|
+
[REPORT.volume]: (state, {
|
|
75
|
+
data
|
|
76
|
+
}) => ({
|
|
77
|
+
...state,
|
|
78
|
+
volume: volumeOf(data)
|
|
79
|
+
}),
|
|
80
|
+
[REPORT.noiseReduction]: (state, {
|
|
81
|
+
data
|
|
82
|
+
}) => ({
|
|
83
|
+
...state,
|
|
84
|
+
noiseReduction: flagOf(data),
|
|
85
|
+
noiseScene: sceneOf(data)
|
|
86
|
+
}),
|
|
87
|
+
[REPORT.mode]: (state, {
|
|
88
|
+
data
|
|
89
|
+
}) => ({
|
|
90
|
+
...state,
|
|
91
|
+
mode: modeOf(data)
|
|
92
|
+
}),
|
|
93
|
+
[REPORT.inEar]: (state, {
|
|
94
|
+
ear,
|
|
95
|
+
data
|
|
96
|
+
}) => withEar(state, SIDE[ear], {
|
|
97
|
+
inEar: flagOf(data)
|
|
98
|
+
}),
|
|
99
|
+
[REPORT.inCase]: (state, {
|
|
100
|
+
ear,
|
|
101
|
+
data
|
|
102
|
+
}) => withEar(state, SIDE[ear], {
|
|
103
|
+
inCase: flagOf(data)
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** The state after one report the aid sent by itself; a report the status does not show leaves it as it was. */
|
|
108
|
+
const withReport = (state, report) => REPORT_UPDATES[report.command]?.(state, report) ?? state;
|
|
109
|
+
const readBatteries = async connection => {
|
|
110
|
+
const batteries = {};
|
|
111
|
+
for (const ear of linkedEars(connection.ears)) {
|
|
112
|
+
batteries[sideOf(ear)] = await readBattery(connection, ear);
|
|
113
|
+
}
|
|
114
|
+
return batteries;
|
|
115
|
+
};
|
|
116
|
+
const withBatteries = (state, batteries) => Object.entries(batteries).reduce((next, [side, battery]) => withEar(next, side, battery), state);
|
|
117
|
+
|
|
118
|
+
/** Streams the pair's status until `signal` aborts: all of it once, then every change and its batteries every minute. */
|
|
119
|
+
const streamStatus = async (connection, onFrame, signal) => {
|
|
120
|
+
let state = await readStatus(connection);
|
|
121
|
+
const publish = next => {
|
|
122
|
+
state = next;
|
|
123
|
+
onFrame({
|
|
124
|
+
state
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
publish(state);
|
|
128
|
+
const stopReports = connection.onReport(report => publish(withReport(state, report)));
|
|
129
|
+
const stopChanges = connection.onChanged(change => {
|
|
130
|
+
if (change.kind !== "factory-reset") {
|
|
131
|
+
publish(withChange(state, change));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
readStatus(connection).then(publish).catch(() => connection.logger.warn("famidoc-hearing-aid.status.reread-failed"));
|
|
135
|
+
});
|
|
136
|
+
const refresh = setInterval(() => {
|
|
137
|
+
readBatteries(connection).then(batteries => publish(withBatteries(state, batteries))).catch(() => connection.logger.warn("famidoc-hearing-aid.battery.refresh-failed"));
|
|
138
|
+
}, BATTERY_REFRESH_MS);
|
|
139
|
+
try {
|
|
140
|
+
await untilAborted(signal);
|
|
141
|
+
} finally {
|
|
142
|
+
stopReports();
|
|
143
|
+
stopChanges();
|
|
144
|
+
clearInterval(refresh);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
export { BATTERY_REFRESH_MS, readStatus, streamStatus, withReport };
|
|
148
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["untilAborted","COMMAND","EAR","REPORT","batteryOf","linkedEars","withChange","flagOf","languageOf","modeOf","sceneOf","volumeOf","BATTERY_REFRESH_MS","SIDE","left","right","sideOf","ear","readBattery","read","percent","charging","battery","readEar","connection","inEar","inCase","readLanguage","main","promptLanguage","then","readStatus","ears","noise","noiseReduction","kind","mainEar","volume","mode","noiseScene","microphone","inEarDetection","withEar","state","side","change","current","undefined","REPORT_UPDATES","data","withReport","report","command","readBatteries","batteries","withBatteries","Object","entries","reduce","next","streamStatus","onFrame","signal","publish","stopReports","onReport","stopChanges","onChanged","catch","logger","warn","refresh","setInterval","clearInterval"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/famidoc-hearing-aid/status.ts"],"mappings":";;AAEA,SAASA,YAAY,QAAQ,mBAAgB;AAE7C,SAASC,OAAO,EAAEC,GAAG,EAAwBC,MAAM,QAAQ,YAAS;AACpE,SAASC,SAAS,EAAEC,UAAU,QAAQ,cAAW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AAM,CAACV,IAAI,KAAK,eAAe,EAAE;MACnC4B,OAAO,CAACzD,UAAU,CAACqC,KAAK,EAAEE,MAAM,CAAC,CAAC;MAElC;IACF;IACAd,UAAU,CAACP,UAAU,CAAC,CACnBM,IAAI,CAACiC,OAAO,CAAC,CACbK,KAAK,CAAC,MAAM5C,UAAU,CAAC6C,MAAM,CAACC,IAAI,CAAC,0CAA0C,CAAC,CAAC;EACpF,CAAC,CAAC;EAEF,MAAMC,OAAO,GAAGC,WAAW,CAAC,MAAM;IAChCnB,aAAa,CAAC7B,UAAU,CAAC,CACtBM,IAAI,CAAEwB,SAAS,IAAKS,OAAO,CAACR,aAAa,CAACZ,KAAK,EAAEW,SAAS,CAAC,CAAC,CAAC,CAC7Dc,KAAK,CAAC,MAAM5C,UAAU,CAAC6C,MAAM,CAACC,IAAI,CAAC,4CAA4C,CAAC,CAAC;EACtF,CAAC,EAAE1D,kBAAkB,CAAC;EAEtB,IAAI;IACF,MAAMZ,YAAY,CAAC8D,MAAM,CAAC;EAC5B,CAAC,SAAS;IACRE,WAAW,CAAC,CAAC;IACbE,WAAW,CAAC,CAAC;IACbO,aAAa,CAACF,OAAO,CAAC;EACxB;AACF,CAAC;AAED,SAAS3D,kBAAkB,EAAEmB,UAAU,EAAE6B,YAAY,EAAEV,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const FLAG = 0x01;
|
|
4
|
+
const VOLUME_MASK = 0x1f;
|
|
5
|
+
const TWO_BITS = 0x03;
|
|
6
|
+
const SCENE_SHIFT = 1;
|
|
7
|
+
|
|
8
|
+
/** The protocol document gives the volume as 0 to 16. */
|
|
9
|
+
const MAX_VOLUME = 16;
|
|
10
|
+
|
|
11
|
+
/** The mode bits in order; the last value is reserved. */
|
|
12
|
+
const MODES = ["mixed", "hearing-aid", "earphone", null];
|
|
13
|
+
|
|
14
|
+
/** The noise scene bits in order. */
|
|
15
|
+
const SCENES = ["general", "outdoor", "meeting", "cinema"];
|
|
16
|
+
|
|
17
|
+
/** The prompt language bit in order. */
|
|
18
|
+
const LANGUAGES = ["chinese", "english"];
|
|
19
|
+
const flagOf = data => ((data[0] ?? 0) & FLAG) !== 0;
|
|
20
|
+
const volumeOf = data => ({
|
|
21
|
+
level: Math.min((data[0] ?? 0) & VOLUME_MASK, MAX_VOLUME),
|
|
22
|
+
max: MAX_VOLUME
|
|
23
|
+
});
|
|
24
|
+
const modeOf = data => MODES[(data[0] ?? 0) & TWO_BITS] ?? null;
|
|
25
|
+
|
|
26
|
+
/** The noise reduction byte holds the scene in bits 2–1 and whether it is on in bit 0. */
|
|
27
|
+
const sceneOf = data => SCENES[(data[0] ?? 0) >> SCENE_SHIFT & TWO_BITS] ?? null;
|
|
28
|
+
const noiseByte = (on, scene) => SCENES.indexOf(scene) << SCENE_SHIFT | (on ? FLAG : 0);
|
|
29
|
+
const languageOf = data => LANGUAGES[(data[0] ?? 0) & FLAG] ?? null;
|
|
30
|
+
|
|
31
|
+
/** A volume within the steps the aid takes. */
|
|
32
|
+
const clampedVolume = level => Math.min(Math.max(Math.round(level), 0), MAX_VOLUME);
|
|
33
|
+
export { clampedVolume, flagOf, LANGUAGES, languageOf, MAX_VOLUME, modeOf, MODES, noiseByte, sceneOf, volumeOf };
|
|
34
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FLAG","VOLUME_MASK","TWO_BITS","SCENE_SHIFT","MAX_VOLUME","MODES","SCENES","LANGUAGES","flagOf","data","volumeOf","level","Math","min","max","modeOf","sceneOf","noiseByte","on","scene","indexOf","languageOf","clampedVolume","round"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/famidoc-hearing-aid/values.ts"],"mappings":";;AAEA,MAAMA,IAAI,GAAG,IAAI;AACjB,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,QAAQ,GAAG,IAAI;AACrB,MAAMC,WAAW,G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,CAACD,IAAI,CAACE,GAAG,CAACF,IAAI,CAACW,KAAK,CAACZ,KAAK,CAAC,EAAE,CAAC,CAAC,EAAEP,UAAU,CAAC;AAErG,SAASkB,aAAa,EAAEd,MAAM,EAAED,SAAS,EAAEc,UAAU,EAAEjB,UAAU,EAAEW,MAAM,EAAEV,KAAK,EAAEY,SAAS,EAAED,OAAO,EAAEN,QAAQ","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { crc8Maxim } from "../../codec/crc8-maxim.js";
|
|
3
4
|
import { framingOf } from "../frame-tools/frame-stream.js";
|
|
4
5
|
import { u16be } from "../frame-tools/numbers.js";
|
|
5
|
-
import { crc8Maxim } from "./crc.js";
|
|
6
6
|
const PHONE_HEADER = [0xbe, 0xb0];
|
|
7
7
|
const MONITOR_HEADER = [0xd0, 0xc2];
|
|
8
8
|
const LENGTH_AT = 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["crc8Maxim","framingOf","u16be","PHONE_HEADER","MONITOR_HEADER","LENGTH_AT","DATA_AT","CHECKSUM_BYTES","COMMAND_BYTES","STATUS_BYTES","FRAME_OVERHEAD","COMMAND","handshake","setTime","turnOff","STATUS","ok","busy","MEASUREMENT_MARKER","encodeFrame","command","payload","body","length","Uint8Array","from","isIntact","frame","subarray","MONITOR_FRAMING","header","lengthOf","held","undefined","accepts","dataOf","statusOf","data"],"sourceRoot":"../../../../../../../src","sources":["modules/next/bluetooth/families/finicare/frame.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,2BAAwB;AAClD,SAAkBC,SAAS,QAAQ,gCAA6B;AAChE,SAASC,KAAK,QAAQ,2BAAwB;AAG9C,MAAMC,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU;AAC1C,MAAMC,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU;AAC5C,MAAMC,SAAS,GA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S,MAAM,GAAIR,KAAiB,IAAiBA,KAAK,CAACC,QAAQ,CAACtB,OAAO,EAAEqB,KAAK,CAACJ,MAAM,GAAGhB,cAAc,CAAC;;AAExG;AACA,MAAM6B,QAAQ,GAAIC,IAAgB,IAA0BA,IAAI,CAACd,MAAM,KAAKd,YAAY,GAAGP,KAAK,CAACmC,IAAI,EAAE,CAAC,CAAC,GAAGJ,SAAU;AAEtH,SAAStB,OAAO,EAAEwB,MAAM,EAAEhB,WAAW,EAAED,kBAAkB,EAAEW,eAAe,EAAEd,MAAM,EAAEqB,QAAQ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ovokOutboxWatch","ovokReadingSink","storagePairedDevices","Bluetooth","Catalog","Device","Discovery","DeviceError","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","BluetoothProvider","useBluetooth","useBluetoothAdapter","useCatalog","usePairedDevices","useReadings","useDevice","useLiveValues","useWaveform","useDiscovery","useOutbox"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/shared.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,OAAO,QAAQ,mBAAgB;AAExC,SAASC,MAAM,QAAQ,kBAAe;
|
|
1
|
+
{"version":3,"names":["ovokOutboxWatch","ovokReadingSink","storagePairedDevices","Bluetooth","Catalog","Device","Discovery","DeviceError","BUILT_IN_MODELS","BUILT_IN_PROTOCOLS","BluetoothProvider","useBluetooth","useBluetoothAdapter","useCatalog","usePairedDevices","useReadings","useDevice","useLiveValues","useWaveform","useDiscovery","useOutbox"],"sourceRoot":"../../../../../src","sources":["modules/next/bluetooth/shared.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,oBAAoB,QAAQ,sCAAmC;AACxE,SAASC,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,OAAO,QAAQ,mBAAgB;AAExC,SAASC,MAAM,QAAQ,kBAAe;AAsBtC,SAASC,SAAS,QAAQ,qBAAkB;AAE5C,SAASC,WAAW,QAAQ,kBAAe;AA0B3C,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,wBAAqB;AACzE,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,oBAAiB;AAEjE,SAASC,mBAAmB,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,WAAW,QAAQ,kBAAe;AAC9F,SAASC,SAAS,EAAEC,aAAa,EAAEC,WAAW,QAAQ,uBAAoB;AAE1E,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,SAAS,QAAQ,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crc8-maxim.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/codec/crc8-maxim.ts"],"names":[],"mappings":"AAGA,gFAAgF;AAChF,QAAA,MAAM,SAAS,GAAI,OAAO,SAAS,CAAC,MAAM,CAAC,KAAG,MASvC,CAAC;AAER,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DeviceModel } from "./catalog";
|
|
2
|
+
import { DeviceState } from "./device-state";
|
|
2
3
|
import { DeviceError } from "./errors";
|
|
3
4
|
import { Battery, DeviceIdentity, PairedDevice } from "./paired-device";
|
|
4
5
|
import { DeviceProtocol } from "./protocol";
|
|
5
6
|
import { LiveFrame, LiveValues, Reading, Waveform } from "./reading";
|
|
6
7
|
/** A button a device may offer. */
|
|
7
|
-
type DeviceAction = "sync" | "records" | "fetch" | "live" | "setClock";
|
|
8
|
+
type DeviceAction = "sync" | "records" | "fetch" | "live" | "setClock" | "change";
|
|
8
9
|
/** Where the link stands; `pairing` is a new device's first connect. */
|
|
9
10
|
type ConnectionState = "disconnected" | "connecting" | "pairing" | "connected" | "disconnecting";
|
|
10
11
|
/** Everything a UI shows about one paired device; the same keys for every model. */
|
|
@@ -74,6 +75,8 @@ type DeviceSnapshot = {
|
|
|
74
75
|
/** When the device reported it. */
|
|
75
76
|
at: Date;
|
|
76
77
|
} | null;
|
|
78
|
+
/** What the device reports about itself while its stream runs, `null` otherwise. */
|
|
79
|
+
deviceState: DeviceState | null;
|
|
77
80
|
};
|
|
78
81
|
/** What a device handle reports: its new snapshot, and readings to save or show. */
|
|
79
82
|
type DeviceEvent = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-snapshot.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/device-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErE,mCAAmC;AACnC,KAAK,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"device-snapshot.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/device-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,cA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,IAAI,EAAE,MAAM,CAAC;IAEb,4CAA4C;IAC5C,MAAM,EAAE,UAAU,CAAC;CACpB,GACD;IAEE,uDAAuD;IACvD,IAAI,EAAE,UAAU,CAAC;IAEjB,8DAA8D;IAC9D,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEN,oCAAoC;AACpC,KAAK,WAAW,GAAG;IAEjB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IAEjB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAYF,+DAA+D;AAC/D,QAAA,MAAM,SAAS,GAAI,UAAU,cAAc,KAAG,YAAY,EAE8C,CAAC;AAEzG,4DAA4D;AAC5D,QAAA,MAAM,YAAY,GAAI,QAAQ,YAAY,EAAE,OAAO,WAAW;;;;;;;;;;;CAW5D,CAAC;AAEH,QAAA,MAAM,eAAe,GAAI,QAAQ,YAAY,EAAE,OAAO,WAAW,EAAE,UAAU,cAAc,KAAG,cAiB5F,CAAC;AAEH,gFAAgF;AAChF,QAAA,MAAM,YAAY,GAAI,sBAAsB,SAAS,KAAG,WAAW,EAGlE,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** One ear of a pair. */
|
|
2
|
+
type EarSide = "left" | "right";
|
|
3
|
+
/** One ear of a hearing aid pair as it last reported itself; a field is `null` until the ear answers. */
|
|
4
|
+
type EarState = {
|
|
5
|
+
/** Charge level from 0 to 100. */
|
|
6
|
+
battery: number | null;
|
|
7
|
+
/** Whether it is charging. */
|
|
8
|
+
charging: boolean | null;
|
|
9
|
+
/** Whether its sensor says it sits in the ear. */
|
|
10
|
+
inEar: boolean | null;
|
|
11
|
+
/** Whether it sits in its charging case. */
|
|
12
|
+
inCase: boolean | null;
|
|
13
|
+
};
|
|
14
|
+
/** A volume step and the highest step the device has. */
|
|
15
|
+
type VolumeStep = {
|
|
16
|
+
/** The step it is set to. */
|
|
17
|
+
level: number;
|
|
18
|
+
/** The highest step. */
|
|
19
|
+
max: number;
|
|
20
|
+
};
|
|
21
|
+
/** How a hearing aid plays sound: amplifying what it hears, playing Bluetooth audio, or both. */
|
|
22
|
+
type HearingAidMode = "mixed" | "hearing-aid" | "earphone";
|
|
23
|
+
/** The surroundings a hearing aid's noise reduction is tuned for. */
|
|
24
|
+
type NoiseScene = "general" | "outdoor" | "meeting" | "cinema";
|
|
25
|
+
/** Where a hearing aid listens: all around with one microphone, or ahead with two. */
|
|
26
|
+
type MicrophoneDirection = "all-around" | "front";
|
|
27
|
+
/** The language of a hearing aid's voice prompts. */
|
|
28
|
+
type PromptLanguage = "chinese" | "english";
|
|
29
|
+
/** A hearing aid pair as it reports itself while linked, every value as the aid sent it. */
|
|
30
|
+
type HearingAidState = {
|
|
31
|
+
/** The kind of device the state comes from. */
|
|
32
|
+
kind: "hearing-aid";
|
|
33
|
+
/** The ear that speaks for the pair. */
|
|
34
|
+
mainEar: EarSide;
|
|
35
|
+
/** The linked ears. */
|
|
36
|
+
ears: Partial<Record<EarSide, EarState>>;
|
|
37
|
+
/** The volume step and the highest step, `null` until read. */
|
|
38
|
+
volume: VolumeStep | null;
|
|
39
|
+
/** How it plays sound, `null` until read or for a value the aid reserves. */
|
|
40
|
+
mode: HearingAidMode | null;
|
|
41
|
+
/** Whether noise reduction is on, `null` until read. */
|
|
42
|
+
noiseReduction: boolean | null;
|
|
43
|
+
/** The surroundings noise reduction is tuned for, `null` until read. */
|
|
44
|
+
noiseScene: NoiseScene | null;
|
|
45
|
+
/** Where it listens, `null` until changed, since the aid cannot be asked. */
|
|
46
|
+
microphone: MicrophoneDirection | null;
|
|
47
|
+
/** Whether it pauses when taken out of the ear, `null` until read. */
|
|
48
|
+
inEarDetection: boolean | null;
|
|
49
|
+
/** The language of its voice prompts, `null` until read. */
|
|
50
|
+
promptLanguage: PromptLanguage | null;
|
|
51
|
+
};
|
|
52
|
+
/** A new volume for a hearing aid. */
|
|
53
|
+
type VolumeChange = {
|
|
54
|
+
/** Which setting changes. */
|
|
55
|
+
kind: "volume";
|
|
56
|
+
/** The step to set; one past the aid's range is kept within it. */
|
|
57
|
+
level: number;
|
|
58
|
+
};
|
|
59
|
+
/** A new way for a hearing aid to play sound. */
|
|
60
|
+
type ModeChange = {
|
|
61
|
+
/** Which setting changes. */
|
|
62
|
+
kind: "mode";
|
|
63
|
+
/** The mode to set. */
|
|
64
|
+
mode: HearingAidMode;
|
|
65
|
+
};
|
|
66
|
+
/** Noise reduction turned on or off, tuned for a scene. */
|
|
67
|
+
type NoiseReductionChange = {
|
|
68
|
+
/** Which setting changes. */
|
|
69
|
+
kind: "noise-reduction";
|
|
70
|
+
/** Whether noise reduction is on. */
|
|
71
|
+
on: boolean;
|
|
72
|
+
/** The surroundings it is tuned for. */
|
|
73
|
+
scene: NoiseScene;
|
|
74
|
+
};
|
|
75
|
+
/** Where a hearing aid listens. */
|
|
76
|
+
type MicrophoneChange = {
|
|
77
|
+
/** Which setting changes. */
|
|
78
|
+
kind: "microphone";
|
|
79
|
+
/** The direction to set. */
|
|
80
|
+
direction: MicrophoneDirection;
|
|
81
|
+
};
|
|
82
|
+
/** Whether a hearing aid pauses when taken out of the ear. */
|
|
83
|
+
type InEarDetectionChange = {
|
|
84
|
+
/** Which setting changes. */
|
|
85
|
+
kind: "in-ear-detection";
|
|
86
|
+
/** Whether in-ear detection is on. */
|
|
87
|
+
on: boolean;
|
|
88
|
+
};
|
|
89
|
+
/** The language of a hearing aid's voice prompts. */
|
|
90
|
+
type PromptLanguageChange = {
|
|
91
|
+
/** Which setting changes. */
|
|
92
|
+
kind: "prompt-language";
|
|
93
|
+
/** The language to set. */
|
|
94
|
+
language: PromptLanguage;
|
|
95
|
+
};
|
|
96
|
+
/** The maker's defaults restored on a hearing aid: volume 9, noise reduction on, mixed mode, Chinese prompts. */
|
|
97
|
+
type FactoryReset = {
|
|
98
|
+
/** Which setting changes. */
|
|
99
|
+
kind: "factory-reset";
|
|
100
|
+
};
|
|
101
|
+
/** One setting to change on a hearing aid. */
|
|
102
|
+
type HearingAidChange = VolumeChange | ModeChange | NoiseReductionChange | MicrophoneChange | InEarDetectionChange | PromptLanguageChange | FactoryReset;
|
|
103
|
+
/** One setting to change on a device, one shape per kind of device. */
|
|
104
|
+
type DeviceChange = HearingAidChange;
|
|
105
|
+
/** What a device reports about itself beyond its battery and identity, one shape per kind of device. */
|
|
106
|
+
type DeviceState = HearingAidState;
|
|
107
|
+
export type { DeviceChange, DeviceState, EarSide, EarState, FactoryReset, HearingAidChange, HearingAidMode, HearingAidState, InEarDetectionChange, MicrophoneChange, MicrophoneDirection, ModeChange, NoiseReductionChange, NoiseScene, PromptLanguage, PromptLanguageChange, VolumeChange, VolumeStep, };
|
|
108
|
+
//# sourceMappingURL=device-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-state.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/device-state.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,KAAK,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhC,yGAAyG;AACzG,KAAK,QAAQ,GAAG;IAEd,kCAAkC;IAClC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,8BAA8B;IAC9B,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAEzB,kDAAkD;IAClD,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtB,4CAA4C;IAC5C,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,yDAAyD;AACzD,KAAK,UAAU,GAAG;IAEhB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IAEd,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF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7 @@
|
|
|
1
1
|
import { Advertisement } from "./advertisement";
|
|
2
2
|
import { DeviceDeps } from "./device-deps";
|
|
3
3
|
import { DeviceEvent, DeviceSnapshot, SyncSummary } from "./device-snapshot";
|
|
4
|
+
import { DeviceChange } from "./device-state";
|
|
4
5
|
import { DeviceSettings, PairedDevice } from "./paired-device";
|
|
5
6
|
import { RecordInfo } from "./protocol";
|
|
6
7
|
/** One paired device: it owns the link, queues every action on it, and reconnects when a press needs it. */
|
|
@@ -32,6 +33,8 @@ declare class Device {
|
|
|
32
33
|
fetch: (recordId: string) => Promise<void>;
|
|
33
34
|
/** Sets the device's clock to now. */
|
|
34
35
|
setClock: () => Promise<void>;
|
|
36
|
+
/** Changes one of the device's settings, such as a hearing aid's volume. */
|
|
37
|
+
change: (change: DeviceChange) => Promise<void>;
|
|
35
38
|
/** Starts `live` and `waveform` events, which the device also records and saves while it measures with `record` on. */
|
|
36
39
|
startLive: () => Promise<void>;
|
|
37
40
|
/** Stops the stream and waits until the device has stopped sending. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAiC,WAAW,EAAE,cAAc,EAAiC,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3I,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,YAAY,EAA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AS,QAAO,OAAO,CAAC,IAAI,CAAC,CACwH;IAE5J,uEAAuE;IAChE,QAAQ,QAAO,OAAO,CAAC,IAAI,CAAC,CAAqB;IAExD,uFAAuF;IAChF,WAAW,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAK1D;IAEF,wFAAwF;IACjF,OAAO,GAAI,UAAU,MAAM,KAAG,IAAI,CAGvC;IAEF,qHAAqH;IAC9G,SAAS,GAAI,UAAU,OAAO,CAAC,cAAc,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC,CAAgC;IAErG,kEAAkE;IAC3D,UAAU,QAAa,OAAO,CAAC,IAAI,CAAC,CAIzC;IAEF,6GAA6G;IACtG,IAAI,QAAO,OAAO,CAAC,IAAI,CAAC,CAA+H;IAE9J,qHAAqH;IAC9G,IAAI,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI;IAapC,OAAO,CAAC,GAAG;YAYG,OAAO;YAmBP,OAAO;YAaP,SAAS;YAaT,WAAW;IAazB,8DAA8D;IAC9D,OAAO,CAAC,KAAK,CAA2F;YAE1F,WAAW;YAIX,OAAO;IAiBrB,wHAAwH;IACxH,OAAO,CAAC,kBAAkB;IAM1B,iGAAiG;IACjG,OAAO,CAAC,WAAW;YAIL,YAAY;IAM1B,OAAO,CAAC,KAAK;CAId;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -5,8 +5,8 @@ declare const STORED_AFTER_MS = 3000;
|
|
|
5
5
|
/** Streams the device's frames to `onFrame` until `signal` aborts. */
|
|
6
6
|
type Live = (onFrame: (frame: LiveFrame) => void, signal: AbortSignal) => Promise<void>;
|
|
7
7
|
type LiveSessionCallbacks = {
|
|
8
|
-
/** The stream started or ended, failed,
|
|
9
|
-
changed: (change: Partial<Pick<DeviceSnapshot, "live" | "lastError" | "measuringSince">>) => void;
|
|
8
|
+
/** The stream started or ended, failed, the device started or stopped measuring, or reported its state. */
|
|
9
|
+
changed: (change: Partial<Pick<DeviceSnapshot, "live" | "lastError" | "measuringSince" | "deviceState">>) => void;
|
|
10
10
|
/** The live numbers and samples of one frame. */
|
|
11
11
|
emit: (event: DeviceEvent) => void;
|
|
12
12
|
/** A measurement ended while the stream still ran, long enough ago for the device to have stored it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-session.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/live-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAgB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,2GAA2G;AAC3G,QAAA,MAAM,eAAe,OAAQ,CAAC;AAE9B,sEAAsE;AACtE,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExF,KAAK,oBAAoB,GAAG;IAE1B,
|
|
1
|
+
{"version":3,"file":"live-session.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/live-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAgB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,2GAA2G;AAC3G,QAAA,MAAM,eAAe,OAAQ,CAAC;AAE9B,sEAAsE;AACtE,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExF,KAAK,oBAAoB,GAAG;IAE1B,2GAA2G;IAC3G,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,WAAW,GAAG,gBAAgB,GAAG,aAAa,CAAC,CAAC,KAAK,IAAI,CAAC;IAElH,iDAAiD;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAEnC,wGAAwG;IACxG,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,GAAG,EAAE,MAAM,IAAI,CAAC;CACjB,CAAC;AAEF,sHAAsH;AACtH,cAAM,WAAW;IAKI,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJ7C,OAAO,CAAC,WAAW,CAA4C;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAEA,SAAS,EAAE,oBAAoB;IASnE,mDAAmD;IAC5C,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAY9B,+GAA+G;IACxG,IAAI,QAAO,OAAO,CAAC,IAAI,CAAC,CAAuB;IAEtD,gEAAgE;IACzD,KAAK,QAAO,IAAI,CAAwB;IAE/C,6FAA6F;IACtF,KAAK,QAAO,OAAO,CAAC,IAAI,CAAC,CAI9B;IAEF,OAAO,CAAC,gBAAgB;CAOzB;AAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Advertisement } from "./advertisement";
|
|
2
|
+
import { DeviceChange } from "./device-state";
|
|
2
3
|
import { Battery, DeviceIdentity } from "./paired-device";
|
|
3
4
|
import { GattLink, Logger } from "./ports";
|
|
4
5
|
import { DecodedReading, LiveFrame } from "./reading";
|
|
@@ -51,6 +52,8 @@ interface DeviceProtocol<C = unknown> {
|
|
|
51
52
|
identify?(connection: C): Promise<Omit<DeviceIdentity, "at">>;
|
|
52
53
|
/** Sets the device's clock to `now`. */
|
|
53
54
|
setClock?(connection: C, now: Date): Promise<void>;
|
|
55
|
+
/** Changes one setting; rejects when the device refuses it. */
|
|
56
|
+
change?(connection: C, change: DeviceChange): Promise<void>;
|
|
54
57
|
/** What pairing needs after the connect steps, on a link of its own that closes once it is done. */
|
|
55
58
|
pairing?(connection: C): Promise<void>;
|
|
56
59
|
/** Reads the battery level. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/next/bluetooth/core/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtD,gIAAgI;AAChI,KAAK,YAAY,GAAG;IAElB,yDAAyD;IACzD,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEnC,uCAAuC;IACvC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC,CAAC;AAEF,8CAA8C;AAC9C,KAAK,eAAe,GAAG;IAErB,uGAAuG;IACvG,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,wCAAwC;IACxC,IAAI,EAAE,QAAQ,CAAC;IAEf,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IAEf,0DAA0D;IAC1D,GAAG,EAAE,MAAM,IAAI,CAAC;IAEhB,+DAA+D;IAC/D,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,yDAAyD;AACzD,KAAK,UAAU,GAAG;IAEhB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IAEX,iEAAiE;IACjE,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,8FAA8F;AAC9F,KAAK,aAAa,GAAG;IAEnB,kGAAkG;IAClG,EAAE,EAAE,MAAM,CAAC;IAEX,oFAA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,oEAAoE;IACpE,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAE/C,oFAAoF;IACpF,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAExE;;;OAGG;IACH,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAEhF,wFAAwF;IACxF,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9F;;;;OAIG;IACH,SAAS,CAAC,CAAC,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,GAAG,aAAa,GAAG,IAAI,CAAC;IAEjF,wDAAwD;IACxD,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeviceState } from "./device-state";
|
|
1
2
|
import { MeasurementType, MetricCode } from "./measurement-type";
|
|
2
3
|
/** A value with its UCUM unit. */
|
|
3
4
|
type Quantity = {
|
|
@@ -107,6 +108,8 @@ type LiveFrame = {
|
|
|
107
108
|
values?: LiveValues;
|
|
108
109
|
/** Samples to trace, when it had any. */
|
|
109
110
|
waveform?: Waveform;
|
|
111
|
+
/** What the device reports about itself, for a device whose stream is its state rather than a measurement. */
|
|
112
|
+
state?: DeviceState;
|
|
110
113
|
};
|
|
111
114
|
export type { DecodedReading, DeviceFlag, LiveFrame, LiveSpan, LiveValues, Quantity, Reading, ReadingSource, Series, Waveform };
|
|
112
115
|
//# sourceMappingURL=reading.d.ts.map
|