Last active
November 23, 2018 19:09
-
-
Save rootasjey/63d323708b4279b9a388c3f225edc2ac to your computer and use it in GitHub Desktop.
Fitbit settings companion messaging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Companion | |
import * as messaging from "messaging"; | |
sendValue('weatherRefreshTime', time); | |
function sendValue(key, val) { | |
if (val) { | |
sendSettingData({ | |
key: key, | |
value: JSON.parse(val) | |
}); | |
} | |
} | |
function sendSettingData(data) { | |
// If we have a MessageSocket, send the data to the device | |
if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) { | |
messaging.peerSocket.send(data); | |
return; | |
} | |
console.log("No peerSocket connection"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment