mirror of https://github.com/espruino/BangleApps
btadv: add sensor location entry
parent
0eea248390
commit
63cbd45cc6
|
@ -43,6 +43,10 @@ const enum BleChar {
|
|||
// <see encode function>
|
||||
HRM = "0x2a37",
|
||||
|
||||
// org.bluetooth.characteristic.body_sensor_location
|
||||
// u8
|
||||
SensorLocation = "0x2a38",
|
||||
|
||||
// org.bluetooth.characteristic.elevation
|
||||
// s24, meters 0.01
|
||||
Elevation = "0x2a6c",
|
||||
|
@ -84,6 +88,16 @@ type LenFunc<T> = {
|
|||
maxLen: number,
|
||||
}
|
||||
|
||||
const enum SensorLocations = {
|
||||
Other = 0,
|
||||
Chest = 1,
|
||||
Wrist = 2,
|
||||
Finger = 3,
|
||||
Hand = 4,
|
||||
EarLobe = 5,
|
||||
Foot = 6,
|
||||
}
|
||||
|
||||
let acc: undefined | AccelData;
|
||||
let bar: undefined | PressureData;
|
||||
let gps: undefined | GPSFix;
|
||||
|
@ -515,12 +529,22 @@ const serviceToAdvert = (serv: BleServ, initial = false): BleServAdvert => {
|
|||
readable: true,
|
||||
notify: true,
|
||||
};
|
||||
const os: BleCharAdvert = {
|
||||
maxLen: 1,
|
||||
readable: true,
|
||||
notify: true,
|
||||
};
|
||||
|
||||
if (hrm) {
|
||||
o.value = encodeHrm(hrm);
|
||||
os.value = SensorLocations.Wrist;
|
||||
hrm = undefined;
|
||||
}
|
||||
|
||||
return { [BleChar.HRM]: o };
|
||||
return {
|
||||
[BleChar.HRM]: o,
|
||||
[BleChar.SensorLocation]: os,
|
||||
};
|
||||
}
|
||||
return {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue