mirror of https://github.com/espruino/BangleApps
btadv: use `ble_advert` module
parent
ce28c0d1b6
commit
91dd1f6ec4
|
@ -1,3 +1,4 @@
|
||||||
0.01: New app!
|
0.01: New app!
|
||||||
0.02: Advertise accelerometer data and sensor location
|
0.02: Advertise accelerometer data and sensor location
|
||||||
0.03: Use the bleAdvert module
|
0.03: Use the bleAdvert module
|
||||||
|
0.04: Actually use the ble_advert module
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
var _a;
|
|
||||||
{
|
{
|
||||||
var __assign = Object.assign;
|
var __assign = Object.assign;
|
||||||
var Layout_1 = require("Layout");
|
var Layout_1 = require("Layout");
|
||||||
|
@ -441,8 +440,6 @@ var _a;
|
||||||
NRF.setServices(ad, {
|
NRF.setServices(ad, {
|
||||||
uart: false,
|
uart: false,
|
||||||
});
|
});
|
||||||
var bangle2 = Bangle;
|
|
||||||
var cycle = Array.isArray(bangle2.bleAdvert) ? bangle2.bleAdvert : [];
|
|
||||||
for (var id in ad) {
|
for (var id in ad) {
|
||||||
var serv = ad[id];
|
var serv = ad[id];
|
||||||
var value = void 0;
|
var value = void 0;
|
||||||
|
@ -450,11 +447,7 @@ var _a;
|
||||||
value = serv[ch].value;
|
value = serv[ch].value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cycle.push((_a = {}, _a[id] = value || [], _a));
|
require("ble_advert").set(id, value || []);
|
||||||
}
|
}
|
||||||
bangle2.bleAdvert = cycle;
|
|
||||||
NRF.setAdvertising(cycle, {
|
|
||||||
interval: 100,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -767,16 +767,6 @@ enableSensors();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
type BleAdvert = { [key: string]: number[] };
|
|
||||||
const bangle2 = Bangle as {
|
|
||||||
bleAdvert?: BleAdvert | BleAdvert[];
|
|
||||||
};
|
|
||||||
const cycle = Array.isArray(bangle2.bleAdvert)
|
|
||||||
? bangle2.bleAdvert
|
|
||||||
: bangle2.bleAdvert
|
|
||||||
? [bangle2.bleAdvert]
|
|
||||||
: [];
|
|
||||||
|
|
||||||
for(const id in ad){
|
for(const id in ad){
|
||||||
const serv = ad[id as BleServ];
|
const serv = ad[id as BleServ];
|
||||||
let value;
|
let value;
|
||||||
|
@ -787,16 +777,7 @@ enableSensors();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cycle.push({ [id]: value || [] });
|
require("ble_advert").set(id, value || []);
|
||||||
}
|
}
|
||||||
|
|
||||||
bangle2.bleAdvert = cycle;
|
|
||||||
|
|
||||||
NRF.setAdvertising(
|
|
||||||
cycle,
|
|
||||||
{
|
|
||||||
interval: 100,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "btadv",
|
"id": "btadv",
|
||||||
"name": "btadv",
|
"name": "btadv",
|
||||||
"shortName": "btadv",
|
"shortName": "btadv",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "Advertise & export live heart rate, accel, pressure, GPS & mag data over bluetooth",
|
"description": "Advertise & export live heart rate, accel, pressure, GPS & mag data over bluetooth",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"tags": "health,tool,sensors,bluetooth",
|
"tags": "health,tool,sensors,bluetooth",
|
||||||
|
|
Loading…
Reference in New Issue