1.0.28 • Published 7 years ago

cordova-plugin-swt-x9-testing v1.0.28

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

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);
1.0.28

7 years ago

1.0.27

7 years ago

1.0.26

7 years ago

1.0.25

7 years ago

1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago