Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/heatsuite/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@
Normalized StudyTasks loading to an array
Renamed high accelerometry max-records setting to `BinMaxRecords`
Fixed `GPSInterval` setting persistence casing
0.16: Refactored blood pressure pairing and measurement flow
Added BP SFLOAT parsing, bonded-device validation, time sync, timeout/disconnect handling, and clearer pairing/security errors
Coordinated BP/scale/temp task launches with widget BLE stop/start to avoid recorder scan conflicts
Improved CORESensor recorder ownership, pause/resume lifecycle
Fixed CORE HR value updates and moved recorder start/stop logging
30 changes: 27 additions & 3 deletions apps/heatsuite/heatsuite.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ let settings = modHS.getSettings();

let appCache = modHS.getCache();

function stopBLEDevices() {
if (global.WIDGETS && WIDGETS["heatsuite"] && WIDGETS["heatsuite"].stopBLEDevices) {
return Promise.resolve(WIDGETS["heatsuite"].stopBLEDevices());
}
return Promise.resolve();
}

function loadTaskApp(appFile, label) {
NRF.setScan();
stopBLEDevices().then(function () {
NRF.setScan();
Bangle.load(appFile);
}).catch(function (e) {
modHS.log("Failed to stop BLE before " + label + " task: " + e);
Bangle.load(appFile);
});
}

function queueNRFFindDeviceTimeout() {
if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout);
NRFFindDeviceTimeout = setTimeout(function () {
Expand All @@ -33,8 +51,7 @@ function findBtDevices() {
if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout);
if (TaskScreenTimeout) clearTimeout(TaskScreenTimeout);
NRF.setScan();
WIDGETS['heatsuite'].stopBLEDevices();
Bangle.load(appFile);
loadTaskApp(appFile, label);
return true;
}
if (devices.length !== 0) {
Expand All @@ -44,7 +61,14 @@ function findBtDevices() {
modHS.log("Services: ", services);
if (services !== undefined && services.includes('1810') && d.id === settings.bt_bloodPressure_id) {
//Blood Pressure
return foundDevice("BP", 'heatsuite.bp.js');
found = true;
if (layout && layout.msg) {
layout.msg.label = "BP Found";
layout.render();
}
if (NRFFindDeviceTimeout) clearTimeout(NRFFindDeviceTimeout);
loadTaskApp('heatsuite.bp.js', "BP");
return true;
} else if (services !== undefined && (services.includes('181b') || services.includes('181d')) && studyTasks.some(task => task.id === "bodyMass")) {
if (services.includes('181b')) {
if (!d.serviceData || !d.serviceData['181b'] || d.serviceData['181b'].length < 2) {
Expand Down
Loading
Loading