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