From d6d9a09d505d11148599a95a5be3e1351edbe0ac Mon Sep 17 00:00:00 2001 From: hc Date: Mon, 13 Apr 2026 15:17:52 +0800 Subject: Local iHealth SDK, device detail screen, iOS event fixes --- libs/ihealth-sdk/module/BGProfileModule.js | 413 +++++++++++++++++++++++++++++ 1 file changed, 413 insertions(+) create mode 100755 libs/ihealth-sdk/module/BGProfileModule.js (limited to 'libs/ihealth-sdk/module/BGProfileModule.js') 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 @@ +/** + * Created by gaoyuanlong on 16/11/16. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.BGProfileModule + +/** + * @module BGProfileModule + */ +module.exports = { + + /** + * The action value of event indicating the error of BG device.
+ * The key and value will be as below: + * + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_ERROR_BG BGProfileModule.ACTION_ERROR_BG("action_measure_error")}
{@link module:BGProfileModule.ERROR_NUM_BG BGProfileModule.ERROR_NUM_BG("error_num")} The error num
{@link module:BGProfileModule.ERROR_DESCRIPTION_BG BGProfileModule.ERROR_DESCRIPTION_BG("description")}Detailed description of the error
+ * Example:
+ * {"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"} + *
+ */ + ACTION_ERROR_BG: RCTModule.ACTION_ERROR_BG, + + /** + * The action value of event indicating keep link success.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_KEEP_LINK BGProfileModule.ACTION_KEEP_LINK("action_keep_link")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_keep_link"}
+ */ + ACTION_KEEP_LINK: RCTModule.ACTION_KEEP_LINK, + + /** + * The action value of event indicating set time success.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_SET_TIME BGProfileModule.ACTION_SET_TIME("action_set_time")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_set_time"}
+ */ + ACTION_SET_TIME: RCTModule.ACTION_SET_TIME, + + /** + * The action value of event indicating set unit success.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_SET_UNIT BGProfileModule.ACTION_SET_UNIT("action_set_unit")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_set_unit"}
+ */ + ACTION_SET_UNIT: RCTModule.ACTION_SET_UNIT, + + /** + * The action value of event indicating the result of get battery command.
+ * The key and value will be as below: + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_GET_BATTERY BGProfileModule.ACTION_GET_BATTERY("action_battery_bg")}
{@link module:BGProfileModule.GET_BATTERY BGProfileModule.GET_BATTERY("battery")}The battery value.
+ * Example:
+ * {"mac":"8CDE52B5FAC2","battery":32,"type":"BG5","action":"action_battery_bg"}
+ */ + ACTION_GET_BATTERY: RCTModule.ACTION_GET_BATTERY, + + /** + * The action value of event indicating start measure success.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_START_MEASURE BGProfileModule.ACTION_START_MEASURE("action_start_measure")}
+ * Example:
+ * {mac":"8CDE52B5FAC2","type":"BG5","action":"action_start_measure"}
+ */ + ACTION_START_MEASURE: RCTModule.ACTION_START_MEASURE, + + /** + * The action value of event indicating the offline data count.
+ * The key and value will be as below: + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_GET_OFFLINEDATA_COUNT BGProfileModule.ACTION_GET_OFFLINEDATA_COUNT("action_historicalnum_bg")}
{@link module:BGProfileModule.GET_OFFLINEDATA_COUNT BGProfileModule.GET_OFFLINEDATA_COUNT("count")}The offline data count value.
+ * Example:
+ * {"count":2,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_historicalnum_bg"} + *
+ */ + ACTION_GET_OFFLINEDATA_COUNT: RCTModule.ACTION_GET_OFFLINEDATA_COUNT, + + /** + * The action value of event indicating the result of offline data.
+ * The key and value will be as below: + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_GET_OFFLINEDATA BGProfileModule.ACTION_GET_OFFLINEDATA("action_historicaldata_bg")}
{@link module:BGProfileModule.GET_OFFLINEDATA BGProfileModule.GET_OFFLINEDATA("his_data_bg")}Get offline data command result
+ * Example:
+ * {
+ * {"his_data_bg":{"history":[{"dataID":"1B92511DE36F54508415257160F9D0EA","value":39,"date":"2017-06-08 15:08:00"}, + * {"dataID":"862D10B79A8560505720B983D658E095","timeProofing":0,"value":38,"date":"2017-06-08 15:09:01"}]}, + * "mac":"8CDE52B5FAC2","type":"BG5","action":"action_historicaldata_bg"} + *
+ */ + ACTION_GET_OFFLINEDATA: RCTModule.ACTION_GET_OFFLINEDATA, + + /** + * The action value of event indicating delete offline data success.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_DELETE_OFFLINEDATA BGProfileModule.ACTION_DELETE_OFFLINEDATA("action_delete_historical_data")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_delete_historical_data"} + *
+ */ + ACTION_DELETE_OFFLINEDATA: RCTModule.ACTION_DELETE_OFFLINEDATA, + + /** + * The action value of event indicating the result of set bottle message command.
+ * The key and value will be as below: + * + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_SET_BOTTLEMESSAGE BGProfileModule.ACTION_SET_BOTTLEMESSAGE("action_set_bottle_message_success")}
{@link module:BGProfileModule.SET_BOTTLEMESSAGE BGProfileModule.SET_BOTTLEMESSAGE("set_bottle_message")}Set bottle message command result
{@link module:BGProfileModule.START_MODE BGProfileModule.START_MODE("start_mode")}The start mode of Bg5 device.
+ * Example:
+ * {"start_mode":2,"set_bottle_message":true,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_set_bottle_message_success"} + *
+ */ + ACTION_SET_BOTTLEMESSAGE: RCTModule.ACTION_SET_BOTTLEMESSAGE, + + /** + * The action value of event indicating the result of get bottle message command.
+ * The key and value will be as below: + * + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_GET_BOTTLEMESSAGE BGProfileModule.ACTION_GET_BOTTLEMESSAGE("action_get_codeinfo")}
{@link module:BGProfileModule.GET_EXPIRECTIME BGProfileModule.GET_EXPIRECTIME("expiretime")}The strip expire time of Bg5 device.
{@link module:BGProfileModule.GET_USENUM BGProfileModule.GET_USENUM("usenum")}The strip used num, from offline data by Bg5 device.
+ * Example:
+ * {"expiretime":"2099-12-16","usenum":0,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_get_codeinfo"} + *
+ */ + ACTION_GET_BOTTLEMESSAGE: RCTModule.ACTION_GET_BOTTLEMESSAGE, + + /** + * The action value of event indicating set bottleID success.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_SET_BOTTLEID BGProfileModule.ACTION_SET_BOTTLEID("action_setbottleid_success")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_setbottleid_success"} + *
+ */ + ACTION_SET_BOTTLEID: RCTModule.ACTION_SET_BOTTLEID, + + /** + * The action value of event indicating the result of get bottleID command.
+ * The key and value will be as below: + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_GET_BOTTLEID BGProfileModule.ACTION_GET_BOTTLEID("action_get_bottleid")}
{@link module:BGProfileModule.GET_BOTTLEID BGProfileModule.GET_BOTTLEID("bottleid")}The bottleId of Bg5 device.
+ * Example:
+ * {"bottleid":926305,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_get_bottleid"} + *
+ */ + ACTION_GET_BOTTLEID: RCTModule.ACTION_GET_BOTTLEID, + + + /** + * The action value of event indicating the result of strip was put in the devices.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_STRIP_IN BGProfileModule.ACTION_STRIP_IN("action_measure_strip_in")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_measure_strip_in"}
+ */ + ACTION_STRIP_IN: RCTModule.ACTION_STRIP_IN, + + /** + * The action value of event indicating the result of strip out of the devices.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_STRIP_OUT BGProfileModule.ACTION_STRIP_OUT("action_measure_strip_out")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_measure_strip_out"} + *
+ */ + ACTION_STRIP_OUT: RCTModule.ACTION_STRIP_OUT, + + /** + * The action value of event indicating the result of get the blood.
+ * The key and value will be as below: + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_GET_BLOOD BGProfileModule.ACTION_GET_BLOOD("action_measure_get_blood")}
+ * Example:
+ * {"mac":"8CDE52B5FAC2","type":"BG5","action":"action_measure_get_blood"} + *
+ */ + ACTION_GET_BLOOD: RCTModule.ACTION_GET_BLOOD, + + /** + * The action value of event indicating the result of get measure value from devices.
+ * The key and value will be as below: + * + * + * + * + * + * + * + *
KeyValue
action{@link module:BGProfileModule.ACTION_ONLINE_RESULT_BG BGProfileModule.ACTION_ONLINE_RESULT_BG("action_value_bg")}
{@link module:BGProfileModule.ONLINE_RESULT_BG BGProfileModule.ONLINE_RESULT_BG("result")}The bg value measured by device
{@link module:BGProfileModule.DATA_ID BGProfileModule.DATA_ID("dataID")}The dataID measured by device
+ * Example:
+ * {"dataID":"E0A831AE7D2220A6417D4E050EA3FCA1","result":141,"mac":"8CDE52B5FAC2","type":"BG5","action":"action_value_bg"} + *
+ */ + ACTION_ONLINE_RESULT_BG: RCTModule.ACTION_ONLINE_RESULT_BG, + + /** + * The error num means different error. + *

0:Battery is low.

+ *

1:Glucose test result is out of the measurement range.

+ *

2:Unknown interference detected, please repeat the test.

+ *

3:Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip..

+ *

4:Reading transmission error. Repeat the test with a new test strip. If the problem persists, contact iHealth customer service for assistance.

+ *

5:The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test.

+ *

6:The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test.

+ *

7:Test strip coding error.

+ *

8:Communication error, press"START" or rescan the code to repeat the test.

+ *

9:Strip removed in the middle of reading, repeat the test with a new strip.

+ *

10:Insert a new test strip and repeat the test.

+ *

11:Cannot write to SN or KEY.

+ *

12:Please set time.

+ *

13:0 test strips remaining.

+ *

14:Test strip expired.

+ *

15:Unplug the charging cable before testing.

+ *

18:Unplug the charging cable before read the history data + *

19:Charging line is inserted + *

20:Charging line pull out + *

21:The bluetooth module failure + *

100:The device is disconnected (Android doesn't support this code) + *

112:Device don't support to query energy.

+ *

400:Parameters out of range.

+ *

402:The order of call is wrong.

+ *

403:Parameter type is not matched in function call.

+ *

404:Function(disConnect) is not supported in iOS platform.(Only available in iOS platform)

+ *

405:QRCode format error

+ */ + ERROR_NUM_BG: RCTModule.ERROR_NUM_BG, + + /** + * The error discription. + */ + ERROR_DESCRIPTION_BG: RCTModule.ERROR_DESCRIPTION_BG, + + /** + * The battery value. + */ + GET_BATTERY: RCTModule.GET_BATTERY, + + /** + * The offline data count value. + */ + GET_OFFLINEDATA_COUNT: RCTModule.GET_OFFLINEDATA_COUNT, + + /** + * Get offline data value. + */ + GET_OFFLINEDATA: RCTModule.GET_OFFLINEDATA, + + /** + * Set bottle message result value. + */ + SET_BOTTLEMESSAGE: RCTModule.SET_BOTTLEMESSAGE, + + /** + * the start mode of Bg5 device. + *
  • + * value=1, start by insert strip, no need to call + *
  • + *
  • + * value=2, start by tap the button, need to call + *
  • + * + */ + START_MODE: RCTModule.START_MODE, + + /** + * The strip expire time of Bg5 device. + */ + GET_EXPIRECTIME: RCTModule.GET_EXPIRECTIME, + + /** + * The strip used num, from offline data by Bg5 device. + */ + GET_USENUM: RCTModule.GET_USENUM, + + + /** + * The bottleId of Bg5 device. + */ + GET_BOTTLEID: RCTModule.GET_BOTTLEID, + + /** + * The bg value measured by device + */ + ONLINE_RESULT_BG: RCTModule.ONLINE_RESULT_BG, + + /** + * The dataID measured by device + */ + DATA_ID: RCTModule.DATA_ID, + + /** + * Callback indicating the code analysis result. + * The key and value will be as below: + * + * + * + * + * + * + * + * + *
    KeyValue
    action{@link module:BGProfileModule.ACTION_CODE_ANALYSIS BGProfileModule.ACTION_CODE_ANALYSIS("action_code_analysis")}
    {@link module:BGProfileModule.STRIP_NUM_BG BGProfileModule.STRIP_NUM_BG("strip_num")}The strip number of the QRCode
    {@link module:BGProfileModule.STRIP_EXPIRETIME_BG BGProfileModule.STRIP_EXPIRETIME_BG("expire_time")}The expire time of the QRCode
    {@link module:BGProfileModule.BOTTLEID_BG BGProfileModule.BOTTLEID_BG("bottle_id")}The bottle id of the QRCode
    + * Example:
    + * {"bottle_id":"926305","expire_time":"2017-03-01","strip_num":"25","action":"action_code_analysis"} + *
    + */ + ACTION_CODE_ANALYSIS:RCTModule.ACTION_CODE_ANALYSIS, + + /** + * the strip number + */ + STRIP_NUM_BG:RCTModule.STRIP_NUM_BG, + + /** + * the expire time + */ + STRIP_EXPIRETIME_BG:RCTModule.STRIP_EXPIRETIME_BG, + + /** + * the bottle id + */ + BOTTLEID_BG:RCTModule.BOTTLEID_BG, + + /** + * Indicates get all connected devices. + */ + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} -- cgit