btadv: integration with existing Bangle.bleAdvert

pull/2912/head
Rob Pilling 2023-08-08 07:57:34 +01:00
parent 701f8c7733
commit 99b72333e5
1 changed files with 7 additions and 3 deletions

View File

@ -774,10 +774,12 @@ enableSensors();
},
);
if(!(Bangle as any).bleAdvert)
(Bangle as any).bleAdvert = {};
type BleAdvert = { [key: string]: number[] };
const bangle2 = Bangle as {
bleAdvert?: BleAdvert | BleAdvert[];
};
const cycle = Array.isArray(bangle2.bleAdvert) ? bangle2.bleAdvert : [];
const cycle = [];
for(const id in ad){
const serv = ad[id as BleServ];
let value;
@ -791,6 +793,8 @@ enableSensors();
cycle.push({ [id]: value || [] });
}
bangle2.bleAdvert = cycle;
NRF.setAdvertising(
cycle,
{