cordova-plugin-swt-x9-testing
v1.0.28
Published
Shenzen Wearable Technologies X9 Cordova plugin
Downloads
6
Maintainers
Readme
Shenzen Wearable Technologies X9 Cordova Plugin
This plugin uses the Bluetooth Low Energy (BLE) Central Plugin to connect to the SWT X9 wristband and return heart rate data and sleep data.
Methods
getHeartRateData
Scan for and connect to the X9 device, start the heart rate monitoring service, and return the response. It will take ~20 or more seconds to run the heart rate monitoring service and return the results.
X9.getHeartRateData(success, error);
Example
X9.getHeartRateData(
function(responseUintArray, responseStr) {
console.log(responseUintArray);
console.log(responseStr);
},
function(errorMessage) {
console.log(errorMessage);
}
);
Return Data
The ble plugin uses typed Arrays or ArrayBuffers for sending and receiving data. The success callback will return the data in the following format:
var responseUintArray = new Uint8Array(response);
var responseStr = String.fromCharCode.apply(String, new Uint8Array(response));
success(responseUintArray, responseStr);
getSleepData
Scan for and connect to the X9 device, and return response from the sleep data service.
X9.getSleepData(success, error);
Example
X9.getHeartRateData(
function(responseUintArray, responseStr) {
console.log(responseUintArray);
console.log(responseStr);
},
function(errorMessage) {
console.log(errorMessage);
}
);
Return Data
The ble plugin uses typed Arrays or ArrayBuffers for sending and receiving data. The success callback will return the data in the following format:
var responseUintArray = new Uint8Array(response);
var responseStr = String.fromCharCode.apply(String, new Uint8Array(response));
success(responseUintArray, responseStr);