summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/module/BGProfileModule.js
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ihealth-sdk/module/BGProfileModule.js')
-rwxr-xr-xlibs/ihealth-sdk/module/BGProfileModule.js413
1 files changed, 413 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/BGProfileModule.js b/libs/ihealth-sdk/module/BGProfileModule.js
new file mode 100755
index 0000000..03dacb5
--- /dev/null
+++ b/libs/ihealth-sdk/module/BGProfileModule.js
@@ -0,0 +1,413 @@
1/**
2 * Created by gaoyuanlong on 16/11/16.
3 */
4'use strict';
5
6
7var {NativeModules} = require('react-native');
8
9var RCTModule = NativeModules.BGProfileModule
10
11/**
12 * @module BGProfileModule
13 */
14module.exports = {
15
16 /**
17 * The action value of event indicating the error of BG device.<br/>
18 * The key and value will be as below:
19 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
20 * <tbody>
21 * <tr><td>Key</td><td>Value</td></tr>
22 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_ERROR_BG BGProfileModule.ACTION_ERROR_BG("action_measure_error")}</td></tr>
23 * <tr><td>{@link module:BGProfileModule.ERROR_NUM_BG BGProfileModule.ERROR_NUM_BG("error_num")}</td><td> The error num</td></tr>
24 * <tr><td>{@link module:BGProfileModule.ERROR_DESCRIPTION_BG BGProfileModule.ERROR_DESCRIPTION_BG("description")}</td><td>Detailed description of the error</td></tr>
25 * </tbody>
26 * </table>
27 * <b>Example:</b><br/>
28 * {"description":"Strip removed in the middle of reading, repeat the test with a new strip.","error_num":9,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_measure_error"}
29 * <br/>
30 */
31 ACTION_ERROR_BG: RCTModule.ACTION_ERROR_BG,
32
33 /**
34 * The action value of event indicating keep link success.<br/>
35 * The key and value will be as below:
36 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
37 * <tbody>
38 * <tr><td>Key</td><td>Value</td></tr>
39 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_KEEP_LINK BGProfileModule.ACTION_KEEP_LINK("action_keep_link")}</td></tr>
40 * </tbody>
41 * </table>
42 * <b>Example:</b><br/>
43 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_keep_link"}<br/>
44 */
45 ACTION_KEEP_LINK: RCTModule.ACTION_KEEP_LINK,
46
47 /**
48 * The action value of event indicating set time success.<br/>
49 * The key and value will be as below:
50 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
51 * <tbody>
52 * <tr><td>Key</td><td>Value</td></tr>
53 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_SET_TIME BGProfileModule.ACTION_SET_TIME("action_set_time")}</td></tr>
54 * </tbody>
55 * </table>
56 * <b>Example:</b><br/>
57 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_set_time"}<br/>
58 */
59 ACTION_SET_TIME: RCTModule.ACTION_SET_TIME,
60
61 /**
62 * The action value of event indicating set unit success.<br/>
63 * The key and value will be as below:
64 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
65 * <tbody>
66 * <tr><td>Key</td><td>Value</td></tr>
67 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_SET_UNIT BGProfileModule.ACTION_SET_UNIT("action_set_unit")}</td></tr>
68 * </tbody>
69 * </table>
70 * <b>Example:</b><br/>
71 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_set_unit"}<br/>
72 */
73 ACTION_SET_UNIT: RCTModule.ACTION_SET_UNIT,
74
75 /**
76 * The action value of event indicating the result of get battery command.<br/>
77 * The key and value will be as below:
78 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
79 * <tbody>
80 * <tr><td>Key</td><td>Value</td></tr>
81 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_GET_BATTERY BGProfileModule.ACTION_GET_BATTERY("action_battery_bg")}</td></tr>
82 * <tr><td>{@link module:BGProfileModule.GET_BATTERY BGProfileModule.GET_BATTERY("battery")}</td><td>The battery value.</td></tr>
83 * </tbody>
84 * </table>
85 * <b>Example:</b><br/>
86 * {"mac":"8CDE52B5FAC2","battery":32,"type":"BG5","action":"action_battery_bg"}<br/>
87 */
88 ACTION_GET_BATTERY: RCTModule.ACTION_GET_BATTERY,
89
90 /**
91 * The action value of event indicating start measure success.<br/>
92 * The key and value will be as below:
93 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
94 * <tbody>
95 * <tr><td>Key</td><td>Value</td></tr>
96 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_START_MEASURE BGProfileModule.ACTION_START_MEASURE("action_start_measure")}</td></tr>
97 * </tbody>
98 * </table>
99 * <b>Example:</b><br/>
100 * {mac":"8CDE52B5FAC2","type":"BG5","action":"action_start_measure"}<br/>
101 */
102 ACTION_START_MEASURE: RCTModule.ACTION_START_MEASURE,
103
104 /**
105 * The action value of event indicating the offline data count.<br/>
106 * The key and value will be as below:
107 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
108 * <tbody>
109 * <tr><td>Key</td><td>Value</td></tr>
110 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_GET_OFFLINEDATA_COUNT BGProfileModule.ACTION_GET_OFFLINEDATA_COUNT("action_historicalnum_bg")}</td></tr>
111 * <tr><td>{@link module:BGProfileModule.GET_OFFLINEDATA_COUNT BGProfileModule.GET_OFFLINEDATA_COUNT("count")}</td><td>The offline data count value.</td></tr>
112 * </tbody>
113 * </table>
114 * <b>Example:</b><br/>
115 * {"count":2,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_historicalnum_bg"}
116 * <br/>
117 */
118 ACTION_GET_OFFLINEDATA_COUNT: RCTModule.ACTION_GET_OFFLINEDATA_COUNT,
119
120 /**
121 * The action value of event indicating the result of offline data.<br/>
122 * The key and value will be as below:
123 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
124 * <tbody>
125 * <tr><td>Key</td><td>Value</td></tr>
126 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_GET_OFFLINEDATA BGProfileModule.ACTION_GET_OFFLINEDATA("action_historicaldata_bg")}</td></tr>
127 * <tr><td>{@link module:BGProfileModule.GET_OFFLINEDATA BGProfileModule.GET_OFFLINEDATA("his_data_bg")}</td><td>Get offline data command result</td></tr>
128 * </tbody>
129 * </table>
130 * <b>Example:</b><br/>
131 * {<br/>
132 * {"his_data_bg":{"history":[{"dataID":"1B92511DE36F54508415257160F9D0EA","value":39,"date":"2017-06-08 15:08:00"},
133 * {"dataID":"862D10B79A8560505720B983D658E095","timeProofing":0,"value":38,"date":"2017-06-08 15:09:01"}]},
134 * "mac":"8CDE52B5FAC2","type":"BG5","action":"action_historicaldata_bg"}
135 * <br/>
136 */
137 ACTION_GET_OFFLINEDATA: RCTModule.ACTION_GET_OFFLINEDATA,
138
139 /**
140 * The action value of event indicating delete offline data success.<br/>
141 * The key and value will be as below:
142 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
143 * <tbody>
144 * <tr><td>Key</td><td>Value</td></tr>
145 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_DELETE_OFFLINEDATA BGProfileModule.ACTION_DELETE_OFFLINEDATA("action_delete_historical_data")}</td></tr>
146 * </tbody>
147 * </table>
148 * <b>Example:</b><br/>
149 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_delete_historical_data"}
150 * <br/>
151 */
152 ACTION_DELETE_OFFLINEDATA: RCTModule.ACTION_DELETE_OFFLINEDATA,
153
154 /**
155 * The action value of event indicating the result of set bottle message command.<br/>
156 * The key and value will be as below:
157 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
158 * <tbody>
159 * <tr><td>Key</td><td>Value</td></tr>
160 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_SET_BOTTLEMESSAGE BGProfileModule.ACTION_SET_BOTTLEMESSAGE("action_set_bottle_message_success")}</td></tr>
161 * <tr><td>{@link module:BGProfileModule.SET_BOTTLEMESSAGE BGProfileModule.SET_BOTTLEMESSAGE("set_bottle_message")}</td><td>Set bottle message command result</td></tr>
162 * <tr><td>{@link module:BGProfileModule.START_MODE BGProfileModule.START_MODE("start_mode")}</td><td>The start mode of Bg5 device.</td></tr>
163 * </tbody>
164 * </table>
165 * <b>Example:</b><br/>
166 * {"start_mode":2,"set_bottle_message":true,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_set_bottle_message_success"}
167 * <br/>
168 */
169 ACTION_SET_BOTTLEMESSAGE: RCTModule.ACTION_SET_BOTTLEMESSAGE,
170
171 /**
172 * The action value of event indicating the result of get bottle message command.<br/>
173 * The key and value will be as below:
174 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
175 * <tbody>
176 * <tr><td>Key</td><td>Value</td></tr>
177 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_GET_BOTTLEMESSAGE BGProfileModule.ACTION_GET_BOTTLEMESSAGE("action_get_codeinfo")}</td></tr>
178 * <tr><td>{@link module:BGProfileModule.GET_EXPIRECTIME BGProfileModule.GET_EXPIRECTIME("expiretime")}</td><td>The strip expire time of Bg5 device.</td></tr>
179 * <tr><td>{@link module:BGProfileModule.GET_USENUM BGProfileModule.GET_USENUM("usenum")}</td><td>The strip used num, from offline data by Bg5 device.</td></tr>
180 * </tbody>
181 * </table>
182 * <b>Example:</b><br/>
183 * {"expiretime":"2099-12-16","usenum":0,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_get_codeinfo"}
184 * <br/>
185 */
186 ACTION_GET_BOTTLEMESSAGE: RCTModule.ACTION_GET_BOTTLEMESSAGE,
187
188 /**
189 * The action value of event indicating set bottleID success.<br/>
190 * The key and value will be as below:
191 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
192 * <tbody>
193 * <tr><td>Key</td><td>Value</td></tr>
194 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_SET_BOTTLEID BGProfileModule.ACTION_SET_BOTTLEID("action_setbottleid_success")}</td></tr>
195 * </tbody>
196 * </table>
197 * <b>Example:</b><br/>
198 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_setbottleid_success"}
199 * <br/>
200 */
201 ACTION_SET_BOTTLEID: RCTModule.ACTION_SET_BOTTLEID,
202
203 /**
204 * The action value of event indicating the result of get bottleID command.<br/>
205 * The key and value will be as below:
206 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
207 * <tbody>
208 * <tr><td>Key</td><td>Value</td></tr>
209 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_GET_BOTTLEID BGProfileModule.ACTION_GET_BOTTLEID("action_get_bottleid")}</td></tr>
210 * <tr><td>{@link module:BGProfileModule.GET_BOTTLEID BGProfileModule.GET_BOTTLEID("bottleid")}</td><td>The bottleId of Bg5 device.</td></tr>
211 * </tbody>
212 * </table>
213 * <b>Example:</b><br/>
214 * {"bottleid":926305,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_get_bottleid"}
215 * <br/>
216 */
217 ACTION_GET_BOTTLEID: RCTModule.ACTION_GET_BOTTLEID,
218
219
220 /**
221 * The action value of event indicating the result of strip was put in the devices.<br/>
222 * The key and value will be as below:
223 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
224 * <tbody>
225 * <tr><td>Key</td><td>Value</td></tr>
226 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_STRIP_IN BGProfileModule.ACTION_STRIP_IN("action_measure_strip_in")}</td></tr>
227 * </tbody>
228 * </table>
229 * <b>Example:</b><br/>
230 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_measure_strip_in"}<br/>
231 */
232 ACTION_STRIP_IN: RCTModule.ACTION_STRIP_IN,
233
234 /**
235 * The action value of event indicating the result of strip out of the devices.<br/>
236 * The key and value will be as below:
237 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
238 * <tbody>
239 * <tr><td>Key</td><td>Value</td></tr>
240 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_STRIP_OUT BGProfileModule.ACTION_STRIP_OUT("action_measure_strip_out")}</td></tr>
241 * </tbody>
242 * </table>
243 * <b>Example:</b><br/>
244 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_measure_strip_out"}
245 * <br/>
246 */
247 ACTION_STRIP_OUT: RCTModule.ACTION_STRIP_OUT,
248
249 /**
250 * The action value of event indicating the result of get the blood.<br/>
251 * The key and value will be as below:
252 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
253 * <tbody>
254 * <tr><td>Key</td><td>Value</td></tr>
255 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_GET_BLOOD BGProfileModule.ACTION_GET_BLOOD("action_measure_get_blood")}</td></tr>
256 * </tbody>
257 * </table>
258 * <b>Example:</b><br/>
259 * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_measure_get_blood"}
260 * <br/>
261 */
262 ACTION_GET_BLOOD: RCTModule.ACTION_GET_BLOOD,
263
264 /**
265 * The action value of event indicating the result of get measure value from devices.<br/>
266 * The key and value will be as below:
267 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
268 * <tbody>
269 * <tr><td>Key</td><td>Value</td></tr>
270 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_ONLINE_RESULT_BG BGProfileModule.ACTION_ONLINE_RESULT_BG("action_value_bg")}</td></tr>
271 * <tr><td>{@link module:BGProfileModule.ONLINE_RESULT_BG BGProfileModule.ONLINE_RESULT_BG("result")}</td><td>The bg value measured by device</td></tr>
272 * <tr><td>{@link module:BGProfileModule.DATA_ID BGProfileModule.DATA_ID("dataID")}</td><td>The dataID measured by device</td></tr>
273 * </tbody>
274 * </table>
275 * <b>Example:</b><br/>
276 * {"dataID":"E0A831AE7D2220A6417D4E050EA3FCA1","result":141,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_value_bg"}
277 * <br/>
278 */
279 ACTION_ONLINE_RESULT_BG: RCTModule.ACTION_ONLINE_RESULT_BG,
280
281 /**
282 * The error num means different error.
283 * <p>0:Battery is low.</p>
284 * <p>1:Glucose test result is out of the measurement range.</p>
285 * <p>2:Unknown interference detected, please repeat the test.</p>
286 * <p>3:Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip..</p>
287 * <p>4:Reading transmission error. Repeat the test with a new test strip. If the problem persists, contact iHealth customer service for assistance.</p>
288 * <p>5:The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test.</p>
289 * <p>6:The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test.</p>
290 * <p>7:Test strip coding error.</p>
291 * <p>8:Communication error, press"START" or rescan the code to repeat the test.</p>
292 * <p>9:Strip removed in the middle of reading, repeat the test with a new strip.</p>
293 * <p>10:Insert a new test strip and repeat the test.</p>
294 * <p>11:Cannot write to SN or KEY.</p>
295 * <p>12:Please set time.</p>
296 * <p>13:0 test strips remaining.</p>
297 * <p>14:Test strip expired.</p>
298 * <p>15:Unplug the charging cable before testing.</p>
299 * <p>18:Unplug the charging cable before read the history data</>
300 * <p>19:Charging line is inserted</>
301 * <p>20:Charging line pull out</>
302 * <p>21:The bluetooth module failure</>
303 * <p>100:The device is disconnected (Android doesn't support this code)</>
304 * <p>112:Device don't support to query energy.</p>
305 * <p>400:Parameters out of range.</p>
306 * <p>402:The order of call is wrong.</p>
307 * <p>403:Parameter type is not matched in function call.</p>
308 * <p>404:Function(disConnect) is not supported in iOS platform.(Only available in iOS platform)</p>
309 * <p>405:QRCode format error</p>
310 */
311 ERROR_NUM_BG: RCTModule.ERROR_NUM_BG,
312
313 /**
314 * The error discription.
315 */
316 ERROR_DESCRIPTION_BG: RCTModule.ERROR_DESCRIPTION_BG,
317
318 /**
319 * The battery value.
320 */
321 GET_BATTERY: RCTModule.GET_BATTERY,
322
323 /**
324 * The offline data count value.
325 */
326 GET_OFFLINEDATA_COUNT: RCTModule.GET_OFFLINEDATA_COUNT,
327
328 /**
329 * Get offline data value.
330 */
331 GET_OFFLINEDATA: RCTModule.GET_OFFLINEDATA,
332
333 /**
334 * Set bottle message result value.
335 */
336 SET_BOTTLEMESSAGE: RCTModule.SET_BOTTLEMESSAGE,
337
338 /**
339 * the start mode of Bg5 device.
340 * <li>
341 * value=1, start by insert strip, no need to call <BG5Module.startMeasure>
342 * </li>
343 * <li>
344 * value=2, start by tap the button, need to call <BG5Module.startMeasure>
345 * </li>
346 * </ul>
347 */
348 START_MODE: RCTModule.START_MODE,
349
350 /**
351 * The strip expire time of Bg5 device.
352 */
353 GET_EXPIRECTIME: RCTModule.GET_EXPIRECTIME,
354
355 /**
356 * The strip used num, from offline data by Bg5 device.
357 */
358 GET_USENUM: RCTModule.GET_USENUM,
359
360
361 /**
362 * The bottleId of Bg5 device.
363 */
364 GET_BOTTLEID: RCTModule.GET_BOTTLEID,
365
366 /**
367 * The bg value measured by device
368 */
369 ONLINE_RESULT_BG: RCTModule.ONLINE_RESULT_BG,
370
371 /**
372 * The dataID measured by device
373 */
374 DATA_ID: RCTModule.DATA_ID,
375
376 /**
377 * Callback indicating the code analysis result.
378 * The key and value will be as below:
379 * <table style="width:100px;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
380 * <tbody>
381 * <tr><td>Key</td><td>Value</td></tr>
382 * <tr><td>action</td><td>{@link module:BGProfileModule.ACTION_CODE_ANALYSIS BGProfileModule.ACTION_CODE_ANALYSIS("action_code_analysis")}</td></tr>
383 * <tr><td>{@link module:BGProfileModule.STRIP_NUM_BG BGProfileModule.STRIP_NUM_BG("strip_num")}</td><td>The strip number of the QRCode</td></tr>
384 * <tr><td>{@link module:BGProfileModule.STRIP_EXPIRETIME_BG BGProfileModule.STRIP_EXPIRETIME_BG("expire_time")}</td><td>The expire time of the QRCode</td></tr>
385 * <tr><td>{@link module:BGProfileModule.BOTTLEID_BG BGProfileModule.BOTTLEID_BG("bottle_id")}</td><td>The bottle id of the QRCode</td></tr>
386 * </tbody>
387 * </table>
388 * <b>Example:</b><br/>
389 * {"bottle_id":"926305","expire_time":"2017-03-01","strip_num":"25","action":"action_code_analysis"}
390 * <br/>
391 */
392 ACTION_CODE_ANALYSIS:RCTModule.ACTION_CODE_ANALYSIS,
393
394 /**
395 * the strip number
396 */
397 STRIP_NUM_BG:RCTModule.STRIP_NUM_BG,
398
399 /**
400 * the expire time
401 */
402 STRIP_EXPIRETIME_BG:RCTModule.STRIP_EXPIRETIME_BG,
403
404 /**
405 * the bottle id
406 */
407 BOTTLEID_BG:RCTModule.BOTTLEID_BG,
408
409 /**
410 * Indicates get all connected devices.
411 */
412 ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES
413}