summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/module/HS6Module.js
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ihealth-sdk/module/HS6Module.js')
-rwxr-xr-xlibs/ihealth-sdk/module/HS6Module.js94
1 files changed, 94 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/HS6Module.js b/libs/ihealth-sdk/module/HS6Module.js
new file mode 100755
index 0000000..06356cd
--- /dev/null
+++ b/libs/ihealth-sdk/module/HS6Module.js
@@ -0,0 +1,94 @@
1/**
2 * Created by lixuesong on 11/11/2016.
3 */
4'use strict';
5
6
7var {NativeModules} = require('react-native');
8
9var RCTModule = NativeModules.HS6Module
10
11/**
12 * @module HS6Module
13 */
14module.exports = {
15
16 Event_Notify: RCTModule.Event_Notify,
17
18 /**
19 * Initializes method.
20 * @param {string} userName the name of user
21 */
22 init: function (userName) {
23 RCTModule.init(userName)
24 },
25
26 /**
27 * Set wifi to the scale.
28 * @param {string} ssid the name of net
29 * @param {string} password the password of the net
30 */
31 setWifi: function (ssid, password) {
32 RCTModule.setWifi(ssid, password)
33 },
34
35 /**
36 * Bind the user and scale together,after bind success user's weight datas can be transmitted to the cloud.
37 * And this method is a time consuming operation that cannot be called in the main thread.
38 * @param {string} birthday format like yyyy-MM-dd HH:mm:ss
39 * @param {float} weight the unit is kg
40 * @param {int} height the unit is cm
41 * @param {int} isSporter is sporter; 2 is not ;3 unknown
42 * @param {int} gender 0 is male ;1 is female
43 * @param {string} serialNumber the mac address of the scale
44 */
45 bindDeviceHS6: function (birthday, weight, height, isSporter, gender, serialNumber) {
46 RCTModule.bindDeviceHS6(birthday, weight, height, isSporter, gender, serialNumber)
47 },
48
49 /**
50 * Unbind the user and scale,and this method is a time consuming operation that cannot be called in the main thread.
51 * @param {string} serialNumber the mac address of scale
52 */
53 unBindDeviceHS6: function (serialNumber) {
54 RCTModule.unBindDeviceHS6(serialNumber)
55 },
56
57 /**
58 * Get AccessToken of HS6 user,and this method is a time consuming operation that cannot be called
59 * in the main thread.
60 * After get AccessToken, you can call openApi(http://developer.ihealthlabs.com) to pull data form iHealth cloud.
61 * @param {string} clientId the identification of the SDK
62 * @param {string} clientSecret the identification of the SDK
63 * @param {string} username the identification of the user
64 * @param {string} clientPara a random string,return back without change
65 */
66 getToken: function (clientId, clientSecret, username, clientPara) {
67 RCTModule.getToken(clientId, clientSecret, username, clientPara)
68 },
69
70 /**
71 * Set unit of HS6,and this method is a time consuming operation that cannot be called
72 * in the main thread.
73 * @param {string} username the identification of the user
74 * @param {int} unitType the unit type
75 * <p>0 Kg
76 * <p>1 lbs
77 * <p>2 st
78 */
79 setUnit: function (username, unitType) {
80 RCTModule.setUnit(username, unitType)
81 },
82
83 /**
84 * DownloadHS6 CloudData
85 * @param {string} clientId the identification of the SDK
86 * @param {string} clientSecret the identification of the SDK
87 * @param {string} username the identification of the user
88 * @param {long} ts time stamp of HS6 measure data. UTC time, unit in milliseconds.
89 * @param {long} pageSize the specific size of data in one download progress
90 */
91 getCloudData: function (clientId, clientSecret, username, ts, pageSize) {
92 RCTModule.getCloudData(clientId, clientSecret, username, ts, pageSize)
93 },
94}