Skip to content

Commit 0fe18ed

Browse files
authored
Merge pull request #4294 from RKBoss6/Bluewatch-Updates
[BlueWatch] Update for new iOS Bluewatch app version
2 parents 8d23899 + e2d7e29 commit 0fe18ed

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

apps/bluewatch/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
0.01: New App!
2+
0.02: Use new device handshake method for more reliable connections (Must use the iOS BlueWatch app version 1.1)

apps/bluewatch/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ Then, follow the app instructions and authorize Bluetooth permissions for the ap
2525
After it pairs, it will automatically push weather and location data to the watch. You can turn these features off in the iOS app's settings menu.
2626

2727
For more documentation, please see the [iOS App's README](https://github.com/RKBoss6/BlueWatch/blob/main/README.md)
28-
28+
## Developer Info
29+
Upon connect, the module sends an event `"BlueWatchConnected"` which can be listened for using the following:
30+
```
31+
Bangle.on("BlueWatchConnected", function (){ ... })
32+
```
33+
34+
To send a string or a JSON, you can use the following:
35+
```
36+
require("bluewatch").sendData("string or object", true);
37+
```
38+
with an optional second parameter `forceSend`. When true, it sends even if BlueWatch is not connected at the time. By default it doesn't send info unless the device handshake is completed and BlueWatch is connected
2939
## Author and Creator of the iOS App
3040
RKBoss6
3141

apps/bluewatch/lib.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ function updateWeatherData(d) {
4545
require("weather").update(weatherEvent);
4646
}
4747

48-
function sendData(dataString) {
49-
if (global.phoneConnected) {
50-
Bluetooth.write("BlueWatch_PRIMER" + "\n");
48+
function sendData(dataString, forceSend) {
49+
if (global.phoneConnected || forceSend) {
5150
setTimeout(function () {
5251
Bluetooth.write(dataString + "\n");
5352
}, 500);
@@ -93,6 +92,7 @@ function sendHealthData() {
9392
}
9493

9594
function onConnect() {
95+
sendData("Handshake Successful",true);
9696
global.phoneConnected = true;
9797
Bangle.emit("BlueWatchConnected");
9898
setTimeout(sendHealthData, 1000);
@@ -185,4 +185,4 @@ exports.sendData = sendData;
185185
exports.sendJSON = sendData;
186186
exports.sendHealthData = sendHealthData;
187187
exports.sendRawHealthData = sendRawHealthData;
188-
exports.receive = messageReceived;
188+
exports.receive = messageReceived;

apps/bluewatch/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"id": "bluewatch",
33
"name": "BlueWatch iOS Integration",
44
"shortName": "BlueWatch",
5-
"version": "0.01",
6-
"description": "Uses the native iOS app BlueWatch to fetch weather, use phone GPS, find phone/watch, and more.",
5+
"version": "0.02",
6+
"description": "Uses the native iOS app 'BlueWatch' to fetch weather, use phone GPS, find phone/watch, and more.",
77
"icon": "app.png",
88
"tags": "tool,bluetooth,apple,ios,system",
99
"supports": ["BANGLEJS2"],

0 commit comments

Comments
 (0)