GyroPalm Web Control

Educational demo page for GyroPalm JavaScript SDK

Declare GyroPalmRealtime Object
Using your GyroPalm API key or masterToken, you can create a new realtime object. // Define params later: var gp = new GyroPalm(); // Instantiate with params: var gp = new GyroPalm("yourAPIkey", "wearableID"); gp.enableVerbose(true); //Include to enable console log
List Wearables
Using your GyroPalm API key, you can retrieve an array of GyroPalm Wearables. // If you have provided API key: gp.getWearables("", onEventReceived); // no need to repeat the API key // If you defined without params: gp.getWearables("yourAPIkey", onEventReceived);
User Info
Using your GyroPalm API key, you can retrieve information about the account. // If you have provided API key: gp.getAccountInfo("", onEventReceived); // no need to repeat the API key // If you defined without params: gp.getAccountInfo("yourAPIkey", onEventReceived);
Connect to Wearable
Once connected to a Wearable, you can send and retrieve data to and from the wearable (pub & sub respectively). // Equivalent of setEventCallback and setConnectionCallback // You can set callbacks and then connect: gp.connect("wearableID", onEventReceived, onConnection); // If you have already defined callbacks, connect with wearableID: gp.connect("wearableID"); // If you have already connected prior and want to re-connect: gp.connect();
Register for Events
To receive incoming events, define your callback functions and register the callback events.
// Run "onEventReceived" callback when new msg gp.addEventCallback(onEventReceived); // Run "onConnection" callback when connected/disconnected gp.addConnectionCallback(onConnection); // Optional. If you want to retrieve verbose messages gp.addVerboseCallback(onVerbose); // Example functions to print out your callbacks: function onEventReceived(obj) { console.log(obj); } function onConnection(obj) { console.log(obj); }
Test Incoming Events
Incoming data objects from the wearable are shown here:

Outgoing Commands
You can send commands and messages to the wearable here.