diff --git a/Document/ReleaseNote.md b/Document/ReleaseNote.md
index 917a430..9e2925a 100755
--- a/Document/ReleaseNote.md
+++ b/Document/ReleaseNote.md
@@ -167,7 +167,7 @@ Release Date: 2020-9-18
1. Support new device PO1
2. Support new device PT3SBT
-Release Date: 2020-10-12
+Release Date: 2020-11-12
### 20. V1.4.5
@@ -181,3 +181,10 @@ Release Date: 2020-12-11
2. Support new device HS2S
Release Date: 2021-01-14
+
+### 21. V1.4.7
+
+1. Support new device BG1S
+
+
+Release Date: 2021-04-16
diff --git a/README.md b/README.md
index a862013..29f0adb 100755
--- a/README.md
+++ b/README.md
@@ -14,55 +14,59 @@ npm install --save @ihealth/ihealthlibrary-react-native
yarn add @ihealth/ihealthlibrary-react-native
```
-## Usage
+#### Using React Native >= 0.60
+Linking the package manually is not required anymore with [Autolinking](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md).
-### Authentication
+- **iOS Platform:**
-#### Download license file
+ `$ npx pod-install` # CocoaPods on iOS needs this extra step
-1. Sign up iHealth developer webside. [Please sign up here](https://dev.ihealthlabs.com)
-2. Press "Add New App" button, fill in your information of your app. We will get email and active the license for your app.
-3. Download license file, as shown below.
-
+- **Android Platform with Android Support:**
-#### Integrate license file
+ Using [Jetifier tool](https://github.com/mikehardy/jetifier) for backward-compatibility if needed
-For iOS
-As shown below, Add your license file to your iOS project.
-
+#### Using React Native < 0.60
-For Android
-As show below, Add your license file to your asserts folder.
-
+You then need to link the native parts of the library for the platforms you are using. The easiest way to link the library is using the CLI tool by running this command from the root of your project:
-#### Using license file
+```
+react-native link @ihealth/ihealthlibrary-react-native
+```
-```js
-import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native';
+If you can't or don't want to use the CLI tool, you can also manually link the library using the instructions below (click on the arrow to show them):
-// your license file
-const filename = 'license.pem';
-iHealthDeviceManagerModule.sdkAuthWithLicense(filename);
+
+Manually link the library on iOS
+
+Either follow the [instructions in the React Native documentation](https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking) to manually link the framework or link using [Cocoapods](https://cocoapods.org) by adding this to your `Podfile`:
+
+```ruby
+pod 'ihealth', :path => '../node_modules/@ihealth/ihealthlibrary-react-native'
```
-### Troubleshooting
+
-#### For Android
+
+Manually link the library on Android
-1. Check settings.gradle file in your android project and node_modules, make sure input the correct module path.
+Make the following changes:
-```gradle
+#### `android/settings.gradle`
+```groovy
include ':ihealthlibrary-react-native'
-project(':ihealthlibrary-react-native').projectDir = new File(rootProject.projectDir,'../node_modules/@ihealth/ihealthlibrary-react-native/android')
+project(':ihealthlibrary-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/@ihealth/ihealthlibrary-react-native/android')
```
-2. Check build.gradle file in your android project, make sure the ihealth module is integrated
-
-```gradle
-compile project(':@ihealth_ihealthlibrary-react-native')
+#### `android/app/build.gradle`
+```groovy
+dependencies {
+ ...
+ implementation project(':ihealthlibrary-react-native')
+}◊
```
-3. Import iHealth module in your MainActivity.java
+#### `android/app/src/main/.../MainActivity.java`
+Import iHealth module in your MainActivity.java
```java
protected List getPackages() {
@@ -72,8 +76,11 @@ protected List getPackages() {
);
}
```
+
+
+#### Android permissions
-4. Location permission(in AndroidManifest.xml)
+Location permission (in AndroidManifest.xml)
```xml
@@ -81,22 +88,53 @@ protected List getPackages() {
```
-#### For iOS
+## Usage
-1. Open your iOS project, add node_modules/@ihealth/ihealthlibrary-react-native/ios/ReactNativeIOSLibrary.xcodeproj to libraries
-2. Under 'Build Phases' -- 'Link Binary With Libraries', add libReactNativeIOSLibrary.a
+### Authentication
+
+#### Download license file
+
+1. Sign up iHealth developer webside. [Please sign up here](https://dev.ihealthlabs.com)
+2. Press "Add New App" button, fill in your information of your app. We will get email and active the license for your app.
+3. Download license file, as shown below.
+
+
+#### Integrate license file
+
+For iOS
+As shown below, Add your license file to your iOS project.
+
+
+For Android
+As show below, Add your license file to your asserts folder.
+
+
+#### Using license file
+
+```js
+import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native';
+
+// your license file
+const filename = 'license.pem';
+iHealthDeviceManagerModule.sdkAuthWithLicense(filename);
+```
### Example
-iHealth SDK module is based on DeviceEventEmitter, So call add listener while the component is loaded, and call remove listener while the component is unloaded, As show as below. If you want more detail information, Please the example code.
+iHealth SDK module is based on DeviceEventEmitter, So call add listener while the component is loaded, and call remove listener while the component is unloaded, As shown below
```js
+import { DeviceEventEmitter } from 'react-native';
+import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native';
+
componentDidMount() {
- iHealthAPI.addListener();
+ DeviceEventEmitter.addListener(
+ iHealthDeviceManagerModule.Event_Authenticate_Result, (event) => { }
+ );
}
componentWillUnmount() {
- iHealthAPI.removeListener();
+ DeviceEventEmitter.removeListener(iHealthDeviceManagerModule.Event_Authenticate_Result);
}
```
diff --git a/android/.idea/.gitignore b/android/.idea/.gitignore
deleted file mode 100644
index 5c98b42..0000000
--- a/android/.idea/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Default ignored files
-/workspace.xml
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index d81fae4..ea81cba 100755
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -36,7 +36,7 @@ dependencies {
api 'com.facebook.react:react-native:+'
api 'com.squareup.okhttp3:okhttp:4.8.0'
api 'com.google.code.gson:gson:2.8.6'
- implementation files('libs/iHealthSDK_2.9.4.4.jar')
+ implementation files('libs/iHealthSDK_2.9.5.jar')
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'no.nordicsemi.android:dfu:1.6.1'
implementation 'com.alibaba:fastjson:1.2.48'
diff --git a/android/libs/iHealthSDK_2.9.4.4.jar b/android/libs/iHealthSDK_2.9.5.jar
similarity index 87%
rename from android/libs/iHealthSDK_2.9.4.4.jar
rename to android/libs/iHealthSDK_2.9.5.jar
index 837aeaa..5830926 100644
Binary files a/android/libs/iHealthSDK_2.9.4.4.jar and b/android/libs/iHealthSDK_2.9.5.jar differ
diff --git a/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java b/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java
index d8d4c01..783835f 100644
--- a/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java
+++ b/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java
@@ -105,6 +105,14 @@ public void getOfflineData(String mac) {
}
}
+ @ReactMethod
+ public void setOfflineModel(String mac, boolean enable) {
+ Bg5sControl bg5sControl = getBg5sControl(mac);
+ if (bg5sControl != null) {
+ bg5sControl.setOfflineMeasurementMode(enable);
+ }
+ }
+
@ReactMethod
public void startMeasure(String mac, int measureType) {
Bg5sControl bg5sControl = getBg5sControl(mac);
@@ -120,7 +128,7 @@ public void adjustOfflineData(String mac, String timeString, String originData)
String offlineData = bg5sControl.adjustOfflineData(timeString, originData);
WritableMap params = Arguments.createMap();
params.putString(Bg5Profile.HISTORICAL_DATA_BG, offlineData);
- params.putString("action", "action_get_offline_data");
+ params.putString("action", "action_adjust_offline_data");
sendEvent(EVENT_NOTIFY, params);
}
}
diff --git a/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java b/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java
index 040b98e..e9d8140 100644
--- a/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java
+++ b/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java
@@ -4,6 +4,7 @@
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.module.annotations.ReactModule;
import com.ihealth.communication.control.Bg5Profile;
+import com.ihealth.communication.control.Bg5sProfile;
import java.util.HashMap;
import java.util.Map;
@@ -16,59 +17,43 @@ public class BG5SProfileModule extends ReactContextBaseJavaModule {
private static final String modelName = "BG5SProfileModule";
private static final String TAG = modelName;
- private static final String ACTION_SET_TIME = "ACTION_SET_TIME";
- private static final String ACTION_SET_UNIT = "ACTION_SET_UNIT";
- private static final String ACTION_GET_BATTERY = "ACTION_GET_BATTERY";
- private static final String ACTION_START_MEASURE = "ACTION_START_MEASURE";
- private static final String ACTION_GET_OFFLINEDATA_COUNT = "ACTION_GET_OFFLINEDATA_COUNT";
- private static final String ACTION_GET_OFFLINEDATA = "ACTION_GET_OFFLINEDATA";
- private static final String ACTION_DELETE_OFFLINEDATA = "ACTION_DELETE_OFFLINEDATA";
-
- private static final String ACTION_ERROR_BG = "ACTION_ERROR_BG";
- private static final String ACTION_STRIP_IN = "ACTION_STRIP_IN";
- private static final String ACTION_STRIP_OUT = "ACTION_STRIP_OUT";
- private static final String ACTION_GET_BLOOD = "ACTION_GET_BLOOD";
- private static final String ACTION_ONLINE_RESULT_BG = "ACTION_ONLINE_RESULT_BG";
-
-
- private static final String GET_BATTERY = "GET_BATTERY";
- private static final String GET_OFFLINEDATA_COUNT = "GET_OFFLINEDATA_COUNT";
- private static final String GET_OFFLINEDATA = "GET_OFFLINEDATA";
- private static final String SET_BOTTLEMESSAGE = "SET_BOTTLEMESSAGE";
- private static final String START_MODE = "START_MODE";
- private static final String GET_EXPIRECTIME = "GET_EXPIRECTIME";
- private static final String GET_USENUM = "GET_USENUM";
- private static final String GET_BOTTLEID = "GET_BOTTLEID";
- private static final String ERROR_NUM_BG = "ERROR_NUM_BG";
- private static final String ERROR_DESCRIPTION_BG = "ERROR_DESCRIPTION_BG";
- private static final String ONLINE_RESULT_BG = "ONLINE_RESULT_BG";
- private static final String DATA_ID = "DATA_ID";
-
- /**
- * Callback indicating the code analysis result.
- */
- private static final String ACTION_CODE_ANALYSIS = "ACTION_CODE_ANALYSIS";
-
-
- /**
- * the strip number
- */
- private static final String STRIP_NUM_BG = "STRIP_NUM_BG";
-
-
- /**
- * the expire time
- */
- private static final String STRIP_EXPIRETIME_BG = "STRIP_EXPIRETIME_BG";
-
-
- /**
- * the bottle id
- */
- private static final String BOTTLEID_BG = "BOTTLEID_BG";
-
+ private static final String ACTION_ERROR = "action_error";
+ private static final String ACTION_SET_TIME = "action_set_time";
+ private static final String ACTION_SET_UNIT = "action_set_unit";
+ private static final String ACTION_SEND_CODE = "action_send_code";
+ private static final String ACTION_DELETE_USED_STRIP = "action_delete_used_strip";
+ private static final String ACTION_DELETE_OFFLINE_DATA = "action_delete_offline_data";
+ private static final String ACTION_GET_OFFLINE_DATA = "action_get_offline_data";
+ private static final String ACTION_START_MEASURE = "action_start_measure";
+ private static final String ACTION_KEEP_LINK = "action_keep_link";
+ private static final String ACTION_STRIP_IN = "action_strip_in";
+ private static final String ACTION_GET_BLOOD = "action_get_blood";
+ private static final String ACTION_STRIP_OUT = "action_strip_out";
+ private static final String ACTION_RESULT = "action_result";
+ private static final String ACTION_GET_STATUS_INFO = "action_get_status_info";
+ private static final String ACTION_SET_OFFLINE_MEASUREMENT_MODE = "action_set_offline_measurement_mode";
+ private static final String ACTION_ENTER_CHARGED_STATE = "action_enter_charged_state";
+ private static final String ACTION_LEAVE_CHARGED_STATE = "action_leave_charged_state";
private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES";
+ private static final String ERROR_NUM = "error_num";
+ private static final String ERROR_DESCRIPTION = "error_description";
+ private static final String INFO_BATTERY_LEVEL = "info_battery_level";
+ private static final String INFO_TIME = "info_time";
+ private static final String INFO_TIMEZONE = "info_timezone";
+ private static final String INFO_USED_STRIP = "info_used_strip";
+ private static final String INFO_OFFLINE_DATA_NUM = "info_offline_data_num";
+ private static final String INFO_CODE_VERSION_BLOOD = "info_code_version_blood";
+ private static final String INFO_CODE_VERSION_CTL = "info_code_version_ctl";
+ private static final String INFO_UNIT = "info_unit";
+ private static final String SEND_CODE_RESULT = "send_code_result";
+ private static final String OFFLINE_DATA = "offline_data";
+ private static final String DATA_TIME_PROOF = "data_time_proof";
+ private static final String DATA_MEASURE_TIME = "data_measure_time";
+ private static final String DATA_MEASURE_TIMEZONE = "data_measure_timezone";
+ private static final String DATA_VALUE = "data_value";
+ private static final String RESULT_VALUE = "result_value";
+ private static final String DATA_ID = "dataID";
public BG5SProfileModule(ReactApplicationContext reactContext) {
super(reactContext);
@@ -85,38 +70,44 @@ public Map getConstants() {
final Map constants = new HashMap<>();
- constants.put(ACTION_SET_TIME, Bg5Profile.ACTION_SET_TIME);
- constants.put(ACTION_SET_UNIT, Bg5Profile.ACTION_SET_UNIT);
- constants.put(ACTION_GET_BATTERY, Bg5Profile.ACTION_BATTERY_BG);
- constants.put(ACTION_START_MEASURE, Bg5Profile.ACTION_START_MEASURE);
- constants.put(ACTION_GET_OFFLINEDATA_COUNT, Bg5Profile.ACTION_HISTORICAL_NUM_BG);
- constants.put(ACTION_GET_OFFLINEDATA, Bg5Profile.ACTION_HISTORICAL_DATA_BG);
- constants.put(ACTION_DELETE_OFFLINEDATA, Bg5Profile.ACTION_DELETE_HISTORICAL_DATA);
- constants.put(ACTION_ERROR_BG, Bg5Profile.ACTION_ERROR_BG);
- constants.put(ACTION_STRIP_IN, Bg5Profile.ACTION_STRIP_IN);
- constants.put(ACTION_STRIP_OUT, Bg5Profile.ACTION_STRIP_OUT);
- constants.put(ACTION_GET_BLOOD, Bg5Profile.ACTION_GET_BLOOD);
- constants.put(ACTION_ONLINE_RESULT_BG, Bg5Profile.ACTION_ONLINE_RESULT_BG);
-
+ constants.put(ACTION_ERROR, Bg5sProfile.ACTION_ERROR);
+ constants.put(ACTION_SET_TIME, Bg5sProfile.ACTION_SET_TIME);
+ constants.put(ACTION_SET_UNIT, Bg5sProfile.ACTION_SET_UNIT);
+ constants.put(ACTION_SEND_CODE, Bg5sProfile.ACTION_SEND_CODE);
+ constants.put(ACTION_START_MEASURE, Bg5sProfile.ACTION_START_MEASURE);
+ constants.put(ACTION_DELETE_USED_STRIP, Bg5sProfile.ACTION_DELETE_USED_STRIP);
+ constants.put(ACTION_DELETE_OFFLINE_DATA, Bg5sProfile.ACTION_DELETE_OFFLINE_DATA);
+ constants.put(ACTION_GET_OFFLINE_DATA, Bg5sProfile.ACTION_GET_OFFLINE_DATA);
+ constants.put(ACTION_KEEP_LINK, Bg5sProfile.ACTION_KEEP_LINK);
+ constants.put(ACTION_STRIP_IN, Bg5sProfile.ACTION_STRIP_IN);
+ constants.put(ACTION_STRIP_OUT, Bg5sProfile.ACTION_STRIP_OUT);
+ constants.put(ACTION_GET_BLOOD, Bg5sProfile.ACTION_GET_BLOOD);
+ constants.put(ACTION_RESULT, Bg5sProfile.ACTION_RESULT);
+ constants.put(ACTION_GET_STATUS_INFO, Bg5sProfile.ACTION_GET_STATUS_INFO);
+ constants.put(ACTION_SET_OFFLINE_MEASUREMENT_MODE, Bg5sProfile.ACTION_SET_OFFLINE_MEASUREMENT_MODE);
+ constants.put(ACTION_ENTER_CHARGED_STATE, Bg5sProfile.ACTION_ENTER_CHARGED_STATE);
+ constants.put(ACTION_LEAVE_CHARGED_STATE, Bg5sProfile.ACTION_LEAVE_CHARGED_STATE);
+ constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES);
- constants.put(GET_BATTERY, Bg5Profile.BATTERY_BG);
- constants.put(GET_OFFLINEDATA_COUNT, Bg5Profile.HISTORICAL_NUM_BG);
- constants.put(GET_OFFLINEDATA, Bg5Profile.HISTORICAL_DATA_BG);
- constants.put(SET_BOTTLEMESSAGE, Bg5Profile.SET_BOTTLE_MESSAGE);
- constants.put(START_MODE, Bg5Profile.START_MODE_EXTRA);
- constants.put(GET_EXPIRECTIME, Bg5Profile.GET_EXPIRECTIME);
- constants.put(GET_USENUM, Bg5Profile.GET_USENUM);
- constants.put(GET_BOTTLEID, Bg5Profile.GET_BOTTLEID);
- constants.put(ERROR_NUM_BG, Bg5Profile.ERROR_NUM_BG);
- constants.put(ERROR_DESCRIPTION_BG, Bg5Profile.ERROR_DESCRIPTION_BG);
- constants.put(ONLINE_RESULT_BG, Bg5Profile.ONLINE_RESULT_BG);
- constants.put(DATA_ID, Bg5Profile.DATA_ID);
+ constants.put(ERROR_NUM, Bg5sProfile.ERROR_NUM);
+ constants.put(ERROR_DESCRIPTION, Bg5sProfile.ERROR_DESCRIPTION);
+ constants.put(INFO_BATTERY_LEVEL, Bg5sProfile.INFO_BATTERY_LEVEL);
+ constants.put(INFO_TIME, Bg5sProfile.INFO_TIME);
+ constants.put(INFO_TIMEZONE, Bg5sProfile.INFO_TIMEZONE);
+ constants.put(INFO_USED_STRIP, Bg5sProfile.INFO_USED_STRIP);
+ constants.put(INFO_OFFLINE_DATA_NUM, Bg5sProfile.INFO_OFFLINE_DATA_NUM);
+ constants.put(INFO_CODE_VERSION_BLOOD, Bg5sProfile.INFO_CODE_VERSION_BLOOD);
+ constants.put(INFO_CODE_VERSION_CTL, Bg5sProfile.INFO_CODE_VERSION_CTL);
+ constants.put(INFO_UNIT, Bg5sProfile.INFO_UNIT);
+ constants.put(SEND_CODE_RESULT, Bg5sProfile.SEND_CODE_RESULT);
+ constants.put(OFFLINE_DATA, Bg5sProfile.OFFLINE_DATA);
+ constants.put(DATA_TIME_PROOF, Bg5sProfile.DATA_TIME_PROOF);
+ constants.put(DATA_MEASURE_TIME, Bg5sProfile.DATA_MEASURE_TIME);
+ constants.put(DATA_MEASURE_TIMEZONE, Bg5sProfile.DATA_MEASURE_TIMEZONE);
+ constants.put(DATA_VALUE, Bg5sProfile.DATA_VALUE);
+ constants.put(RESULT_VALUE, Bg5sProfile.RESULT_VALUE);
+ constants.put(DATA_ID, Bg5sProfile.DATA_ID);
- constants.put(ACTION_CODE_ANALYSIS, "action_code_analysis");
- constants.put(STRIP_NUM_BG, "strip_num");
- constants.put(STRIP_EXPIRETIME_BG, "expire_time");
- constants.put(BOTTLEID_BG, "bottle_id");
- constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES);
return constants;
}
}
diff --git a/doc/bg1s.md b/doc/bg1s.md
index 0173275..9622f29 100644
--- a/doc/bg1s.md
+++ b/doc/bg1s.md
@@ -31,6 +31,7 @@ Set current time to BG1S and return battery level, bg1s code version.
BG1SModule.getFunction(mac);
// response
+// {"action": "action_get_device_info", "battery": 100, "info_version_code_blood_bg1s": 1, "info_version_code_ctl_bg1s": 2, "mac": "F65FF0CBA330", "type": "BG1S"}
notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => {
if (event.action === BG1SProfileModule.ACTION_CODE_ANALYSIS) {
console.log(event[BG1SProfileModule.INFO_BATTERY_BG1S]);
@@ -43,18 +44,21 @@ notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event
### start a measurement
```js
-// measureMode 1: measure with real blood, 2: measure with control solution
+// measureMode 0: measure with real blood, 1: measure with control solution
BG1SModule.measure(mac, 1);
// response
notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => {
if (event.action === BG1SProfileModule.ACTION_STRIP_INSERTION_STATUS) {
+ // {"action": "action_strip_insertion_status", "describe": "strip in", "insertion_status": 1, "mac": "F65FF0CBA330", "type": "BG1S"}
console.log("strip in");
} else if (event.action === BG1SProfileModule.ACTION_GET_BLOOD) {
+ // {"action": "action_get_blood", "describe": "get blood", "mac": "F65FF0CBA330", "type": "BG1S"}
console.log("blood");
- } else if (event.action === BG1SProfileModule.ACTION_SET_MEASURE_MODE) {
+ } else if (event.action === BG1SProfileModule.ACTION_MEASURE_RESULT) {
+ // {"action": "action_measure_result", "mac": "F65FF0CBA330", "measure_mode": 0, "measure_result": 0, "type": "BG1S"}
console.log(event[BG1SProfileModule.MEASURE_MODE]);
console.log(event[BG1SProfileModule.MEASURE_RESULT]);
}
diff --git a/doc/bg5s.md b/doc/bg5s.md
index a12fc33..06bc6d4 100644
--- a/doc/bg5s.md
+++ b/doc/bg5s.md
@@ -31,6 +31,7 @@ If you use new bg5 or it has not been used for a long time. You should sync curr
BG5SModule.setTime(mac);
// response
+// {"type":"BG5S","mac":"5C0272267365","action":"action_set_time"}
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
if (event.action === BG5SProfileModule.ACTION_SET_TIME) {
console.log("set time");
@@ -47,6 +48,7 @@ The API can change the unit of the bg5 display.
BG5SModule.setUnit(mac, 1);
// response
+// {"type":"BG5S","mac":"5C0272267365","action":"action_set_unit"}
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
if (event.action === BG5SProfileModule.ACTION_SET_UNIT) {
console.log("set Unit");
@@ -57,77 +59,79 @@ notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event
### get bg5s status information
```js
-BG5SModule.getBottleInfoFromQR(QRCode);
+BG5SModule.getStatusInfo(mac);
// response
+// {"info_unit":2,"info_code_version_ctl":3,"info_code_version_blood":3,"info_offline_data_num":0,"info_used_strip":0,////"info_timezone":8,"info_time":"2017-01-01 00:40:37","info_battery_level":71,"type":"BG5S","mac":"5C0272267365","action":"action_get_status_info"}
+
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
- if (event.action === BG5SProfileModule.ACTION_CODE_ANALYSIS) {
- console.log(event[BG5SProfileModule.STRIP_NUM_BG]);
- console.log(event[BG5SProfileModule.STRIP_EXPIRETIME_BG]);
- console.log(event[BG5SProfileModule.BOTTLEID_BG]);
+ if (event.action === BG5SProfileModule.ACTION_GET_STATUS_INFO) {
+ console.log(event[BG5SProfileModule.INFO_BATTERY_LEVEL]);
+ console.log(event[BG5SProfileModule.INFO_TIME]);
+ console.log(event[BG5SProfileModule.INFO_TIMEZONE]);
+ console.log(event[BG5SProfileModule.INFO_USED_STRIP]);
+ console.log(event[BG5SProfileModule.INFO_OFFLINE_DATA_NUM]);
+ console.log(event[BG5SProfileModule.INFO_CODE_VERSION_BLOOD]);
+ console.log(event[BG5SProfileModule.INFO_CODE_VERSION_CTL]);
+ console.log(event[BG5SProfileModule.INFO_UNIT]);
}
});
```
-### set bottle id
+### delete userd strip
```js
-BG5SModule.getBottleInfoFromQR(QRCode);
+BG5SModule.deleteUsedStrip(QRCode);
// response
+// {"type":"BG5S","mac":"5C0272267365","action":"action_delete_used_strip"}
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
- if (event.action === BGProfileModule.ACTION_SET_BOTTLEID) {
- console.log("Set bottleID");
+ if (event.action === BG5SProfileModule.ACTION_DELETE_USED_STRIP) {
+
}
});
```
-### get bottle id
+### delete offline data
```js
-BG5SModule.getBottleInfoFromQR(QRCode);
+BG5SModule.deleteOfflineData(QRCode);
// response
+// {"type":"BG5S","mac":"5C0272267365","action":"action_delete_offline_data"}
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
- if (event.action === BGProfileModule.ACTION_GET_BOTTLEID) {
- console.log(event[BGProfileModule.GET_BOTTLEID]);
+ if (event.action === BG5SProfileModule.ACTION_DELETE_OFFLINE_DATA) {
+
}
});
```
-### Set bottle message
-
-When you use a new bg5 device or you open a new strip bottle, must set bottle message to bg5 device.
+### get offline data
```js
-/**
- * mac device mac address
- * stripType 1: GOD, 2: GDH
- * measureType 1: measure with real blood, 2: measure with control solution
- * barcode for GOD strip, you can scan barcode at top of the bottle. for GDH strip, set null.
- * unusedStrip unused strip.
- * expireDay check the expire day on the bottle, and stirp is expired after opening for 90 days.
- */
-BG5SModule.setBottleMessage(mac, 1, 1, QRCode, 25, "2027-07-15");
+BG5SModule.getOfflineData(mac);
// response
+// {"offline_data":[{"dataID":"D8615BFEB73C3928D83131894D68E87B","data_measure_timezone":8,"data_measure_time":"2019-04-22 01:31:47","data_value":1023,"data_time_proof":false}],"type":"BG5S","mac":"5C0272267365","action":"action_get_offline_data"}
+
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
- if (event.action === BGProfileModule.ACTION_SET_BOTTLEMESSAGE) {
- console.log("set bottle message success");
+ if (event.action === BG5SProfileModule.ACTION_GET_OFFLINE_DATA) {
+ console.log(event[BG5SProfileModule.OFFLINE_DATA]);
}
});
```
-### get bottle message
+### adjust offline data
```js
-BG5SModule.getBottleMessage(mac);
+BG5SModule.adjustOfflineData(mac);
// response
+// {"offline_data":[{"dataID":"D8615BFEB73C3928D83131894D68E87B","data_measure_timezone":8,"data_measure_time":"2019-04-22 01:31:47","data_value":1023,"data_time_proof":false}],"type":"BG5S","mac":"5C0272267365","action":"action_get_offline_data"}
+
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
- if (event.action === BGProfileModule.ACTION_GET_BOTTLEMESSAGE) {
- console.log(event[BGProfileModule.GET_EXPIRECTIME]);
- console.log(event[BGProfileModule.GET_USENUM]);
+ if (event.action === "action_adjust_offline_data") {
+ console.log(event[BG5SProfileModule.OFFLINE_DATA]);
}
});
```
@@ -140,18 +144,19 @@ BG5SModule.startMeasure(mac, 1);
// response
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
- if (event.action === BGProfileModule.ACTION_STRIP_IN) {
+ if (event.action === BG5SProfileModule.ACTION_STRIP_IN) {
console.log("strip in");
- } else if (event.action === BGProfileModule.ACTION_STRIP_OUT) {
+ } else if (event.action === BG5SProfileModule.ACTION_STRIP_OUT) {
console.log("strip out");
- } else if (event.action === BGProfileModule.ACTION_GET_BLOOD) {
+ } else if (event.action === BG5SProfileModule.ACTION_GET_BLOOD) {
console.log("analysis blood");
- } else if (event.action === BGProfileModule.ACTION_ONLINE_RESULT_BG) {
- console.log(event[BGProfileModule.ONLINE_RESULT_BG]);
- console.log(event[BGProfileModule.DATA_ID]);
+ } else if (event.action === BG5SProfileModule.ACTION_RESULT) {
+ // {"dataID":"FCB4230B3F081306DCC0404090861A36","result_value":84,"type":"BG5S","mac":"5C0272267365","action":"action_result"}
+ console.log(event[BG5SProfileModule.RESULT_VALUE]);
+ console.log(event[BG5SProfileModule.DATA_ID]);
}
});
```
@@ -159,13 +164,13 @@ notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event
### get data stored in the bg5 device
```js
-BG5SModule.getOfflineData(mac);
+BG5SModule.setOfflineModel(mac, true);
// response
+// // {"type":"BG5S","mac":"5C0272267365","action":"action_delete_offline_data"}
notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => {
- if (event.action === BGProfileModule.ACTION_GET_OFFLINEDATA_COUNT) {
- console.log(event[BGProfileModule.GET_OFFLINEDATA_COUNT]);
- console.log(event[BGProfileModule.GET_OFFLINEDATA]);
+ if (event.action === BG5SProfileModule.ACTION_SET_OFFLINE_MEASUREMENT_MODE) {
+
}
});
```
\ No newline at end of file
diff --git a/iHealth.podspec b/iHealth.podspec
new file mode 100644
index 0000000..b204ec8
--- /dev/null
+++ b/iHealth.podspec
@@ -0,0 +1,18 @@
+require "json"
+package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
+
+Pod::Spec.new do |s|
+ s.name = "iHealth"
+ s.version = package["version"]
+ s.summary = package["description"]
+ s.homepage = package['homepage']
+ s.license = package['license']
+ s.authors = package['author']
+ s.platform = :ios, "9.0"
+ s.source = { :git => "https://github.com/SynappzMA/iHealth-React-Native-SDK.git", :tag => s.version.to_s }
+ s.source_files = "ios/**/*.{h,m}"
+ s.public_header_files = "ios/ReactNativeIOSLibrary/Communication_SDK/Headers/*.h"
+ s.vendored_libraries = "ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.3.a"
+ s.requires_arc = true
+ s.dependency "React"
+end
\ No newline at end of file
diff --git a/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj b/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj
index 03a3c88..96bcd77 100755
--- a/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj
+++ b/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj
@@ -22,8 +22,8 @@
18B752C91FFF67DE00DE2629 /* ECGProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 18B752C81FFF67DE00DE2629 /* ECGProfileModule.m */; };
18B752CC1FFF67F100DE2629 /* ECGUSBModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 18B752CB1FFF67F100DE2629 /* ECGUSBModule.m */; };
3F31C42B21ABE80400811B02 /* HS2Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F31C42A21ABE80400811B02 /* HS2Module.m */; };
- 3FE801E125C8D9EB005BD951 /* iHealthSDK2.7.2.6.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FE8014B25C8D9EA005BD951 /* iHealthSDK2.7.2.6.a */; };
45A72D18256E5FCB00825201 /* BP7Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A72D16256E5FCB00825201 /* BP7Module.m */; };
+ 6C839B21262F06DB00BFECEB /* libiHealthSDK2.7.3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C839B20262F06DB00BFECEB /* libiHealthSDK2.7.3.a */; };
8CCCE9B21E5ADF49007F7FE4 /* PO3Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CCCE9AF1E5ADF49007F7FE4 /* PO3Module.m */; };
8CCCE9B31E5ADF49007F7FE4 /* POProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CCCE9B11E5ADF49007F7FE4 /* POProfileModule.m */; };
8CCCE9E31E5E7C58007F7FE4 /* HS6ProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CCCE9E21E5E7C58007F7FE4 /* HS6ProfileModule.m */; };
@@ -95,7 +95,6 @@
18B752CB1FFF67F100DE2629 /* ECGUSBModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ECGUSBModule.m; sourceTree = ""; };
3F31C42921ABE80400811B02 /* HS2Module.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HS2Module.h; sourceTree = ""; };
3F31C42A21ABE80400811B02 /* HS2Module.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HS2Module.m; sourceTree = ""; };
- 3FE8014B25C8D9EA005BD951 /* iHealthSDK2.7.2.6.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = iHealthSDK2.7.2.6.a; sourceTree = ""; };
3FE8014D25C8D9EB005BD951 /* IDOSyncBpDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncBpDataModel.h; sourceTree = ""; };
3FE8014E25C8D9EB005BD951 /* BPContinua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPContinua.h; sourceTree = ""; };
3FE8014F25C8D9EB005BD951 /* IDOWeightBluetoothModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOWeightBluetoothModel.h; sourceTree = ""; };
@@ -246,6 +245,7 @@
3FE801E025C8D9EB005BD951 /* BPLoopMeasureSettingModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPLoopMeasureSettingModel.h; sourceTree = ""; };
45A72D16256E5FCB00825201 /* BP7Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BP7Module.m; sourceTree = ""; };
45A72D17256E5FCB00825201 /* BP7Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP7Module.h; sourceTree = ""; };
+ 6C839B20262F06DB00BFECEB /* libiHealthSDK2.7.3.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libiHealthSDK2.7.3.a; sourceTree = ""; };
8CCCE9AE1E5ADF49007F7FE4 /* PO3Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PO3Module.h; sourceTree = ""; };
8CCCE9AF1E5ADF49007F7FE4 /* PO3Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PO3Module.m; sourceTree = ""; };
8CCCE9B01E5ADF49007F7FE4 /* POProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = POProfileModule.h; sourceTree = ""; };
@@ -304,7 +304,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 3FE801E125C8D9EB005BD951 /* iHealthSDK2.7.2.6.a in Frameworks */,
+ 6C839B21262F06DB00BFECEB /* libiHealthSDK2.7.3.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -421,8 +421,8 @@
187510351DE5E6A5005E66B1 /* Communication_SDK */ = {
isa = PBXGroup;
children = (
+ 6C839B20262F06DB00BFECEB /* libiHealthSDK2.7.3.a */,
3FE8014C25C8D9EB005BD951 /* Headers */,
- 3FE8014B25C8D9EA005BD951 /* iHealthSDK2.7.2.6.a */,
);
path = Communication_SDK;
sourceTree = "";
@@ -785,6 +785,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ReactNativeIOSLibrary/Communication_SDK",
+ "$(PROJECT_DIR)/ReactNativeIOSLibrary",
);
MODULEMAP_PRIVATE_FILE = "";
OTHER_LDFLAGS = "-ObjC";
@@ -800,6 +801,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ReactNativeIOSLibrary/Communication_SDK",
+ "$(PROJECT_DIR)/ReactNativeIOSLibrary",
);
MODULEMAP_PRIVATE_FILE = "";
OTHER_LDFLAGS = "-ObjC";
diff --git a/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/chaoli.xcuserdatad/UserInterfaceState.xcuserstate b/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/chaoli.xcuserdatad/UserInterfaceState.xcuserstate
index a8d8881..d1fc4ba 100644
Binary files a/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/chaoli.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/chaoli.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/jing.xcuserdatad/UserInterfaceState.xcuserstate b/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/jing.xcuserdatad/UserInterfaceState.xcuserstate
index 10a1040..12e8f7c 100644
Binary files a/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/jing.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcuserdata/jing.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/ios/ReactNativeIOSLibrary.xcodeproj/xcuserdata/jing.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/ReactNativeIOSLibrary.xcodeproj/xcuserdata/jing.xcuserdatad/xcschemes/xcschememanagement.plist
index 15c9afe..f39467b 100644
--- a/ios/ReactNativeIOSLibrary.xcodeproj/xcuserdata/jing.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/ios/ReactNativeIOSLibrary.xcodeproj/xcuserdata/jing.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -12,7 +12,7 @@
ReactNativeIOSLibrary.xcscheme_^#shared#^_
orderHint
- 6
+ 2
diff --git a/ios/ReactNativeIOSLibrary/BG1SModule.m b/ios/ReactNativeIOSLibrary/BG1SModule.m
index ed40aea..3ea3369 100644
--- a/ios/ReactNativeIOSLibrary/BG1SModule.m
+++ b/ios/ReactNativeIOSLibrary/BG1SModule.m
@@ -67,65 +67,68 @@ -(BG1S*)getDeviceWithMac:(NSString*)mac{
RCT_EXPORT_METHOD(measure:(nonnull NSString *)mac measureMode:(nonnull NSNumber *)testType){
- if ([self getDeviceWithMac:mac] != nil) {
-
- BGMeasureMode models= BGMeasureMode_Blood;
-
- if ([testType intValue]==0) {
-
- models=BGMeasureMode_Blood;
-
- }else{
-
- models=BGMeasureMode_NoBlood;
- }
-
- [[self getDeviceWithMac:mac] commandCreateBG1STestModel:models DisposeBGStripInBlock:^(BOOL inORout) {
-
- if (inORout) {
- [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
- BG1S_KEY_MAC:mac,
- BG1S_ACTION:kRN_ACTION_STRIP_IN,
- }];
- }else{
-
- [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
- BG1S_KEY_MAC:mac,
- BG1S_ACTION:kRN_ACTION_STRIP_OUT,
- }];
- }
-
- } DisposeBGBloodBlock:^{
-
- [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
- BG1S_KEY_MAC:mac,
- BG1S_ACTION:kRN_ACTION_GET_BLOOD,
- }];
-
- } DisposeBGResultBlock:^(NSDictionary *result) {
-
-
- [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
- BG1S_KEY_MAC:mac,
- @"result":result,
- BG1S_ACTION:kRN_ACTION_ONLINE_RESULT_BG,
- }];
-
- } DisposeBGErrorBlock:^(BG1SDeviceError error) {
-
- }];
-
-// [[self getDeviceWithMac:mac] commandStartMeasure:^(NSDictionary *result) {
-//
-// NSDictionary* deviceInfo = @{BG1S_ACTION:@"action_measurement_result",BG1S_THERMOMETER_TYPE:[result objectForKey:@"bodyFlag"],BG1S_UNIT_FLAG:[result objectForKey:@"unit"],BG1S_RESULT:[result objectForKey:@"result"]};
-//
-// [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:deviceInfo];
-//
-//
-//
-// }];
-
- }
+ if ([self getDeviceWithMac:mac] != nil) {
+
+ BGMeasureMode models= BGMeasureMode_Blood;
+
+ if ([testType intValue]==1) {
+
+ models=BGMeasureMode_NoBlood;
+
+ }else{
+
+ models=BGMeasureMode_Blood;
+ }
+
+ [[self getDeviceWithMac:mac] commandCreateBG1STestModel:models DisposeBGStripInBlock:^(BOOL inORout) {
+
+ if (inORout) {
+ [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
+ BG1S_ACTION:ACTION_STRIP_INSERTION_STATUS,
+ BG1S_KEY_MAC:mac,
+ BG1S_TYPE:@"BG1S",
+ OPERATION_DESCRIBE:@"strip in",
+ STRIP_INSERTION_STATUS:@1,
+ }];
+ }else{
+
+ [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
+ BG1S_ACTION:ACTION_STRIP_INSERTION_STATUS,
+ BG1S_KEY_MAC:mac,
+ BG1S_TYPE:@"BG1S",
+ OPERATION_DESCRIBE:@"strip put",
+ STRIP_INSERTION_STATUS:@2,
+ }];
+ }
+
+ } DisposeBGBloodBlock:^{
+
+ [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
+ BG1S_ACTION:ACTION_GET_BLOOD,
+ BG1S_KEY_MAC:mac,
+ BG1S_TYPE:@"BG1S",
+ OPERATION_DESCRIBE:@"get blood"
+ }];
+
+ } DisposeBGResultBlock:^(NSDictionary *result) {
+
+
+ [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
+ BG1S_ACTION:ACTION_MEASURE_RESULT,
+ BG1S_KEY_MAC:mac,
+ BG1S_TYPE:@"BG1S",
+ MEASURE_RESULT:[result valueForKey:@"Result"],
+ MEASURE_MODE:[result valueForKey:@"TestState"]
+ }];
+
+ } DisposeBGErrorBlock:^(BG1SDeviceError error) {
+
+ [self sendBG1SErrorCode:error mac:mac];
+
+ }];
+
+
+ }
}
@@ -138,29 +141,77 @@ -(BG1S*)getDeviceWithMac:(NSString*)mac{
[self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:@{
- BG1S_KEY_MAC:mac,
- @"result":functionDict,
- BG1S_ACTION:kRN_ACTION_GET_FUNCTION,
- }];
+ BG1S_ACTION:ACTION_CODE_ANALYSIS,
+ BG1S_KEY_MAC:mac,
+ BG1S_TYPE:@"BG1S",
+ INFO_BATTERY_BG1S:[functionDict valueForKey:@"Battary"],
+ INFO_VERSION_CODE_BLOOD_BG1S:[functionDict valueForKey:@"CodeVersion"],
+ INFO_VERSION_CODE_CTL_BG1S:[functionDict valueForKey:@"DcodeVersion"],
+
+ }];
} DisposeBGErrorBlock:^(BG1SDeviceError error) {
+
+ [self sendBG1SErrorCode:error mac:mac];
+
}];
-
- }else{
}
}
//断开连接
RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){
+
if ([self getDeviceWithMac:mac]!=nil) {
[[self getDeviceWithMac:mac] commandDisconnectDevice];
- }else{
-
}
+
+}
+
+-(void)sendBG1SErrorCode:(BG1SDeviceError)errorID mac:(NSString*)mac{
+
+ NSString *errorMassage = [NSString string];
+ switch (errorID) {
+ case 0:
+ errorMassage = @"BG1SDeviceError0";
+ break;
+ case 1:
+ errorMassage = @"BG1SError_LowBattery";
+ break;
+ case 2:
+ errorMassage = @"BG1SError_ReferenceUnstable";
+ break;
+ case 3:
+ errorMassage = @"BG1SError_BadStrip";
+ break;
+ case 4:
+ errorMassage = @"BG1SError_BadEEPROM";
+ break;
+ case 5:
+ errorMassage = @"BG1SError_LowAmbientTemperature";
+ break;
+ case 6:
+ errorMassage = @"BG1SError_HighAmbientTemperature";
+ break;
+ case 7:
+ errorMassage = @"BG1SError_BleedEarly";
+ break;
+ case 8:
+ errorMassage = @"BG1SError_Other";
+ break;
+
+
+ default:
+ break;
+ }
+
+ NSDictionary *deviceInfo = @{BG1S_KEY_MAC:mac,BG1S_ACTION:ACTION_ERROR_BG1S,ERROR_NUM_BG1S:[NSNumber numberWithInt:errorID],ERROR_DESCRIPTION_BG1S:errorMassage};
+ [self.bridge.eventDispatcher sendDeviceEventWithName:BG1S_EVENT_NOTIFY body:deviceInfo];
+
+
}
@end
diff --git a/ios/ReactNativeIOSLibrary/BG1SProfileModule.h b/ios/ReactNativeIOSLibrary/BG1SProfileModule.h
index f016ae9..ab9abc4 100644
--- a/ios/ReactNativeIOSLibrary/BG1SProfileModule.h
+++ b/ios/ReactNativeIOSLibrary/BG1SProfileModule.h
@@ -16,28 +16,46 @@
@interface BG1SProfileModule : NSObject
-#define BG1S_EVENT_NOTIFY @"event_notify_BG1S"
+#define BG1S_EVENT_NOTIFY @"event_notify_bg1s"
#define BG1S_ACTION @"action"
+#define BG1S_TYPE @"type"
+
#define BG1S_DEVICE @"devices"
-#define BG1S_KEY_MAC @"mac"
+#define BG1S_KEY_MAC @"mac"
+
+#define OPERATION_DESCRIBE @"describe"
+
+#define STRIP_INSERTION_STATUS @"insertion_status"
#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES"
-#define BG1S_RESULT @"result"
+#define MEASURE_RESULT @"measure_result"
+
+#define MEASURE_MODE @"measure_mode"
+
+#define ACTION_CODE_ANALYSIS @"action_get_device_info"
+
+#define INFO_BATTERY_BG1S @"battery"
+
+#define INFO_VERSION_CODE_BLOOD_BG1S @"info_version_code_blood_bg1s"
+
+#define INFO_VERSION_CODE_CTL_BG1S @"info_version_code_ctl_bg1s"
+
+#define ACTION_ERROR_BG1S @"action_error"
+
+#define ERROR_NUM_BG1S @"error_num"
+
+#define ERROR_DESCRIPTION_BG1S @"error_description"
-#define BG1S_UNIT_FLAG @"unit_flag"
+#define ACTION_STRIP_INSERTION_STATUS @"action_strip_insertion_status"
-#define BG1S_THERMOMETER_TYPE @"thermometer_type"
+#define ACTION_GET_BLOOD @"action_get_blood"
+#define ACTION_MEASURE_RESULT @"action_measure_result"
-#define kRN_ACTION_STRIP_IN @"ACTION_STRIP_IN"
-#define kRN_ACTION_STRIP_OUT @"ACTION_STRIP_OUT"
-#define kRN_ACTION_GET_BLOOD @"ACTION_GET_BLOOD"
-#define kRN_ACTION_ONLINE_RESULT_BG @"ACTION_ONLINE_RESULT_BG"
-#define kRN_ACTION_GET_FUNCTION @"ACTION_GET_FUNCTION"
@end
diff --git a/ios/ReactNativeIOSLibrary/BG1SProfileModule.m b/ios/ReactNativeIOSLibrary/BG1SProfileModule.m
index 1e76589..a3f153b 100644
--- a/ios/ReactNativeIOSLibrary/BG1SProfileModule.m
+++ b/ios/ReactNativeIOSLibrary/BG1SProfileModule.m
@@ -19,19 +19,25 @@ @implementation BG1SProfileModule
- (NSDictionary *)constantsToExport
{
return @{
- @"ACTION_MEASUREMENT_RESULT":@"action_measurement_result",
- BG1S_ACTION:@"action",
- BG1S_DEVICE:@"device",
- BG1S_KEY_MAC:@"mac",
+ BG1S_ACTION:BG1S_ACTION,
+ BG1S_DEVICE:BG1S_DEVICE,
+ BG1S_KEY_MAC:BG1S_KEY_MAC,
+ BG1S_TYPE:BG1S_TYPE,
+ OPERATION_DESCRIBE:OPERATION_DESCRIBE,
+ STRIP_INSERTION_STATUS:STRIP_INSERTION_STATUS,
kACTION_GET_ALL_CONNECTED_DEVICES:kACTION_GET_ALL_CONNECTED_DEVICES,
- BG1S_RESULT:@"result",
- BG1S_UNIT_FLAG:@"unit_flag",
- BG1S_THERMOMETER_TYPE:@"thermometer_type",
- kRN_ACTION_STRIP_IN :kRN_ACTION_STRIP_IN,
- kRN_ACTION_STRIP_OUT :kRN_ACTION_STRIP_OUT,
- kRN_ACTION_GET_BLOOD :kRN_ACTION_GET_BLOOD,
- kRN_ACTION_ONLINE_RESULT_BG :kRN_ACTION_ONLINE_RESULT_BG,
- kRN_ACTION_GET_FUNCTION :kRN_ACTION_GET_FUNCTION
+ @"ACTION_STRIP_INSERTION_STATUS" :ACTION_STRIP_INSERTION_STATUS,
+ @"ACTION_GET_BLOOD" :ACTION_GET_BLOOD,
+ @"ACTION_MEASURE_RESULT" :ACTION_MEASURE_RESULT,
+ @"ACTION_CODE_ANALYSIS" :ACTION_CODE_ANALYSIS,
+ @"INFO_BATTERY_BG1S" :INFO_BATTERY_BG1S,
+ @"INFO_VERSION_CODE_BLOOD_BG1S" :INFO_VERSION_CODE_BLOOD_BG1S,
+ @"INFO_VERSION_CODE_CTL_BG1S" :INFO_VERSION_CODE_CTL_BG1S,
+ @"ACTION_ERROR_BG1S" :ACTION_ERROR_BG1S,
+ @"ERROR_NUM_BG1S" :ERROR_NUM_BG1S,
+ @"ERROR_DESCRIPTION_BG1S" :ERROR_DESCRIPTION_BG1S,
+ @"MEASURE_RESULT" :MEASURE_RESULT,
+ @"MEASURE_MODE" :MEASURE_MODE
};
};
diff --git a/ios/ReactNativeIOSLibrary/BG5SModule.m b/ios/ReactNativeIOSLibrary/BG5SModule.m
old mode 100755
new mode 100644
index 693a3c6..b86d380
--- a/ios/ReactNativeIOSLibrary/BG5SModule.m
+++ b/ios/ReactNativeIOSLibrary/BG5SModule.m
@@ -82,34 +82,30 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
[self.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:deviceInfo];
}
+
//综合查询
RCT_EXPORT_METHOD(getStatusInfo:(nonnull NSString *)mac){
if ([self getDeviceWithMac:mac]!=nil) {
__weak typeof(self) weakSelf = self;
-
[[self getDeviceWithMac:mac] queryStateInfoWithSuccess:^(BG5SStateInfo *stateInfo) {
- NSDate *tempDate =stateInfo.deviceDate;
-
NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init];
-
[mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
-
- NSString *dateStr = [mydateFormatter stringFromDate:tempDate];
+ NSString *dateStr = [mydateFormatter stringFromDate:stateInfo.deviceDate];
NSDictionary* response = @{
kMAC_KEY:mac,
kACTION_KEY:kACTION_GET_STATUS_INFO,
- kFUNCTION_BatteryValue:@(stateInfo.batteryValue),
- kFUNCTION_DeviceDate:dateStr,
- kFUNCTION_DeviceTimeZone:@(stateInfo.deviceTimeZone),
- kFUNCTION_StripUsedValue:@(stateInfo.stripUsedValue),
- kFUNCTION_OfflineDataQuantity:@(stateInfo.offlineDataQuantity),
- kFUNCTION_BloodCodeVersion:@(stateInfo.bloodCodeVersion),
- kFUNCTION_CtlCodeVersion:@(stateInfo.ctlCodeVersion),
- kFUNCTION_Unit:(stateInfo.unit == BGUnit_mmolPL)?@"mmol":((stateInfo.unit == BGUnit_mgPmL)?@"mg":@"unknown"),
+ INFO_BATTERY_LEVEL:@(stateInfo.batteryValue),
+ INFO_TIME:dateStr,
+ INFO_TIMEZONE:@(stateInfo.deviceTimeZone),
+ INFO_USED_STRIP:@(stateInfo.stripUsedValue),
+ INFO_OFFLINE_DATA_NUM:@(stateInfo.offlineDataQuantity),
+ INFO_CODE_VERSION_BLOOD:@(stateInfo.bloodCodeVersion),
+ INFO_CODE_VERSION_CTL:@(stateInfo.ctlCodeVersion),
+ INFO_UNIT:(stateInfo.unit == BGUnit_mmolPL)?@"mmol":((stateInfo.unit == BGUnit_mgPmL)?@"mg":@"unknown"),
};
[weakSelf.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:response];
@@ -127,8 +123,16 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
RCT_EXPORT_METHOD(setTime:(nonnull NSString *)mac date:(nonnull NSString *)date timezone:(nonnull NSNumber *)timezone){
if ([self getDeviceWithMac:mac]) {
+
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+
+ [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+
+ NSDate*mydate=[dateFormatter dateFromString:date];
+
+
__weak typeof(self) weakSelf = self;
- [[self getDeviceWithMac:mac] setTimeWithDate:[NSDate date] timezone:[timezone floatValue] successBlock:^{
+ [[self getDeviceWithMac:mac] setTimeWithDate:mydate timezone:[timezone floatValue] successBlock:^{
[weakSelf.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:@{
kMAC_KEY:mac,
kACTION_KEY:kACTION_SET_TIME,
@@ -141,6 +145,29 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
}
}
+////同步时间
+//RCT_EXPORT_METHOD(setTime:(nonnull NSString *)mac){
+// if ([self getDeviceWithMac:mac]) {
+//
+// __weak typeof(self) weakSelf = self;
+//
+// NSString *zone = [[NSTimeZone systemTimeZone] description];
+// NSString *time = [[zone componentsSeparatedByString:@"offset "] objectAtIndex:1];
+// float floatTimeZone = time.floatValue/3600;
+//
+// [[self getDeviceWithMac:mac] setTimeWithDate:[NSDate date] timezone:floatTimeZone successBlock:^{
+// [weakSelf.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:@{
+// kMAC_KEY:mac,
+// kACTION_KEY:kACTION_SET_TIME,
+// }];
+// } errorBlock:^(BG5SError error, NSString *detailInfo) {
+// [weakSelf sendMeasureErrorEventWithMac:mac errorId:error];
+// }];
+// }else{
+// [self sendNoMatchedDeviceEventWithMac:mac];
+// }
+//}
+
//设置单位
RCT_EXPORT_METHOD(setUnit:(nonnull NSString *)mac type:(nonnull NSNumber *)type){
if ([self getDeviceWithMac:mac]) {
@@ -178,10 +205,10 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
BOOL modelType=YES;
if ([type intValue]==0) {
- modelType=YES;
+ modelType=NO;
}else{
- modelType=NO;
+ modelType=YES;
}
@@ -228,7 +255,7 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
[[self getDeviceWithMac:mac] deleteRecordWithSuccessBlock:^{
[self.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:@{
kMAC_KEY:mac,
- kACTION_KEY:kACTION_DELETE_OFFLINEDATA,
+ kACTION_KEY:kACTION_DELETE_OFFLINE_DATA,
}];
} errorBlock:^(BG5SError error, NSString *detailInfo) {
[weakSelf sendMeasureErrorEventWithMac:mac errorId:error];
@@ -258,7 +285,7 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
[mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *dateStr = [mydateFormatter stringFromDate:tempDate];
- NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:dateStr,@"date",@(model.value),@"value",model.dataID,@"dataID",@(model.timeZone),@"timeZone",flag,@"canCorrect", nil];
+ NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:dateStr,@"data_measure_time",@(model.value),@"data_value",model.dataID,@"dataID",@(model.timeZone),@"data_measure_timezone",flag,@"data_time_proof", nil];
[tempArr addObject:dic];
}
@@ -266,7 +293,7 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
NSDictionary*hisDic=[NSDictionary dictionaryWithObjectsAndKeys:tempArr,@"history", nil];
- NSDictionary *deviceInfo = @{@"mac":mac,@"action":kACTION_GET_OFFLINEDATA,kGET_OFFLINEDATA:hisDic,@"type":@"BG5S"};
+ NSDictionary *deviceInfo = @{@"mac":mac,@"action":kACTION_GET_OFFLINE_DATA,kGET_OFFLINEDATA:hisDic,@"type":@"BG5S"};
[weakSelf.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:deviceInfo];
@@ -287,7 +314,7 @@ -(BG5S*)getDeviceWithMac:(NSString*)mac{
BGMeasureMode measureMode = BGMeasureMode_Blood;
if ([type isEqual:@(BGMeasureMode_Blood)]) {
- measureMode = BGMeasureMode_NoBlood;
+ measureMode = BGMeasureMode_Blood;
} else if([type isEqual:@(BGMeasureMode_NoBlood)]) {
measureMode = BGMeasureMode_NoBlood;
} else {
@@ -340,16 +367,31 @@ - (void)deviceDropBlood:(BG5S *)device{
}
- (void)device:(BG5S *)device dataID:(NSString *)dataID measureReult:(NSInteger)result{
NSLog(@"结果:%d",(int)result);
- NSDictionary *resultDic = [NSDictionary dictionaryWithObjectsAndKeys:@(result),@"value",dataID,@"dataID", nil];
+// NSDictionary *resultDic = [NSDictionary dictionaryWithObjectsAndKeys:@(result),@"value",dataID,@"dataID", nil];
[self.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:@{
kMAC_KEY:device.serialNumber,
- @"result":resultDic,
- kACTION_KEY:kACTION_ONLINE_RESULT_BG,
+ RESULT_VALUE:@(result),
+ kDATA_ID:dataID,
+
+ kACTION_KEY:kACTION_RESULT,
}];
}
- (void)device:(BG5S *)device chargeStateDidUpdate:(BG5SChargeState)state{
NSLog(@"充电线状态:%@",(state == BG5SChargeState_Charging)?@"插入":@"拔出");
+
+ if (state == BG5SChargeState_Charging) {
+ [self.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:@{
+ kMAC_KEY:device.serialNumber,
+ kACTION_KEY:kACTION_ENTER_CHARGED_STATE,
+ }];
+ }else{
+ [self.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:@{
+ kMAC_KEY:device.serialNumber,
+ kACTION_KEY:kACTION_LEAVE_CHARGED_STATE,
+ }];
+
+ }
}
@@ -467,7 +509,10 @@ - (void)sendNoMatchedDeviceEventWithMac:(NSString *)mac{
} else {
[self.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:@{
kACTION_KEY:kACTION_ERROR_BG,
- kERROR_NUM_BG:@100
+
+ kERROR_NUM_BG:@100,
+ kERROR_DESCRIPTION_BG:@"Device disconnect."
+
}];
}
}
diff --git a/ios/ReactNativeIOSLibrary/BG5SProfileModule.h b/ios/ReactNativeIOSLibrary/BG5SProfileModule.h
old mode 100755
new mode 100644
index 6af3cc0..e26770a
--- a/ios/ReactNativeIOSLibrary/BG5SProfileModule.h
+++ b/ios/ReactNativeIOSLibrary/BG5SProfileModule.h
@@ -22,8 +22,8 @@
#define kACTION_GET_BATTERY @"ACTION_GET_BATTERY"
#define kACTION_START_MEASURE @"ACTION_START_MEASURE"
#define kACTION_GET_OFFLINEDATA_COUNT @"ACTION_GET_OFFLINEDATA_COUNT"
-#define kACTION_GET_OFFLINEDATA @"ACTION_GET_OFFLINEDATA"
-#define kACTION_DELETE_OFFLINEDATA @"ACTION_DELETE_OFFLINEDATA"
+#define kACTION_GET_OFFLINE_DATA @"ACTION_GET_OFFLINE_DATA"
+#define kACTION_DELETE_OFFLINE_DATA @"ACTION_DELETE_OFFLINE_DATA"
#define kACTION_SET_BOTTLEMESSAGE @"ACTION_SET_BOTTLEMESSAGE"
#define kACTION_GET_BOTTLEMESSAGE @"ACTION_GET_BOTTLEMESSAGE"
#define kACTION_SET_BOTTLEID @"ACTION_SET_BOTTLEID"
@@ -33,8 +33,7 @@
#define kACTION_GET_BLOOD @"ACTION_GET_BLOOD"
#define kACTION_ONLINE_RESULT_BG @"ACTION_ONLINE_RESULT_BG"
#define kACTION_ADJUST_OFFLINE_DATA @"ACTION_ADJUST_OFFLINE_DATA"
-#define kACTION_DELETE_USED_STRIP @"ACTION_DELETE_USED_STRIP"
-#define kACTION_SET_OFFINEMODEL @"ACTION_SET_OFFINEMODEL"
+#define kACTION_DELETE_USED_STRIP @"ACTION_DELETE_USED_STRIP"
@@ -55,7 +54,20 @@
#define kSTRIP_EXPIRETIME_BG @"STRIP_EXPIRETIME_BG"
#define kBOTTLEID_BG @"BOTTLEID_BG"
#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES"
+#define kACTION_RESULT @"ACTION_RESULT"
+#define kACTION_ENTER_CHARGED_STATE @"ACTION_ENTER_CHARGED_STATE"
+#define kACTION_LEAVE_CHARGED_STATE @"ACTION_LEAVE_CHARGED_STATE"
+#define INFO_BATTERY_LEVEL @"INFO_BATTERY_LEVEL"
+#define INFO_TIME @"INFO_TIME"
+#define INFO_TIMEZONE @"INFO_TIMEZONE"
+#define INFO_USED_STRIP @"INFO_USED_STRIP"
+#define INFO_OFFLINE_DATA_NUM @"INFO_OFFLINE_DATA_NUM"
+#define INFO_CODE_VERSION_BLOOD @"INFO_CODE_VERSION_BLOOD"
+#define INFO_CODE_VERSION_CTL @"INFO_CODE_VERSION_CTL"
+#define INFO_UNIT @"INFO_UNIT"
+#define RESULT_VALUE @"RESULT_VALUE"
+#define kACTION_SET_OFFINEMODEL @"ACTION_SET_OFFINEMODEL"
typedef NS_ENUM(NSInteger,RNBGError) {
RNBGError_Unknown = -1,
diff --git a/ios/ReactNativeIOSLibrary/BG5SProfileModule.m b/ios/ReactNativeIOSLibrary/BG5SProfileModule.m
old mode 100755
new mode 100644
index d1de388..a80fcd2
--- a/ios/ReactNativeIOSLibrary/BG5SProfileModule.m
+++ b/ios/ReactNativeIOSLibrary/BG5SProfileModule.m
@@ -31,8 +31,8 @@ - (NSDictionary *)constantsToExport
kRN_ACTION_GET_BATTERY :kACTION_GET_BATTERY,
kRN_ACTION_START_MEASURE :kACTION_START_MEASURE,
kRN_ACTION_GET_OFFLINEDATA_COUNT :kACTION_GET_OFFLINEDATA_COUNT,
- kRN_ACTION_GET_OFFLINEDATA :kACTION_GET_OFFLINEDATA,
- kRN_ACTION_DELETE_OFFLINEDATA :kACTION_DELETE_OFFLINEDATA,
+ kRN_ACTION_GET_OFFLINE_DATA :kACTION_GET_OFFLINE_DATA,
+ kRN_ACTION_DELETE_OFFLINE_DATA :kACTION_DELETE_OFFLINE_DATA,
kRN_ACTION_SET_BOTTLEMESSAGE :kACTION_SET_BOTTLEMESSAGE,
kRN_ACTION_GET_BOTTLEMESSAGE :kACTION_GET_BOTTLEMESSAGE,
kRN_ACTION_SET_BOTTLEID :kACTION_SET_BOTTLEID,
@@ -60,9 +60,19 @@ - (NSDictionary *)constantsToExport
kRN_BOTTLEID_BG :kBOTTLEID_BG,
kRN_ACTION_DELETE_USED_STRIP :kACTION_DELETE_USED_STRIP,
kRN_ACTION_ADJUST_OFFLINE_DATA :kACTION_ADJUST_OFFLINE_DATA,
-
- kACTION_SET_OFFINEMODEL :kACTION_SET_OFFINEMODEL,
-
+ INFO_BATTERY_LEVEL :INFO_BATTERY_LEVEL,
+ INFO_TIME :INFO_TIME,
+ INFO_TIMEZONE :INFO_TIMEZONE,
+ INFO_USED_STRIP :INFO_USED_STRIP,
+ INFO_OFFLINE_DATA_NUM :INFO_OFFLINE_DATA_NUM,
+ INFO_CODE_VERSION_BLOOD :INFO_CODE_VERSION_BLOOD,
+ INFO_CODE_VERSION_CTL :INFO_CODE_VERSION_CTL,
+ INFO_UNIT :INFO_UNIT,
+ kACTION_RESULT :kACTION_RESULT,
+ RESULT_VALUE :RESULT_VALUE,
+ kACTION_ENTER_CHARGED_STATE :kACTION_ENTER_CHARGED_STATE,
+ kACTION_LEAVE_CHARGED_STATE :kACTION_LEAVE_CHARGED_STATE,
+ kACTION_SET_OFFINEMODEL:kACTION_SET_OFFINEMODEL,
};
};
diff --git a/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h b/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h
index 5f03ee0..d0a1526 100644
--- a/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h
+++ b/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h
@@ -176,6 +176,8 @@
/**
Query BG5S state information including battery value,device date, device timezone, strip used, quantity of offline data, blood code version, CTL code version, unit.
+
+ After the device is successfully connected, this method must be called first!!!
@param stateInfoBlock BG5SStateInfo object
@param errorBlock the block means fail. You can get error from this block
diff --git a/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h b/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h
index 44d7d14..40acb2d 100644
--- a/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h
+++ b/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h
@@ -480,9 +480,14 @@ typedef void(^BG5SSDKErrorBlock)(BG5SError error,NSString *detailInfo);
typedef NS_ENUM(NSUInteger, BG1SDeviceError) {
BG1SDeviceError0=0,
- BG1SDeviceError1,
- BG1SDeviceError2,
- BG1SDeviceError3,
+ BG1SError_LowBattery,
+ BG1SError_ReferenceUnstable,//2.5V reference is unstable
+ BG1SError_BadStrip,
+ BG1SError_BadEEPROM,
+ BG1SError_LowAmbientTemperature,//Low ambient temperature
+ BG1SError_HighAmbientTemperature,//High ambient temperature
+ BG1SError_BleedEarly,
+ BG1SError_Other,
};
typedef void(^BlockBG1SDeviceFunction)(NSDictionary *functionDict);
diff --git a/ios/ReactNativeIOSLibrary/Communication_SDK/iHealthSDK2.7.2.6.a b/ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.3.a
similarity index 98%
rename from ios/ReactNativeIOSLibrary/Communication_SDK/iHealthSDK2.7.2.6.a
rename to ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.3.a
index 5318964..09ee54c 100644
Binary files a/ios/ReactNativeIOSLibrary/Communication_SDK/iHealthSDK2.7.2.6.a and b/ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.3.a differ
diff --git a/ios/ReactNativeIOSLibrary/PO3Module.m b/ios/ReactNativeIOSLibrary/PO3Module.m
index 651fba1..73d4f03 100644
--- a/ios/ReactNativeIOSLibrary/PO3Module.m
+++ b/ios/ReactNativeIOSLibrary/PO3Module.m
@@ -191,7 +191,6 @@ -(PO3*)getPO3WithMac:(NSString*)mac{
NSDictionary* deviceInfo = @{
- POACTION:@"ACTION_OFFLINEDATA_PO",
@"measureDate":locationString,
@"dataID":[OfflineData valueForKey:@"dataID"],
@"pulseWave":[OfflineData valueForKey:@"wave"],
@@ -207,7 +206,8 @@ -(PO3*)getPO3WithMac:(NSString*)mac{
} withFinishMeasure:^(BOOL resetSuc) {
- NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:resultArray,@"offLineData", nil];
+ NSDictionary *dic = @{kMAC:mac,POACTION:@"ACTION_OFFLINEDATA_PO",@"offlineData":resultArray};
+// NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:resultArray,@"offLineData", nil];
[self.bridge.eventDispatcher sendDeviceEventWithName:EVENT_NOTIFY body:dic];
diff --git a/ios/ReactNativeIOSLibrary/POProfileModule.h b/ios/ReactNativeIOSLibrary/POProfileModule.h
index e25456a..1eb9cdd 100755
--- a/ios/ReactNativeIOSLibrary/POProfileModule.h
+++ b/ios/ReactNativeIOSLibrary/POProfileModule.h
@@ -18,7 +18,6 @@
#define POACTION @"action"
#define PO_BATTERY @"BATTERY_PO"
-
-
+#define kMAC @"mac"
@end
diff --git a/ios/ReactNativeIOSLibrary/RNBGMacro.h b/ios/ReactNativeIOSLibrary/RNBGMacro.h
index d00571c..6edea70 100644
--- a/ios/ReactNativeIOSLibrary/RNBGMacro.h
+++ b/ios/ReactNativeIOSLibrary/RNBGMacro.h
@@ -18,7 +18,9 @@
#define kRN_ACTION_START_MEASURE @"ACTION_START_MEASURE"
#define kRN_ACTION_GET_OFFLINEDATA_COUNT @"ACTION_GET_OFFLINEDATA_COUNT"
#define kRN_ACTION_GET_OFFLINEDATA @"ACTION_GET_OFFLINEDATA"
+#define kRN_ACTION_GET_OFFLINE_DATA @"ACTION_GET_OFFLINE_DATA"
#define kRN_ACTION_DELETE_OFFLINEDATA @"ACTION_DELETE_OFFLINEDATA"
+#define kRN_ACTION_DELETE_OFFLINE_DATA @"ACTION_DELETE_OFFLINE_DATA"
#define kRN_ACTION_SET_BOTTLEMESSAGE @"ACTION_SET_BOTTLEMESSAGE"
#define kRN_ACTION_GET_BOTTLEMESSAGE @"ACTION_GET_BOTTLEMESSAGE"
#define kRN_ACTION_SET_BOTTLEID @"ACTION_SET_BOTTLEID"
diff --git a/module/BG1SProfileModule.js b/module/BG1SProfileModule.js
index bdd4227..c950330 100644
--- a/module/BG1SProfileModule.js
+++ b/module/BG1SProfileModule.js
@@ -22,5 +22,9 @@ module.exports = {
MEASURE_MODE: RCTModule.MEASURE_MODE,
MEASURE_RESULT: RCTModule.MEASURE_RESULT,
+ ACTION_ERROR_BG1S: RCTModule.ACTION_ERROR_BG1S,
+ ERROR_NUM_BG1S: RCTModule.ERROR_NUM_BG1S,
+ ERROR_DESCRIPTION_BG1S: RCTModule.ERROR_DESCRIPTION_BG1S,
+
ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES
}
diff --git a/module/BG5SModule.js b/module/BG5SModule.js
index b4fd637..28ee38d 100644
--- a/module/BG5SModule.js
+++ b/module/BG5SModule.js
@@ -40,14 +40,6 @@ module.exports = {
}
},
- setOfflineModel: function (mac, type){
- if (RCTModule != null) {
- RCTModule.setOfflineModel(mac, type);
- } else {
- console.log('~~~~~ BG5S setOfflineModel RCTModule is null')
- }
- },
-
/**
* Set unit to BG5 device.
* @param {string} mac Device's mac address
@@ -122,6 +114,14 @@ module.exports = {
}
},
+ setOfflineModel: function (mac, enable) {
+ if (RCTModule != null) {
+ RCTModule.getAllConnectedDevices(mac, enable);
+ } else {
+ console.log('~~~~~ BG5S adjustOfflineData RCTModule is null')
+ }
+ },
+
disConnect: function (mac){
if (RCTModule != null) {
if (Platform.OS === 'ios'){
diff --git a/package.json b/package.json
index 22c8c36..1d669a5 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@ihealth/ihealthlibrary-react-native",
- "version": "1.4.6",
+ "version": "1.4.7",
"description": "React Native Model for iHealth Library",
"main": "index.js",
"scripts": {