-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.js
More file actions
28 lines (22 loc) · 1014 Bytes
/
Copy pathdebug.js
File metadata and controls
28 lines (22 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// =====================================================================
// debug.js - debug-build helpers. Lets the app run with no BLE/rower by
// faking scan results and a connection. Kept separate from production
// logic so it can be removed without touching the controller.
// =====================================================================
var Debug = (function () {
'use strict';
function isOn() { return ui.debug; }
// Pretend a rower was found shortly after a scan starts.
function fakeScan(onResult) {
setTimeout(function () {
onResult({ devices: [{ id: 'DE:BU:G0:00:01 Debug Rower' }] });
}, 1200);
}
// Pretend the connection succeeded.
function fakeConnect(onResult) {
setTimeout(function () { onResult({ success: true }); }, 800);
}
function startSim() { DebugSim.reset(); DebugSim.start(); }
function stopSim() { DebugSim.stop(); }
return { isOn: isOn, fakeScan: fakeScan, fakeConnect: fakeConnect, startSim: startSim, stopSim: stopSim };
})();