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/README.md | 138 ++ libs/ihealth-sdk/ReactNativeIOSLibrary.podspec | 18 + libs/ihealth-sdk/android/.project | 28 + .../.settings/org.eclipse.buildship.core.prefs | 13 + libs/ihealth-sdk/android/build.gradle | 46 + .../android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + libs/ihealth-sdk/android/gradlew | 172 ++ libs/ihealth-sdk/android/gradlew.bat | 84 + .../android/libs/arm64-v8a/libBodyfat_SDK.so | Bin 0 -> 18944 bytes .../android/libs/arm64-v8a/libECGOffline.so | Bin 0 -> 83984 bytes .../android/libs/arm64-v8a/libECGOnline.so | Bin 0 -> 47776 bytes .../android/libs/arm64-v8a/libVeryFitMulti.so | Bin 0 -> 1907416 bytes .../android/libs/arm64-v8a/libiHealth.so | Bin 0 -> 14976 bytes .../android/libs/armeabi-v7a/libBodyfat_SDK.so | Bin 0 -> 26908 bytes .../android/libs/armeabi-v7a/libECGOffline.so | Bin 0 -> 79596 bytes .../android/libs/armeabi-v7a/libECGOnline.so | Bin 0 -> 47440 bytes .../android/libs/armeabi-v7a/libVeryFitMulti.so | Bin 0 -> 1243220 bytes .../android/libs/armeabi-v7a/libiHealth.so | Bin 0 -> 18792 bytes libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar | Bin 0 -> 2222561 bytes .../android/libs/iHealthSDK_2.9.8.jar.bak | Bin 0 -> 2169923 bytes .../android/libs/iHealthSDK_2.9.8_original.jar | Bin 0 -> 2169923 bytes .../android/libs/smartlinklib3.6.4_product.jar | Bin 0 -> 17608 bytes .../ihealth-sdk/android/libs/x86/libBodyfat_SDK.so | Bin 0 -> 18604 bytes libs/ihealth-sdk/android/libs/x86/libECGOffline.so | Bin 0 -> 91820 bytes libs/ihealth-sdk/android/libs/x86/libECGOnline.so | Bin 0 -> 51520 bytes .../android/libs/x86/libVeryFitMulti.so | Bin 0 -> 2041980 bytes libs/ihealth-sdk/android/libs/x86/libiHealth.so | Bin 0 -> 18732 bytes .../android/libs/x86_64/libBodyfat_SDK.so | Bin 0 -> 19216 bytes .../android/libs/x86_64/libECGOffline.so | Bin 0 -> 104760 bytes .../android/libs/x86_64/libECGOnline.so | Bin 0 -> 60360 bytes .../android/libs/x86_64/libVeryFitMulti.so | Bin 0 -> 1936488 bytes libs/ihealth-sdk/android/libs/x86_64/libiHealth.so | Bin 0 -> 19352 bytes libs/ihealth-sdk/android/proguard-rules.pro | 17 + .../ihealthlibrary/ExampleInstrumentedTest.java | 26 + .../ihealthlibrary/ExampleInstrumentedTest.java | 26 + .../android/src/main/AndroidManifest.xml | 7 + .../com/ihealth/ihealthlibrary/AM3SModule.java | 339 ++++ .../java/com/ihealth/ihealthlibrary/AM4Module.java | 339 ++++ .../java/com/ihealth/ihealthlibrary/AM5Module.java | 378 ++++ .../ihealth/ihealthlibrary/AM5ProfileModule.java | 161 ++ .../ihealth/ihealthlibrary/AMProfileModule.java | 312 ++++ .../java/com/ihealth/ihealthlibrary/BG1Module.java | 116 ++ .../ihealth/ihealthlibrary/BG1ProfileModule.java | 176 ++ .../com/ihealth/ihealthlibrary/BG1SModule.java | 106 ++ .../ihealth/ihealthlibrary/BG1SProfileModule.java | 225 +++ .../java/com/ihealth/ihealthlibrary/BG5Module.java | 323 ++++ .../com/ihealth/ihealthlibrary/BG5SModule.java | 185 ++ .../ihealth/ihealthlibrary/BG5SProfileModule.java | 113 ++ .../ihealth/ihealthlibrary/BGProfileModule.java | 146 ++ .../com/ihealth/ihealthlibrary/BP3LModule.java | 133 ++ .../com/ihealth/ihealthlibrary/BP550BTModule.java | 159 ++ .../java/com/ihealth/ihealthlibrary/BP5Module.java | 193 ++ .../com/ihealth/ihealthlibrary/BP5SModule.java | 155 ++ .../java/com/ihealth/ihealthlibrary/BP7Module.java | 148 ++ .../com/ihealth/ihealthlibrary/BP7SModule.java | 176 ++ .../ihealth/ihealthlibrary/BPProfileModule.java | 168 ++ .../java/com/ihealth/ihealthlibrary/BTMModule.java | 145 ++ .../ihealth/ihealthlibrary/BTMProfileModule.java | 74 + .../java/com/ihealth/ihealthlibrary/ECGModule.java | 157 ++ .../ihealth/ihealthlibrary/ECGProfileModule.java | 385 ++++ .../com/ihealth/ihealthlibrary/ECGUSBModule.java | 290 +++ .../java/com/ihealth/ihealthlibrary/HS2Module.java | 115 ++ .../com/ihealth/ihealthlibrary/HS2SModule.java | 322 ++++ .../ihealth/ihealthlibrary/HS2SProfileModule.java | 209 +++ .../com/ihealth/ihealthlibrary/HS4SModule.java | 129 ++ .../java/com/ihealth/ihealthlibrary/HS6Module.java | 134 ++ .../ihealth/ihealthlibrary/HS6ProfileModule.java | 93 + .../ihealth/ihealthlibrary/HSProfileModule.java | 92 + .../com/ihealth/ihealthlibrary/NT13BModule.java | 98 + .../ihealth/ihealthlibrary/NT13BProfileModule.java | 52 + .../java/com/ihealth/ihealthlibrary/PO1Module.java | 99 + .../ihealth/ihealthlibrary/PO1ProfileModule.java | 73 + .../java/com/ihealth/ihealthlibrary/PO3Module.java | 115 ++ .../ihealth/ihealthlibrary/POProfileModule.java | 78 + .../com/ihealth/ihealthlibrary/PT3SBTModule.java | 152 ++ .../ihealthlibrary/PT3SBTProfileModule.java | 73 + .../com/ihealth/ihealthlibrary/TS28BModule.java | 98 + .../ihealth/ihealthlibrary/TS28BProfileModule.java | 52 + .../java/com/ihealth/ihealthlibrary/Utils.java | 123 ++ .../ihealth/ihealthlibrary/iHealthBaseModule.java | 40 + .../ihealthlibrary/iHealthDeviceManagerModule.java | 734 ++++++++ .../iHealthDeviceManagerPackage.java | 70 + .../android/src/main/res/values/strings.xml | 3 + .../jing/ihealthlibrary/ExampleUnitTest.java | 17 + .../ihealth/ihealthlibrary/ExampleUnitTest.java | 17 + libs/ihealth-sdk/doc/README.md | 138 ++ libs/ihealth-sdk/doc/am3s.md | 388 ++++ libs/ihealth-sdk/doc/am4.md | 388 ++++ libs/ihealth-sdk/doc/am5.md | 215 +++ libs/ihealth-sdk/doc/bg1.md | 0 libs/ihealth-sdk/doc/bg1s.md | 66 + libs/ihealth-sdk/doc/bg5.md | 195 ++ libs/ihealth-sdk/doc/bg5s.md | 176 ++ libs/ihealth-sdk/doc/bp3l.md | 161 ++ libs/ihealth-sdk/doc/bp5.md | 161 ++ libs/ihealth-sdk/doc/bp5s.md | 153 ++ libs/ihealth-sdk/doc/bp7.md | 175 ++ libs/ihealth-sdk/doc/bp7s.md | 129 ++ libs/ihealth-sdk/doc/download.png | Bin 0 -> 328013 bytes libs/ihealth-sdk/doc/ecg.md | 69 + libs/ihealth-sdk/doc/ecgusb.md | 76 + libs/ihealth-sdk/doc/hs2.md | 84 + libs/ihealth-sdk/doc/hs2s.md | 307 ++++ libs/ihealth-sdk/doc/hs4s.md | 84 + libs/ihealth-sdk/doc/hs6.md | 137 ++ libs/ihealth-sdk/doc/integrate-android.png | Bin 0 -> 63077 bytes libs/ihealth-sdk/doc/integrate-ios.png | Bin 0 -> 873378 bytes libs/ihealth-sdk/doc/kn550.md | 114 ++ libs/ihealth-sdk/doc/nt13b.md | 38 + libs/ihealth-sdk/doc/po1.md | 54 + libs/ihealth-sdk/doc/po3.md | 87 + libs/ihealth-sdk/doc/pt3sbt.md | 142 ++ libs/ihealth-sdk/doc/ts28b.md | 38 + libs/ihealth-sdk/index.js | 49 + .../project.pbxproj | 849 +++++++++ .../project.xcworkspace/contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../ios/ReactNativeIOSLibrary/AM3SModule.h | 20 + .../ios/ReactNativeIOSLibrary/AM3SModule.m | 788 ++++++++ .../ios/ReactNativeIOSLibrary/AM4Module.h | 19 + .../ios/ReactNativeIOSLibrary/AM4Module.m | 854 +++++++++ .../ios/ReactNativeIOSLibrary/AM5Module.h | 19 + .../ios/ReactNativeIOSLibrary/AM5Module.m | 542 ++++++ .../ios/ReactNativeIOSLibrary/AM5ProfileModule.h | 128 ++ .../ios/ReactNativeIOSLibrary/AM5ProfileModule.m | 87 + .../ios/ReactNativeIOSLibrary/AMProfileModule.h | 18 + .../ios/ReactNativeIOSLibrary/AMProfileModule.m | 248 +++ .../ios/ReactNativeIOSLibrary/BG1Module.h | 22 + .../ios/ReactNativeIOSLibrary/BG1Module.m | 236 +++ .../ios/ReactNativeIOSLibrary/BG1ProfileModule.h | 18 + .../ios/ReactNativeIOSLibrary/BG1ProfileModule.m | 84 + .../ios/ReactNativeIOSLibrary/BG1SModule.h | 20 + .../ios/ReactNativeIOSLibrary/BG1SModule.m | 224 +++ .../ios/ReactNativeIOSLibrary/BG1SProfileModule.h | 61 + .../ios/ReactNativeIOSLibrary/BG1SProfileModule.m | 50 + .../ios/ReactNativeIOSLibrary/BG5Module.h | 23 + .../ios/ReactNativeIOSLibrary/BG5Module.m | 643 +++++++ .../ios/ReactNativeIOSLibrary/BG5SModule.h | 19 + .../ios/ReactNativeIOSLibrary/BG5SModule.m | 529 ++++++ .../ios/ReactNativeIOSLibrary/BG5SProfileModule.h | 85 + .../ios/ReactNativeIOSLibrary/BG5SProfileModule.m | 84 + .../ios/ReactNativeIOSLibrary/BGProfileModule.h | 65 + .../ios/ReactNativeIOSLibrary/BGProfileModule.m | 69 + .../ios/ReactNativeIOSLibrary/BP3LModule.h | 19 + .../ios/ReactNativeIOSLibrary/BP3LModule.m | 226 +++ .../ios/ReactNativeIOSLibrary/BP550BTModule.h | 23 + .../ios/ReactNativeIOSLibrary/BP550BTModule.m | 318 ++++ .../ios/ReactNativeIOSLibrary/BP5Module.h | 23 + .../ios/ReactNativeIOSLibrary/BP5Module.m | 501 +++++ .../ios/ReactNativeIOSLibrary/BP5SModule.h | 19 + .../ios/ReactNativeIOSLibrary/BP5SModule.m | 426 +++++ .../ios/ReactNativeIOSLibrary/BP7Module.h | 23 + .../ios/ReactNativeIOSLibrary/BP7Module.m | 521 ++++++ .../ios/ReactNativeIOSLibrary/BP7SModule.h | 19 + .../ios/ReactNativeIOSLibrary/BP7SModule.m | 284 +++ .../ios/ReactNativeIOSLibrary/BPProfileModule.h | 83 + .../ios/ReactNativeIOSLibrary/BPProfileModule.m | 182 ++ .../ios/ReactNativeIOSLibrary/BTMModule.h | 19 + .../ios/ReactNativeIOSLibrary/BTMModule.m | 370 ++++ .../ios/ReactNativeIOSLibrary/BTMProfileModule.h | 50 + .../ios/ReactNativeIOSLibrary/BTMProfileModule.m | 47 + .../Communication_SDK/Headers/ABI.h | 82 + .../Communication_SDK/Headers/ABIController.h | 28 + .../Communication_SDK/Headers/ABPM.h | 144 ++ .../Communication_SDK/Headers/ABPMController.h | 25 + .../Communication_SDK/Headers/AM3.h | 188 ++ .../Communication_SDK/Headers/AM3Controller.h | 29 + .../Communication_SDK/Headers/AM3SController_V2.h | 29 + .../Communication_SDK/Headers/AM3S_V2.h | 227 +++ .../Communication_SDK/Headers/AM4.h | 223 +++ .../Communication_SDK/Headers/AM4Controller.h | 31 + .../Communication_SDK/Headers/AM5.h | 335 ++++ .../Communication_SDK/Headers/AM5Controller.h | 30 + .../Communication_SDK/Headers/AM5Header.h | 20 + .../Communication_SDK/Headers/AMHeader.h | 27 + .../Communication_SDK/Headers/AMMacroFile.h | 1171 ++++++++++++ .../Communication_SDK/Headers/BG1.h | 53 + .../Communication_SDK/Headers/BG1Controller.h | 46 + .../Communication_SDK/Headers/BG1S.h | 64 + .../Communication_SDK/Headers/BG1SController.h | 25 + .../Communication_SDK/Headers/BG3.h | 83 + .../Communication_SDK/Headers/BG3Controller.h | 28 + .../Communication_SDK/Headers/BG5.h | 158 ++ .../Communication_SDK/Headers/BG5Controller.h | 28 + .../Communication_SDK/Headers/BG5S.h | 294 +++ .../Communication_SDK/Headers/BG5SController.h | 29 + .../Communication_SDK/Headers/BGController.h | 32 + .../Communication_SDK/Headers/BGDevice.h | 42 + .../Communication_SDK/Headers/BGHeader.h | 23 + .../Communication_SDK/Headers/BGMacroFile.h | 507 ++++++ .../Communication_SDK/Headers/BP3.h | 77 + .../Communication_SDK/Headers/BP3Controller.h | 27 + .../Communication_SDK/Headers/BP3L.h | 58 + .../Communication_SDK/Headers/BP3LController.h | 30 + .../Communication_SDK/Headers/BP5.h | 32 + .../Communication_SDK/Headers/BP5C.h | 131 ++ .../Communication_SDK/Headers/BP5CController.h | 25 + .../Communication_SDK/Headers/BP5Controller.h | 25 + .../Communication_SDK/Headers/BP5S.h | 97 + .../Communication_SDK/Headers/BP5SController.h | 27 + .../Communication_SDK/Headers/BP5SRW.h | 101 + .../Communication_SDK/Headers/BP5SRWController.h | 26 + .../Communication_SDK/Headers/BP7.h | 141 ++ .../Communication_SDK/Headers/BP7Controller.h | 25 + .../Communication_SDK/Headers/BP7S.h | 106 ++ .../Communication_SDK/Headers/BP7SController.h | 32 + .../Communication_SDK/Headers/BPAV10Device.h | 15 + .../Communication_SDK/Headers/BPBTLEDevice.h | 17 + .../Communication_SDK/Headers/BPBV10Device.h | 20 + .../Communication_SDK/Headers/BPContinua.h | 56 + .../Headers/BPContinuaController.h | 30 + .../Communication_SDK/Headers/BPController.h | 40 + .../Communication_SDK/Headers/BPDevice.h | 131 ++ .../Communication_SDK/Headers/BPHeader.h | 54 + .../Headers/BPLoopMeasureSettingModel.h | 120 ++ .../Communication_SDK/Headers/BPM1AE.h | 80 + .../Communication_SDK/Headers/BPMacroFile.h | 247 +++ .../Communication_SDK/Headers/BPV24Device.h | 16 + .../Communication_SDK/Headers/BPV25Device.h | 17 + .../Headers/ConnectDeviceController.h | 27 + .../Communication_SDK/Headers/DFUController.h | 160 ++ .../Headers/DFUDeviceFirmwareInfo.h | 56 + .../Communication_SDK/Headers/DFUHeader.h | 19 + .../Communication_SDK/Headers/DFUMacro.h | 264 +++ .../Headers/DFUServerFirmwareInfo.h | 48 + .../Communication_SDK/Headers/ECG3.h | 94 + .../Communication_SDK/Headers/ECG3Controller.h | 30 + .../Communication_SDK/Headers/ECG3USB.h | 145 ++ .../Communication_SDK/Headers/ECG3USBController.h | 31 + .../Communication_SDK/Headers/ECGHeader.h | 20 + .../Communication_SDK/Headers/ECGMacroFile.h | 84 + .../Communication_SDK/Headers/HFSmartLink.h | 88 + .../Headers/HFSmartLinkDeviceInfo.h | 14 + .../Communication_SDK/Headers/HS2.h | 64 + .../Communication_SDK/Headers/HS2Controller.h | 25 + .../Communication_SDK/Headers/HS2S.h | 399 ++++ .../Communication_SDK/Headers/HS2SController.h | 27 + .../Communication_SDK/Headers/HS3.h | 63 + .../Communication_SDK/Headers/HS3Controller.h | 32 + .../Communication_SDK/Headers/HS4.h | 64 + .../Communication_SDK/Headers/HS4Controller.h | 26 + .../Communication_SDK/Headers/HS5.h | 141 ++ .../Communication_SDK/Headers/HS5Controller.h | 38 + .../Communication_SDK/Headers/HSHeader.h | 25 + .../Communication_SDK/Headers/HSMacroFile.h | 709 ++++++++ .../Communication_SDK/Headers/HealthHeader.h | 67 + .../Communication_SDK/Headers/HealthUser.h | 126 ++ .../Communication_SDK/Headers/IDOBindEnum.h | 49 + .../Headers/IDOBlueDataResponse.h | 66 + .../Communication_SDK/Headers/IDOBlueEnum.h | 213 +++ .../Headers/IDOBluetoothBaseModel.h | 112 ++ .../Communication_SDK/Headers/IDOBluetoothEngine.h | 283 +++ .../Headers/IDOBluetoothManager.h | 166 ++ .../Headers/IDOBluetoothServices.h | 75 + .../Headers/IDOCalculateBluetoothModel.h | 263 +++ .../Communication_SDK/Headers/IDOCommonMacro.h | 89 + .../Headers/IDODataExchangeModel.h | 128 ++ .../Headers/IDODataMigrationManager.h | 79 + .../Communication_SDK/Headers/IDOErrorCodeToStr.h | 19 + .../Headers/IDOFoundationCommand.h | 1178 ++++++++++++ .../Headers/IDOGetInfoBluetoothModel.h | 1924 ++++++++++++++++++++ .../Communication_SDK/Headers/IDOLogEnum.h | 165 ++ .../Communication_SDK/Headers/IDOPeripheralModel.h | 59 + .../Communication_SDK/Headers/IDORecordDeviceLog.h | 56 + .../Headers/IDOSetInfoBluetoothModel.h | 1760 ++++++++++++++++++ .../Headers/IDOSyncActivityDataModel.h | 207 +++ .../Communication_SDK/Headers/IDOSyncBpDataModel.h | 191 ++ .../Communication_SDK/Headers/IDOSyncEnum.h | 316 ++++ .../Headers/IDOSyncGpsDataModel.h | 133 ++ .../Headers/IDOSyncHeartRateDataModel.h | 442 +++++ .../Communication_SDK/Headers/IDOSyncManager.h | 161 ++ .../Headers/IDOSyncPressureDataModel.h | 158 ++ .../Headers/IDOSyncSleepDataModel.h | 224 +++ .../Headers/IDOSyncSpo2DataModel.h | 175 ++ .../Headers/IDOSyncSportDataModel.h | 221 +++ .../Headers/IDOSyncSwimDataModel.h | 188 ++ .../Communication_SDK/Headers/IDOTranEnum.h | 93 + .../Headers/IDOTransferFileManager.h | 116 ++ .../Headers/IDOWatchDialInfoModel.h | 95 + .../Headers/IDOWatchDialManager.h | 75 + .../Headers/IDOWeightBluetoothModel.h | 124 ++ .../Communication_SDK/Headers/IHSDKCloudUser.h | 104 ++ .../Communication_SDK/Headers/KN550BT.h | 115 ++ .../Communication_SDK/Headers/KN550BTController.h | 32 + .../Headers/ManageDeviceController.h | 34 + .../Communication_SDK/Headers/NT13B.h | 33 + .../Communication_SDK/Headers/NT13BController.h | 28 + .../Communication_SDK/Headers/NT13BHeader.h | 16 + .../Communication_SDK/Headers/NT13BMacroFile.h | 34 + .../Communication_SDK/Headers/PO1.h | 82 + .../Communication_SDK/Headers/PO1Controller.h | 29 + .../Communication_SDK/Headers/PO3.h | 96 + .../Communication_SDK/Headers/PO3Controller.h | 29 + .../Communication_SDK/Headers/POHeader.h | 20 + .../Communication_SDK/Headers/POMacroFile.h | 142 ++ .../Communication_SDK/Headers/PT3SBT.h | 167 ++ .../Communication_SDK/Headers/PT3SBTController.h | 27 + .../Communication_SDK/Headers/PT3SBTMacroFile.h | 92 + .../Headers/SDKFlowUpdateDevice.h | 196 ++ .../Communication_SDK/Headers/SDKInfo.h | 30 + .../Communication_SDK/Headers/SDKUpdateDevice.h | 235 +++ .../Headers/ScanDeviceController.h | 47 + .../Communication_SDK/Headers/THV3.h | 104 ++ .../Communication_SDK/Headers/THV3Controller.h | 30 + .../Communication_SDK/Headers/THV3Macro.h | 17 + .../Communication_SDK/Headers/TS28B.h | 26 + .../Communication_SDK/Headers/TS28BController.h | 142 ++ .../Communication_SDK/Headers/TS28BHeader.h | 15 + .../Communication_SDK/Headers/iHealthHS6.h | 174 ++ .../Communication_SDK/libiHealthSDK2.7.5.a | Bin 0 -> 74566552 bytes .../ios/ReactNativeIOSLibrary/ECGModule.h | 17 + .../ios/ReactNativeIOSLibrary/ECGModule.m | 245 +++ .../ios/ReactNativeIOSLibrary/ECGProfileModule.h | 75 + .../ios/ReactNativeIOSLibrary/ECGProfileModule.m | 76 + .../ios/ReactNativeIOSLibrary/ECGUSBModule.h | 18 + .../ios/ReactNativeIOSLibrary/ECGUSBModule.m | 258 +++ .../ios/ReactNativeIOSLibrary/HS2Module.h | 19 + .../ios/ReactNativeIOSLibrary/HS2Module.m | 277 +++ .../ios/ReactNativeIOSLibrary/HS2SModule.h | 19 + .../ios/ReactNativeIOSLibrary/HS2SModule.m | 1052 +++++++++++ .../ios/ReactNativeIOSLibrary/HS2SProfileModule.h | 169 ++ .../ios/ReactNativeIOSLibrary/HS2SProfileModule.m | 167 ++ .../ios/ReactNativeIOSLibrary/HS4SModule.h | 20 + .../ios/ReactNativeIOSLibrary/HS4SModule.m | 257 +++ .../ios/ReactNativeIOSLibrary/HS6Module.h | 25 + .../ios/ReactNativeIOSLibrary/HS6Module.m | 339 ++++ .../ios/ReactNativeIOSLibrary/HS6ProfileModule.h | 51 + .../ios/ReactNativeIOSLibrary/HS6ProfileModule.m | 70 + .../ios/ReactNativeIOSLibrary/HSProfileModule.h | 60 + .../ios/ReactNativeIOSLibrary/HSProfileModule.m | 79 + .../ios/ReactNativeIOSLibrary/NT13BModule.h | 20 + .../ios/ReactNativeIOSLibrary/NT13BModule.m | 103 ++ .../ios/ReactNativeIOSLibrary/NT13BProfileModule.h | 36 + .../ios/ReactNativeIOSLibrary/NT13BProfileModule.m | 39 + .../ios/ReactNativeIOSLibrary/PO1Module.h | 19 + .../ios/ReactNativeIOSLibrary/PO1Module.m | 167 ++ .../ios/ReactNativeIOSLibrary/PO1ProfileModule.h | 20 + .../ios/ReactNativeIOSLibrary/PO1ProfileModule.m | 58 + .../ios/ReactNativeIOSLibrary/PO3Module.h | 19 + .../ios/ReactNativeIOSLibrary/PO3Module.m | 260 +++ .../ios/ReactNativeIOSLibrary/POProfileModule.h | 24 + .../ios/ReactNativeIOSLibrary/POProfileModule.m | 48 + .../ios/ReactNativeIOSLibrary/PT3SBTModule.h | 19 + .../ios/ReactNativeIOSLibrary/PT3SBTModule.m | 347 ++++ .../ReactNativeIOSLibrary/PT3SBTProfileModule.h | 52 + .../ReactNativeIOSLibrary/PT3SBTProfileModule.m | 49 + .../ios/ReactNativeIOSLibrary/RNBGMacro.h | 60 + .../ios/ReactNativeIOSLibrary/TS28BModule.h | 21 + .../ios/ReactNativeIOSLibrary/TS28BModule.m | 116 ++ .../ios/ReactNativeIOSLibrary/TS28BProfileModule.h | 38 + .../ios/ReactNativeIOSLibrary/TS28BProfileModule.m | 40 + .../iHealthDeviceManagerModule.h | 27 + .../iHealthDeviceManagerModule.m | 1338 ++++++++++++++ libs/ihealth-sdk/module/AM3SModule.js | 274 +++ libs/ihealth-sdk/module/AM4Module.js | 321 ++++ libs/ihealth-sdk/module/AM5Module.js | 150 ++ libs/ihealth-sdk/module/AM5ProfileModule.js | 68 + libs/ihealth-sdk/module/AMProfileModule.js | 463 +++++ libs/ihealth-sdk/module/BG1Module.js | 40 + libs/ihealth-sdk/module/BG1ProfileModule.js | 90 + libs/ihealth-sdk/module/BG1SModule.js | 48 + libs/ihealth-sdk/module/BG1SProfileModule.js | 30 + libs/ihealth-sdk/module/BG5Module.js | 184 ++ libs/ihealth-sdk/module/BG5SModule.js | 145 ++ libs/ihealth-sdk/module/BG5SProfileModule.js | 401 ++++ libs/ihealth-sdk/module/BGProfileModule.js | 413 +++++ libs/ihealth-sdk/module/BP3LModule.js | 75 + libs/ihealth-sdk/module/BP550BTModule.js | 90 + libs/ihealth-sdk/module/BP5Module.js | 125 ++ libs/ihealth-sdk/module/BP5SModule.js | 139 ++ libs/ihealth-sdk/module/BP7Module.js | 149 ++ libs/ihealth-sdk/module/BP7SModule.js | 121 ++ libs/ihealth-sdk/module/BPProfileModule.js | 69 + libs/ihealth-sdk/module/BTMModule.js | 88 + libs/ihealth-sdk/module/BTMProfileModule.js | 33 + libs/ihealth-sdk/module/ECGModule.js | 60 + libs/ihealth-sdk/module/ECGProfileModule.js | 208 +++ libs/ihealth-sdk/module/ECGUSBModule.js | 119 ++ libs/ihealth-sdk/module/HS2Module.js | 63 + libs/ihealth-sdk/module/HS2SModule.js | 110 ++ libs/ihealth-sdk/module/HS2SProfileModule.js | 103 ++ libs/ihealth-sdk/module/HS4SModule.js | 53 + libs/ihealth-sdk/module/HS6Module.js | 94 + libs/ihealth-sdk/module/HS6ProfileModule.js | 50 + libs/ihealth-sdk/module/HSProfileModule.js | 42 + libs/ihealth-sdk/module/NT13BModule.js | 39 + libs/ihealth-sdk/module/NT13BProfileModule.js | 20 + libs/ihealth-sdk/module/PO1Module.js | 38 + libs/ihealth-sdk/module/PO1ProfileModule.js | 33 + libs/ihealth-sdk/module/PO3Module.js | 58 + libs/ihealth-sdk/module/POProfileModule.js | 34 + libs/ihealth-sdk/module/PT3SBTModule.js | 87 + libs/ihealth-sdk/module/PT3SBTProfileModule.js | 31 + libs/ihealth-sdk/module/TS28BModule.js | 39 + libs/ihealth-sdk/module/TS28BProfileModule.js | 20 + .../module/iHealthDeviceManagerModule.js | 277 +++ libs/ihealth-sdk/package-lock.json | 5 + libs/ihealth-sdk/package.json | 19 + libs/ihealth-sdk/react-native.config.js | 10 + libs/ihealth-sdk/yarn.lock | 4 + 401 files changed, 53001 insertions(+) create mode 100755 libs/ihealth-sdk/README.md create mode 100644 libs/ihealth-sdk/ReactNativeIOSLibrary.podspec create mode 100644 libs/ihealth-sdk/android/.project create mode 100644 libs/ihealth-sdk/android/.settings/org.eclipse.buildship.core.prefs create mode 100755 libs/ihealth-sdk/android/build.gradle create mode 100644 libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.jar create mode 100644 libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 libs/ihealth-sdk/android/gradlew create mode 100644 libs/ihealth-sdk/android/gradlew.bat create mode 100755 libs/ihealth-sdk/android/libs/arm64-v8a/libBodyfat_SDK.so create mode 100755 libs/ihealth-sdk/android/libs/arm64-v8a/libECGOffline.so create mode 100755 libs/ihealth-sdk/android/libs/arm64-v8a/libECGOnline.so create mode 100755 libs/ihealth-sdk/android/libs/arm64-v8a/libVeryFitMulti.so create mode 100755 libs/ihealth-sdk/android/libs/arm64-v8a/libiHealth.so create mode 100755 libs/ihealth-sdk/android/libs/armeabi-v7a/libBodyfat_SDK.so create mode 100755 libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOffline.so create mode 100755 libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOnline.so create mode 100755 libs/ihealth-sdk/android/libs/armeabi-v7a/libVeryFitMulti.so create mode 100755 libs/ihealth-sdk/android/libs/armeabi-v7a/libiHealth.so create mode 100644 libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar create mode 100644 libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar.bak create mode 100644 libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8_original.jar create mode 100644 libs/ihealth-sdk/android/libs/smartlinklib3.6.4_product.jar create mode 100755 libs/ihealth-sdk/android/libs/x86/libBodyfat_SDK.so create mode 100755 libs/ihealth-sdk/android/libs/x86/libECGOffline.so create mode 100755 libs/ihealth-sdk/android/libs/x86/libECGOnline.so create mode 100755 libs/ihealth-sdk/android/libs/x86/libVeryFitMulti.so create mode 100755 libs/ihealth-sdk/android/libs/x86/libiHealth.so create mode 100755 libs/ihealth-sdk/android/libs/x86_64/libBodyfat_SDK.so create mode 100755 libs/ihealth-sdk/android/libs/x86_64/libECGOffline.so create mode 100755 libs/ihealth-sdk/android/libs/x86_64/libECGOnline.so create mode 100755 libs/ihealth-sdk/android/libs/x86_64/libVeryFitMulti.so create mode 100755 libs/ihealth-sdk/android/libs/x86_64/libiHealth.so create mode 100755 libs/ihealth-sdk/android/proguard-rules.pro create mode 100755 libs/ihealth-sdk/android/src/androidTest/java/com/example/jing/ihealthlibrary/ExampleInstrumentedTest.java create mode 100755 libs/ihealth-sdk/android/src/androidTest/java/com/ihealth/ihealthlibrary/ExampleInstrumentedTest.java create mode 100755 libs/ihealth-sdk/android/src/main/AndroidManifest.xml create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM3SModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM4Module.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5Module.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5ProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AMProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1Module.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1ProfileModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5Module.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BGProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP3LModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP550BTModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5Module.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5SModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7Module.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7SModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BPProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMProfileModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGProfileModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGUSBModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2Module.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS4SModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6Module.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6ProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HSProfileModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BProfileModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1Module.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1ProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO3Module.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/POProfileModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTProfileModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BProfileModule.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/Utils.java create mode 100755 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthBaseModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerModule.java create mode 100644 libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerPackage.java create mode 100755 libs/ihealth-sdk/android/src/main/res/values/strings.xml create mode 100755 libs/ihealth-sdk/android/src/test/java/com/example/jing/ihealthlibrary/ExampleUnitTest.java create mode 100755 libs/ihealth-sdk/android/src/test/java/com/ihealth/ihealthlibrary/ExampleUnitTest.java create mode 100755 libs/ihealth-sdk/doc/README.md create mode 100644 libs/ihealth-sdk/doc/am3s.md create mode 100644 libs/ihealth-sdk/doc/am4.md create mode 100644 libs/ihealth-sdk/doc/am5.md create mode 100644 libs/ihealth-sdk/doc/bg1.md create mode 100644 libs/ihealth-sdk/doc/bg1s.md create mode 100644 libs/ihealth-sdk/doc/bg5.md create mode 100644 libs/ihealth-sdk/doc/bg5s.md create mode 100644 libs/ihealth-sdk/doc/bp3l.md create mode 100644 libs/ihealth-sdk/doc/bp5.md create mode 100644 libs/ihealth-sdk/doc/bp5s.md create mode 100644 libs/ihealth-sdk/doc/bp7.md create mode 100644 libs/ihealth-sdk/doc/bp7s.md create mode 100644 libs/ihealth-sdk/doc/download.png create mode 100644 libs/ihealth-sdk/doc/ecg.md create mode 100644 libs/ihealth-sdk/doc/ecgusb.md create mode 100644 libs/ihealth-sdk/doc/hs2.md create mode 100644 libs/ihealth-sdk/doc/hs2s.md create mode 100644 libs/ihealth-sdk/doc/hs4s.md create mode 100644 libs/ihealth-sdk/doc/hs6.md create mode 100644 libs/ihealth-sdk/doc/integrate-android.png create mode 100644 libs/ihealth-sdk/doc/integrate-ios.png create mode 100644 libs/ihealth-sdk/doc/kn550.md create mode 100644 libs/ihealth-sdk/doc/nt13b.md create mode 100644 libs/ihealth-sdk/doc/po1.md create mode 100644 libs/ihealth-sdk/doc/po3.md create mode 100644 libs/ihealth-sdk/doc/pt3sbt.md create mode 100644 libs/ihealth-sdk/doc/ts28b.md create mode 100755 libs/ihealth-sdk/index.js create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABI.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABIController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPM.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPMController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3SController_V2.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3S_V2.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4Controller.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Header.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMHeader.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1S.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1SController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5SController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGDevice.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3L.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3LController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5C.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5CController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5S.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRW.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRWController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7S.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7SController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPAV10Device.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBTLEDevice.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBV10Device.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinua.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinuaController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPDevice.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPLoopMeasureSettingModel.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPM1AE.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV24Device.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV25Device.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ConnectDeviceController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUDeviceFirmwareInfo.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUServerFirmwareInfo.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3Controller.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USB.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USBController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLink.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLinkDeviceInfo.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2S.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2SController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthUser.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBindEnum.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueDataResponse.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueEnum.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothBaseModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothEngine.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothManager.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothServices.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCalculateBluetoothModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCommonMacro.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataExchangeModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataMigrationManager.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOErrorCodeToStr.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOFoundationCommand.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOGetInfoBluetoothModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOLogEnum.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOPeripheralModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDORecordDeviceLog.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSetInfoBluetoothModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncActivityDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncBpDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncEnum.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncGpsDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncHeartRateDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncManager.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncPressureDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSleepDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSpo2DataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSportDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSwimDataModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTranEnum.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTransferFileManager.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialInfoModel.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialManager.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWeightBluetoothModel.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IHSDKCloudUser.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BT.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BTController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ManageDeviceController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13B.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBT.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTMacroFile.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKFlowUpdateDevice.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKInfo.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKUpdateDevice.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ScanDeviceController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Controller.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Macro.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28B.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BController.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BHeader.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/iHealthHS6.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.5.a create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SProfileModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6Module.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTProfileModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTProfileModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/RNBGMacro.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.m create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.h create mode 100644 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.m create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.h create mode 100755 libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.m create mode 100755 libs/ihealth-sdk/module/AM3SModule.js create mode 100755 libs/ihealth-sdk/module/AM4Module.js create mode 100755 libs/ihealth-sdk/module/AM5Module.js create mode 100755 libs/ihealth-sdk/module/AM5ProfileModule.js create mode 100755 libs/ihealth-sdk/module/AMProfileModule.js create mode 100755 libs/ihealth-sdk/module/BG1Module.js create mode 100755 libs/ihealth-sdk/module/BG1ProfileModule.js create mode 100644 libs/ihealth-sdk/module/BG1SModule.js create mode 100644 libs/ihealth-sdk/module/BG1SProfileModule.js create mode 100755 libs/ihealth-sdk/module/BG5Module.js create mode 100644 libs/ihealth-sdk/module/BG5SModule.js create mode 100644 libs/ihealth-sdk/module/BG5SProfileModule.js create mode 100755 libs/ihealth-sdk/module/BGProfileModule.js create mode 100755 libs/ihealth-sdk/module/BP3LModule.js create mode 100755 libs/ihealth-sdk/module/BP550BTModule.js create mode 100755 libs/ihealth-sdk/module/BP5Module.js create mode 100755 libs/ihealth-sdk/module/BP5SModule.js create mode 100755 libs/ihealth-sdk/module/BP7Module.js create mode 100755 libs/ihealth-sdk/module/BP7SModule.js create mode 100755 libs/ihealth-sdk/module/BPProfileModule.js create mode 100755 libs/ihealth-sdk/module/BTMModule.js create mode 100755 libs/ihealth-sdk/module/BTMProfileModule.js create mode 100755 libs/ihealth-sdk/module/ECGModule.js create mode 100755 libs/ihealth-sdk/module/ECGProfileModule.js create mode 100755 libs/ihealth-sdk/module/ECGUSBModule.js create mode 100755 libs/ihealth-sdk/module/HS2Module.js create mode 100755 libs/ihealth-sdk/module/HS2SModule.js create mode 100644 libs/ihealth-sdk/module/HS2SProfileModule.js create mode 100755 libs/ihealth-sdk/module/HS4SModule.js create mode 100755 libs/ihealth-sdk/module/HS6Module.js create mode 100755 libs/ihealth-sdk/module/HS6ProfileModule.js create mode 100755 libs/ihealth-sdk/module/HSProfileModule.js create mode 100644 libs/ihealth-sdk/module/NT13BModule.js create mode 100644 libs/ihealth-sdk/module/NT13BProfileModule.js create mode 100644 libs/ihealth-sdk/module/PO1Module.js create mode 100644 libs/ihealth-sdk/module/PO1ProfileModule.js create mode 100755 libs/ihealth-sdk/module/PO3Module.js create mode 100755 libs/ihealth-sdk/module/POProfileModule.js create mode 100644 libs/ihealth-sdk/module/PT3SBTModule.js create mode 100644 libs/ihealth-sdk/module/PT3SBTProfileModule.js create mode 100644 libs/ihealth-sdk/module/TS28BModule.js create mode 100644 libs/ihealth-sdk/module/TS28BProfileModule.js create mode 100644 libs/ihealth-sdk/module/iHealthDeviceManagerModule.js create mode 100644 libs/ihealth-sdk/package-lock.json create mode 100755 libs/ihealth-sdk/package.json create mode 100644 libs/ihealth-sdk/react-native.config.js create mode 100644 libs/ihealth-sdk/yarn.lock (limited to 'libs/ihealth-sdk') diff --git a/libs/ihealth-sdk/README.md b/libs/ihealth-sdk/README.md new file mode 100755 index 0000000..a862013 --- /dev/null +++ b/libs/ihealth-sdk/README.md @@ -0,0 +1,138 @@ +# iHealth device sdk + +## Installation + +### Using npm + +```shell +npm install --save @ihealth/ihealthlibrary-react-native +``` + +### Using yarn + +```shell +yarn add @ihealth/ihealthlibrary-react-native +``` + +## Usage + +### 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. +![Download](./doc/download.png) + +#### Integrate license file + +For iOS +As shown below, Add your license file to your iOS project. +![integrate ios](./doc/integrate-ios.png) + +For Android +As show below, Add your license file to your asserts folder. +![integrate android](./doc/integrate-android.png) + +#### Using license file + +```js +import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; + +// your license file +const filename = 'license.pem'; +iHealthDeviceManagerModule.sdkAuthWithLicense(filename); +``` + +### Troubleshooting + +#### For Android + +1. Check settings.gradle file in your android project and node_modules, make sure input the correct module path. + +```gradle +include ':ihealthlibrary-react-native' +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') +``` + +3. Import iHealth module in your MainActivity.java + +```java +protected List getPackages() { + return Arrays.asList( + new MainReactPackage(), + new iHealthDeviceManagerPackage() + ); +} +``` + +4. Location permission(in AndroidManifest.xml) + +```xml + + + +``` + +#### For iOS + +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 + +### 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. + +```js +componentDidMount() { + iHealthAPI.addListener(); +} + +componentWillUnmount() { + iHealthAPI.removeListener(); +} +``` + +#### For bluetooth LE or regular bluetooth device + +##### search device + +```js +import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; +const type = 'BP5'; // AM3S, AM4, BG5, BG5S, BP3L, BP5, BP5S, BP7S, HS2, HS4S, PO3,HS2S,BG1S +iHealthDeviceManagerModule.startDiscovery(type); +``` + +##### connect device + +```js +import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; +const mac = 'xxxxxxxxxxxxxx'; +const type = 'BP5'; // AM3S, AM4, BG5, BG5S, BP3L, BP5, BP5S, BP7S, HS2, HS4S, PO3,HS2S,BG1S +iHealthDeviceManagerModule.connectDevice(mac, type); +``` + +##### device workflow + +[AM3S workflow](./doc/am3s.md) +[AM4 workflow](./doc/am4.md) +[BG1 workflow](./doc/bg1.md) +[BG5 workflow](./doc/bg5.md) +[BG5S workflow](./doc/bg5s.md) +[BP3L workflow](./doc/bp3l.md) +[BP5 workflow](./doc/bp5.md) +[BP5S workflow](./doc/bp5s.md) +[BP7S workflow](./doc/bp7s.md) +[HS2 workflow](./doc/hs2.md) +[HS4S workflow](./doc/hs4s.md) +[HS6 workflow](./doc/hs6.md) +[PO3 workflow](./doc/po3.md) +[HS2S workflow](./doc/hs2s.md) +[BG1S workflow](./doc/bg1s.md) diff --git a/libs/ihealth-sdk/ReactNativeIOSLibrary.podspec b/libs/ihealth-sdk/ReactNativeIOSLibrary.podspec new file mode 100644 index 0000000..dea217c --- /dev/null +++ b/libs/ihealth-sdk/ReactNativeIOSLibrary.podspec @@ -0,0 +1,18 @@ +Pod::Spec.new do |s| + s.name = "ReactNativeIOSLibrary" + s.version = "1.5.0" + s.summary = "iHealth React Native SDK" + s.description = "React Native bridge for iHealth device SDK" + s.homepage = "https://dev.ihealthlabs.com" + s.license = "MIT" + s.author = { "iHealthLabs" => "sdk@ihealthlabs.com" } + s.platform = :ios, "13.0" + s.source = { :git => "https://github.com/iHealthDeviceLabs/iHealth-React-Native-SDK.git", :tag => "v#{s.version}" } + 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.5.a" + s.requires_arc = true + s.frameworks = "CoreBluetooth" + + s.dependency "React-Core" +end diff --git a/libs/ihealth-sdk/android/.project b/libs/ihealth-sdk/android/.project new file mode 100644 index 0000000..df0d1c9 --- /dev/null +++ b/libs/ihealth-sdk/android/.project @@ -0,0 +1,28 @@ + + + android + Project android created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + + + 1623719603491 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/libs/ihealth-sdk/android/.settings/org.eclipse.buildship.core.prefs b/libs/ihealth-sdk/android/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..dc1d8e8 --- /dev/null +++ b/libs/ihealth-sdk/android/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,13 @@ +arguments= +auto.sync=false +build.scans.enabled=false +connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) +connection.project.dir= +eclipse.preferences.version=1 +gradle.user.home= +java.home=/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home +jvm.arguments= +offline.mode=false +override.workspace.settings=true +show.console.view=true +show.executions.view=true diff --git a/libs/ihealth-sdk/android/build.gradle b/libs/ihealth-sdk/android/build.gradle new file mode 100755 index 0000000..8f07183 --- /dev/null +++ b/libs/ihealth-sdk/android/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 35 + buildToolsVersion '35.0.0' + + defaultConfig { + minSdkVersion 24 + targetSdkVersion 35 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + sourceSets { + main { + jniLibs.srcDirs = ['libs'] + } + } +} + +dependencies { + testImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + api 'androidx.appcompat:appcompat:1.2.0' + api 'androidx.core:core:1.6.0' + api 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' + api 'androidx.annotation:annotation:1.3.0' + testImplementation 'junit:junit:4.12' + 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.8.jar') + implementation 'org.greenrobot:greendao:3.2.2' + // implementation 'no.nordicsemi.android:dfu:1.6.1' // removed — not needed for scanning, and repo not available + implementation 'com.alibaba:fastjson:1.2.48' +} diff --git a/libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.jar b/libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.properties b/libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0f14bff --- /dev/null +++ b/libs/ihealth-sdk/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat May 09 13:27:51 CST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/libs/ihealth-sdk/android/gradlew b/libs/ihealth-sdk/android/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/libs/ihealth-sdk/android/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/libs/ihealth-sdk/android/gradlew.bat b/libs/ihealth-sdk/android/gradlew.bat new file mode 100644 index 0000000..e95643d --- /dev/null +++ b/libs/ihealth-sdk/android/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/libs/ihealth-sdk/android/libs/arm64-v8a/libBodyfat_SDK.so b/libs/ihealth-sdk/android/libs/arm64-v8a/libBodyfat_SDK.so new file mode 100755 index 0000000..4fc680d Binary files /dev/null and b/libs/ihealth-sdk/android/libs/arm64-v8a/libBodyfat_SDK.so differ diff --git a/libs/ihealth-sdk/android/libs/arm64-v8a/libECGOffline.so b/libs/ihealth-sdk/android/libs/arm64-v8a/libECGOffline.so new file mode 100755 index 0000000..60a9d84 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/arm64-v8a/libECGOffline.so differ diff --git a/libs/ihealth-sdk/android/libs/arm64-v8a/libECGOnline.so b/libs/ihealth-sdk/android/libs/arm64-v8a/libECGOnline.so new file mode 100755 index 0000000..edffde2 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/arm64-v8a/libECGOnline.so differ diff --git a/libs/ihealth-sdk/android/libs/arm64-v8a/libVeryFitMulti.so b/libs/ihealth-sdk/android/libs/arm64-v8a/libVeryFitMulti.so new file mode 100755 index 0000000..c58f6e8 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/arm64-v8a/libVeryFitMulti.so differ diff --git a/libs/ihealth-sdk/android/libs/arm64-v8a/libiHealth.so b/libs/ihealth-sdk/android/libs/arm64-v8a/libiHealth.so new file mode 100755 index 0000000..5d7659c Binary files /dev/null and b/libs/ihealth-sdk/android/libs/arm64-v8a/libiHealth.so differ diff --git a/libs/ihealth-sdk/android/libs/armeabi-v7a/libBodyfat_SDK.so b/libs/ihealth-sdk/android/libs/armeabi-v7a/libBodyfat_SDK.so new file mode 100755 index 0000000..4d3374f Binary files /dev/null and b/libs/ihealth-sdk/android/libs/armeabi-v7a/libBodyfat_SDK.so differ diff --git a/libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOffline.so b/libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOffline.so new file mode 100755 index 0000000..3fa9085 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOffline.so differ diff --git a/libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOnline.so b/libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOnline.so new file mode 100755 index 0000000..792b7ac Binary files /dev/null and b/libs/ihealth-sdk/android/libs/armeabi-v7a/libECGOnline.so differ diff --git a/libs/ihealth-sdk/android/libs/armeabi-v7a/libVeryFitMulti.so b/libs/ihealth-sdk/android/libs/armeabi-v7a/libVeryFitMulti.so new file mode 100755 index 0000000..e254b6f Binary files /dev/null and b/libs/ihealth-sdk/android/libs/armeabi-v7a/libVeryFitMulti.so differ diff --git a/libs/ihealth-sdk/android/libs/armeabi-v7a/libiHealth.so b/libs/ihealth-sdk/android/libs/armeabi-v7a/libiHealth.so new file mode 100755 index 0000000..5def22d Binary files /dev/null and b/libs/ihealth-sdk/android/libs/armeabi-v7a/libiHealth.so differ diff --git a/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar b/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar new file mode 100644 index 0000000..db31d0b Binary files /dev/null and b/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar differ diff --git a/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar.bak b/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar.bak new file mode 100644 index 0000000..7d8aa90 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8.jar.bak differ diff --git a/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8_original.jar b/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8_original.jar new file mode 100644 index 0000000..7d8aa90 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/iHealthSDK_2.9.8_original.jar differ diff --git a/libs/ihealth-sdk/android/libs/smartlinklib3.6.4_product.jar b/libs/ihealth-sdk/android/libs/smartlinklib3.6.4_product.jar new file mode 100644 index 0000000..7152e5f Binary files /dev/null and b/libs/ihealth-sdk/android/libs/smartlinklib3.6.4_product.jar differ diff --git a/libs/ihealth-sdk/android/libs/x86/libBodyfat_SDK.so b/libs/ihealth-sdk/android/libs/x86/libBodyfat_SDK.so new file mode 100755 index 0000000..2cff220 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86/libBodyfat_SDK.so differ diff --git a/libs/ihealth-sdk/android/libs/x86/libECGOffline.so b/libs/ihealth-sdk/android/libs/x86/libECGOffline.so new file mode 100755 index 0000000..96001b5 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86/libECGOffline.so differ diff --git a/libs/ihealth-sdk/android/libs/x86/libECGOnline.so b/libs/ihealth-sdk/android/libs/x86/libECGOnline.so new file mode 100755 index 0000000..23621f3 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86/libECGOnline.so differ diff --git a/libs/ihealth-sdk/android/libs/x86/libVeryFitMulti.so b/libs/ihealth-sdk/android/libs/x86/libVeryFitMulti.so new file mode 100755 index 0000000..79c513f Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86/libVeryFitMulti.so differ diff --git a/libs/ihealth-sdk/android/libs/x86/libiHealth.so b/libs/ihealth-sdk/android/libs/x86/libiHealth.so new file mode 100755 index 0000000..355d1ae Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86/libiHealth.so differ diff --git a/libs/ihealth-sdk/android/libs/x86_64/libBodyfat_SDK.so b/libs/ihealth-sdk/android/libs/x86_64/libBodyfat_SDK.so new file mode 100755 index 0000000..c76e666 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86_64/libBodyfat_SDK.so differ diff --git a/libs/ihealth-sdk/android/libs/x86_64/libECGOffline.so b/libs/ihealth-sdk/android/libs/x86_64/libECGOffline.so new file mode 100755 index 0000000..c2bb960 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86_64/libECGOffline.so differ diff --git a/libs/ihealth-sdk/android/libs/x86_64/libECGOnline.so b/libs/ihealth-sdk/android/libs/x86_64/libECGOnline.so new file mode 100755 index 0000000..8871982 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86_64/libECGOnline.so differ diff --git a/libs/ihealth-sdk/android/libs/x86_64/libVeryFitMulti.so b/libs/ihealth-sdk/android/libs/x86_64/libVeryFitMulti.so new file mode 100755 index 0000000..4af84a5 Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86_64/libVeryFitMulti.so differ diff --git a/libs/ihealth-sdk/android/libs/x86_64/libiHealth.so b/libs/ihealth-sdk/android/libs/x86_64/libiHealth.so new file mode 100755 index 0000000..a4c6f9d Binary files /dev/null and b/libs/ihealth-sdk/android/libs/x86_64/libiHealth.so differ diff --git a/libs/ihealth-sdk/android/proguard-rules.pro b/libs/ihealth-sdk/android/proguard-rules.pro new file mode 100755 index 0000000..dff1cf5 --- /dev/null +++ b/libs/ihealth-sdk/android/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/jing/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/libs/ihealth-sdk/android/src/androidTest/java/com/example/jing/ihealthlibrary/ExampleInstrumentedTest.java b/libs/ihealth-sdk/android/src/androidTest/java/com/example/jing/ihealthlibrary/ExampleInstrumentedTest.java new file mode 100755 index 0000000..5417626 --- /dev/null +++ b/libs/ihealth-sdk/android/src/androidTest/java/com/example/jing/ihealthlibrary/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.jing.ihealthlibrary; + +import android.content.Context; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.example.jing.ihealthlibrary.test", appContext.getPackageName()); + } +} diff --git a/libs/ihealth-sdk/android/src/androidTest/java/com/ihealth/ihealthlibrary/ExampleInstrumentedTest.java b/libs/ihealth-sdk/android/src/androidTest/java/com/ihealth/ihealthlibrary/ExampleInstrumentedTest.java new file mode 100755 index 0000000..600e0ef --- /dev/null +++ b/libs/ihealth-sdk/android/src/androidTest/java/com/ihealth/ihealthlibrary/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.ihealth.ihealthlibrary; + +import android.content.Context; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.ihealth.ihealthlibrary.test", appContext.getPackageName()); + } +} diff --git a/libs/ihealth-sdk/android/src/main/AndroidManifest.xml b/libs/ihealth-sdk/android/src/main/AndroidManifest.xml new file mode 100755 index 0000000..82fcbe2 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM3SModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM3SModule.java new file mode 100755 index 0000000..77276fe --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM3SModule.java @@ -0,0 +1,339 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Am3sControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by Jeepend on 22/11/2016. + */ +@ReactModule(name = "AM3SModule") +public class AM3SModule extends iHealthBaseModule { + private static final String modelName = "AM3SModule"; + private static final String TAG = "AM3SModule"; + + private static final String EVENT_NOTIFY = "event_notify_am3s"; + + public AM3SModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + private static Am3sControl getControl(String mac) { + return iHealthDevicesManager.getInstance().getAm3sControl(mac); + } + + @ReactMethod + public void getIdps(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + String idps = control.getIdps(); + WritableMap params = Arguments.createMap(); + if (!TextUtils.isEmpty(idps)) { + Utils.jsonToMap(idps, params); + } + sendEvent(EVENT_NOTIFY, params); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void reset(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.reset(1); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getUserId(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.getUserId(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getAlarmClockNum(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.getAlarmClockNum(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getAlarmClockDetail(String mac, ReadableArray alarmIDArray) { + Am3sControl control = getControl(mac); + if (control != null) { + int[] alarmIDs = new int[alarmIDArray.size()]; + for (int i = 0; i < alarmIDArray.size(); i++) { + alarmIDs[i] = alarmIDArray.getInt(i); + } + control.getAlarmClockDetail(alarmIDs); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void setAlarmClock(String mac, int id, int hour, int min, boolean isRepeat, ReadableArray weekArray, boolean isOn) { + Am3sControl control = getControl(mac); + if (control != null) { + int[] weeks = new int[weekArray.size()]; + for (int i = 0; i < weekArray.size(); i++) { + weeks[i] = weekArray.getInt(i); + } + control.setAlarmClock(id, hour, min, isRepeat, weeks, isOn); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void deleteAlarmClock(String mac, int id) { + Am3sControl control = getControl(mac); + if (control != null) { + control.deleteAlarmClock(id); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getActivityRemind(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.getActivityRemind(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void setActivityRemind(String mac, int hour, int min, boolean isOn) { + Am3sControl control = getControl(mac); + if (control != null) { + control.setActivityRemind(hour, min, isOn); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void queryAMState(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.queryAMState(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void setUserId(String mac, int id) { + Am3sControl control = getControl(mac); + if (control != null) { + control.setUserId(id); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getUserInfo(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.getUserInfo(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void setUserBmr(String mac, int bmr) { + Am3sControl control = getControl(mac); + if (control != null) { + control.setUserBmr(bmr); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void syncActivityData(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.syncActivityData(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void syncSleepData(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.syncSleepData(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void syncRealData(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.syncRealData(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void syncRealTime(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.syncRealTime(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void setHourMode(String mac, int hourMode) { + Am3sControl control = getControl(mac); + if (control != null) { + control.setHourMode(hourMode); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getHourMode(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.getHourMode(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.disconnect(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void setUserInfo(String mac, int age, int height, float weight, int gender, int unit, int target, int activityLevel) { + Am3sControl control = getControl(mac); + if (control != null) { + control.setUserInfo(age, height, weight, gender, unit, target, activityLevel); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void syncStageReportData(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.syncStageReprotData(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void sendRandom(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.sendRandom(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getPicture(String mac) { + Am3sControl control = getControl(mac); + if (control != null) { + control.getPicture(); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void setPicture(String mac, int index) { + Am3sControl control = getControl(mac); + if (control != null) { + control.setPicture(index); + } else { + Log.e(TAG, "Can not find AM3S Control mac:" + mac); + } + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getAm3sDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM4Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM4Module.java new file mode 100755 index 0000000..ca02e4c --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM4Module.java @@ -0,0 +1,339 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Am4Control; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by jing on 16/10/20. + */ +@ReactModule(name = "AM4Module") +public class AM4Module extends iHealthBaseModule { + private static final String modelName = "AM4Module"; + private static final String TAG = "AM4Module"; + + private static final String EVENT_NOTIFY = "event_notify_am4"; + + public AM4Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + private static Am4Control getControl(String mac) { + return iHealthDevicesManager.getInstance().getAm4Control(mac); + } + + @ReactMethod + public void getIdps(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + String idps = control.getIdps(); + WritableMap params = Arguments.createMap(); + if (!TextUtils.isEmpty(idps)) { + Utils.jsonToMap(idps, params); + } + sendEvent(EVENT_NOTIFY, params); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void reset(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.reset(1); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void getUserId(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.getUserId(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void getAlarmClockNum(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.getAlarmClockNum(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void getAlarmClockDetail(String mac, ReadableArray alarmIDArray) { + Am4Control control = getControl(mac); + if (control != null) { + int[] alarmIDs = new int[alarmIDArray.size()]; + for (int i = 0; i< alarmIDArray.size(); i++) { + alarmIDs[i] = alarmIDArray.getInt(i); + } + control.getAlarmClockDetail(alarmIDs); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void setAlarmClock(String mac, int id, int hour, int min, boolean isRepeat, ReadableArray weekArray, boolean isOn) { + Am4Control control = getControl(mac); + if (control != null) { + int[] weeks = new int[weekArray.size()]; + for (int i = 0; i < weekArray.size(); i++) { + weeks[i] = weekArray.getInt(i); + } + control.setAlarmClock(id, hour, min, isRepeat, weeks, isOn); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void deleteAlarmClock(String mac, int id) { + Am4Control control = getControl(mac); + if (control != null) { + control.deleteAlarmClock(id); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void getActivityRemind(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.getActivityRemind(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void setActivityRemind(String mac, int hour, int min, boolean isOn) { + Am4Control control = getControl(mac); + if (control != null) { + control.setActivityRemind(hour, min, isOn); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void queryAMState(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.queryAMState(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void setUserId(String mac, int id) { + Am4Control control = getControl(mac); + if (control != null) { + control.setUserId(id); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void getUserInfo(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.getUserInfo(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void setUserBmr(String mac, int bmr){ + Am4Control control = getControl(mac); + if (control != null) { + control.setUserBmr(bmr); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void syncActivityData(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.syncActivityData(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void syncSleepData(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.syncSleepData(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void syncRealData(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.syncRealData(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void syncRealTime(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.syncRealTime(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void setHourMode(String mac, int hourMode) { + Am4Control control = getControl(mac); + if (control != null) { + control.setHourMode(hourMode); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void getHourMode(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.getHourMode(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.disconnect(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void setUserInfo(String mac, int age, int height, float weight, int gender, int unit, int target, int activityLevel, int min) { + Am4Control control = getControl(mac); + if (control != null) { + control.setUserInfo(age, height, weight, gender, unit, target, activityLevel, min); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void syncStageReportData(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.syncStageReprotData(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void sendRandom(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.sendRandom(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void checkSwimPara(String mac) { + Am4Control control = getControl(mac); + if (control != null) { + control.checkSwimPara(); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void setSwimPara(String mac, boolean isOpen, int poolLength, int hours, int minutes, int unit) { + Am4Control control = getControl(mac); + if (control != null) { + control.setSwimPara(isOpen, poolLength, hours, minutes, unit); + } else { + Log.e(TAG, "Can not find AM4 Control mac:" + mac); + } + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getAm4Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5Module.java new file mode 100755 index 0000000..570a2fd --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5Module.java @@ -0,0 +1,378 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ido.ble.protocol.model.QuickSportMode; +import com.ihealth.communication.control.Am5Control; +import com.ihealth.communication.manager.iHealthDevicesManager; +import com.ihealth.communication.model.AM5Alarm; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "AM5Module") +public class AM5Module extends iHealthBaseModule { + private static final String modelName = "AM5Module"; + private static final String TAG = AM5Module.modelName; + + private static final String EVENT_NOTIFY = "event_notify_am5"; + + public AM5Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + private static Am5Control getControl(String mac) { + return iHealthDevicesManager.getInstance().getAm5Control(mac); + } + + @ReactMethod + public void bindDevice(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.bindDevice(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void unBindDevice(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.unBindDevice(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void isBind(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.isBind(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void getBasicInfo(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.getBasicInfo(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void getMacAddress(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.getMacAddress(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void getLiveData(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.getLiveData(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void getActivityCount(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.getActivityCount(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setTime(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.setTime(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + // @ReactMethod + // public void setTime(String mac, int year, int month, int day, int hour, int minute, int second, int week) { + // Am5Control control = getControl(mac); + // if (control != null) { + // control.setTime(year, month, day, hour, minute, second, week); + // } else { + // Log.e(TAG, "Can not find AM5 Control mac:" + mac); + // } + // } + + @ReactMethod + public void setAlarm(String mac, List alarmList) { + Am5Control control = getControl(mac); + if (control != null) { + control.setAlarm(alarmList); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setGoal(String mac, String goal) { + Am5Control control = getControl(mac); + if (control != null) { + control.setGoal(goal); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setLongSit(String mac, int startHour, int startMinute, + int endHour,int endMinute, int interval, + boolean isOn, boolean[] repeat){ + Am5Control control = getControl(mac); + if (control != null) { + control.setLongSit(startHour, startMinute, endHour, + endMinute, interval, isOn, repeat); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setUserInfo(String mac, int birthYear, int birthMonth, int birthDay, int weight, int height, int sex) { + Am5Control control = getControl(mac); + if (control != null) { + control.setUserInfo(birthYear, birthMonth, birthDay, weight, height, sex); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setUnit(String mac, int type, int unit) { + Am5Control control = getControl(mac); + if (control != null) { + control.setUnit(type, unit); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void reboot(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.reboot(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setHandWearMode(String mac, int mode) { + Am5Control control = getControl(mac); + if (control != null) { + control.setHandWearMode(mode); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setHeartRateInterval(String mac, int burn, int aerobic, int limit, int userMaxHR) { + Am5Control control = getControl(mac); + if (control != null) { + control.setHeartRateInterval(burn, aerobic, limit, userMaxHR); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setHeartRateMeasureMode(String mac, int hasTimeRange, int measureMode, int startHour, int startMin, int endHour, int endMin) { + Am5Control control = getControl(mac); + if (control != null) { + control.setHeartRateMeasureMode(hasTimeRange, measureMode, startHour, startMin, endHour, endMin); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setNotDisturb(String mac, boolean isOpen, int startHour, int startMin, int endHour, int endMin) { + Am5Control control = getControl(mac); + if (control != null) { + control.setNotDisturb(isOpen, startHour, startMin, endHour, endMin); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setSportMode(String mac, QuickSportMode quickSportMode) { + Am5Control control = getControl(mac); + if (control != null) { + control.setSportMode(quickSportMode); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setIncomingCallInfo(String mac, String name, String phoneNumber) { + Am5Control control = getControl(mac); + if (control != null) { + control.setIncomingCallInfo(name, phoneNumber); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setStopInComingCall(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.setStopInComingCall(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void setNewMessageDetailInfo(String mac, int type, String name, String number, String content) { + Am5Control control = getControl(mac); + if (control != null) { + control.setNewMessageDetailInfo(type, name, number, content); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void syncConfigData(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.syncConfigData(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void stopSyncConfigData(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.stopSyncConfigData(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void syncHealthData(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.syncHealthData(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void stopSyncHealthData(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.stopSyncHealthData(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void syncActivityData(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.syncActivityData(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void stopSyncActivityData(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.stopSyncActivityData(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + Am5Control control = getControl(mac); + if (control != null) { + control.disconnect(); + } else { + Log.e(TAG, "Can not find AM5 Control mac:" + mac); + } + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getAm5Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5ProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5ProfileModule.java new file mode 100755 index 0000000..18c585e --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AM5ProfileModule.java @@ -0,0 +1,161 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.AmProfile; +import com.ihealth.communication.control.OtherDeviceProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +@ReactModule(name = "AM5ProfileModule") +public class AM5ProfileModule extends ReactContextBaseJavaModule { + + private static final String modelName = "AM5ProfileModule"; + private static final String TAG = "AM5ProfileModule"; + + private static final String ACTION_ERROR = "ACTION_ERROR"; + private static final String ERROR_NUM = "ERROR_NUM"; + private static final String ERROR_DESCRIPTION = "ERROR_DESCRIPTION"; + + private static final String ACTION_USER_BIND = "ACTION_USER_BIND"; + private static final String ACTION_USER_UNBIND = "ACTION_USER_UNBIND"; + private static final String ACTION_FUNCTION_SUPPORT = "ACTION_FUNCTION_SUPPORT"; + private static final String ACTION_BASIC_INFO = "ACTION_BASIC_INFO"; + private static final String ACTION_MAC_ADDRESS = "ACTION_MAC_ADDRESS"; + + private static final String MAC_ADDRESS = "MAC_ADDRESS"; + private static final String BASIC_BATTSTATUS = "BASIC_BATTSTATUS"; + private static final String BASIC_DEIVCEID = "BASIC_DEIVCEID"; + private static final String BASIC_ENERGE = "BASIC_ENERGE"; + private static final String BASIC_FIRMWAREVERSION = "BASIC_FIRMWAREVERSION"; + private static final String BASIC_MODE = "BASIC_MODE"; + private static final String BASIC_PAIRFLAG = "BASIC_PAIRFLAG"; + private static final String BASIC_REBOOT = "BASIC_REBOOT"; + + private static final String ACTION_LIVE_DATA = "ACTION_LIVE_DATA"; + private static final String ACTION_ACTIVITY_COUNT = "ACTION_ACTIVITY_COUNT"; + private static final String ACTION_SET_TIME = "ACTION_SET_TIME"; + private static final String ACTION_SET_ALARM = "ACTION_SET_ALARM"; + private static final String ACTION_SET_GOAL = "ACTION_SET_GOAL"; + private static final String ACTION_SET_LONG_SIT = "ACTION_SET_LONG_SIT"; + private static final String ACTION_SET_USER_INFO = "ACTION_SET_USER_INFO"; + private static final String ACTION_SET_UNIT = "ACTION_SET_UNIT"; + private static final String ACTION_SET_HAND_WEAR_MODE = "ACTION_SET_HAND_WEAR_MODE"; + private static final String ACTION_SET_UP_HAND_GESTURE = "ACTION_SET_UP_HAND_GESTURE"; + private static final String ACTION_SET_HEART_RATE_INTERVAL = "ACTION_SET_HEART_RATE_INTERVAL"; + private static final String ACTION_SET_HEART_RATE_MEASURE_MODE = "ACTION_SET_HEART_RATE_MEASURE_MODE"; + private static final String ACTION_SET_ONE_KEY_RESET = "ACTION_SET_ONE_KEY_RESET"; + private static final String ACTION_SET_NOT_DISTURB = "ACTION_SET_NOT_DISTURB"; + private static final String ACTION_SET_SPORT_MODE = "ACTION_SET_SPORT_MODE"; + + private static final String OPERATION_RESULT = "OPERATION_RESULT"; + private static final String OPERATION_ACTION = "OPERATION_ACTION"; + + private static final String ACTION_NOTICE_COMMING_CALL = "ACTION_NOTICE_COMMING_CALL"; + private static final String ACTION_NOTICE_COMMING_CALL_STOP = "ACTION_NOTICE_COMMING_CALL_STOP"; + private static final String ACTION_NOTICE_NEW_MESSAGE = "ACTION_NOTICE_NEW_MESSAGE"; + + private static final String ACTION_SYNC_ACTIVITY = "ACTION_SYNC_ACTIVITY"; + private static final String ACTION_SYNC_ACTIVITY_DATA = "ACTION_SYNC_ACTIVITY_DATA"; + private static final String ACTION_SYNC_CONFIG = "ACTION_SYNC_CONFIG"; + private static final String ACTION_SYNC_HEALTH_DATA = "ACTION_SYNC_HEALTH_DATA"; + private static final String ACTION_SYNC_HEALTH_DATA_SPORT = "ACTION_SYNC_HEALTH_DATA_SPORT"; + private static final String ACTION_SYNC_HEALTH_DATA_SLEEP = "ACTION_SYNC_HEALTH_DATA_SLEEP"; + private static final String ACTION_SYNC_HEALTH_DATA_HEART_RATE = "ACTION_SYNC_HEALTH_DATA_HEART_RATE"; + private static final String ACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE = "ACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE"; + + private static final String OPERATION_STATUS = "OPERATION_STATUS"; + private static final String PROGRESS = "PROGRESS"; + private static final int STATUS_START = 0; + private static final int STATUS_STOP = 1; + private static final int STATUS_DOING = 2; + private static final int STATUS_SUCCESS = 3; + private static final int STATUS_FAIL = 4; + private static final int STATUS_CANCEL = 5; + + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + + public AM5ProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_ERROR, OtherDeviceProfile.ACTION_ERROR); + constants.put(ERROR_NUM, OtherDeviceProfile.ERROR_NUM); + constants.put(ERROR_DESCRIPTION, OtherDeviceProfile.ERROR_DESCRIPTION); + + constants.put(ACTION_USER_BIND, OtherDeviceProfile.ACTION_USER_BIND); + constants.put(ACTION_USER_UNBIND, OtherDeviceProfile.ACTION_USER_UNBIND); + constants.put(ACTION_FUNCTION_SUPPORT, OtherDeviceProfile.ACTION_FUNCTION_SUPPORT); + constants.put(ACTION_BASIC_INFO, OtherDeviceProfile.ACTION_BASIC_INFO); + constants.put(ACTION_MAC_ADDRESS, OtherDeviceProfile.ACTION_MAC_ADDRESS); + + constants.put(MAC_ADDRESS, OtherDeviceProfile.MAC_ADDRESS); + constants.put(BASIC_BATTSTATUS, OtherDeviceProfile.BASIC_BATTSTATUS); + constants.put(BASIC_DEIVCEID, OtherDeviceProfile.BASIC_DEIVCEID); + constants.put(BASIC_ENERGE, OtherDeviceProfile.BASIC_ENERGE); + constants.put(BASIC_FIRMWAREVERSION, OtherDeviceProfile.BASIC_FIRMWAREVERSION); + constants.put(BASIC_MODE, OtherDeviceProfile.BASIC_MODE); + constants.put(BASIC_PAIRFLAG, OtherDeviceProfile.BASIC_PAIRFLAG); + constants.put(BASIC_REBOOT, OtherDeviceProfile.BASIC_REBOOT); + + constants.put(ACTION_LIVE_DATA, OtherDeviceProfile.ACTION_LIVE_DATA); + constants.put(ACTION_ACTIVITY_COUNT, OtherDeviceProfile.ACTION_ACTIVITY_COUNT); + constants.put(ACTION_SET_TIME, OtherDeviceProfile.ACTION_SET_TIME); + + constants.put(ACTION_SET_ALARM, OtherDeviceProfile.ACTION_SET_ALARM); + constants.put(ACTION_SET_GOAL, OtherDeviceProfile.ACTION_SET_GOAL); + constants.put(ACTION_SET_LONG_SIT, OtherDeviceProfile.ACTION_SET_LONG_SIT); + constants.put(ACTION_SET_USER_INFO, OtherDeviceProfile.ACTION_SET_USER_INFO); + constants.put(ACTION_SET_UNIT, OtherDeviceProfile.ACTION_SET_UNIT); + constants.put(ACTION_SET_HAND_WEAR_MODE, OtherDeviceProfile.ACTION_SET_HAND_WEAR_MODE); + constants.put(ACTION_SET_UP_HAND_GESTURE, OtherDeviceProfile.ACTION_SET_UP_HAND_GESTURE); + constants.put(ACTION_SET_HEART_RATE_INTERVAL, OtherDeviceProfile.ACTION_SET_HEART_RATE_INTERVAL); + constants.put(ACTION_SET_HEART_RATE_MEASURE_MODE, OtherDeviceProfile.ACTION_SET_HEART_RATE_MEASURE_MODE); + constants.put(ACTION_SET_ONE_KEY_RESET, OtherDeviceProfile.ACTION_SET_ONE_KEY_RESET); + constants.put(ACTION_SET_NOT_DISTURB, OtherDeviceProfile.ACTION_SET_NOT_DISTURB); + constants.put(ACTION_SET_SPORT_MODE, OtherDeviceProfile.ACTION_SET_SPORT_MODE); + + constants.put(OPERATION_RESULT, OtherDeviceProfile.OPERATION_RESULT); + constants.put(OPERATION_ACTION, OtherDeviceProfile.OPERATION_ACTION); + + constants.put(ACTION_NOTICE_COMMING_CALL, OtherDeviceProfile.ACTION_NOTICE_COMMING_CALL); + constants.put(ACTION_NOTICE_COMMING_CALL_STOP, OtherDeviceProfile.ACTION_NOTICE_COMMING_CALL_STOP); + constants.put(ACTION_NOTICE_NEW_MESSAGE, OtherDeviceProfile.ACTION_NOTICE_NEW_MESSAGE); + + constants.put(ACTION_SYNC_ACTIVITY, OtherDeviceProfile.ACTION_SYNC_ACTIVITY); + constants.put(ACTION_SYNC_ACTIVITY_DATA, OtherDeviceProfile.ACTION_SYNC_ACTIVITY_DATA); + constants.put(ACTION_SYNC_CONFIG, OtherDeviceProfile.ACTION_SYNC_CONFIG); + constants.put(ACTION_SYNC_HEALTH_DATA, OtherDeviceProfile.ACTION_SYNC_HEALTH_DATA); + constants.put(ACTION_SYNC_HEALTH_DATA_SPORT, OtherDeviceProfile.ACTION_SYNC_HEALTH_DATA_SPORT); + constants.put(ACTION_SYNC_HEALTH_DATA_SLEEP, OtherDeviceProfile.ACTION_SYNC_HEALTH_DATA_SLEEP); + constants.put(ACTION_SYNC_HEALTH_DATA_HEART_RATE, OtherDeviceProfile.ACTION_SYNC_HEALTH_DATA_HEART_RATE); + constants.put(ACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE, OtherDeviceProfile.ACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE); + + constants.put(OPERATION_STATUS, OtherDeviceProfile.OPERATION_STATUS); + constants.put(PROGRESS, OtherDeviceProfile.PROGRESS); + + constants.put("STATUS_START", 0); + constants.put("STATUS_STOP", 1); + constants.put("STATUS_DOING", 2); + constants.put("STATUS_SUCCESS", 3); + constants.put("STATUS_FAIL", 4); + constants.put("STATUS_CANCEL", 5); + + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AMProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AMProfileModule.java new file mode 100755 index 0000000..344ac85 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/AMProfileModule.java @@ -0,0 +1,312 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.AmProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by Jeepend on 15/11/2016. + */ +@ReactModule(name = "AMProfileModule") +public class AMProfileModule extends ReactContextBaseJavaModule { + private static final String modelName = "AMProfileModule"; + private static final String TAG = "AMProfileModule"; + + private static final String ACTION_ERROR_AM = "ACTION_ERROR_AM"; + private static final String ACTION_RESET_AM = "ACTION_RESET_AM"; + private static final String ACTION_USERID_AM = "ACTION_USERID_AM"; + private static final String ACTION_SET_USERID_SUCCESS_AM = "ACTION_SET_USERID_SUCCESS_AM"; + private static final String ACTION_SYNC_TIME_SUCCESS_AM = "ACTION_SYNC_TIME_SUCCESS_AM"; + private static final String ACTION_SET_USERINFO_SUCCESS_AM = "ACTION_SET_USERINFO_SUCCESS_AM"; + private static final String ACTION_GET_USERINFO_AM = "ACTION_GET_USERINFO_AM"; + private static final String ACTION_GET_ALARMNUM_AM = "ACTION_GET_ALARMNUM_AM"; + private static final String ACTION_GET_ALARMINFO_AM = "ACTION_GET_ALARMINFO_AM"; + private static final String ACTION_SET_ALARMINFO_SUCCESS_AM = "ACTION_SET_ALARMINFO_SUCCESS_AM"; + private static final String ACTION_DELETE_ALARM_SUCCESS_AM = "ACTION_DELETE_ALARM_SUCCESS_AM"; + private static final String ACTION_GET_ACTIVITY_REMIND_AM = "ACTION_GET_ACTIVITY_REMIND_AM"; + private static final String ACTION_SET_ACTIVITYREMIND_SUCCESS_AM = "ACTION_SET_ACTIVITYREMIND_SUCCESS_AM"; + private static final String ACTION_SYNC_ACTIVITY_DATA_AM = "ACTION_SYNC_ACTIVITY_DATA_AM"; + private static final String ACTION_SYNC_SLEEP_DATA_AM = "ACTION_SYNC_SLEEP_DATA_AM"; + private static final String ACTION_SYNC_STAGE_DATA_AM = "ACTION_SYNC_STAGE_DATA_AM"; + private static final String ACTION_QUERY_STATE_AM = "ACTION_QUERY_STATE_AM"; + private static final String ACTION_SYNC_REAL_DATA_AM = "ACTION_SYNC_REAL_DATA_AM"; + private static final String ACTION_SET_BMR_SUCCESS_AM = "ACTION_SET_BMR_SUCCESS_AM"; + private static final String ACTION_GET_SWIMINFO_AM = "ACTION_GET_SWIMINFO_AM"; + private static final String ACTION_SET_SWIMINFO_AM = "ACTION_SET_SWIMINFO_AM"; + private static final String ACTION_GET_RANDOM_AM = "ACTION_GET_RANDOM_AM"; + private static final String ACTION_SET_HOUR_MODE_SUCCESS_AM = "ACTION_SET_HOUR_MODE_SUCCESS_AM"; + private static final String ACTION_GET_HOUR_MODE_AM = "ACTION_GET_HOUR_MODE_AM"; + private static final String ACTION_SET_DEVICE_MODE_AM = "ACTION_SET_DEVICE_MODE_AM"; + private static final String ACTION_CLOUD_BINDING_AM_SUCCESS = "ACTION_CLOUD_BINDING_AM_SUCCESS"; + private static final String ACTION_CLOUD_BINDING_AM_FAIL = "ACTION_CLOUD_BINDING_AM_FAIL"; + private static final String ACTION_CLOUD_UNBINDING_AM_SUCCESS = "ACTION_CLOUD_UNBINDING_AM_SUCCESS"; + private static final String ACTION_CLOUD_UNBINDING_AM_FAIL = "ACTION_CLOUD_UNBINDING_AM_FAIL"; + private static final String ACTION_CLOUD_SEARCH_AM = "ACTION_CLOUD_SEARCH_AM"; + private static final String ACTION_CLOUD_SEARCH_FAIL_AM = "ACTION_CLOUD_SEARCH_FAIL_AM"; + private static final String ACTION_SET_PICTURE_SUCCESS_AM = "ACTION_SET_PICTURE_SUCCESS_AM"; + private static final String ACTION_GET_PICTURE_AM = "ACTION_GET_PICTURE_AM"; + + private static final String ERROR_NUM_AM = "ERROR_NUM_AM"; + private static final String ERROR_ID_ILLEGAL_ARGUMENT = "ERROR_ID_ILLEGAL_ARGUMENT"; + private static final String ERROR_ID_VERSION_NOT_SUPPORT = "ERROR_ID_VERSION_NOT_SUPPORT"; + private static final String ERROR_DESCRIPTION_AM = "ERROR_DESCRIPTION_AM"; + private static final String RESET_AM = "RESET_AM"; + private static final String USERID_AM = "USERID_AM"; + private static final String GET_USER_AGE_AM = "GET_USER_AGE_AM"; + private static final String GET_USER_STEP_AM = "GET_USER_STEP_AM"; + private static final String GET_USER_HEIGHT_AM = "GET_USER_HEIGHT_AM"; + private static final String GET_USER_SEX_AM = "GET_USER_SEX_AM"; + private static final String GET_USER_WEIGHT_AM = "GET_USER_WEIGHT_AM"; + private static final String GET_USER_UNIT_AM = "GET_USER_UNIT_AM"; + private static final String GET_USER_TARGET1_AM = "GET_USER_TARGET1_AM"; + private static final String GET_USER_TARGET2_AM = "GET_USER_TARGET2_AM"; + private static final String GET_USER_TARGET3_AM = "GET_USER_TARGET3_AM"; + private static final String GET_USER_SWIMTARGET_AM = "GET_USER_SWIMTARGET_AM"; + private static final String GET_ALARMNUM_AM = "GET_ALARMNUM_AM"; + private static final String GET_ALARMNUM_ID_AM = "GET_ALARMNUM_ID_AM"; + private static final String GET_ALARM_CLOCK_DETAIL = "GET_ALARM_CLOCK_DETAIL"; + private static final String GET_ALARM_ID_AM = "GET_ALARM_ID_AM"; + private static final String GET_ALARM_TIME_AM = "GET_ALARM_TIME_AM"; + private static final String GET_ALARM_ISREPEAT_AM = "GET_ALARM_ISREPEAT_AM"; + private static final String GET_ALARM_WEEK_AM = "GET_ALARM_WEEK_AM"; + private static final String GET_ALARM_WEEK_SUNDAY_AM = "GET_ALARM_WEEK_SUNDAY_AM"; + private static final String GET_ALARM_WEEK_MONDAY_AM = "GET_ALARM_WEEK_MONDAY_AM"; + private static final String GET_ALARM_WEEK_TUESDAY_AM = "GET_ALARM_WEEK_TUESDAY_AM"; + private static final String GET_ALARM_WEEK_WEDNESDAY_AM = "GET_ALARM_WEEK_WEDNESDAY_AM"; + private static final String GET_ALARM_WEEK_THURSDAY_AM = "GET_ALARM_WEEK_THURSDAY_AM"; + private static final String GET_ALARM_WEEK_FRIDAY_AM = "GET_ALARM_WEEK_FRIDAY_AM"; + private static final String GET_ALARM_WEEK_SATURDAY_AM = "GET_ALARM_WEEK_SATURDAY_AM"; + private static final String GET_ALARM_ISON_AM = "GET_ALARM_ISON_AM"; + private static final String GET_ACTIVITY_REMIND_TIME_AM = "GET_ACTIVITY_REMIND_TIME_AM"; + private static final String GET_ACTIVITY_REMIND_ISON_AM = "GET_ACTIVITY_REMIND_ISON_AM"; + private static final String SYNC_ACTIVITY_DATA_AM = "SYNC_ACTIVITY_DATA_AM"; + private static final String SYNC_ACTIVITY_DATA_TIME_AM = "SYNC_ACTIVITY_DATA_TIME_AM"; + private static final String SYNC_ACTIVITY_DATA_STEP_AM = "SYNC_ACTIVITY_DATA_STEP_AM"; + private static final String SYNC_ACTIVITY_DATA_STEP_LENGTH_AM = "SYNC_ACTIVITY_DATA_STEP_LENGTH_AM"; + private static final String SYNC_ACTIVITY_DATA_CALORIE_AM = "SYNC_ACTIVITY_DATA_CALORIE_AM"; + private static final String SYNC_ACTIVITY_EACH_DATA_AM = "SYNC_ACTIVITY_EACH_DATA_AM"; + private static final String SYNC_SLEEP_DATA_AM = "SYNC_SLEEP_DATA_AM"; + private static final String SYNC_SLEEP_DATA_TIME_AM = "SYNC_SLEEP_DATA_TIME_AM"; + private static final String SYNC_SLEEP_DATA_LEVEL_AM = "SYNC_SLEEP_DATA_LEVEL_AM"; + private static final String SYNC_SLEEP_EACH_DATA_AM = "SYNC_SLEEP_EACH_DATA_AM"; + private static final String SYNC_STAGE_DATA_AM = "SYNC_STAGE_DATA_AM"; + private static final String SYNC_STAGE_DATA_TYPE_AM = "SYNC_STAGE_DATA_TYPE_AM"; + private static final String SYNC_STAGE_DATA_TYPE_WORKOUT_AM = "SYNC_STAGE_DATA_TYPE_WORKOUT_AM"; + private static final String SYNC_STAGE_DATA_TYPE_SLEEP_AM = "SYNC_STAGE_DATA_TYPE_SLEEP_AM"; + private static final String SYNC_STAGE_DATA_TYPE_SWIM_AM = "SYNC_STAGE_DATA_TYPE_SWIM_AM"; + private static final String SYNC_STAGE_DATA_TYPE_PAGE_VIEW_SUMMARY = "SYNC_STAGE_DATA_TYPE_PAGE_VIEW_SUMMARY"; + private static final String SYNC_STAGE_DATA_STOP_TIME_AM = "SYNC_STAGE_DATA_STOP_TIME_AM"; + private static final String SYNC_STAGE_DATA_USED_TIME_AM = "SYNC_STAGE_DATA_USED_TIME_AM"; + private static final String SYNC_STAGE_DATA_WORKOUT_STEP_AM = "SYNC_STAGE_DATA_WORKOUT_STEP_AM"; + private static final String SYNC_STAGE_DATA_DISTANCE_AM = "SYNC_STAGE_DATA_DISTANCE_AM"; + private static final String SYNC_STAGE_DATA_CALORIE_AM = "SYNC_STAGE_DATA_CALORIE_AM"; + private static final String SYNC_STAGE_DATA_SLEEP_EFFICIENCY_AM = "SYNC_STAGE_DATA_SLEEP_EFFICIENCY_AM"; + private static final String SYNC_STAGE_DATA_SLEEP_IS50MIN_AM = "SYNC_STAGE_DATA_SLEEP_IS50MIN_AM"; + private static final String SYNC_STAGE_DATA_SWIM_STROKE_AM = "SYNC_STAGE_DATA_SWIM_STROKE_AM"; + private static final String SYNC_STAGE_DATA_SWIM_PULL_TIMES_AM = "SYNC_STAGE_DATA_SWIM_PULL_TIMES_AM"; + private static final String SYNC_STAGE_DATA_SWIM_TURNS_AM = "SYNC_STAGE_DATA_SWIM_TURNS_AM"; + private static final String SYNC_STAGE_DATA_SWIMPOOL_LENGTH_AM = "SYNC_STAGE_DATA_SWIMPOOL_LENGTH_AM"; + private static final String SYNC_STAGE_DATA_SWIM_CUTINDIF_AM = "SYNC_STAGE_DATA_SWIM_CUTINDIF_AM"; + private static final String SYNC_STAGE_DATA_SWIM_CUTOUTDIF_AM = "SYNC_STAGE_DATA_SWIM_CUTOUTDIF_AM"; + private static final String SYNC_STAGE_DATA_SWIM_PROCESSFLAG_AM = "SYNC_STAGE_DATA_SWIM_PROCESSFLAG_AM"; + private static final String SYNC_STAGE_DATA_VIEW_SUMMARY_DATE_AM = "SYNC_STAGE_DATA_VIEW_SUMMARY_DATE_AM"; + private static final String SYNC_STAGE_DATA_VIEW_SUMMARY_STEP_AM = "SYNC_STAGE_DATA_VIEW_SUMMARY_STEP_AM"; + private static final String SYNC_STAGE_DATA_VIEW_SUMMARY_DISTANCE_AM = "SYNC_STAGE_DATA_VIEW_SUMMARY_DISTANCE_AM"; + private static final String SYNC_STAGE_DATA_VIEW_SUMMARY_CALORIE_AM = "SYNC_STAGE_DATA_VIEW_SUMMARY_CALORIE_AM"; + private static final String SYNC_STAGE_DATA_VIEW_SUMMARY_TARGET_AM = "SYNC_STAGE_DATA_VIEW_SUMMARY_TARGET_AM"; + private static final String SYNC_STAGE_DATA_VIEW_SUMMARY_SWIM_AM = "SYNC_STAGE_DATA_VIEW_SUMMARY_SWIM_AM"; + private static final String QUERY_STATE_AM = "QUERY_STATE_AM"; + private static final String QUERY_BATTERY_AM = "QUERY_BATTERY_AM"; + private static final String SYNC_REAL_STEP_AM = "SYNC_REAL_STEP_AM"; + private static final String SYNC_REAL_CALORIE_AM = "SYNC_REAL_CALORIE_AM"; + private static final String SYNC_REAL_TOTALCALORIE_AM = "SYNC_REAL_TOTALCALORIE_AM"; + private static final String GET_SWIMLANE_LENGTH_AM = "GET_SWIMLANE_LENGTH_AM"; + private static final String GET_SWIM_SWITCH_AM = "GET_SWIM_SWITCH_AM"; + private static final String GET_SWIM_CUTOUT_HOUR_AM = "GET_SWIM_CUTOUT_HOUR_AM"; + private static final String GET_SWIM_CUTOUT_MINUTE_AM = "GET_SWIM_CUTOUT_MINUTE_AM"; + private static final String GET_SWIM_UNIT_AM = "GET_SWIM_UNIT_AM"; + private static final String GET_RANDOM_AM = "GET_RANDOM_AM"; + private static final String AM_SWITCH_OPEN = "AM_SWITCH_OPEN"; + private static final String AM_SWITCH_CLOSE = "AM_SWITCH_CLOSE"; + private static final String AM_SWITCH_REPEAT = "AM_SWITCH_REPEAT"; + private static final String AM_SEITCH_NOT_REPEAT = "AM_SEITCH_NOT_REPEAT"; + private static final String AM_SET_MALE = "AM_SET_MALE"; + private static final String AM_SET_FEMALE = "AM_SET_FEMALE"; + private static final String AM_SET_UNIT_METRIC = "AM_SET_UNIT_METRIC"; + private static final String AM_SET_UNIT_IMPERIAL_STANDARD = "AM_SET_UNIT_IMPERIAL_STANDARD"; + private static final String AM_SET_12_HOUR_MODE = "AM_SET_12_HOUR_MODE"; + private static final String AM_SET_24_HOUR_MODE = "AM_SET_24_HOUR_MODE"; + private static final String AM_SET_EUROPE_12_HOUR_MODE = "AM_SET_EUROPE_12_HOUR_MODE"; + private static final String AM_SET_EUROPE_24_HOUR_MODE = "AM_SET_EUROPE_24_HOUR_MODE"; + private static final String AM_SET_EXCEPT_EUROPE_12_HOUR_MODE = "AM_SET_EXCEPT_EUROPE_12_HOUR_MODE"; + private static final String AM_SET_EXCEPT_EUROPE_24_HOUR_MODE = "AM_SET_EXCEPT_EUROPE_24_HOUR_MODE"; + private static final String GET_HOUR_MODE_AM = "GET_HOUR_MODE_AM"; + private static final String AM_DEVICE_MODE_SLEEP = "AM_DEVICE_MODE_SLEEP"; + private static final String AM_DEVICE_MODE_ACTIVITY = "AM_DEVICE_MODE_ACTIVITY"; + private static final String AM_DEVICE_MODE_FLIGHT = "AM_DEVICE_MODE_FLIGHT"; + private static final String AM_DEVICE_MODE_DRIVING = "AM_DEVICE_MODE_DRIVING"; + private static final String CLOUD_SEARCH_AM = "CLOUD_SEARCH_AM"; + private static final String DATAID = "DATAID"; + private static final String GET_PICTURE_AM = "GET_PICTURE_AM"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + + public AMProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_ERROR_AM, AmProfile.ACTION_ERROR_AM); + constants.put(ACTION_RESET_AM, AmProfile.ACTION_RESET_AM); + constants.put(ACTION_USERID_AM, AmProfile.ACTION_USERID_AM); + constants.put(ACTION_SET_USERID_SUCCESS_AM, AmProfile.ACTION_SET_USERID_SUCCESS_AM); + constants.put(ACTION_SYNC_TIME_SUCCESS_AM, AmProfile.ACTION_SYNC_TIME_SUCCESS_AM); + constants.put(ACTION_SET_USERINFO_SUCCESS_AM, AmProfile.ACTION_SET_USERINFO_SUCCESS_AM); + constants.put(ACTION_GET_USERINFO_AM, AmProfile.ACTION_GET_USERINFO_AM); + constants.put(ACTION_GET_ALARMNUM_AM, AmProfile.ACTION_GET_ALARMNUM_AM); + constants.put(ACTION_GET_ALARMINFO_AM, AmProfile.ACTION_GET_ALARMINFO_AM); + constants.put(ACTION_SET_ALARMINFO_SUCCESS_AM, AmProfile.ACTION_SET_ALARMINFO_SUCCESS_AM); + constants.put(ACTION_DELETE_ALARM_SUCCESS_AM, AmProfile.ACTION_DELETE_ALARM_SUCCESS_AM); + constants.put(ACTION_GET_ACTIVITY_REMIND_AM, AmProfile.ACTION_GET_ACTIVITY_REMIND_AM); + constants.put(ACTION_SET_ACTIVITYREMIND_SUCCESS_AM, AmProfile.ACTION_SET_ACTIVITYREMIND_SUCCESS_AM); + constants.put(ACTION_SYNC_ACTIVITY_DATA_AM, AmProfile.ACTION_SYNC_ACTIVITY_DATA_AM); + constants.put(ACTION_SYNC_SLEEP_DATA_AM, AmProfile.ACTION_SYNC_SLEEP_DATA_AM); + constants.put(ACTION_SYNC_STAGE_DATA_AM, AmProfile.ACTION_SYNC_STAGE_DATA_AM); + constants.put(ACTION_QUERY_STATE_AM, AmProfile.ACTION_QUERY_STATE_AM); + constants.put(ACTION_SYNC_REAL_DATA_AM, AmProfile.ACTION_SYNC_REAL_DATA_AM); + constants.put(ACTION_SET_BMR_SUCCESS_AM, AmProfile.ACTION_SET_BMR_SUCCESS_AM); + constants.put(ACTION_GET_SWIMINFO_AM, AmProfile.ACTION_GET_SWIMINFO_AM); + constants.put(ACTION_SET_SWIMINFO_AM, AmProfile.ACTION_SET_SWIMINFO_AM); + constants.put(ACTION_GET_RANDOM_AM, AmProfile.ACTION_GET_RANDOM_AM); + constants.put(ACTION_SET_HOUR_MODE_SUCCESS_AM, AmProfile.ACTION_SET_HOUR_MODE_SUCCESS_AM); + constants.put(ACTION_GET_HOUR_MODE_AM, AmProfile.ACTION_GET_HOUR_MODE_AM); + constants.put(ACTION_SET_DEVICE_MODE_AM, AmProfile.ACTION_SET_DEVICE_MODE_AM); + constants.put(ACTION_CLOUD_BINDING_AM_SUCCESS, AmProfile.ACTION_CLOUD_BINDING_AM_SUCCESS); + constants.put(ACTION_CLOUD_BINDING_AM_FAIL, AmProfile.ACTION_CLOUD_BINDING_AM_FAIL); + constants.put(ACTION_CLOUD_UNBINDING_AM_SUCCESS, AmProfile.ACTION_CLOUD_UNBINDING_AM_SUCCESS); + constants.put(ACTION_CLOUD_UNBINDING_AM_FAIL, AmProfile.ACTION_CLOUD_UNBINDING_AM_FAIL); + constants.put(ACTION_CLOUD_SEARCH_AM, AmProfile.ACTION_CLOUD_SEARCH_AM); + constants.put(ACTION_CLOUD_SEARCH_FAIL_AM, AmProfile.ACTION_CLOUD_SEARCH_FAIL_AM); + constants.put(ACTION_SET_PICTURE_SUCCESS_AM, AmProfile.ACTION_SET_PICTURE_SUCCESS_AM); + constants.put(ACTION_GET_PICTURE_AM, AmProfile.ACTION_GET_PICTURE_AM); + + constants.put(ERROR_NUM_AM, AmProfile.ERROR_NUM_AM); + constants.put(ERROR_ID_ILLEGAL_ARGUMENT, AmProfile.ERROR_ID_ILLEGAL_ARGUMENT); + constants.put(ERROR_ID_VERSION_NOT_SUPPORT, AmProfile.ERROR_ID_VERSION_NOT_SUPPORT); + constants.put(ERROR_DESCRIPTION_AM, AmProfile.ERROR_DESCRIPTION_AM); + constants.put(RESET_AM, AmProfile.RESET_AM); + constants.put(USERID_AM, AmProfile.USERID_AM); + constants.put(GET_USER_AGE_AM, AmProfile.GET_USER_AGE_AM); + constants.put(GET_USER_STEP_AM, AmProfile.GET_USER_STEP_AM); + constants.put(GET_USER_HEIGHT_AM, AmProfile.GET_USER_HEIGHT_AM); + constants.put(GET_USER_SEX_AM, AmProfile.GET_USER_SEX_AM); + constants.put(GET_USER_WEIGHT_AM, AmProfile.GET_USER_WEIGHT_AM); + constants.put(GET_USER_UNIT_AM, AmProfile.GET_USER_UNIT_AM); + constants.put(GET_USER_TARGET1_AM, AmProfile.GET_USER_TARGET1_AM); + constants.put(GET_USER_TARGET2_AM, AmProfile.GET_USER_TARGET2_AM); + constants.put(GET_USER_TARGET3_AM, AmProfile.GET_USER_TARGET3_AM); + constants.put(GET_USER_SWIMTARGET_AM, AmProfile.GET_USER_SWIMTARGET_AM); + constants.put(GET_ALARMNUM_AM, AmProfile.GET_ALARMNUM_AM); + constants.put(GET_ALARMNUM_ID_AM, AmProfile.GET_ALARMNUM_ID_AM); + constants.put(GET_ALARM_CLOCK_DETAIL, AmProfile.GET_ALARM_CLOCK_DETAIL); + constants.put(GET_ALARM_ID_AM, AmProfile.GET_ALARM_ID_AM); + constants.put(GET_ALARM_TIME_AM, AmProfile.GET_ALARM_TIME_AM); + constants.put(GET_ALARM_ISREPEAT_AM, AmProfile.GET_ALARM_ISREPEAT_AM); + constants.put(GET_ALARM_WEEK_AM, AmProfile.GET_ALARM_WEEK_AM); + constants.put(GET_ALARM_WEEK_SUNDAY_AM, AmProfile.GET_ALARM_WEEK_SUNDAY_AM); + constants.put(GET_ALARM_WEEK_MONDAY_AM, AmProfile.GET_ALARM_WEEK_MONDAY_AM); + constants.put(GET_ALARM_WEEK_TUESDAY_AM, AmProfile.GET_ALARM_WEEK_TUESDAY_AM); + constants.put(GET_ALARM_WEEK_WEDNESDAY_AM, AmProfile.GET_ALARM_WEEK_WEDNESDAY_AM); + constants.put(GET_ALARM_WEEK_THURSDAY_AM, AmProfile.GET_ALARM_WEEK_THURSDAY_AM); + constants.put(GET_ALARM_WEEK_FRIDAY_AM, AmProfile.GET_ALARM_WEEK_FRIDAY_AM); + constants.put(GET_ALARM_WEEK_SATURDAY_AM, AmProfile.GET_ALARM_WEEK_SATURDAY_AM); + constants.put(GET_ALARM_ISON_AM, AmProfile.GET_ALARM_ISON_AM); + constants.put(GET_ACTIVITY_REMIND_TIME_AM, AmProfile.GET_ACTIVITY_REMIND_TIME_AM); + constants.put(GET_ACTIVITY_REMIND_ISON_AM, AmProfile.GET_ACTIVITY_REMIND_ISON_AM); + constants.put(SYNC_ACTIVITY_DATA_AM, AmProfile.SYNC_ACTIVITY_DATA_AM); + constants.put(SYNC_ACTIVITY_DATA_TIME_AM, AmProfile.SYNC_ACTIVITY_DATA_TIME_AM); + constants.put(SYNC_ACTIVITY_DATA_STEP_AM, AmProfile.SYNC_ACTIVITY_DATA_STEP_AM); + constants.put(SYNC_ACTIVITY_DATA_STEP_LENGTH_AM, AmProfile.SYNC_ACTIVITY_DATA_STEP_LENGTH_AM); + constants.put(SYNC_ACTIVITY_DATA_CALORIE_AM, AmProfile.SYNC_ACTIVITY_DATA_CALORIE_AM); + constants.put(SYNC_ACTIVITY_EACH_DATA_AM, AmProfile.SYNC_ACTIVITY_EACH_DATA_AM); + constants.put(SYNC_SLEEP_DATA_AM, AmProfile.SYNC_SLEEP_DATA_AM); + constants.put(SYNC_SLEEP_DATA_TIME_AM, AmProfile.SYNC_SLEEP_DATA_TIME_AM); + constants.put(SYNC_SLEEP_DATA_LEVEL_AM, AmProfile.SYNC_SLEEP_DATA_LEVEL_AM); + constants.put(SYNC_SLEEP_EACH_DATA_AM, AmProfile.SYNC_SLEEP_EACH_DATA_AM); + constants.put(SYNC_STAGE_DATA_AM, AmProfile.SYNC_STAGE_DATA_AM); + constants.put(SYNC_STAGE_DATA_TYPE_AM, AmProfile.SYNC_STAGE_DATA_TYPE_AM); + constants.put(SYNC_STAGE_DATA_TYPE_WORKOUT_AM, AmProfile.SYNC_STAGE_DATA_TYPE_WORKOUT_AM); + constants.put(SYNC_STAGE_DATA_TYPE_SLEEP_AM, AmProfile.SYNC_STAGE_DATA_TYPE_SLEEP_AM); + constants.put(SYNC_STAGE_DATA_TYPE_SWIM_AM, AmProfile.SYNC_STAGE_DATA_TYPE_SWIM_AM); + constants.put(SYNC_STAGE_DATA_TYPE_PAGE_VIEW_SUMMARY, AmProfile.SYNC_STAGE_DATA_TYPE_PAGE_VIEW_SUMMARY); + constants.put(SYNC_STAGE_DATA_STOP_TIME_AM, AmProfile.SYNC_STAGE_DATA_STOP_TIME_AM); + constants.put(SYNC_STAGE_DATA_USED_TIME_AM, AmProfile.SYNC_STAGE_DATA_USED_TIME_AM); + constants.put(SYNC_STAGE_DATA_WORKOUT_STEP_AM, AmProfile.SYNC_STAGE_DATA_WORKOUT_STEP_AM); + constants.put(SYNC_STAGE_DATA_DISTANCE_AM, AmProfile.SYNC_STAGE_DATA_DISTANCE_AM); + constants.put(SYNC_STAGE_DATA_CALORIE_AM, AmProfile.SYNC_STAGE_DATA_CALORIE_AM); + constants.put(SYNC_STAGE_DATA_SLEEP_EFFICIENCY_AM, AmProfile.SYNC_STAGE_DATA_SLEEP_EFFICIENCY_AM); + constants.put(SYNC_STAGE_DATA_SLEEP_IS50MIN_AM, AmProfile.SYNC_STAGE_DATA_SLEEP_IS50MIN_AM); + constants.put(SYNC_STAGE_DATA_SWIM_STROKE_AM, AmProfile.SYNC_STAGE_DATA_SWIM_STROKE_AM); + constants.put(SYNC_STAGE_DATA_SWIM_PULL_TIMES_AM, AmProfile.SYNC_STAGE_DATA_SWIM_PULL_TIMES_AM); + constants.put(SYNC_STAGE_DATA_SWIM_TURNS_AM, AmProfile.SYNC_STAGE_DATA_SWIM_TURNS_AM); + constants.put(SYNC_STAGE_DATA_SWIMPOOL_LENGTH_AM, AmProfile.SYNC_STAGE_DATA_SWIMPOOL_LENGTH_AM); + constants.put(SYNC_STAGE_DATA_SWIM_CUTINDIF_AM, AmProfile.SYNC_STAGE_DATA_SWIM_CUTINDIF_AM); + constants.put(SYNC_STAGE_DATA_SWIM_CUTOUTDIF_AM, AmProfile.SYNC_STAGE_DATA_SWIM_CUTOUTDIF_AM); + constants.put(SYNC_STAGE_DATA_SWIM_PROCESSFLAG_AM, AmProfile.SYNC_STAGE_DATA_SWIM_PROCESSFLAG_AM); + constants.put(SYNC_STAGE_DATA_VIEW_SUMMARY_DATE_AM, AmProfile.SYNC_STAGE_DATA_VIEW_SUMMARY_DATE_AM); + constants.put(SYNC_STAGE_DATA_VIEW_SUMMARY_STEP_AM, AmProfile.SYNC_STAGE_DATA_VIEW_SUMMARY_STEP_AM); + constants.put(SYNC_STAGE_DATA_VIEW_SUMMARY_DISTANCE_AM, AmProfile.SYNC_STAGE_DATA_VIEW_SUMMARY_DISTANCE_AM); + constants.put(SYNC_STAGE_DATA_VIEW_SUMMARY_CALORIE_AM, AmProfile.SYNC_STAGE_DATA_VIEW_SUMMARY_CALORIE_AM); + constants.put(SYNC_STAGE_DATA_VIEW_SUMMARY_TARGET_AM, AmProfile.SYNC_STAGE_DATA_VIEW_SUMMARY_TARGET_AM); + constants.put(SYNC_STAGE_DATA_VIEW_SUMMARY_SWIM_AM, AmProfile.SYNC_STAGE_DATA_VIEW_SUMMARY_SWIM_AM); + constants.put(QUERY_STATE_AM, AmProfile.QUERY_STATE_AM); + constants.put(QUERY_BATTERY_AM, AmProfile.QUERY_BATTERY_AM); + constants.put(SYNC_REAL_STEP_AM, AmProfile.SYNC_REAL_STEP_AM); + constants.put(SYNC_REAL_CALORIE_AM, AmProfile.SYNC_REAL_CALORIE_AM); + constants.put(SYNC_REAL_TOTALCALORIE_AM, AmProfile.SYNC_REAL_TOTALCALORIE_AM); + constants.put(GET_SWIMLANE_LENGTH_AM, AmProfile.GET_SWIMLANE_LENGTH_AM); + constants.put(GET_SWIM_SWITCH_AM, AmProfile.GET_SWIM_SWITCH_AM); + constants.put(GET_SWIM_CUTOUT_HOUR_AM, AmProfile.GET_SWIM_CUTOUT_HOUR_AM); + constants.put(GET_SWIM_CUTOUT_MINUTE_AM, AmProfile.GET_SWIM_CUTOUT_MINUTE_AM); + constants.put(GET_SWIM_UNIT_AM, AmProfile.GET_SWIM_UNIT_AM); + constants.put(GET_RANDOM_AM, AmProfile.GET_RANDOM_AM); + constants.put(AM_SWITCH_OPEN, AmProfile.AM_SWITCH_OPEN); + constants.put(AM_SWITCH_CLOSE, AmProfile.AM_SWITCH_CLOSE); + constants.put(AM_SWITCH_REPEAT, AmProfile.AM_SWITCH_REPEAT); + constants.put(AM_SEITCH_NOT_REPEAT, AmProfile.AM_SEITCH_NOT_REPEAT); + constants.put(AM_SET_MALE, AmProfile.AM_SET_MALE); + constants.put(AM_SET_FEMALE, AmProfile.AM_SET_FEMALE); + constants.put(AM_SET_UNIT_METRIC, AmProfile.AM_SET_UNIT_METRIC); + constants.put(AM_SET_UNIT_IMPERIAL_STANDARD, AmProfile.AM_SET_UNIT_IMPERIAL_STANDARD); + constants.put(AM_SET_12_HOUR_MODE, AmProfile.AM_SET_12_HOUR_MODE); + constants.put(AM_SET_24_HOUR_MODE, AmProfile.AM_SET_24_HOUR_MODE); + constants.put(AM_SET_EUROPE_12_HOUR_MODE, AmProfile.AM_SET_EUROPE_12_HOUR_MODE); + constants.put(AM_SET_EUROPE_24_HOUR_MODE, AmProfile.AM_SET_EUROPE_24_HOUR_MODE); + constants.put(AM_SET_EXCEPT_EUROPE_12_HOUR_MODE, AmProfile.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE); + constants.put(AM_SET_EXCEPT_EUROPE_24_HOUR_MODE, AmProfile.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE); + constants.put(GET_HOUR_MODE_AM, AmProfile.GET_HOUR_MODE_AM); + constants.put(AM_DEVICE_MODE_SLEEP, AmProfile.AM_DEVICE_MODE_SLEEP); + constants.put(AM_DEVICE_MODE_ACTIVITY, AmProfile.AM_DEVICE_MODE_ACTIVITY); + constants.put(AM_DEVICE_MODE_FLIGHT, AmProfile.AM_DEVICE_MODE_FLIGHT); + constants.put(AM_DEVICE_MODE_DRIVING, AmProfile.AM_DEVICE_MODE_DRIVING); + constants.put(CLOUD_SEARCH_AM, AmProfile.CLOUD_SEARCH_AM); + constants.put(DATAID, AmProfile.DATAID); + constants.put(GET_PICTURE_AM, AmProfile.GET_PICTURE_AM); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1Module.java new file mode 100755 index 0000000..6b19583 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1Module.java @@ -0,0 +1,116 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg1Control; +import com.ihealth.communication.control.Bg1Profile; +import com.ihealth.communication.utils.Log; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by zhaoyongguang on 29/11/2016. + */ +@ReactModule(name = "BG1Module") +public class BG1Module extends iHealthBaseModule { + private static final String TAG = BG1Module.class.getSimpleName(); + private static final String moduleName = BG1Module.class.getSimpleName(); + private static final String EVENT_NOTIFY = "event_notify_bg1"; + + public BG1Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return moduleName; + } + +// @ReactMethod +// public void init(String userName, int filter, boolean showUI) { +// //Bg1Control.getInstance().init(getReactApplicationContext(), userName, filter, showUI); +// } +// +// @ReactMethod +// public void connect() { +// //Bg1Control.getInstance().connect(); +// } +// +// @ReactMethod +// public void disconnect() { +// //Bg1Control.getInstance().disconnect(); +// } + + @ReactMethod + public void sendCode(String QRCode, int stripType, int measureType) { + Bg1Control.getInstance().sendCode(QRCode, stripType, measureType); + } + + @ReactMethod + public void getBottleInfoFromQR(String QRCode) { + String result = Bg1Control.getBottleInfoFromQR(QRCode); + Log.v(TAG, "code info = " + result); + + JSONObject resultJsonStr = new JSONObject(); + + try { + JSONArray jsonArray = new JSONObject(result).getJSONArray("bottleInfo"); + resultJsonStr.put("strip_num", ((JSONObject) jsonArray.get(0)).getString("stripNum")); + resultJsonStr.put("expire_time", ((JSONObject) jsonArray.get(0)).getString("overDate")); + resultJsonStr.put("bottle_id", ((JSONObject) jsonArray.get(0)).getString("bottleId")); + + } catch (JSONException e) { + try { + resultJsonStr.put("description","QRCode format error"); + } catch (JSONException e1) { + e1.printStackTrace(); + } + } + + + WritableMap params = Arguments.createMap(); + params.putString("action", "action_code_analysis"); + if (!TextUtils.isEmpty(resultJsonStr.toString())) { + Utils.jsonToMap(resultJsonStr.toString(), params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + Log.v(TAG, "action ----> " + action ); + Log.v(TAG, "message ----> " + message ); + } + + /** + * @return a map of constants this module exports to JS. Supports JSON types. + */ + @Nullable + @Override + public Map getConstants() { + final Map constants = new HashMap<>(); + constants.put("Event_Notify", EVENT_NOTIFY); + + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1ProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1ProfileModule.java new file mode 100755 index 0000000..f715dc4 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1ProfileModule.java @@ -0,0 +1,176 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg1Profile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by zhaoyongguang on 07/12/2016. + */ +@ReactModule(name = "BG1ProfileModule") +public class BG1ProfileModule extends ReactContextBaseJavaModule { + private static final String name = BG1ProfileModule.class.getSimpleName(); + /** + * Callback indicating the send code result of bg1 device. + *
    + * KeyList: + *
      + *
    • + * {@link #BG1_SENDCODE_RESULT} + *
    • + */ + private static final String ACTION_BG1_SENDCODE_RESULT = "ACTION_BG1_SENDCODE_RESULT"; + + /** + * The send code result of bg1 device. + *

      + * value : 0 success; other error + */ + private static final String BG1_SENDCODE_RESULT = "BG1_SENDCODE_RESULT"; + + /** + * Callback indicating the error of Bg1 device. + *

        + * KeyList: + *
          + *
        • + * {@link #BG1_MEASURE_ERROR} + *
        • + *
        + * eg. {"error_num_for_bg1":0} + *
      + */ + private static final String ACTION_BG1_MEASURE_ERROR = "ACTION_BG1_MEASURE_ERROR"; + + /** + * Flag Error number of Bg1 device. + *

      Error code and Description

      + *

      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:Communication error,resend the code to repeat the test. {@link Bg1Control#sendCode(String)}

      + *

      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,rescan the code to repeat the test.

      + *

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

      + *

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

      + *

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

      + *

      12:Glucose test result is low.

      + *

      13:Glucose test result is high.

      + *

      400:Parameters out of range.

      + *

      401:Dolby is on ,please turn it off.

      + */ + private static final String BG1_MEASURE_ERROR = "BG1_MEASURE_ERROR"; + + /** + * Callback indicating the strip in action. + */ + private static final String ACTION_BG1_MEASURE_STRIP_IN = "ACTION_BG1_MEASURE_STRIP_IN"; + + /** + * Callback indicating the get blood action. + */ + private static final String ACTION_BG1_MEASURE_GET_BLOOD = "ACTION_BG1_MEASURE_GET_BLOOD"; + + /** + * Callback indicating the measure result. + *
        + * KeyList: + *
          + *
        • + * {@link #BG1_MEASURE_RESULT} + *
        • + */ + private static final String ACTION_BG1_MEASURE_RESULT = "ACTION_BG1_MEASURE_RESULT"; + + /** + * The measure result + *

          + * Range : 20-600 mg/dL + */ + private static final String BG1_MEASURE_RESULT = "BG1_MEASURE_RESULT"; + + /** + * Callback indicating the strip out action. + */ + private static final String ACTION_BG1_MEASURE_STRIP_OUT = "ACTION_BG1_MEASURE_STRIP_OUT"; + + /** + * Callback indicating the Bg1 device get in standby mode. + */ + private static final String ACTION_BG1_MEASURE_STANDBY = "ACTION_BG1_MEASURE_STANDBY"; + + /** + * the data id + */ + 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"; + + /** + * @return the name of this module. This will be the name used to {@code require()} this module + * from javascript. + */ + @Override + public String getName() { + return name; + } + + public BG1ProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + /** + * @return a map of constants this module exports to JS. Supports JSON types. + */ + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_BG1_SENDCODE_RESULT, Bg1Profile.ACTION_BG1_SENDCODE_RESULT); + constants.put(BG1_SENDCODE_RESULT, Bg1Profile.BG1_SENDCODE_RESULT); + constants.put(ACTION_BG1_MEASURE_ERROR, Bg1Profile.ACTION_BG1_MEASURE_ERROR); + constants.put(BG1_MEASURE_ERROR, Bg1Profile.BG1_MEASURE_ERROR); + constants.put(ACTION_BG1_MEASURE_STRIP_IN, Bg1Profile.ACTION_BG1_MEASURE_STRIP_IN); + constants.put(ACTION_BG1_MEASURE_GET_BLOOD, Bg1Profile.ACTION_BG1_MEASURE_GET_BLOOD); + constants.put(ACTION_BG1_MEASURE_RESULT, Bg1Profile.ACTION_BG1_MEASURE_RESULT); + constants.put(BG1_MEASURE_RESULT, Bg1Profile.BG1_MEASURE_RESULT); + constants.put(ACTION_BG1_MEASURE_STRIP_OUT, Bg1Profile.ACTION_BG1_MEASURE_STRIP_OUT); + constants.put(ACTION_BG1_MEASURE_STANDBY, Bg1Profile.ACTION_BG1_MEASURE_STANDBY); + constants.put(DATA_ID, Bg1Profile.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"); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SModule.java new file mode 100644 index 0000000..7349ca6 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SModule.java @@ -0,0 +1,106 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg1sControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "BG1SModule") +public class BG1SModule extends iHealthBaseModule { + + private static final String moduleName = "BG1SModule"; + private static final String TAG = "BG1SModule"; + private static final String EVENT_NOTIFY = "event_notify_bg1s"; + + public BG1SModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return moduleName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void getFunction(String mac) { + Bg1sControl Bg1sControl = getBg1sControl(mac); + if (Bg1sControl != null) { + Bg1sControl.getDeviceStatus(); + } + } + + @ReactMethod + public void measure(String mac,int measureMode) { + Bg1sControl Bg1sControl = getBg1sControl(mac); + if (Bg1sControl != null) { + Bg1sControl.setMeasureMode(measureMode); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bg1sControl Bg1sControl = getBg1sControl(mac); + if (Bg1sControl != null) { + Bg1sControl.disconnect(); + } + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + private Bg1sControl getBg1sControl(String mac) { + Bg1sControl Bg1sControl = iHealthDevicesManager.getInstance().getBg1sControl(mac); + if (Bg1sControl == null) { + senErrMessage(400); + } + return Bg1sControl; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBg1sDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SProfileModule.java new file mode 100755 index 0000000..9dd00aa --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG1SProfileModule.java @@ -0,0 +1,225 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg1Profile; +import com.ihealth.communication.control.Bg1sProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by zhaoyongguang on 07/12/2016. + */ +@ReactModule(name = "BG1SProfileModule") +public class BG1SProfileModule extends ReactContextBaseJavaModule { + private static final String name = BG1SProfileModule.class.getSimpleName(); + /** + * The action type of callback indicating the error of BG1S device.
          + * KeyList of the message: + *

            + *
          • {@link #ERROR_NUM_BG1S}
          • + *
          • {@link #ERROR_DESCRIPTION_BG1S}
          • + *
          + * Example message:
          + * {
          + *     "error": 400,
          + *     "description": "getOfflineData() parameter userPstCode should be in the range [0, 19]."
          + * }
          + */ + String ACTION_ERROR_BG1S = "action_error"; + /** + * error code + */ + String ERROR_NUM_BG1S = "error_num"; + /** + * error description + */ + String ERROR_DESCRIPTION_BG1S = "error_description"; + + /** + * The action type of callback indicating get device info. + */ + String ACTION_GET_DEVICE_INFO = "action_get_device_info"; + + /** + * The action type of callback indicating set mode of measure. + */ + String ACTION_SET_MEASURE_MODE = "action_set_measure_mode"; + + /** + * Callback indicating power of Battery for BG1S device. + */ + String ACTION_BATTERY_BG1S = "battery_bg1s"; + + /** + * The power of Battery for BG1S device. + */ + String INFO_BATTERY_BG1S = "battery"; + + /** + * The version of Blood Code for BG1S device. + */ + String INFO_VERSION_CODE_BLOOD_BG1S = "info_version_code_blood_bg1s"; + + /** + * The version of CTL Code for BG1S device. + */ + String INFO_VERSION_CODE_CTL_BG1S = "info_version_code_ctl_bg1s"; + + /** + * The history data status + *
            + *
          • 0: has no history data
          • + *
          • 1: has history data
          • + *
          + */ + String INFO_HISTORY_STATUS_BG1S = "info_history_status_bg1s"; + + + /** + * The action type of callback indicating blood drop detected. + */ + String ACTION_GET_BLOOD = "action_get_blood"; + + /** + * The action type of callback indicating insertion status of test strip. + *
            + *
          • 1: strip in
          • + *
          • 2: strip out
          • + *
          + */ + String ACTION_STRIP_INSERTION_STATUS = "action_strip_insertion_status"; + + /** + * The insertion status of test strip + */ + String STRIP_INSERTION_STATUS = "insertion_status"; + + /** + * The action type of callback indicating result of measure. + */ + String ACTION_MEASURE_RESULT = "action_measure_result"; + /** + * The mode of measure + */ + String MEASURE_MODE = "measure_mode"; + /** + * The result of measure + */ + String MEASURE_RESULT = "measure_result"; + /** + * The status of operation + */ + String OPERATION_STATUS = "status"; + + /** + * The describe of operation + */ + String OPERATION_DESCRIBE = "describe"; + + /** + * The action type of callback indicating check code of device. + */ + String ACTION_CHECK_CODE = "action_check_code"; + + /** + * The result of check the blood code + *
            + *
          • 0: check the blood code is success
          • + *
          • other: check the blood code is fail
          • + *
          + */ + String BLOOD_CHECK_CODE_RESULT = "blood_check_code_result"; + + /** + * The blood code. + */ + String BLOOD_CODE = "blood_code"; + + /** + * The CRC of the blood code + */ + String BLOOD_CODE_CRC = "blood_code_crc"; + + + /** + * The result of check the blood code + *
            + *
          • 0: check the blood code is success
          • + *
          • other: check the blood code is fail
          • + *
          + */ + String CTL_CHECK_CODE_RESULT = "ctl_check_code_result"; + + /** + * The CTL code. + */ + String CTL_CODE = "ctl_code"; + + /** + * The CRC of the CTL code + */ + String CTL_CODE_CRC = "ctl_code_crc"; + + /** + * The action type of callback indicating set code of device. + */ + String ACTION_SET_DEVICE_CODE = "action_set_device_code"; + + /** + * @return the name of this module. This will be the name used to {@code require()} this module + * from javascript. + */ + @Override + public String getName() { + return name; + } + + public BG1SProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + /** + * @return a map of constants this module exports to JS. Supports JSON types. + */ + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_ERROR_BG1S, Bg1sProfile.ACTION_ERROR_BG1S); + constants.put(ERROR_NUM_BG1S, Bg1sProfile.ERROR_NUM_BG1S); + constants.put(ERROR_DESCRIPTION_BG1S, Bg1sProfile.ERROR_DESCRIPTION_BG1S); + + constants.put(ACTION_GET_DEVICE_INFO, Bg1sProfile.ACTION_GET_DEVICE_INFO); + constants.put(ACTION_SET_MEASURE_MODE, Bg1sProfile.ACTION_SET_MEASURE_MODE); + constants.put(ACTION_BATTERY_BG1S, Bg1sProfile.ACTION_BATTERY_BG1S); + constants.put(INFO_BATTERY_BG1S, Bg1sProfile.INFO_BATTERY_BG1S); + constants.put(INFO_VERSION_CODE_BLOOD_BG1S, Bg1sProfile.INFO_VERSION_CODE_BLOOD_BG1S); + constants.put(INFO_VERSION_CODE_CTL_BG1S, Bg1sProfile.INFO_VERSION_CODE_CTL_BG1S); + constants.put(INFO_HISTORY_STATUS_BG1S, Bg1sProfile.INFO_HISTORY_STATUS_BG1S); + + constants.put(ACTION_GET_BLOOD, Bg1sProfile.ACTION_GET_BLOOD); + constants.put(ACTION_STRIP_INSERTION_STATUS, Bg1sProfile.ACTION_STRIP_INSERTION_STATUS); + constants.put(STRIP_INSERTION_STATUS, Bg1sProfile.STRIP_INSERTION_STATUS); + constants.put(ACTION_MEASURE_RESULT, Bg1sProfile.ACTION_MEASURE_RESULT); + constants.put(MEASURE_MODE, Bg1sProfile.MEASURE_MODE); + constants.put(MEASURE_RESULT, Bg1sProfile.MEASURE_RESULT); + + constants.put(OPERATION_STATUS, Bg1sProfile.OPERATION_STATUS); + constants.put(OPERATION_DESCRIBE, Bg1sProfile.OPERATION_DESCRIBE); + + constants.put(ACTION_CHECK_CODE, Bg1sProfile.ACTION_CHECK_CODE); + constants.put(BLOOD_CHECK_CODE_RESULT, Bg1sProfile.BLOOD_CHECK_CODE_RESULT); + constants.put(BLOOD_CODE, Bg1sProfile.BLOOD_CODE); + constants.put(BLOOD_CODE_CRC, Bg1sProfile.BLOOD_CODE_CRC); + constants.put(CTL_CHECK_CODE_RESULT, Bg1sProfile.CTL_CHECK_CODE_RESULT); + constants.put(CTL_CODE, Bg1sProfile.CTL_CODE); + constants.put(CTL_CODE_CRC, Bg1sProfile.CTL_CODE_CRC); + constants.put(ACTION_SET_DEVICE_CODE, Bg1sProfile.ACTION_SET_DEVICE_CODE); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5Module.java new file mode 100755 index 0000000..8932de4 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5Module.java @@ -0,0 +1,323 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg5Control; +import com.ihealth.communication.control.Bg5Profile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * Created by gyl on 2016/11/15. + */ + +@ReactModule(name = "BG5Module") +public class BG5Module extends iHealthBaseModule { + + private static final String modelName = "BG5Module"; + private static final String TAG = modelName; + + private static final String EVENT_NOTIFY = "event_notify_bg5"; + + public BG5Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void holdLink(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + Log.v("aa", "bg5Control != null "); + bg5Control.holdLink(); + } else { + Log.v("aa", "bg5Control == null "); + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void setTime(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.setTime(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void setUnit(String mac, double type) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.setUnit((int) type); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void getBattery(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.getBattery(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void startMeasure(String mac, double type) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.startMeasure((int) type); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void getOfflineData(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.getOfflineData(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void deleteOfflineData(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.deleteOfflineData(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + +// @ReactMethod +// public void setBottleMessage(String mac, String QRCode) { +// Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); +// if (bg5Control != null) { +// bg5Control.setBottleMessage(QRCode); +// } else { +// WritableMap params = Arguments.createMap(); +// params.putInt("errorid", 400); +// sendEvent(EVENT_NOTIFY, params); +// } +// } + +// @ReactMethod +// public void setBottleMessage(String mac , String QRCode, final int stripNum, final String overDate) { +// Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); +// if (bg5Control != null) { +// bg5Control.setBottleMessage(QRCode, stripNum, overDate); +// } else { +// WritableMap params = Arguments.createMap(); +// params.putInt("errorid", 400); +// iHealthDeviceManagerModule.sendEvent("Error", params); +// } +// } + + @ReactMethod + public void setBottleMessageWithInfo(String mac, int stripType, int measureType, String QRCode, int stripNum, String overDate) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.setBottleMessageWithInfo(stripType, measureType, QRCode, stripNum, overDate); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void getBottleMessage(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.getBottleMessage(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void setBottleId(String mac, String bottleID) { + long bottleId = 0; + try { + bottleId = Long.parseLong(bottleID); + } catch (NumberFormatException e) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + return; + } + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.setBottleId(bottleId); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void getBottleId(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.getBottleId(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void disConnect(String mac) { + Bg5Control bg5Control = iHealthDevicesManager.getInstance().getBg5Control(mac); + if (bg5Control != null) { + bg5Control.disconnect(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void Logger(String tag, String msg) { + Log.e(TAG, msg); + } + + @ReactMethod + public void getBottleInfoFromQR(String QRCode) { + String result = Bg5Control.getBottleInfoFromQR(QRCode); + Log.v(TAG, "code info = " + result); + + JSONObject resultJsonStr = new JSONObject(); + + try { + JSONArray jsonArray = new JSONObject(result).getJSONArray("bottleInfo"); + resultJsonStr.put("strip_num", ((JSONObject) jsonArray.get(0)).getString("stripNum")); + resultJsonStr.put("expire_time", ((JSONObject) jsonArray.get(0)).getString("overDate")); + resultJsonStr.put("bottle_id", ((JSONObject) jsonArray.get(0)).getString("bottleId")); + + } catch (JSONException e) { + try { + resultJsonStr.put("description", "QRCode format error"); + } catch (JSONException e1) { + e1.printStackTrace(); + } + } + + + WritableMap params = Arguments.createMap(); + params.putString("action", "action_code_analysis"); + if (!TextUtils.isEmpty(resultJsonStr.toString())) { + Utils.jsonToMap(resultJsonStr.toString(), params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBg5Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + switch (action) { + + //只需要Action就代表成功 + case Bg5Profile.ACTION_KEEP_LINK: + case Bg5Profile.ACTION_SET_TIME: + case Bg5Profile.ACTION_SET_UNIT: + case Bg5Profile.ACTION_START_MEASURE: + case Bg5Profile.ACTION_DELETE_HISTORICAL_DATA: + case Bg5Profile.ACTION_SET_BOTTLE_ID_SUCCESS: + case Bg5Profile.ACTION_STRIP_IN: + case Bg5Profile.ACTION_STRIP_OUT: + case Bg5Profile.ACTION_GET_BLOOD: + + sendEvent(EVENT_NOTIFY, params); + break; + + case Bg5Profile.ACTION_BATTERY_BG: + case Bg5Profile.ACTION_HISTORICAL_NUM_BG: + case Bg5Profile.ACTION_HISTORICAL_DATA_BG: + case Bg5Profile.ACTION_SET_BOTTLE_MESSAGE_SUCCESS: + case Bg5Profile.ACTION_GET_CODEINFO: + case Bg5Profile.ACTION_GET_BOTTLEID: + case Bg5Profile.ACTION_ERROR_BG: + case Bg5Profile.ACTION_ONLINE_RESULT_BG: + + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + break; + + default: + break; + } + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java new file mode 100644 index 0000000..783835f --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SModule.java @@ -0,0 +1,185 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg5Profile; +import com.ihealth.communication.control.Bg5sControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.ihealth.communication.control.Bg5Profile.ACTION_HISTORICAL_DATA_BG; + +/** + * @author chenxuewei + * @date 04/19/2019 + */ +@ReactModule(name = "BG5SModule") +public class BG5SModule extends iHealthBaseModule { + + private static final String TAG = BG5SModule.class.getName(); + + private static final String ModelName = "BG5SModule"; + private static final String EVENT_NOTIFY = "event_notify_bg5s"; + + public BG5SModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return ModelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void getStatusInfo(String mac) { + Bg5sControl bg5sControl = getBg5sControl(mac); + if (bg5sControl != null) { + bg5sControl.getStatusInfo(); + } + } + + @ReactMethod + public void setTime(String mac, String date, float timezone) { + Bg5sControl bg5sControl = getBg5sControl(mac); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + Date temp = formatter.parse(date); + if (bg5sControl != null) { + bg5sControl.setTime(temp, timezone); + } + } catch (ParseException e) { + Log.i(TAG, "time format need yyyy-MM-dd HH:mm:ss"); + } + + } + + @ReactMethod + public void setUnit(String mac, int unitType) { + Bg5sControl bg5sControl = getBg5sControl(mac); + if (bg5sControl != null) { + bg5sControl.setUnit(unitType); + } + } + + @ReactMethod + public void deleteUsedStrip(String mac) { + Bg5sControl bg5sControl = getBg5sControl(mac); + if (bg5sControl != null) { + bg5sControl.deleteUsedStrip(); + } + } + + @ReactMethod + public void deleteOfflineData(String mac) { + Bg5sControl bg5sControl = getBg5sControl(mac); + if (bg5sControl != null) { + bg5sControl.deleteOfflineData(); + } + } + + @ReactMethod + public void getOfflineData(String mac) { + Bg5sControl bg5sControl = getBg5sControl(mac); + if (bg5sControl != null) { + bg5sControl.getOfflineData(); + } + } + + @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); + if (bg5sControl != null) { + bg5sControl.startMeasure(measureType); + } + } + + @ReactMethod + public void adjustOfflineData(String mac, String timeString, String originData) { + Bg5sControl bg5sControl = getBg5sControl(mac); + if (bg5sControl != null) { + String offlineData = bg5sControl.adjustOfflineData(timeString, originData); + WritableMap params = Arguments.createMap(); + params.putString(Bg5Profile.HISTORICAL_DATA_BG, offlineData); + params.putString("action", "action_adjust_offline_data"); + sendEvent(EVENT_NOTIFY, params); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bg5sControl bg5sControl = getBg5sControl(mac); + if (bg5sControl != null) { + bg5sControl.disconnect(); + } + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBg5sDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + private Bg5sControl getBg5sControl(String mac) { + Bg5sControl bg5sControl = iHealthDevicesManager.getInstance().getBg5sControl(mac); + if (bg5sControl == null) { + senErrMessage(400); + } + return bg5sControl; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java new file mode 100644 index 0000000..e9d8140 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BG5SProfileModule.java @@ -0,0 +1,113 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +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; + +import javax.annotation.Nullable; + +@ReactModule(name = "BG5SProfileModule") +public class BG5SProfileModule extends ReactContextBaseJavaModule { + + private static final String modelName = "BG5SProfileModule"; + private static final String TAG = modelName; + + 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); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + + final Map constants = new HashMap<>(); + + 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(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); + + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BGProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BGProfileModule.java new file mode 100755 index 0000000..256bb13 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BGProfileModule.java @@ -0,0 +1,146 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg5Profile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by gaoyuanlong on 16/11/17. + */ +@ReactModule(name = "BGProfileModule") +public class BGProfileModule extends ReactContextBaseJavaModule { + + private static final String modelName = "BGProfileModule"; + private static final String TAG = modelName; + + private static final String ACTION_KEEP_LINK = "ACTION_KEEP_LINK"; + 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_SET_BOTTLEMESSAGE = "ACTION_SET_BOTTLEMESSAGE"; + private static final String ACTION_GET_BOTTLEMESSAGE = "ACTION_GET_BOTTLEMESSAGE"; + private static final String ACTION_SET_BOTTLEID = "ACTION_SET_BOTTLEID"; + private static final String ACTION_GET_BOTTLEID = "ACTION_GET_BOTTLEID"; + 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 KEEP_LINK = "KEEP_LINK"; +// private static final String SET_TIME = "SET_TIME"; +// private static final String SET_UNIT = "SET_UNIT"; + private static final String GET_BATTERY = "GET_BATTERY"; +// private static final String START_MEASURE = "START_MEASURE"; + private static final String GET_OFFLINEDATA_COUNT = "GET_OFFLINEDATA_COUNT"; + private static final String GET_OFFLINEDATA = "GET_OFFLINEDATA"; +// private static final String DELETE_OFFLINEDATA = "DELETE_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 SET_BOTTLEID = "SET_BOTTLEID"; + 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_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + + public BGProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + + final Map constants = new HashMap<>(); + + constants.put(ACTION_KEEP_LINK, Bg5Profile.ACTION_KEEP_LINK); + 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_SET_BOTTLEMESSAGE, Bg5Profile.ACTION_SET_BOTTLE_MESSAGE_SUCCESS); + constants.put(ACTION_GET_BOTTLEMESSAGE, Bg5Profile.ACTION_GET_CODEINFO); + constants.put(ACTION_SET_BOTTLEID, Bg5Profile.ACTION_SET_BOTTLE_ID_SUCCESS); + constants.put(ACTION_GET_BOTTLEID, Bg5Profile.ACTION_GET_BOTTLEID); + 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(KEEP_LINK, Bg5Profile.KEEP_LINK); +// constants.put(SET_TIME, Bg5Profile.SET_TIME); +// constants.put(SET_UNIT, Bg5Profile.SET_UNIT); + constants.put(GET_BATTERY, Bg5Profile.BATTERY_BG); +// constants.put(START_MEASURE, Bg5Profile.START_MEASURE); + constants.put(GET_OFFLINEDATA_COUNT, Bg5Profile.HISTORICAL_NUM_BG); + constants.put(GET_OFFLINEDATA, Bg5Profile.HISTORICAL_DATA_BG); +// constants.put(DELETE_OFFLINEDATA, Bg5Profile.DELETE_HISTORICAL_DATA); + 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(SET_BOTTLEID, Bg5Profile.SET_BOTTLE_MESSAGE); + 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(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/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP3LModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP3LModule.java new file mode 100755 index 0000000..587a06b --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP3LModule.java @@ -0,0 +1,133 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bp3lControl; +import com.ihealth.communication.control.BpProfile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by zhangxu on 16/11/14. + */ +@ReactModule(name = "BP3LModule") +public class BP3LModule extends iHealthBaseModule { + private String modelName = "BP3LModule"; + private static final String TAG = "BP3LModule"; + + private static final String EVENT_NOTIFY = "event_notify_bp3l"; + + public BP3LModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + + @ReactMethod + public void startMeasure(String mac) { + Bp3lControl bp3lControl = iHealthDevicesManager.getInstance().getBp3lControl(mac); + if (bp3lControl != null) { + bp3lControl.startMeasure(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + + + @ReactMethod + public void stopMeasure(String mac) { + Bp3lControl bp3lControl = iHealthDevicesManager.getInstance().getBp3lControl(mac); + if (bp3lControl != null) { + bp3lControl.interruptMeasure(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getBattery(String mac) { + Bp3lControl bp3lControl = iHealthDevicesManager.getInstance().getBp3lControl(mac); + if (bp3lControl != null) { + bp3lControl.getBattery(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error",params); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bp3lControl bp3lControl = iHealthDevicesManager.getInstance().getBp3lControl(mac); + if (bp3lControl != null) { + bp3lControl.disconnect(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error",params); + } + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + if (action.equals(BpProfile.ACTION_ONLINE_RESULT_BP)) { + try { + JSONObject jsonObject = new JSONObject(message); + jsonObject.remove(BpProfile.MEASUREMENT_HSD_BP); + message = jsonObject.toString(); + } catch (JSONException e) { + e.printStackTrace(); + } + } + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBp3lDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP550BTModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP550BTModule.java new file mode 100755 index 0000000..41023b5 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP550BTModule.java @@ -0,0 +1,159 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bp550BTControl; +import com.ihealth.communication.control.BpProfile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by zhangxu on 16/11/20. + */ +@ReactModule(name = "BP550BTModule") +public class BP550BTModule extends iHealthBaseModule { + private static final String modelName = "BP550BTModule"; + private static final String TAG = "BP550BTModule"; + + private static final String EVENT_NOTIFY = "event_notify_bp550bt"; + + public BP550BTModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void getBattery(String mac) { + Bp550BTControl bp550BTControl = iHealthDevicesManager.getInstance().getBp550BTControl(mac); + + if (bp550BTControl != null) { + bp550BTControl.getBattery(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getOffLineNum(String mac) { + Bp550BTControl bp550BTControl = iHealthDevicesManager.getInstance().getBp550BTControl(mac); + if (bp550BTControl != null) { + bp550BTControl.getOfflineNum(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getOffLineData(String mac) { + Bp550BTControl bp550BTControl = iHealthDevicesManager.getInstance().getBp550BTControl(mac); + ; + if (bp550BTControl != null) { + bp550BTControl.getOfflineData(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getFunctionInfo(String mac) { + Bp550BTControl bp550BTControl = iHealthDevicesManager.getInstance().getBp550BTControl(mac); + if (bp550BTControl != null) { + bp550BTControl.getFunctionInfo(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bp550BTControl bp550BTControl = iHealthDevicesManager.getInstance().getBp550BTControl(mac); + if (bp550BTControl != null) { + bp550BTControl.disconnect(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + switch (action) { + case BpProfile.ACTION_BATTERY_BP: + + break; + case BpProfile.ACTION_ZOREING_BP: + + break; + case BpProfile.ACTION_ZOREOVER_BP: + + break; + case BpProfile.ACTION_ONLINE_PRESSURE_BP: + + break; + case BpProfile.ACTION_ONLINE_PULSEWAVE_BP: + + break; + case BpProfile.ACTION_ONLINE_RESULT_BP: + + break; + default: + break; + } + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + if (deviceType.equals("KN-550BT")) { + params.putString("type", "KN550"); + } else { + params.putString("type", deviceType); + } + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBp550BTDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5Module.java new file mode 100755 index 0000000..e190ad7 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5Module.java @@ -0,0 +1,193 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bp5Control; +import com.ihealth.communication.control.BpProfile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by jing on 16/10/24. + */ +@ReactModule(name = "BP5Module") +public class BP5Module extends iHealthBaseModule { + + private static final String modelName = "BP5Module"; + private static final String TAG = "BP5Module"; + private static final String EVENT_NOTIFY = "event_notify_bp5"; + + public BP5Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void startMeasure(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.startMeasure(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void stopMeasure(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.interruptMeasure(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void getBattery(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.getBattery(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void enbleOffline(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.enbleOffline(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void disableOffline(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.disableOffline(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void isEnableOffline(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.isEnableOffline(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getOfflineNum(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.getOfflineNum(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void getOfflineData(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.getOfflineData(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bp5Control bp5Control = iHealthDevicesManager.getInstance().getBp5Control(mac); + if (bp5Control != null) { + bp5Control.disconnect(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error",params); + } + } + + @ReactMethod + public void Logger(String tag, String msg) { + Log.e(TAG, msg); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + if (action.equals(BpProfile.ACTION_ONLINE_RESULT_BP)) { + try { + JSONObject jsonObject = new JSONObject(message); + jsonObject.remove(BpProfile.MEASUREMENT_HSD_BP); + message = jsonObject.toString(); + } catch (JSONException e) { + e.printStackTrace(); + } + } + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBp5Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5SModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5SModule.java new file mode 100644 index 0000000..6a99caf --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP5SModule.java @@ -0,0 +1,155 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bp5sControl; +import com.ihealth.communication.control.BpProfile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "BP5SModule") +public class BP5SModule extends iHealthBaseModule { + + private static final String moduleName = "BP5SModule"; + private static final String TAG = "BP5SModule"; + private static final String EVENT_NOTIFY = "event_notify_bp5s"; + + public BP5SModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return moduleName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void getBattery(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.getBattery(); + } + } + + @ReactMethod + public void getOffLineNum(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.getOfflineDataNum(); + } + } + + @ReactMethod + public void getOffLineData(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.getOfflineData(); + } + } + + @ReactMethod + public void getFunctionInfo(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.getFunctionInfo(); + } + } + + @ReactMethod + public void startMeasure(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.startMeasure(); + } + } + + @ReactMethod + public void stopMeasure(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.interruptMeasure(); + } + } + + @ReactMethod + public void enbleOffline(String mac, int mode) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.setMode(mode); + } + } + + @ReactMethod + public void deleteData(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.deleteMemoryData(); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bp5sControl bp5sControl = getBp5sControl(mac); + if (bp5sControl != null) { + bp5sControl.disconnect(); + } + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + private Bp5sControl getBp5sControl(String mac) { + Bp5sControl bp5sControl = iHealthDevicesManager.getInstance().getBp5sControl(mac); + if (bp5sControl == null) { + senErrMessage(400); + } + return bp5sControl; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBp5sDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7Module.java new file mode 100755 index 0000000..f68b93c --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7Module.java @@ -0,0 +1,148 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bp7Control; +import com.ihealth.communication.control.BpProfile; +import com.ihealth.communication.control.Po1Control; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "BP7Module") +public class BP7Module extends iHealthBaseModule { + + private static final String moduleName = BP7Module.class.getSimpleName(); + private static final String TAG = BP7Module.class.getSimpleName(); + + private static final String EVENT_NOTIFY = "event_notify_bp7"; + + public BP7Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return moduleName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + private Bp7Control getBp7Control(String mac) { + Bp7Control bp7Control = iHealthDevicesManager.getInstance().getBp7Control(mac); + if (bp7Control == null) { + senErrMessage(400); + } + return bp7Control; + } + + @ReactMethod + public void getBattery(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.getBattery(); + } + } + + @ReactMethod + public void startMeasure(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.startMeasure(); + } + } + + @ReactMethod + public void stopMeasure(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.interruptMeasure(); + } + } + + @ReactMethod + public void enableOfflineMeasurement(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.enableOffline(); + } + } + + @ReactMethod + public void getOfflineNum(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.getOfflineNum(); + } + } + + @ReactMethod + public void getOfflineData(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.getOfflineData(); + } + } + + @ReactMethod + public void conformAngle(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.conformAngle(); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bp7Control bp7Control = getBp7Control(mac); + if (bp7Control != null) { + bp7Control.disconnect(); + } + } + + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBp7sDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } + +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7SModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7SModule.java new file mode 100755 index 0000000..bc4f109 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BP7SModule.java @@ -0,0 +1,176 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bp7sControl; +import com.ihealth.communication.control.BpProfile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by zhangxu on 16/11/20. + */ +@ReactModule(name = "BP7SModule") +public class BP7SModule extends iHealthBaseModule { + + private static final String moduleName = "BP7SModule"; + private static final String TAG = "BP7SModule"; + + private static final String EVENT_NOTIFY = "event_notify_bp7s"; + + public BP7SModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return moduleName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void getBattery(String mac) { + Bp7sControl bp7sControl = iHealthDevicesManager.getInstance().getBp7sControl(mac); + if (bp7sControl != null) { + bp7sControl.getBattery(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getOffLineNum(String mac) { + Bp7sControl bp7sControl = iHealthDevicesManager.getInstance().getBp7sControl(mac); + if (bp7sControl != null) { + bp7sControl.getOfflineNum(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void getOffLineData(String mac) { + Bp7sControl bp7sControl = iHealthDevicesManager.getInstance().getBp7sControl(mac); + if (bp7sControl != null) { + bp7sControl.getOfflineData(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void setUnit(String mac, int unit) { + Bp7sControl bp7sControl = iHealthDevicesManager.getInstance().getBp7sControl(mac); + if (bp7sControl != null) { + bp7sControl.setUnit(unit); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void angleSet(String mac, int leftUpper,int leftLow, int rightUpper, int rightLow) { + Bp7sControl bp7sControl = iHealthDevicesManager.getInstance().getBp7sControl(mac); + if (bp7sControl != null) { + bp7sControl.angleSet((byte)leftUpper,(byte)leftLow,(byte)rightUpper,(byte)rightLow); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + @ReactMethod + public void getFunctionInfo(String mac) { + Bp7sControl bp7sControl = iHealthDevicesManager.getInstance().getBp7sControl(mac); + if (bp7sControl != null) { + bp7sControl.getFunctionInfo(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void disconnect(String mac) { + Bp7sControl bp7sControl = iHealthDevicesManager.getInstance().getBp7sControl(mac); + if (bp7sControl != null) { + bp7sControl.disconnect(); + }else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid",400); + sendEvent("Error",params); + } + } + + + public void handleNotify(String mac, String deviceType, String action, String message) { + switch (action) { + case BpProfile.ACTION_BATTERY_BP: + + break; + case BpProfile.ACTION_ZOREING_BP: + + break; + case BpProfile.ACTION_ZOREOVER_BP: + + break; + case BpProfile.ACTION_ONLINE_PRESSURE_BP: + + break; + case BpProfile.ACTION_ONLINE_PULSEWAVE_BP: + + break; + case BpProfile.ACTION_ONLINE_RESULT_BP: + + break; + default: + break; + } + + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBp7sDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } + +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BPProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BPProfileModule.java new file mode 100755 index 0000000..e92b417 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BPProfileModule.java @@ -0,0 +1,168 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.BpProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by zhangxu on 16/11/16. + */ +@ReactModule(name = "BPProfileModule") +public class BPProfileModule extends ReactContextBaseJavaModule { + + + private static final String modelName = "BPProfileModule"; + private static final String TAG = "BPProfileModule"; + + + private static final String ACTION_ERROR_BP = "ACTION_ERROR_BP"; + private static final String ERROR_NUM_BP = "ERROR_NUM_BP"; + private static final String ERROR_DESCRIPTION_BP = "ERROR_DESCRIPTION_BP"; + + //battery + private static final String ACTION_BATTERY_BP = "ACTION_BATTERY_BP"; + private static final String BATTERY_BP = "BATTERY_BP"; + + private static final String ACTION_ZOREING_BP = "ACTION_ZOREING_BP"; + private static final String ACTION_ZOREOVER_BP = "ACTION_ZOREOVER_BP"; + + private static final String ACTION_ONLINE_PRESSURE_BP = "ACTION_ONLINE_PRESSURE_BP"; + private static final String BLOOD_PRESSURE_BP = "BLOOD_PRESSURE_BP"; + + private static final String ACTION_ONLINE_PULSEWAVE_BP = "ACTION_ONLINE_PULSEWAVE_BP"; + private static final String FLAG_HEARTBEAT_BP = "FLAG_HEARTBEAT_BP"; + private static final String PULSEWAVE_BP = "PULSEWAVE_BP"; + + private static final String ACTION_ONLINE_RESULT_BP = "ACTION_ONLINE_RESULT_BP"; + private static final String HIGH_BLOOD_PRESSURE_BP = "HIGH_BLOOD_PRESSURE_BP"; + private static final String LOW_BLOOD_PRESSURE_BP = "LOW_BLOOD_PRESSURE_BP"; + private static final String PULSE_BP = "PULSE_BP"; + private static final String MEASUREMENT_AHR_BP = "MEASUREMENT_AHR_BP"; + private static final String MEASUREMENT_HSD_BP = "MEASUREMENT_HSD_BP"; + private static final String DATAID = "DATAID"; + + private static final String ACTION_HISTORICAL_NUM_BP = "ACTION_HISTORICAL_NUM_BP"; + private static final String HISTORICAL_NUM_BP = "HISTORICAL_NUM_BP"; + + + private static final String ACTION_HISTORICAL_DATA_BP = "ACTION_HISTORICAL_DATA_BP"; + private static final String HISTORICAL_DATA_BP = "HISTORICAL_DATA_BP"; + private static final String MEASUREMENT_DATE_BP = "MEASUREMENT_DATE_BP"; + private static final String MEASUREMENT_STRAT_ANGLE_BP = "MEASUREMENT_STRAT_ANGLE_BP"; + private static final String MEASUREMENT_ANGLE_CHANGE_BP = "MEASUREMENT_ANGLE_CHANGE_BP"; + private static final String MEASUREMENT_HAND_BP = "MEASUREMENT_HAND_BP"; + + private static final String ACTION_HISTORICAL_OVER_BP = "ACTION_HISTORICAL_OVER_BP"; + + private static final String ACTION_FUNCTION_INFORMATION_BP = "ACTION_FUNCTION_INFORMATION_BP"; + private static final String FUNCTION_IS_UPAIR_MEASURE = "FUNCTION_IS_UPAIR_MEASURE"; + private static final String FUNCTION_IS_ARM_MEASURE = "FUNCTION_IS_ARM_MEASURE"; + private static final String FUNCTION_HAVE_ANGLE_SENSOR = "FUNCTION_HAVE_ANGLE_SENSOR"; + private static final String FUNCTION_HAVE_OFFLINE = "FUNCTION_HAVE_OFFLINE"; + private static final String FUNCTION_HAVE_HSD = "FUNCTION_HAVE_HSD"; + private static final String FUNCTION_HAVE_ANGLE_SETTING = "FUNCTION_HAVE_ANGLE_SETTING"; + private static final String FUNCTION_IS_MULTI_UPLOAD = "FUNCTION_IS_MULTI_UPLOAD"; + private static final String FUNCTION_HAVE_SELF_UPDATE = "FUNCTION_HAVE_SELF_UPDATE"; + + private static final String ACTION_ENABLE_OFFLINE_BP = "ACTION_ENABLE_OFFLINE_BP"; + private static final String ACTION_DISENABLE_OFFLINE_BP = "ACTION_DISENABLE_OFFLINE_BP"; + private static final String ACTION_IS_ENABLE_OFFLINE = "ACTION_IS_ENABLE_OFFLINE"; + private static final String IS_ENABLE_OFFLINE = "IS_ENABLE_OFFLINE"; + + private static final String ACTION_SET_UNIT_SUCCESS_BP = "ACTION_SET_UNIT_SUCCESS_BP"; + private static final String ACTION_SET_ANGLE_SUCCESS_BP = "ACTION_SET_ANGLE_SUCCESS_BP"; + + private static final String ACTION_INTERRUPTED_BP = "ACTION_INTERRUPTED_BP"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + private static final String ACTION_ANGLE_BP = "ACTION_ANGLE_BP"; + private static final String WHICH_ARM = "WHICH_ARM"; + private static final String ANGLE_BP = "ANGLE_BP"; + + public BPProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + + final Map constants = new HashMap<>(); + + constants.put(ACTION_ERROR_BP, BpProfile.ACTION_ERROR_BP); + constants.put(ERROR_NUM_BP, BpProfile.ERROR_NUM_BP); + constants.put(ERROR_DESCRIPTION_BP, BpProfile.ERROR_DESCRIPTION_BP); + + constants.put(ACTION_BATTERY_BP, BpProfile.ACTION_BATTERY_BP); + constants.put(BATTERY_BP,BpProfile.BATTERY_BP); + + constants.put(ACTION_ZOREING_BP, BpProfile.ACTION_ZOREING_BP); + constants.put(ACTION_ZOREOVER_BP, BpProfile.ACTION_ZOREOVER_BP); + + constants.put(ACTION_ONLINE_PRESSURE_BP, BpProfile.ACTION_ONLINE_PRESSURE_BP); + constants.put(BLOOD_PRESSURE_BP,BpProfile.BLOOD_PRESSURE_BP); + + constants.put(ACTION_ONLINE_PULSEWAVE_BP,BpProfile.ACTION_ONLINE_PULSEWAVE_BP); + constants.put(FLAG_HEARTBEAT_BP,BpProfile.FLAG_HEARTBEAT_BP); + constants.put(PULSEWAVE_BP,BpProfile.PULSEWAVE_BP); + + constants.put(ACTION_ONLINE_RESULT_BP, BpProfile.ACTION_ONLINE_RESULT_BP); + constants.put(HIGH_BLOOD_PRESSURE_BP,BpProfile.HIGH_BLOOD_PRESSURE_BP); + constants.put(LOW_BLOOD_PRESSURE_BP,BpProfile.LOW_BLOOD_PRESSURE_BP); + constants.put(PULSE_BP,BpProfile.PULSE_BP); + constants.put(MEASUREMENT_AHR_BP,BpProfile.MEASUREMENT_AHR_BP); + constants.put(MEASUREMENT_HSD_BP,BpProfile.MEASUREMENT_HSD_BP); + constants.put(DATAID,BpProfile.DATAID); + + constants.put(ACTION_HISTORICAL_NUM_BP, BpProfile.ACTION_HISTORICAL_NUM_BP); + constants.put(HISTORICAL_NUM_BP, BpProfile.HISTORICAL_NUM_BP); + + constants.put(ACTION_HISTORICAL_DATA_BP,BpProfile.ACTION_HISTORICAL_DATA_BP); + constants.put(HISTORICAL_DATA_BP, BpProfile.HISTORICAL_DATA_BP); + constants.put(MEASUREMENT_DATE_BP, BpProfile.MEASUREMENT_DATE_BP); + constants.put(MEASUREMENT_STRAT_ANGLE_BP,BpProfile.MEASUREMENT_STRAT_ANGLE_BP); + constants.put(MEASUREMENT_ANGLE_CHANGE_BP,BpProfile.MEASUREMENT_ANGLE_CHANGE_BP); + constants.put(MEASUREMENT_HAND_BP,BpProfile.MEASUREMENT_HAND_BP); + + constants.put(ACTION_HISTORICAL_OVER_BP,BpProfile.ACTION_HISTORICAL_OVER_BP); + + constants.put(ACTION_FUNCTION_INFORMATION_BP,BpProfile.ACTION_FUNCTION_INFORMATION_BP); + constants.put(FUNCTION_IS_UPAIR_MEASURE, BpProfile.FUNCTION_IS_UPAIR_MEASURE); + constants.put(FUNCTION_IS_ARM_MEASURE, BpProfile.FUNCTION_IS_ARM_MEASURE); + constants.put(FUNCTION_HAVE_ANGLE_SENSOR, BpProfile.FUNCTION_HAVE_ANGLE_SENSOR); + constants.put(FUNCTION_HAVE_OFFLINE, BpProfile.FUNCTION_HAVE_OFFLINE); + constants.put(FUNCTION_HAVE_HSD, BpProfile.FUNCTION_HAVE_HSD); + constants.put(FUNCTION_HAVE_ANGLE_SETTING, BpProfile.FUNCTION_HAVE_ANGLE_SETTING); + constants.put(FUNCTION_IS_MULTI_UPLOAD, BpProfile.FUNCTION_IS_MULTI_UPLOAD); + constants.put(FUNCTION_HAVE_SELF_UPDATE, BpProfile.FUNCTION_HAVE_SELF_UPDATE); + + constants.put(ACTION_ENABLE_OFFLINE_BP, BpProfile.ACTION_ENABLE_OFFLINE_BP); + constants.put(ACTION_DISENABLE_OFFLINE_BP, BpProfile.ACTION_DISENABLE_OFFLINE_BP); + + constants.put(ACTION_IS_ENABLE_OFFLINE, BpProfile.ACTION_IS_ENABLE_OFFLINE); + constants.put(IS_ENABLE_OFFLINE,BpProfile.IS_ENABLE_OFFLINE); + + constants.put(ACTION_SET_UNIT_SUCCESS_BP,BpProfile.ACTION_SET_UNIT_SUCCESS_BP); + constants.put(ACTION_SET_ANGLE_SUCCESS_BP,BpProfile.ACTION_SET_ANGLE_SUCCESS_BP); + + constants.put(ACTION_INTERRUPTED_BP, BpProfile.ACTION_INTERRUPTED_BP); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + + constants.put(ACTION_ANGLE_BP, BpProfile.ACTION_ANGLE_BP); + constants.put(WHICH_ARM, BpProfile.WHICH_ARM); + constants.put(ANGLE_BP, BpProfile.ANGLE_BP); + + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMModule.java new file mode 100755 index 0000000..32e7106 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMModule.java @@ -0,0 +1,145 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.BtmControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by lixuesong on 2016/11/21. + */ +@ReactModule(name = "BTMModule") +public class BTMModule extends iHealthBaseModule { + private static final String modelName = "BTMModule"; + private static final String TAG = "BTMModule"; + + private static final String EVENT_NOTIFY = "event_notify_btm"; + + public BTMModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + private static BtmControl getControl(String mac) { + return iHealthDevicesManager.getInstance().getBtmControl(mac); + } + + @ReactMethod + public void getBattery(String mac) { + BtmControl btmControl = getControl(mac); + if (btmControl != null) { + btmControl.getBattery(); + } else { + Log.e(TAG, "Can not find BTM Control mac:" + mac); + } + } + + @ReactMethod + public void setStandbyTime(String mac, int hour, int minute, int second) { + BtmControl btmControl = getControl(mac); + if (btmControl != null) { + btmControl.setStandbyTime(hour, minute, second); + } else { + Log.e(TAG, "Can not find BTM Control mac:" + mac); + } + } + + @ReactMethod + public void setTemperatureUnit(String mac, int unit) { + BtmControl btmControl = getControl(mac); + if (btmControl != null) { + btmControl.setTemperatureUnit((byte) unit); + } else { + Log.e(TAG, "Can not find BTM Control mac:" + mac); + } + } + + @ReactMethod + public void setMeasuringTarget(String mac, int target) { + BtmControl btmControl = getControl(mac); + if (btmControl != null) { + btmControl.setMeasuringTarget((byte) target); + } else { + Log.e(TAG, "Can not find BTM Control mac:" + mac); + } + } + + @ReactMethod + public void setOfflineTarget(String mac, int target) { + BtmControl btmControl = getControl(mac); + if (btmControl != null) { + btmControl.setOfflineTarget((byte) target); + } else { + Log.e(TAG, "Can not find BTM Control mac:" + mac); + } + } + + @ReactMethod + public void getMemoryData(String mac) { + BtmControl btmControl = getControl(mac); + if (btmControl != null) { + btmControl.getMemoryData(); + } else { + Log.e(TAG, "Can not find BTM Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + BtmControl btmControl = getControl(mac); + if (btmControl != null) { + btmControl.disconnect(); + } else { + Log.e(TAG, "Can not find BTM Control mac:" + mac); + } + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getBTMDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMProfileModule.java new file mode 100755 index 0000000..4949093 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMProfileModule.java @@ -0,0 +1,74 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.BtmProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by lixuesong on 15/11/2016. + */ +@ReactModule(name = "BTMProfileModule") +public class BTMProfileModule extends ReactContextBaseJavaModule { + private static final String modelName = "BTMProfileModule"; + private static final String TAG = "BTMProfileModule"; + + private static final String ACTION_BTM_BATTERY = "ACTION_BTM_BATTERY"; + private static final String BTM_BATTERY = "BTM_BATTERY"; + + private static final String ACTION_BTM_MEMORY = "ACTION_BTM_MEMORY"; + private static final String MEMORY_COUNT = "MEMORY_COUNT"; + private static final String BTM_TEMPERATURE_ARRAY = "BTM_TEMPERATURE_ARRAY"; + private static final String BTM_TEMPERATURE = "BTM_TEMPERATURE"; + private static final String BTM_TEMPERATURE_TARGET = "BTM_TEMPERATURE_TARGET"; + private static final String BTM_MEASURE_TIME = "BTM_MEASURE_TIME"; + + private static final String ACTION_BTM_MEASURE = "ACTION_BTM_MEASURE"; + + private static final String ACTION_BTM_CALLBACK = "ACTION_BTM_CALLBACK"; + + private static final String ACTION_ERROR_BTM = "ACTION_ERROR_BTM"; + private static final String ERROR_NUM_BTM = "ERROR_NUM_BTM"; + private static final String ERROR_DESCRIPTION_BTM = "ERROR_DESCRIPTION_BTM"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + + public BTMProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_BTM_BATTERY, BtmProfile.ACTION_BTM_BATTERY); + constants.put(BTM_BATTERY, BtmProfile.BTM_BATTERY); + + constants.put(ACTION_BTM_MEMORY, BtmProfile.ACTION_BTM_MEMORY); + constants.put(MEMORY_COUNT, BtmProfile.MEMORY_COUNT); + constants.put(BTM_TEMPERATURE_ARRAY, BtmProfile.BTM_TEMPERATURE_ARRAY); + constants.put(BTM_TEMPERATURE, BtmProfile.BTM_TEMPERATURE); + constants.put(BTM_TEMPERATURE_TARGET, BtmProfile.BTM_TEMPERATURE_TARGET); + constants.put(BTM_MEASURE_TIME, BtmProfile.BTM_MEASURE_TIME); + + constants.put(ACTION_BTM_MEASURE, BtmProfile.ACTION_BTM_MEASURE); + + constants.put(ACTION_BTM_CALLBACK, BtmProfile.ACTION_BTM_CALLBACK); + + constants.put(ACTION_ERROR_BTM, BtmProfile.ACTION_ERROR_BTM); + constants.put(ERROR_NUM_BTM, BtmProfile.ERROR_NUM_BTM); + constants.put(ERROR_DESCRIPTION_BTM, BtmProfile.ERROR_DESCRIPTION_BTM); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGModule.java new file mode 100644 index 0000000..566e276 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGModule.java @@ -0,0 +1,157 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.ECG3Control; +import com.ihealth.communication.control.ECG3Profile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.ihealth.communication.control.ECG3Profile.ONLINE_DATA; +import static com.ihealth.communication.control.ECG3Profile.ONLINE_HR; +import static com.ihealth.ihealthlibrary.ECGProfileModule.MEASURE_WAVEData; +import static com.ihealth.ihealthlibrary.ECGProfileModule.MEASURE_ECGPulse; + +/** + * Created by zhaoyongguang on 2018/1/22. + */ +@ReactModule(name = "ECGModule") +public class ECGModule extends iHealthBaseModule { + private static final String modelName = "ECGModule"; + private static final String TAG = "ECGModule"; + + private static final String EVENT_NOTIFY = "event_notify_ecg3"; + + public ECGModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + + if (action.equals(ECG3Profile.ACTION_SYNC_ONLINE_DATA)) { + params.putString("action", ECGProfileModule.ACTION_MEASURE_WAVEData); + try { + JSONObject jsonObject = new JSONObject(message); + params.putArray(MEASURE_WAVEData, Utils.getWritableArrayFromJSONArray(jsonObject.getJSONArray(ONLINE_DATA))); + + //split pulse + if (jsonObject.getInt(MEASURE_ECGPulse) > 0) { + WritableMap paramsHR = Arguments.createMap(); + paramsHR.putString("action", ECGProfileModule.ACTION_MEASURE_ECGPulse); + paramsHR.putInt(MEASURE_ECGPulse, jsonObject.getInt(ONLINE_HR)); + paramsHR.putString("mac", mac); + paramsHR.putString("type", deviceType); + sendEvent(EVENT_NOTIFY, paramsHR); + } + } catch (Exception e) { + e.printStackTrace(); + } + } else { + params.putString("action", action); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + } + params.putString("mac", mac); + params.putString("type", deviceType); + + sendEvent(EVENT_NOTIFY, params); + } + + + private static ECG3Control getControl(String mac) { + return iHealthDevicesManager.getInstance().getECG3Control(mac); + } + + /** + * @return the name of this module. This will be the name used to {@code require()} this module + * from javascript. + */ + @Override + public String getName() { + return modelName; + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getECG3Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void sysTime(String mac) { + ECG3Control control = getControl(mac); + if (control != null) { + control.setTime(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getBattery(String mac) { + ECG3Control control = getControl(mac); + if (control != null) { + control.getBattery(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void startMeasure(String mac) { + ECG3Control control = getControl(mac); + if (control != null) { + control.startMeasure(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void stopMeasure(String mac) { + ECG3Control control = getControl(mac); + if (control != null) { + control.stopMeasure(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGProfileModule.java new file mode 100644 index 0000000..6f51279 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGProfileModule.java @@ -0,0 +1,385 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.ECG3Profile; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by zhaoyongguang on 2018/1/22. + */ +@ReactModule(name = "ECGProfileModule") +public class ECGProfileModule extends ReactContextBaseJavaModule { + private static final String modelName = "ECGProfileModule"; + + private static final String ACTION_ERROR_ECG = "ACTION_ERROR_ECG"; + private static final String ERROR_NUM_ECG = "ERROR_NUM_ECG"; + private static final String ERROR_DESCRIPTION_ECG = "ERROR_DESCRIPTION_ECG"; + private static final String ACTION_BATTERY_ECG = "ACTION_BATTERY_ECG"; + private static final String BATTERY_ECG = "BATTERY_ECG"; + private static final String ACTION_SYSTIME = "ACTION_SYSTIME"; + private static final String ACTION_STOPMEASURE_ECG = "ACTION_STOPMEASURE_ECG"; + public static final String ACTION_MEASURE_WAVEData = "ACTION_MEASURE_WAVEData"; + public static final String ACTION_MEASURE_ECGPulse = "ACTION_MEASURE_ECGPulse"; + + /** + * Callback indicating sync offline data from ECG3_USB. + *
            + * KeyList: + *
              + *
            • {@link #OFFLINE_DATA_SYNC_PROGRESS}
            • + *
            • {@link #OFFLINE_DATA_SYNC_FINISH}
            • + *
            • {@link #OFFLINE_DATAS}
            • + *
            + *
          + *

          + *

          + * If {@link #OFFLINE_DATA_SYNC_FINISH sync finish }, you can get filtered data info with {@link #OFFLINE_DATAS}. + *
          eg.
          + * {
          + *     "offline_data_sync_progress": 100,
          + *     "offline_data_sync_finish": true,
          + *     "offline_datas": [{
          + *         "offline_data_file_name": "20160420022253",
          + *         "offline_data_simpling_rate": 248,
          + *         "offline_data_start_time": "20160420022253",
          + *         "offline_data_finish_time": "20160420022357",
          + *         "offline_data_flag": 7
          + * }]
          + * }
          + *

          + *

          All the filtered data is stored in the current app`s internal storage {@link iHealthDevicesManager#TYPE_ECG3_USB ECG3_USB} directory. + * And the data fields are in the order of MSB to LSB. Where MSB = Most Significant Bit and LSB = Least Significant Bit. + *

          The definition of those data as bellow 1~7: + *

            + *
          1. Filtered ECG data, Short type, every 2 bytes represent a simpling value. The target file: {@link ECGAnalyseResult_[fileName].txt} That is {@link #PREFIX_FILTERED_DATA} + fileName + .txt + *
          2. ECG HR Information EveryHour, Int type, every 4 bytes represent a value, and every 4 value as a group. Act as Maximum HR/Minimum HR/Average HR/Total heart beat of every hour. The target file: {@link ECGHREveryHour_[fileName].txt} That is {@link #PREFIX_HR_EVERY_HOUR} + fileName + .txt + *
          3. ECG HR Information for Day, Int type, every 4 bytes represent a value, and every 4 value as a group. Act as Maximum HR/Minimum HR/Average HR/Total heart beat of the day. The target file: {@link ECGDetail_[fileName].txt} That is {@link #PREFIX_HR_DETAIL} + fileName + .txt + *
          4. Abnormal points filtered by algorithm, Int type, every 4 bytes represent a value. The target file: {@link ECGOBByFilter_[fileName].txt} That is {@link #PREFIX_OB_BY_FILTER} + fileName + .txt + *
          5. Abnormal points marked by user, Int type, every 4 bytes represent a value.The target file: {@link OBData_[fileName].txt} That is {@link #PREFIX_OB} + fileName + .txt + *
          6. Electrode lead off Begin points, Int type, every 4 bytes represent a value. The target file: {@link ECGLeadOffBegin_[fileName].txt} That is {@link #PREFIX_LEADOFF_BEGIN} + fileName + .txt + *
          7. Electrode lead off End points, Int type, every 4 bytes represent a value. The target file: {@link ECGLeadOffEnd_[fileName].txt} That is {@link #PREFIX_LEADOFF_END} + fileName + .txt + *

            + *

          + *

          {@link notice And then, read the target data as follows:} + *

          +     * //Example to access the result files
          +     * private void readData() {
          +     * // Step 1, get the dir path
          +     * File resultsDir = new File(getFilesDir().getAbsolutePath() + File.separator + iHealthDevicesManager.TYPE_ECG3_USB);
          +     * // Step 2, get the target file according to the file name and flags {@link ECG3Profile#OFFLINE_DATA_FLAG}
          +     * //check bit 0 of OFFLINE_DATA_FLAG
          +     * if ((offline_data_flag & 0x01) != 0) {
          +     * //wave data
          +     * File file = new File(resultsDir, ECG3Profile.PREFIX_FILTERED_DATA + fileName + ".txt");
          +     * if (file.exists()) {
          +     * byte[] array = new byte[(int) file.length()];
          +     * InputStream in = null;
          +     * try {
          +     * in = new FileInputStream(file);
          +     * in.read(array);
          +     * } catch (FileNotFoundException e) {
          +     * e.printStackTrace();
          +     * } catch (IOException e) {
          +     * e.printStackTrace();
          +     * } finally {
          +     * if (in != null) {
          +     * try {
          +     * in.close();
          +     * } catch (IOException e) {
          +     * e.printStackTrace();
          +     * }
          +     * }
          +     * }
          +     * short[] waveBuffer = BytetoShort(array);
          +     * float[] formatDataBuffer = FormatECGData(waveBuffer);
          +     * //todo draw view
          +     * } else {
          +     * Log.e(TAG, "File not exist: " + file);
          +     * }
          +     * }
          +     * //check bit 1 of OFFLINE_DATA_FLAG
          +     * if ((offline_data_flag & 0x02) != 0) {
          +     * //heart rate data
          +     * File fileHREveryHour = new File(resultsDir, ECG3Profile.PREFIX_HR_EVERY_HOUR + fileName + ".txt");
          +     * if (fileHREveryHour.exists()) {
          +     * byte[] array = new byte[(int) fileHREveryHour.length()];
          +     * InputStream in = null;
          +     * try {
          +     * in = new FileInputStream(fileHREveryHour);
          +     * in.read(array);
          +     * } catch (FileNotFoundException e) {
          +     * e.printStackTrace();
          +     * } catch (IOException e) {
          +     * e.printStackTrace();
          +     * } finally {
          +     * if (in != null) {
          +     * try {
          +     * in.close();
          +     * } catch (IOException e) {
          +     * e.printStackTrace();
          +     * }
          +     * }
          +     * }
          +     * int[] hrEveryHourBuffer = BytetoInt(array);
          +     * //todo show hr list
          +     * } else {
          +     * Log.e(TAG, "File not exist: " + fileHREveryHour);
          +     * }
          +     * File fileHRAllDay = new File(resultsDir, ECG3Profile.PREFIX_HR_DETAIL + fileName + ".txt");
          +     * if (fileHRAllDay.exists()) {
          +     * byte[] array = new byte[(int) fileHRAllDay.length()];
          +     * InputStream in = null;
          +     * try {
          +     * in = new FileInputStream(fileHRAllDay);
          +     * in.read(array);
          +     * } catch (FileNotFoundException e) {
          +     * e.printStackTrace();
          +     * } catch (IOException e) {
          +     * e.printStackTrace();
          +     * } finally {
          +     * if (in != null) {
          +     * try {
          +     * in.close();
          +     * } catch (IOException e) {
          +     * e.printStackTrace();
          +     * }
          +     * }
          +     * }
          +     * int[] hrAllDayBuffer = BytetoInt(array);
          +     * //todo show hr list
          +     * } else {
          +     * Log.e(TAG, "File not exist: " + fileHRAllDay);
          +     * }
          +     * }
          +     * // the same for other data
          +     * }
          +     * // Every 2 bytes represents a short data, the fields are in the order of MSB to LSB. Where MSB = Most Significant Bit and LSB = Least Significant Bit
          +     * private short[] BytetoShort(byte[] array) {
          +     * short[] result = new short[array.length / 2];
          +     * for (int i = 0; i < result.length; i++) {
          +     * int value = array[i * 2] * 256 + array[i * 2 + 1];
          +     * result[i] = (short) ((value > 32767) ? (value - 65536) : value);
          +     * }
          +     * return result;
          +     * }
          +     * // Every 4 bytes represents a int data, the fields are in the order of MSB to LSB. Where MSB = Most Significant Bit and LSB = Least Significant Bit
          +     * private int[] BytetoInt(byte[] array) {
          +     * int[] result = new int[array.length / 4];
          +     * for (int i = 0; i < result.length; i++) {
          +     * result[i] = array[i * 4] * 256 * 256 * 256
          +     * + array[i * 4 + 1] * 256 * 256
          +     * + array[i * 4 + 2] * 256
          +     * + array[i * 4 + 3];
          +     * }
          +     * return result;
          +     * }
          +     * //Format ECG value,  unit mV
          +     * private float[] FormatECGData(short[] array) {
          +     * float[] result = new float[array.length];
          +     * for (int i = 0; i < result.length; i++) {
          +     * result[i] = array[i] * 2420.0f / (6 * 32767);
          +     * }
          +     * return result;
          +     * }
          +     * 
          + * Otherwise, no filtered data, only update the sync progress. + *
          eg. + * {
          + *     "offline_data_sync_progress": 30.5,
          + *     "offline_data_sync_finish": false
          + * }
          + *
          + */ + public static final String ACTION_STARTSYNCDATA_ECGUSB = "ACTION_STARTSYNCDATA_ECGUSB"; + + public static final String ACTION_SYNCDATAPROGRESS_ECGUSB = "ACTION_SYNCDATAPROGRESS_ECGUSB"; + /** + * Callback indicating no historical data for ECG device. + */ + public static final String ACTION_NO_HISTORICAL_DATA = "ACTION_NO_HISTORICAL_DATA"; + /** + * Key of sync progress, range [0, 100]. Value 100 indicates sync finish. + */ + public static final String PROGRESS = "PROGRESS"; + + public static final String ACTION_SYNCDATAINFO_ECGUSB = "ACTION_SYNCDATAINFO_ECGUSB"; + public static final String DATAINFO = "DATAINFO"; + + public static final String MEASURE_WAVEData = "MEASURE_WAVEData"; + public static final String MEASURE_ECGPulse = "MEASURE_ECGPulse"; + + public static final String FILEPATH = "FilePath"; + /** + * Key of file name. + */ + private static final String OFFLINE_DATA_FILE_NAME = "OFFLINE_DATA_FILE_NAME"; + + /** + * Key of simpling rate.You should use it to display view. + */ + private static final String OFFLINE_DATA_SIMPLING_RATE = "OFFLINE_DATA_SIMPLING_RATE"; + /** + * Key of start measure time. + */ + private static final String OFFLINE_DATA_START_TIME = "OFFLINE_DATA_START_TIME"; + /** + * Key of stop measure time. + */ + private static final String OFFLINE_DATA_FINISH_TIME = "OFFLINE_DATA_FINISH_TIME"; + + public static final String ACTION_SPLICE = "ACTION_SPLICE"; + public static final String SPLICE_DATA = "SPLICE_DATA"; + public static final String ACTION_GET_CACHE = "ACTION_GET_CACHE"; + public static final String GET_CACHE_DATA = "GET_CACHE_DATA"; + public static final String ACTION_FILTER = "ACTION_FILTER"; + public static final String FILTER_DATA = "FILTER_DATA"; + + + /** + * Key of data flags, define which data fields are valid in the result. + *

          + * + * + * + * + * + * + *
          NameFormatBit field
          Flags32bits + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
          BitSizeNameDefinition
          01Represent filtered data, target file: {@link #PREFIX_FILTERED_DATA}+[fileName].txt + * + * + * + * + * + * + *
          ValueDescription
          0NA
          1Valid
          11Represent heart rate data, target file: {@link #PREFIX_HR_EVERY_HOUR}+[fileName].txt and {@link #PREFIX_HR_DETAIL}+[fileName].txt + * + * + * + * + * + *
          0NA
          1Valid
          21Represent abnormal points filtered by algorithm, target file: {@link #PREFIX_OB_BY_FILTER}+[fileName].txt + * + * + * + * + * + *
          0NA
          1Valid
          31Represent electrode lead off data,target file: {@link #PREFIX_LEADOFF_BEGIN}+[fileName].txt and {@link #PREFIX_LEADOFF_END}+[fileName].txt + * + * + * + * + * + *
          0NA
          1Valid
          41Represent abnormal points marked by user, target file: {@link #PREFIX_OB}+[fileName].txt + * + * + * + * + * + *
          0NA
          1Valid
          5~3127Reserved
          + */ + private static final String OFFLINE_DATA_FLAG = "offline_data_flag"; + + private static final String ACTION_DELETEDATA_ECGUSB = "ACTION_DELETEDATA_ECGUSB"; + private static final String DELETE_RESULT = "DELETE_RESULT"; + private static final String ACTION_ELECTRODE_STATUS = "ACTION_ELECTRODE_STATUS"; + private static final String ELECTRODE_STATUS = "ELECTRODE_STATUS"; + + private static final String ACTION_GET_IDPS = "ACTION_GET_IDPS"; + + private static final String ACTION_ERROR_ECGUSB = "ACTION_ERROR_ECGUSB"; + private static final String ERROR_NUM_ECGUSB = "ERROR_NUM_ECGUSB"; + private static final String ERROR_DESCRIPTION_ECGUSB = "ERROR_DESCRIPTION_ECGUSB"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + public ECGProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + /** + * @return the name of this module. This will be the name used to {@code require()} this module + * from javascript. + */ + @Override + public String getName() { + return modelName; + } + + /** + * @return a map of constants this module exports to JS. Supports JSON types. + */ + @Nullable + @Override + public Map getConstants() { + final Map constants = new HashMap<>(); + + constants.put(ACTION_ERROR_ECG, ECG3Profile.ACTION_ERROR); + constants.put(ERROR_NUM_ECG, ECG3Profile.ERROR_NUM); + constants.put(ERROR_DESCRIPTION_ECG, ECG3Profile.ERROR_DESCRIPTION); + constants.put(ACTION_BATTERY_ECG, ECG3Profile.ACTION_GET_BATTERY); + constants.put(BATTERY_ECG, ECG3Profile.BATTERY); + constants.put(ACTION_SYSTIME, ECG3Profile.ACTION_SET_TIME); + constants.put(ACTION_STOPMEASURE_ECG, ECG3Profile.ACTION_STOP_ONLINE_MEASUREMENT); + constants.put(ACTION_MEASURE_WAVEData, ACTION_MEASURE_WAVEData); + constants.put(MEASURE_WAVEData, MEASURE_WAVEData); + constants.put(ACTION_MEASURE_ECGPulse, ACTION_MEASURE_ECGPulse); + constants.put(MEASURE_ECGPulse, MEASURE_ECGPulse); + + constants.put(ACTION_STARTSYNCDATA_ECGUSB, ACTION_STARTSYNCDATA_ECGUSB); + constants.put(ACTION_SYNCDATAPROGRESS_ECGUSB, ACTION_SYNCDATAPROGRESS_ECGUSB); + constants.put(PROGRESS, PROGRESS); + constants.put(ACTION_SYNCDATAINFO_ECGUSB, ACTION_SYNCDATAINFO_ECGUSB); + constants.put(DATAINFO, DATAINFO); + constants.put(OFFLINE_DATA_FILE_NAME, ECG3Profile.OFFLINE_DATA_FILE_NAME); + constants.put(OFFLINE_DATA_SIMPLING_RATE, ECG3Profile.OFFLINE_DATA_SIMPLING_RATE); + constants.put(OFFLINE_DATA_START_TIME, ECG3Profile.OFFLINE_DATA_START_TIME); + constants.put(OFFLINE_DATA_FINISH_TIME, ECG3Profile.OFFLINE_DATA_FINISH_TIME); + constants.put(OFFLINE_DATA_FLAG, ECG3Profile.OFFLINE_DATA_FLAG); + + constants.put(ACTION_DELETEDATA_ECGUSB, ECG3Profile.ACTION_DELETE_DATA); + constants.put(DELETE_RESULT, ECG3Profile.DELETE_RESULT); + constants.put(ACTION_ELECTRODE_STATUS, ECG3Profile.ACTION_ELECTRODE_STATUS); + constants.put(ELECTRODE_STATUS, ECG3Profile.ELECTRODE_STATUS); + + constants.put(ACTION_GET_IDPS, ECG3Profile.ACTION_GET_IDPS); + + constants.put(ACTION_ERROR_ECGUSB, ECG3Profile.ACTION_ERROR); + constants.put(ERROR_NUM_ECGUSB, ECG3Profile.ERROR_NUM); + constants.put(ERROR_DESCRIPTION_ECGUSB, ECG3Profile.ERROR_DESCRIPTION); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + constants.put(FILEPATH,ECG3Profile.FILE_PATH); + + constants.put(ACTION_SPLICE, ECG3Profile.ACTION_SPLICING_DATA); + constants.put(SPLICE_DATA, ECG3Profile.GET_SPLICING_DATA); + + constants.put(ACTION_GET_CACHE, ECG3Profile.ACTION_GET_CACHE_DATA); + constants.put(GET_CACHE_DATA, ECG3Profile.GET_CACHE_DATA); + + constants.put(ACTION_FILTER, ECG3Profile.ACTION_GET_FILTER_FILES); + constants.put(FILTER_DATA, ECG3Profile.GET_FILTER_DATA); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGUSBModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGUSBModule.java new file mode 100644 index 0000000..94f3451 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/ECGUSBModule.java @@ -0,0 +1,290 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.ECG3Profile; +import com.ihealth.communication.control.ECG3USBControl; +import com.ihealth.communication.manager.iHealthDevicesManager; +import com.facebook.react.bridge.Callback; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +import static com.ihealth.ihealthlibrary.ECGProfileModule.ACTION_FILTER; +import static com.ihealth.ihealthlibrary.ECGProfileModule.ACTION_SPLICE; +import static com.ihealth.ihealthlibrary.ECGProfileModule.ACTION_GET_CACHE; +import static com.ihealth.ihealthlibrary.ECGProfileModule.ACTION_SYNCDATAINFO_ECGUSB; +import static com.ihealth.ihealthlibrary.ECGProfileModule.ACTION_SYNCDATAPROGRESS_ECGUSB; +import static com.ihealth.ihealthlibrary.ECGProfileModule.DATAINFO; +import static com.ihealth.ihealthlibrary.ECGProfileModule.GET_CACHE_DATA; +import static com.ihealth.ihealthlibrary.ECGProfileModule.FILTER_DATA; +import static com.ihealth.ihealthlibrary.ECGProfileModule.SPLICE_DATA; +import static com.ihealth.ihealthlibrary.ECGProfileModule.PROGRESS; +import static com.ihealth.ihealthlibrary.ECGProfileModule.FILEPATH; + + +/** + * Created by zhaoyongguang on 2018/1/22. + */ +@ReactModule(name = "ECGUSBModule") +public class ECGUSBModule extends iHealthBaseModule { + private static final String modelName = "ECGUSBModule"; + private static final String TAG = "ECGUSBModule"; + private static final String mac = "000000000000"; + private static final String EVENT_NOTIFY = "event_notify_ecg3_usb"; + + public ECGUSBModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + if (action.equals(ECG3Profile.ACTION_SYNC_OFFLINE_DATA)){ + WritableMap params = Arguments.createMap(); + try { + JSONObject jsonObject = new JSONObject(message); + //split progress + if (jsonObject.getBoolean(ECG3Profile.OFFLINE_DATA_SYNC_FINISH)) { + WritableMap paramsFinish = Arguments.createMap(); + paramsFinish.putString("action", ACTION_SYNCDATAPROGRESS_ECGUSB); + paramsFinish.putDouble(PROGRESS, 100); + paramsFinish.putString("mac", mac); + paramsFinish.putString("type", deviceType); + sendEvent(EVENT_NOTIFY, paramsFinish); + + + params.putString("action", ACTION_SYNCDATAINFO_ECGUSB); + params.putArray(DATAINFO, Utils.getWritableArrayFromJSONArray(jsonObject.getJSONArray(ECG3Profile.OFFLINE_DATAS))); + params.putString("mac", mac); + params.putString("type", deviceType); +// params.putString(FILEPATH, jsonObject.getString(ECG3Profile.FILE_PATH)); + sendEvent(EVENT_NOTIFY, params); + } else { + params.putString("action", ACTION_SYNCDATAPROGRESS_ECGUSB); + params.putDouble(PROGRESS, jsonObject.getDouble(ECG3Profile.OFFLINE_DATA_SYNC_PROGRESS)); + params.putString("mac", mac); + params.putString("type", deviceType); + sendEvent(EVENT_NOTIFY, params); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return; + } + if (action.equals(ECG3Profile.ACTION_SPLICING_DATA)) { + WritableMap params = Arguments.createMap(); + try { + JSONObject jsonObject = new JSONObject(message); + params.putString("action", ACTION_SPLICE); + params.putMap(SPLICE_DATA, Utils.getMapFromJSONObject(jsonObject.getJSONObject(ECG3Profile.GET_SPLICING_DATA))); + params.putString("mac", mac); + params.putString("type", deviceType); + params.putString(FILEPATH, jsonObject.getString(ECG3Profile.FILE_PATH)); + sendEvent(EVENT_NOTIFY, params); + } catch (Exception e) { + e.printStackTrace(); + } + + return; + } + if (action.equals(ECG3Profile.ACTION_GET_CACHE_DATA)) + { + WritableMap params = Arguments.createMap(); + try { + JSONObject jsonObject = new JSONObject(message); + params.putString("action", ACTION_GET_CACHE); + params.putArray(GET_CACHE_DATA, Utils.getWritableArrayFromJSONArray(jsonObject.getJSONArray(GET_CACHE_DATA))); + params.putString("mac", mac); + params.putString("type", deviceType); + params.putString(FILEPATH, jsonObject.getString(ECG3Profile.FILE_PATH)); + sendEvent(EVENT_NOTIFY, params); + } catch ( + Exception e) + { + e.printStackTrace(); + } + + return; + } + if (action.equals(ECG3Profile.ACTION_GET_FILTER_FILES)) + { + WritableMap params = Arguments.createMap(); + try { + JSONObject jsonObject = new JSONObject(message); + params.putString("action", ACTION_FILTER); + params.putArray(FILTER_DATA, Utils.getWritableArrayFromJSONArray(jsonObject.getJSONArray(ECG3Profile.GET_FILTER_DATA))); + params.putString("mac", mac); + params.putString("type", deviceType); + params.putString(FILEPATH, jsonObject.getString(ECG3Profile.FILE_PATH)); + sendEvent(EVENT_NOTIFY, params); + } catch ( + Exception e) + { + e.printStackTrace(); + } + + return; + } + if (action.equals(ECG3Profile.ACTION_GET_IDPS)){ + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + try { + params.putMap("idps", Utils.getMapFromJSONObject(new JSONObject(message))); + } catch (JSONException e) { + e.printStackTrace(); + } + sendEvent(EVENT_NOTIFY, params); + return; + } + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + /** + * @return the name of this module. This will be the name used to {@code require()} this module + * from javascript. + */ + @Override + public String getName() { + return modelName; + } + + private static ECG3USBControl getControl() { + return iHealthDevicesManager.getInstance().getECG3USBControl(mac); + } + + @ReactMethod + public void syncData() { + ECG3USBControl control = getControl(); + if (control != null) { + control.syncData(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getIdps() { + ECG3USBControl control = getControl(); + if (control != null) { + control.getIdps(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void deleteData() { + ECG3USBControl control = getControl(); + if (control != null) { + control.deleteAll(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getECG3USBDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void spliceData(ReadableArray filesNames) { + ECG3USBControl control = getControl(); + if (control != null && filesNames != null) { + + String[] files = new String[filesNames.size()]; + for (int x = 0; x < filesNames.size(); x++) { + files[x] = filesNames.getString(x); + } + control.spliceWithFileNames(files); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getCache() { + ECG3USBControl control = getControl(); + if (control != null) { + control.getCacheData(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void deleteCacheData() { + ECG3USBControl control = getControl(); + if (control != null) { + control.deleteCacheData(); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + + @ReactMethod + public void getFilterDataByFileName(String dataFileName,String markFileName) { + ECG3USBControl control = getControl(); + if (control != null) { + control.getFilterDataByFileName(dataFileName,markFileName); + } else { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", 400); + sendEvent("Error", params); + } + } + +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2Module.java new file mode 100755 index 0000000..b637b7e --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2Module.java @@ -0,0 +1,115 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Hs2Control; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by lixuesong on 16/10/20. + */ +@ReactModule(name = "HS2Module") +public class HS2Module extends iHealthBaseModule { + private static final String modelName = "HS2Module"; + private static final String TAG = "HS2Module"; + + private static final String EVENT_NOTIFY = "event_notify_hs2"; + + public HS2Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + private static Hs2Control getControl(String mac) { + return iHealthDevicesManager.getInstance().getHs2Control(mac); + } + + @ReactMethod + public void getOfflineData(String mac) { + Hs2Control control = getControl(mac); + if (control != null) { + control.getOfflineData(); + } else { + Log.e(TAG, "Can not find HS2 Control mac:" + mac); + } + } + + @ReactMethod + public void measureOnline(String mac, int unit, int userId) { + Hs2Control control = getControl(mac); + if (control != null) { + control.measureOnline(unit, userId); + } else { + Log.e(TAG, "Can not find HS2 Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + Hs2Control hs2Control = getControl(mac); + if (hs2Control != null) { + hs2Control.disconnect(); + } else { + Log.e(TAG, "Can not find HS2 Control mac:" + mac); + } + } + + @ReactMethod + public void getBattery(String mac) { + Hs2Control hs2Control = getControl(mac); + if (hs2Control != null) { + hs2Control.getBattery(); + } else { + Log.e(TAG, "Can not find HS2 Control mac:" + mac); + } + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getHs2Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SModule.java new file mode 100755 index 0000000..f99dfcc --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SModule.java @@ -0,0 +1,322 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Hs2sControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "HS2SModule") +public class HS2SModule extends iHealthBaseModule { + private static final String modelName = "HS2SModule"; + private static final String TAG = "HS2SModule"; + + private static final String EVENT_NOTIFY = "event_notify_hs2s"; + + public HS2SModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + private static Hs2sControl getControl(String mac) { + return iHealthDevicesManager.getInstance().getHs2sControl(mac); + } + + @ReactMethod + public void getDeviceInfo(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.getDeviceInfo(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.disconnect(); + } else { + Log.e(TAG, "Can not find HS2 Control mac:" + mac); + } + } + + @ReactMethod + public void getBattery(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.getBattery(); + } else { + Log.e(TAG, "Can not find HS2 Control mac:" + mac); + } + } + + @ReactMethod + public void setUnit(String mac, int unit) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.setUnit(unit); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void getUserInfo(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.getUserInfo(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void updateUserInfo(String mac, String id, int createTS, float weight, int age, int height, int gender, int impedance, int bodybuilding) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.createOrUpdateUserInfo(id, weight, gender, age, height, impedance, bodybuilding); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void deleteUser(String mac, String id) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.deleteUserInfo(id); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void specifyTouristUsers(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.specifyTouristUsers(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void measure(String mac, int index, String id, int ts, float weight, int age, int height, int gender, int impedance, int bodybuilding) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.specifyOnlineUsers(id, weight, gender, age, height, impedance, bodybuilding); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void getMemoryDataCount(String mac, String id) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.getOfflineDataCount(id); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void getMemoryData(String mac, String id) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.getOfflineData(id); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void deleteMemoryData(String mac, String id) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.deleteOfflineData(id); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void getAnonymousMemoryDataCount(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.getAnonymousDataCount(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void getAnonymousMemoryData(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.getAnonymousData(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void deleteAnonymousMemoryData(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.deleteAnonymousData(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void resetDevice(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.restoreFactorySettings(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void setDeviceLightUp(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.setBleLight(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void enterHS2SHeartRateMeasurementMode(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.startHeartRateMode(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @ReactMethod + public void exitHS2SHeartRateMeasurementMode(String mac) { + Hs2sControl control = getControl(mac); + if (control != null) { + control.stopHeartRateMode(); + } else { + Log.e(TAG, "Can not find HS2S Control mac:" + mac); + } + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + Log.i(TAG, "message -> " + message); + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + + if ("action_history_data".equals(action) || "action_anonymous_data".equals(action)) { + message = "{\"history_data\":" + message + "}"; + } + + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + if ("battery_hs".equals(action)) { + params.putString("action", "action_get_battery_hs"); + int battery = params.getInt("battery"); + params.putInt("battery", battery); + + } else if ("action_set_unit_success".equals(action)) { + params.putString("action", "action_set_unit"); + params.putBoolean("result", true); + + } else if ("action_create_or_update_user_info".equals(action)) { + int status = params.getInt("status"); + params.putInt("result", status); + params.putNull("describe"); + params.putNull("status"); + + } else if ("action_delete_user_info".equals(action)) { + int status = params.getInt("status"); + params.putInt("result", status); + params.putNull("describe"); + params.putNull("status"); + + } else if ("action_history_data_num".equals(action)) { + ReadableArray array = params.getArray("history_data_count_array"); + int history_data_count = 0; + if (array != null && array.size() > 0) { + history_data_count = array.getMap(0).getInt("history_data_count"); + } + params.putNull("history_data_count_array"); + params.putNull("history_data_user_count"); + params.putInt("history_data_count", history_data_count); + + } else if ("action_delete_history_data".equals(action)) { + int status = params.getInt("status"); + params.putInt("result", status); + params.putNull("describe"); + params.putNull("status"); + + } else if ("action_delete_anonymous_data".equals(action)) { + int status = params.getInt("status"); + params.putInt("result", status); + params.putNull("describe"); + params.putNull("status"); + + } else if ("action_restore_factory_settings".equals(action)) { + params.putBoolean("result", true); + + } else if ("action_specify_users".equals(action)) { + int status = params.getInt("status"); + params.putInt("result", status); + params.putNull("describe"); + params.putNull("status"); + } + + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getHs2sDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SProfileModule.java new file mode 100755 index 0000000..725d09c --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS2SProfileModule.java @@ -0,0 +1,209 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Hs2sProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +@ReactModule(name = "HS2SProfileModule") +public class HS2SProfileModule extends ReactContextBaseJavaModule { + private static final String modelName = "HS2SProfileModule"; + private static final String TAG = "HS2SProfileModule"; + + private static final String ACTION_ERROR_HS = "ACTION_ERROR_HS"; + private static final String ERROR_NUM_HS = "ERROR_NUM_HS"; + private static final String ERROR_DESCRIPTION_HS = "ERROR_DESCRIPTION_HS"; + + private static final String ACTION_GET_DEVICE_INFO = "ACTION_GET_DEVICE_INFO"; + private static final String HS_USER_COUNT = "HS_USER_COUNT"; + private static final String HS_UNIT_CURRENT = "HS_UNIT_CURRENT"; + + private static final String ACTION_BATTERY_HS = "ACTION_BATTERY_HS"; + private static final String BATTERY_HS = "BATTERY_HS"; + + private static final String ACTION_SET_UNIT_SUCCESS = "ACTION_SET_UNIT_SUCCESS"; + + private static final String ACTION_GET_USER_INFO = "ACTION_GET_USER_INFO"; + private static final String USER_INFO_COUNT = "USER_INFO_COUNT"; + private static final String USER_INFO_ARRAY = "USER_INFO_ARRAY"; + private static final String USER_INFO_USER_ID = "USER_INFO_USER_ID"; + private static final String USER_INFO_CREATE_TIME = "USER_INFO_CREATE_TIME"; + private static final String USER_INFO_WEIGHT = "USER_INFO_WEIGHT"; + private static final String USER_INFO_GENDER = "USER_INFO_GENDER"; + private static final String USER_INFO_AGE = "USER_INFO_AGE"; + private static final String USER_INFO_HEIGHT = "USER_INFO_HEIGHT"; + private static final String USER_INFO_IMPEDANCE = "USER_INFO_IMPEDANCE"; + private static final String USER_INFO_BODYBUILDING = "USER_INFO_BODYBUILDING"; + + private static final String ACTION_CREATE_OR_UPDATE_USER_INFO = "ACTION_CREATE_OR_UPDATE_USER_INFO"; + private static final String OPERATION_STATUS = "OPERATION_STATUS"; + private static final String OPERATION_DESCRIBE = "OPERATION_DESCRIBE"; + + private static final String ACTION_DELETE_USER_INFO = "ACTION_DELETE_USER_INFO"; + + private static final String ACTION_SPECIFY_USERS = "ACTION_SPECIFY_USERS"; + + private static final String ACTION_MEASURE_FINISH_AT_CRITICAL = "ACTION_MEASURE_FINISH_AT_CRITICAL"; + + private static final String ACTION_HISTORY_DATA_NUM = "ACTION_HISTORY_DATA_NUM"; + private static final String HISTORY_DATA_USER_COUNT = "HISTORY_DATA_USER_COUNT"; + private static final String HISTORY_DATA_COUNT_ARRAY = "HISTORY_DATA_COUNT_ARRAY"; + private static final String HISTORY_DATA_COUNT = "HISTORY_DATA_COUNT"; + + private static final String ACTION_HISTORY_DATA = "ACTION_HISTORY_DATA"; + private static final String DATA_ID = "DATA_ID"; + private static final String DATA_WEIGHT = "DATA_WEIGHT"; + private static final String DATA_IMPEDANCE = "DATA_IMPEDANCE"; + private static final String DATA_USER_NUM = "DATA_USER_NUM"; + private static final String DATA_GENDER = "DATA_GENDER"; + private static final String DATA_AGE = "DATA_AGE"; + private static final String DATA_HEIGHT = "DATA_HEIGHT"; + private static final String DATA_MEASURE_TIME = "DATA_MEASURE_TIME"; + private static final String DATA_RIGHT_TIME = "DATA_RIGHT_TIME"; + private static final String DATA_BODYBUILDING = "DATA_BODYBUILDING"; + private static final String DATA_INSTRUCTION_TYPE = "DATA_INSTRUCTION_TYPE"; + private static final String DATA_BODY_FIT_PERCENTAGE = "DATA_BODY_FIT_PERCENTAGE"; + private static final String DATA_MUSCLE_MASS = "DATA_MUSCLE_MASS"; + private static final String DATA_BONE_SALT_CONTENT = "DATA_BONE_SALT_CONTENT"; + private static final String DATA_BODY_WATER_RATE = "DATA_BODY_WATER_RATE"; + private static final String DATA_PROTEIN_RATE = "DATA_PROTEIN_RATE"; + private static final String DATA_SKELETAL_MUSCLE_MASS = "DATA_SKELETAL_MUSCLE_MASS"; + private static final String DATA_BASAL_METABOLIC_RATE = "DATA_BASAL_METABOLIC_RATE"; + private static final String DATA_VISCERAL_FAT_GRADE = "DATA_VISCERAL_FAT_GRADE"; + private static final String DATA_PHYSICAL_AGE = "DATA_PHYSICAL_AGE"; + private static final String DATA_BODY_MASS_INDEX = "DATA_BODY_MASS_INDEX"; + + private static final String DATA_STANDARD_WEIGHT = "DATA_STANDARD_WEIGHT"; + private static final String DATA_WEIGHT_CONTROL = "DATA_WEIGHT_CONTROL"; + private static final String DATA_MUSCLE_CONTROL = "DATA_MUSCLE_CONTROL"; + private static final String DATA_FAT_CONTROL = "DATA_FAT_CONTROL"; + private static final String DATA_FAT_WEIGHT = "DATA_FAT_WEIGHT"; + private static final String DATA_DE_FAT_WEIGHT = "DATA_DE_FAT_WEIGHT"; + + private static final String ACTION_ONLINE_RESULT = "ACTION_ONLINE_RESULT"; + private static final String ACTION_DELETE_HISTORY_DATA = "ACTION_DELETE_HISTORY_DATA"; + + private static final String ACTION_ANONYMOUS_DATA_NUM = "ACTION_ANONYMOUS_DATA_NUM"; + private static final String ANONYMOUS_DATA_COUNT = "ANONYMOUS_DATA_COUNT"; + + private static final String ACTION_DELETE_ANONYMOUS_DATA = "ACTION_DELETE_ANONYMOUS_DATA"; + private static final String ACTION_ONLINE_REAL_TIME_WEIGHT = "ACTION_ONLINE_REAL_TIME_WEIGHT"; + private static final String ACTION_BODY_FAT_RESULT = "ACTION_BODY_FAT_RESULT"; + private static final String DATA_BODY_FAT_RESULT = "DATA_BODY_FAT_RESULT"; + + private static final String ACTION_RESTORE_FACTORY_SETTINGS = "ACTION_RESTORE_FACTORY_SETTINGS"; + + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + private static final String ACTION_HS2S_LightUp_DEVICE = "ACTION_HS2S_LightUp_DEVICE"; + private static final String HS2S_DEVICE_STATUS = "HS2S_DEVICE_STATUS"; + private static final String ACTION_HS2S_MEASURE_HEARTRATE = "ACTION_HS2S_MEASURE_HEARTRATE"; + private static final String ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS = "ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS"; + private static final String HS2S_MEASURE_HEARTRATE_RESULT = "HS2S_MEASURE_HEARTRATE_RESULT"; + + public HS2SProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_ERROR_HS, Hs2sProfile.ACTION_ERROR_HS); + constants.put(ERROR_NUM_HS, Hs2sProfile.ERROR_NUM_HS); + constants.put(ERROR_DESCRIPTION_HS, Hs2sProfile.ERROR_DESCRIPTION_HS); + + constants.put(ACTION_GET_DEVICE_INFO, Hs2sProfile.ACTION_GET_DEVICE_INFO); + constants.put(HS_USER_COUNT, Hs2sProfile.HS_USER_COUNT); + constants.put(HS_UNIT_CURRENT, Hs2sProfile.HS_UNIT_CURRENT); + + constants.put(ACTION_BATTERY_HS, Hs2sProfile.ACTION_BATTERY_HS); + constants.put(BATTERY_HS, Hs2sProfile.BATTERY_HS); + + constants.put(ACTION_SET_UNIT_SUCCESS, Hs2sProfile.ACTION_SET_UNIT_SUCCESS); + + constants.put(ACTION_GET_USER_INFO, Hs2sProfile.ACTION_GET_USER_INFO); + constants.put(USER_INFO_COUNT, Hs2sProfile.USER_INFO_COUNT); + constants.put(USER_INFO_ARRAY, Hs2sProfile.USER_INFO_ARRAY); + constants.put(USER_INFO_USER_ID, Hs2sProfile.USER_INFO_USER_ID); + constants.put(USER_INFO_CREATE_TIME, Hs2sProfile.USER_INFO_CREATE_TIME); + constants.put(USER_INFO_WEIGHT, Hs2sProfile.USER_INFO_WEIGHT); + constants.put(USER_INFO_GENDER, Hs2sProfile.USER_INFO_GENDER); + constants.put(USER_INFO_AGE, Hs2sProfile.USER_INFO_AGE); + constants.put(USER_INFO_HEIGHT, Hs2sProfile.USER_INFO_HEIGHT); + constants.put(USER_INFO_IMPEDANCE, Hs2sProfile.USER_INFO_IMPEDANCE); + constants.put(USER_INFO_BODYBUILDING, Hs2sProfile.USER_INFO_BODYBUILDING); + + constants.put(ACTION_CREATE_OR_UPDATE_USER_INFO, Hs2sProfile.ACTION_CREATE_OR_UPDATE_USER_INFO); + constants.put(OPERATION_STATUS, Hs2sProfile.OPERATION_STATUS); + constants.put(OPERATION_DESCRIBE, Hs2sProfile.OPERATION_DESCRIBE); + + constants.put(ACTION_DELETE_USER_INFO, Hs2sProfile.ACTION_DELETE_USER_INFO); + constants.put(ACTION_SPECIFY_USERS, Hs2sProfile.ACTION_SPECIFY_USERS); + constants.put(ACTION_MEASURE_FINISH_AT_CRITICAL, Hs2sProfile.ACTION_MEASURE_FINISH_AT_CRITICAL); + + constants.put(ACTION_HISTORY_DATA_NUM, Hs2sProfile.ACTION_HISTORY_DATA_NUM); + constants.put(HISTORY_DATA_USER_COUNT, Hs2sProfile.HISTORY_DATA_USER_COUNT); + constants.put(HISTORY_DATA_COUNT_ARRAY, Hs2sProfile.HISTORY_DATA_COUNT_ARRAY); + constants.put(HISTORY_DATA_COUNT, Hs2sProfile.HISTORY_DATA_COUNT); + + constants.put(ACTION_HISTORY_DATA, Hs2sProfile.ACTION_HISTORY_DATA); + constants.put(DATA_ID, Hs2sProfile.DATA_ID); + constants.put(DATA_WEIGHT, Hs2sProfile.DATA_WEIGHT); + constants.put(DATA_IMPEDANCE, Hs2sProfile.DATA_IMPEDANCE); + constants.put(DATA_USER_NUM, Hs2sProfile.DATA_USER_NUM); + constants.put(DATA_GENDER, Hs2sProfile.DATA_GENDER); + constants.put(DATA_AGE, Hs2sProfile.DATA_AGE); + constants.put(DATA_HEIGHT, Hs2sProfile.DATA_HEIGHT); + constants.put(DATA_MEASURE_TIME, Hs2sProfile.DATA_MEASURE_TIME); + constants.put(DATA_RIGHT_TIME, Hs2sProfile.DATA_RIGHT_TIME); + constants.put(DATA_BODYBUILDING, Hs2sProfile.DATA_BODYBUILDING); + constants.put(DATA_INSTRUCTION_TYPE, Hs2sProfile.DATA_INSTRUCTION_TYPE); + constants.put(DATA_BODY_FIT_PERCENTAGE, Hs2sProfile.DATA_BODY_FIT_PERCENTAGE); + constants.put(DATA_MUSCLE_MASS, Hs2sProfile.DATA_MUSCLE_MASS); + constants.put(DATA_BONE_SALT_CONTENT, Hs2sProfile.DATA_BONE_SALT_CONTENT); + constants.put(DATA_BODY_WATER_RATE, Hs2sProfile.DATA_BODY_WATER_RATE); + constants.put(DATA_SKELETAL_MUSCLE_MASS, Hs2sProfile.DATA_SKELETAL_MUSCLE_MASS); + constants.put(DATA_BASAL_METABOLIC_RATE, Hs2sProfile.DATA_BASAL_METABOLIC_RATE); + constants.put(DATA_VISCERAL_FAT_GRADE, Hs2sProfile.DATA_VISCERAL_FAT_GRADE); + constants.put(DATA_PHYSICAL_AGE, Hs2sProfile.DATA_PHYSICAL_AGE); + constants.put(DATA_BODY_MASS_INDEX, Hs2sProfile.DATA_BODY_MASS_INDEX); + constants.put(DATA_STANDARD_WEIGHT, Hs2sProfile.DATA_STANDARD_WEIGHT); + constants.put(DATA_WEIGHT_CONTROL, Hs2sProfile.DATA_WEIGHT_CONTROL); + constants.put(DATA_MUSCLE_CONTROL, Hs2sProfile.DATA_MUSCLE_CONTROL); + constants.put(DATA_FAT_CONTROL, Hs2sProfile.DATA_FAT_CONTROL); + constants.put(DATA_FAT_WEIGHT, Hs2sProfile.DATA_FAT_WEIGHT); + constants.put(DATA_DE_FAT_WEIGHT, Hs2sProfile.DATA_DE_FAT_WEIGHT); + + constants.put(ACTION_ONLINE_RESULT, Hs2sProfile.ACTION_ONLINE_RESULT); + constants.put(ACTION_DELETE_HISTORY_DATA, Hs2sProfile.ACTION_DELETE_HISTORY_DATA); + + constants.put(ACTION_ANONYMOUS_DATA_NUM, Hs2sProfile.ACTION_ANONYMOUS_DATA_NUM); + constants.put(ANONYMOUS_DATA_COUNT, Hs2sProfile.ANONYMOUS_DATA_COUNT); + + constants.put(ACTION_DELETE_ANONYMOUS_DATA, Hs2sProfile.ACTION_DELETE_ANONYMOUS_DATA); + constants.put(ACTION_ONLINE_REAL_TIME_WEIGHT, Hs2sProfile.ACTION_ONLINE_REAL_TIME_WEIGHT); + constants.put(ACTION_BODY_FAT_RESULT, Hs2sProfile.ACTION_BODY_FAT_RESULT); + constants.put(DATA_BODY_FAT_RESULT, Hs2sProfile.DATA_BODY_FAT_RESULT); + + constants.put(ACTION_RESTORE_FACTORY_SETTINGS, Hs2sProfile.ACTION_RESTORE_FACTORY_SETTINGS); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + + constants.put(ACTION_HS2S_LightUp_DEVICE, Hs2sProfile.ACTION_SET_BLE_LIGHT); + constants.put(HS2S_DEVICE_STATUS, Hs2sProfile.OPERATION_STATUS); + constants.put(ACTION_HS2S_MEASURE_HEARTRATE, Hs2sProfile.ACTION_START_HEARTRATE_MEASURE); + constants.put(ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS, Hs2sProfile.ACTION_STOP_HEARTRATE_MEASURE); + constants.put(HS2S_MEASURE_HEARTRATE_RESULT, Hs2sProfile.DATA_HEARTRATE); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS4SModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS4SModule.java new file mode 100755 index 0000000..e7b8469 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS4SModule.java @@ -0,0 +1,129 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Hs4Control; +import com.ihealth.communication.control.Hs4sControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by lixuesong on 16/10/20. + */ +@ReactModule(name = "HS4SModule") +public class HS4SModule extends iHealthBaseModule { + private static final String modelName = "HS4SModule"; + private static final String TAG = "HS4SModule"; + + private static final String EVENT_NOTIFY = "event_notify_hs4s"; + + public HS4SModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + private static Hs4Control getHs4Control(String mac) { + return iHealthDevicesManager.getInstance().getHs4Control(mac); + } + + private static Hs4sControl getHs4sControl(String mac) { + return iHealthDevicesManager.getInstance().getHs4sControl(mac); + } + + @ReactMethod + public void getOfflineData(String mac) { + Hs4Control hs4Control = getHs4Control(mac); + Hs4sControl hs4sControl = getHs4sControl(mac); + if (hs4Control != null) { + hs4Control.getOfflineData(); + + } else if (hs4sControl != null){ + hs4sControl.getOfflineData(); + + } else { + Log.e(TAG, "Can not find HS4/HS4S Control mac:" + mac); + } + } + + @ReactMethod + public void measureOnline(String mac, int unit, int userId) { + Hs4Control hs4Control = getHs4Control(mac); + Hs4sControl hs4sControl = getHs4sControl(mac); + if (hs4Control != null) { + hs4Control.measureOnline(unit, userId); + + } else if (hs4sControl != null) { + hs4sControl.measureOnline(unit, userId); + + } else { + Log.e(TAG, "Can not find HS4/HS4S Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + Hs4Control hs4Control = getHs4Control(mac); + Hs4sControl hs4sControl = getHs4sControl(mac); + if (hs4Control != null) { + hs4Control.disconnect(); + + } else if (hs4sControl != null) { + hs4sControl.disconnect(); + + } else { + Log.e(TAG, "Can not find HS4/HS4S Control mac:" + mac); + } + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getHs4Devices(); + List device2 = iHealthDevicesManager.getInstance().getHs4sDevices(); + devices.addAll(device2); + + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6Module.java new file mode 100755 index 0000000..c0da5b2 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6Module.java @@ -0,0 +1,134 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.HS6Control; +import com.ihealth.communication.manager.iHealthDeviceHs6Callback; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by lixuesong on 16/10/20. + */ +@ReactModule(name = "HS6Module") +public class HS6Module extends iHealthBaseModule { + private static final String modelName = "HS6Module"; + private static final String TAG = "HS6Module"; + + private static final String EVENT_NOTIFY = "event_notify_hs6"; + private ReactApplicationContext mContext; + private HS6Control mHS6control; + + public HS6Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + this.mContext = reactContext; + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void init(String userName) { + mHS6control = new HS6Control(userName, mContext, iHealthDevicesManager.TYPE_HS6, mIHealthDeviceHs6Callback); + } + + @ReactMethod + public void setWifi(String ssid, String password) { + if (mHS6control != null) { + mHS6control.setWifi(ssid, password); + } else { + Log.e(TAG, "Please call init(String username) method first"); + } + } + + @ReactMethod + public void bindDeviceHS6(String birthday, float weight, int height, int isSporter, int gender, String serialNumber) { + if (mHS6control != null) { + mHS6control.bindDeviceHS6(birthday, weight, height, isSporter, gender, serialNumber); + } else { + Log.e(TAG, "Please call init(String username) method first"); + } + } + + @ReactMethod + public void unBindDeviceHS6(String serialNumber) { + if (mHS6control != null) { + mHS6control.unBindDeviceHS6(serialNumber); + } else { + Log.e(TAG, "Please call init(String username) method first"); + } + } + + @ReactMethod + public void getToken(String clientId, String clientSecret, String username, String clientPara) { + if (mHS6control != null) { + mHS6control.getToken(clientId, clientSecret, username, clientPara); + } else { + Log.e(TAG, "Please call init(String username) method first"); + } + } + + @ReactMethod + public void setUnit(String username, int unitType) { + if (mHS6control != null) { + mHS6control.setUnit(username, unitType); + } else { + Log.e(TAG, "Please call init(String username) method first"); + } + } + + @ReactMethod + public void getCloudData(String clientId, String clientSecret, String username, double downloadTS, double pageSize) { + if (mHS6control != null) { + mHS6control.getDataByMeasuretimeFromCloud(clientId, clientSecret, username, (long) downloadTS, (long) pageSize); + } else { + Log.e(TAG, "Please call init(String username) method first"); + } + } + + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + private iHealthDeviceHs6Callback mIHealthDeviceHs6Callback = new iHealthDeviceHs6Callback() { + public void setWifiNotify(String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("deviceType", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + public void onNotify(String mac, String deviceType, String action, String message) { + handleNotify(mac, deviceType, action, message); + } + }; +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6ProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6ProfileModule.java new file mode 100755 index 0000000..2b3a77d --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HS6ProfileModule.java @@ -0,0 +1,93 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.HS6Control; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by lixuesong on 15/11/2016. + */ +@ReactModule(name = "HS6ProfileModule") +public class HS6ProfileModule extends ReactContextBaseJavaModule { + private static final String modelName = "HS6ProfileModule"; + private static final String TAG = "HS6ProfileModule"; + + private static final String ACTION_HS6_SETWIFI = "ACTION_HS6_SETWIFI"; + private static final String SETWIFI_RESULT = "SETWIFI_RESULT"; + + private static final String ACTION_HS6_BIND = "ACTION_HS6_BIND"; + private static final String HS6_BIND_EXTRA = "HS6_BIND_EXTRA"; + private static final String BIND_HS6_RESULT = "BIND_HS6_RESULT"; + private static final String HS6_MODEL = "HS6_MODEL"; + private static final String HS6_POSITION = "HS6_POSITION"; + private static final String HS6_SETTED_WIFI = "HS6_SETTED_WIFI"; + + private static final String ACTION_HS6_UNBIND = "ACTION_HS6_UNBIND"; + private static final String HS6_UNBIND_RESULT = "HS6_UNBIND_RESULT"; + + private static final String ACTION_HS6_GET_TOKEN = "ACTION_HS6_GET_TOKEN"; + private static final String GET_TOKEN_RESULT = "GET_TOKEN_RESULT"; + + private static final String ACTION_HS6_SET_UNIT = "ACTION_HS6_SET_UNIT"; + private static final String SET_UNIT_RESULT = "SET_UNIT_RESULT"; + + private static final String ACTION_HS6_ERROR = "ACTION_HS6_ERROR"; + private static final String HS6_ERROR = "HS6_ERROR"; + + + public static final String ACTION_HS6_GET_DATA = "ACTION_HS6_GET_DATA"; + + public static final String DATA_RESULT = "DATA_RESULT"; + + public static final String DATA_DOWNLOAD_TS = "DATA_DOWNLOAD_TS"; + public static final String DATA_LEFTNUMBER = "DATA_LEFTNUMBER"; + + + public HS6ProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_HS6_SETWIFI, HS6Control.ACTION_HS6_SETWIFI); + constants.put(SETWIFI_RESULT, HS6Control.SETWIFI_RESULT); + + constants.put(ACTION_HS6_BIND, HS6Control.ACTION_HS6_BIND); + constants.put(HS6_BIND_EXTRA, HS6Control.HS6_BIND_EXTRA); + constants.put(BIND_HS6_RESULT, HS6Control.BIND_HS6_RESULT); + constants.put(HS6_MODEL, HS6Control.HS6_MODEL); + constants.put(HS6_POSITION, HS6Control.HS6_POSITION); + constants.put(HS6_SETTED_WIFI, HS6Control.HS6_SETTED_WIFI); + + constants.put(ACTION_HS6_UNBIND, HS6Control.ACTION_HS6_UNBIND); + constants.put(HS6_UNBIND_RESULT, HS6Control.HS6_UNBIND_RESULT); + + constants.put(ACTION_HS6_GET_TOKEN, HS6Control.ACTION_HS6_GET_TOKEN); + constants.put(GET_TOKEN_RESULT, HS6Control.GET_TOKEN_RESULT); + + constants.put(ACTION_HS6_SET_UNIT, HS6Control.ACTION_HS6_SET_UNIT); + constants.put(SET_UNIT_RESULT, HS6Control.SET_UNIT_RESULT); + + constants.put(ACTION_HS6_ERROR, HS6Control.ACTION_HS6_ERROR); + constants.put(HS6_ERROR, HS6Control.HS6_ERROR); + constants.put(ACTION_HS6_GET_DATA, HS6Control.ACTION_HS6_GET_DATA); + constants.put(DATA_RESULT, HS6Control.DATA_RESULT); + constants.put(DATA_DOWNLOAD_TS, HS6Control.DATA_DOWNLOAD_TS); + constants.put(DATA_LEFTNUMBER, HS6Control.DATA_LEFTNUMBER); + + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HSProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HSProfileModule.java new file mode 100755 index 0000000..75c7930 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/HSProfileModule.java @@ -0,0 +1,92 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.HsProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by lixuesong on 15/11/2016. + */ +@ReactModule(name = "HSProfileModule") +public class HSProfileModule extends ReactContextBaseJavaModule { + private static final String modelName = "HSProfileModule"; + private static final String TAG = "HSProfileModule"; + + private static final String ACTION_LIVEDATA_HS = "ACTION_LIVEDATA_HS"; + private static final String LIVEDATA_HS = "LIVEDATA_HS"; + + private static final String ACTION_ONLINE_RESULT_HS = "ACTION_ONLINE_RESULT_HS"; + private static final String DATAID = "DATAID"; + private static final String WEIGHT_HS = "WEIGHT_HS"; + private static final String FAT_HS = "FAT_HS"; + private static final String WATER_HS = "WATER_HS"; + private static final String MUSCLE_HS = "MUSCLE_HS"; + private static final String SKELETON_HS = "SKELETON_HS"; + private static final String FATELEVEL_HS = "FATELEVEL_HS"; + private static final String DCI_HS = "DCI_HS"; + + private static final String ACTION_HISTORICAL_DATA_HS = "ACTION_HISTORICAL_DATA_HS"; + private static final String HISTORDATA_HS = "HISTORDATA_HS"; + private static final String MEASUREMENT_DATE_HS = "MEASUREMENT_DATE_HS"; + + private static final String ACTION_HISTORICAL_DATA_COMPLETE_HS = "ACTION_HISTORICAL_DATA_COMPLETE_HS"; + + private static final String ACTION_NO_HISTORICALDATA = "ACTION_NO_HISTORICALDATA"; + + private static final String ACTION_ERROR_HS = "ACTION_ERROR_HS"; + private static final String ERROR_NUM_HS = "ERROR_NUM_HS"; + private static final String ERROR_ID_ILLEGAL_ARGUMENT = "ERROR_ID_ILLEGAL_ARGUMENT"; + private static final String ERROR_ID_WIFI_DISABLED = "ERROR_ID_WIFI_DISABLED"; + private static final String ERROR_DESCRIPTION_HS = "ERROR_DESCRIPTION_HS"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + + public HSProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_LIVEDATA_HS, HsProfile.ACTION_LIVEDATA_HS); + constants.put(LIVEDATA_HS, HsProfile.LIVEDATA_HS); + + constants.put(ACTION_ONLINE_RESULT_HS, HsProfile.ACTION_ONLINE_RESULT_HS); + constants.put(HISTORDATA_HS, HsProfile.HISTORDATA_HS); + constants.put(DATAID, HsProfile.DATAID); + constants.put(WEIGHT_HS, HsProfile.WEIGHT_HS); + constants.put(FAT_HS, HsProfile.FAT_HS); + constants.put(WATER_HS, HsProfile.WATER_HS); + constants.put(MUSCLE_HS, HsProfile.MUSCLE_HS); + constants.put(SKELETON_HS, HsProfile.SKELETON_HS); + constants.put(FATELEVEL_HS, HsProfile.FATELEVEL_HS); + constants.put(DCI_HS, HsProfile.DCI_HS); + + constants.put(ACTION_HISTORICAL_DATA_HS, HsProfile.ACTION_HISTORICAL_DATA_HS); + constants.put(MEASUREMENT_DATE_HS, HsProfile.MEASUREMENT_DATE_HS); + + constants.put(ACTION_HISTORICAL_DATA_COMPLETE_HS, HsProfile.ACTION_HISTORICAL_DATA_COMPLETE_HS); + + constants.put(ACTION_NO_HISTORICALDATA, HsProfile.ACTION_NO_HISTORICALDATA); + + constants.put(ACTION_ERROR_HS, HsProfile.ACTION_ERROR_HS); + constants.put(ERROR_NUM_HS, HsProfile.ERROR_NUM_HS); + constants.put(ERROR_ID_ILLEGAL_ARGUMENT, HsProfile.ERROR_ID_ILLEGAL_ARGUMENT); + constants.put(ERROR_ID_WIFI_DISABLED, HsProfile.ERROR_ID_WIFI_DISABLED); + constants.put(ERROR_DESCRIPTION_HS, HsProfile.ERROR_DESCRIPTION_HS); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BModule.java new file mode 100644 index 0000000..ab26294 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BModule.java @@ -0,0 +1,98 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.NT13BControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "NT13BModule") +public class NT13BModule extends iHealthBaseModule{ + + private static final String modelName = "NT13BModule"; + private static final String TAG = "NT13BModule"; + + private static final String EVENT_NOTIFY = "event_notify_nt13b"; + + public NT13BModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void measure(String mac) { + NT13BControl nt13bControl = getNt13bControl(mac); + if (nt13bControl != null) { + nt13bControl.getMeasurement(); + } + } + + @ReactMethod + public void disconnect(String mac) { + NT13BControl nt13bControl = getNt13bControl(mac); + if (nt13bControl != null) { + nt13bControl.disconnect(); + } + } + + private NT13BControl getNt13bControl(String mac) { + NT13BControl nt13bControl = iHealthDevicesManager.getInstance().getNT13BControl(mac); + if (nt13bControl == null) { + senErrMessage(400); + } + return nt13bControl; + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getNT13BDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BProfileModule.java new file mode 100644 index 0000000..8160b90 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/NT13BProfileModule.java @@ -0,0 +1,52 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.NT13BProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +@ReactModule(name = "NT13BProfileModule") +public class NT13BProfileModule extends ReactContextBaseJavaModule { + + private static final String modelName = "NT13BProfileModule"; + private static final String TAG = "NT13BProfileModule"; + + private static final String ACTION_MEASUREMENT_RESULT = "ACTION_MEASUREMENT_RESULT"; + private static final String UNIT_FLAG = "unit_flag"; + private static final String RESULT = "result"; + private static final String TS_FLAG = "ts_flag"; + private static final String TS = "ts"; + private static final String THERMOMETER_TYPE_FLAG = "thermometer_type_flag"; + private static final String THERMOMETER_TYPE = "thermometer_type"; + + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + public NT13BProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_MEASUREMENT_RESULT, NT13BProfile.ACTION_MEASUREMENT_RESULT); + constants.put(UNIT_FLAG, NT13BProfile.UNIT_FLAG); + constants.put(RESULT, NT13BProfile.RESULT); + constants.put(TS_FLAG, NT13BProfile.TS_FLAG); + constants.put(TS, NT13BProfile.TS); + constants.put(THERMOMETER_TYPE_FLAG, NT13BProfile.THERMOMETER_TYPE_FLAG); + constants.put(THERMOMETER_TYPE, NT13BProfile.THERMOMETER_TYPE); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1Module.java new file mode 100644 index 0000000..3213531 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1Module.java @@ -0,0 +1,99 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Po1Control; +import com.ihealth.communication.control.Pt3sbtControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "PO1Module") +public class PO1Module extends iHealthBaseModule { + + private static final String modelName = PO1Module.class.getSimpleName(); + private static final String TAG = PO1Module.class.getSimpleName(); + + private static final String EVENT_NOTIFY = "event_notify_po1"; + + public PO1Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void getBattery(String mac) { + Po1Control po1Control = getPo1Control(mac); + if (po1Control != null) { + po1Control.getBattery(); + } + } + + @ReactMethod + public void disconnect(String mac) { + Po1Control po1Control = getPo1Control(mac); + if (po1Control != null) { + po1Control.disconnect(); + } + } + + private Po1Control getPo1Control(String mac) { + Po1Control po1Control = iHealthDevicesManager.getInstance().getPo1Device(mac); + if (po1Control == null) { + senErrMessage(400); + } + return po1Control; + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getPo1Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1ProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1ProfileModule.java new file mode 100644 index 0000000..8860361 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO1ProfileModule.java @@ -0,0 +1,73 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Po1Profile; +import com.ihealth.communication.control.PoProfile; +import com.ihealth.communication.control.Pt3sbtControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Nullable; + +@ReactModule(name = "PO1ProfileModule") +public class PO1ProfileModule extends ReactContextBaseJavaModule { + + private static final String modelName = PO1ProfileModule.class.getSimpleName(); + private static final String TAG = PO1ProfileModule.class.getSimpleName(); + + private static final String ACTION_BO_MEASUREMENT = "ACTION_BO_MEASUREMENT"; + private static final String ACTION_ERROR_PO1 = "ACTION_ERROR_PO1"; + private static final String ACTION_GET_BATTERY = "ACTION_GET_BATTERY"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + private static final String ERROR_ID = "ERROR_ID"; + private static final String ERROR_DESCRIPTION = "ERROR_DESCRIPTION"; + private static final String BATTERY = "BATTERY"; + private static final String STATUS = "STATUS"; + + private static final String BLOOD_OXYGEN = "PO1_BLOOD_OXYGEN"; + private static final String PULSE = "PO1_PULSE"; + private static final String PULSE_FORCE = "PO1_PULSE_FORCE"; + private static final String PI = "PO1_PI"; + private static final String WAVE = "PO1_WAVE"; + + public PO1ProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_BO_MEASUREMENT, Po1Profile.ACTION_BO_MEASUREMENT); + constants.put(ACTION_GET_BATTERY, Po1Profile.ACTION_GET_BATTERY); + constants.put(ACTION_ERROR_PO1, Po1Profile.ACTION_ERROR_PO1); + constants.put(ERROR_ID, Po1Profile.ERROR_ID); + constants.put(ERROR_DESCRIPTION, Po1Profile.ERROR_DESCRIPTION); + constants.put(BATTERY, Po1Profile.BATTERY); + constants.put(STATUS, Po1Profile.STATUS); + constants.put(BLOOD_OXYGEN, Po1Profile.BLOOD_OXYGEN); + constants.put(PULSE, Po1Profile.PULSE); + constants.put(PULSE_FORCE, Po1Profile.PULSE_FORCE); + constants.put(PI, Po1Profile.PI); + constants.put(WAVE, Po1Profile.WAVE); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO3Module.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO3Module.java new file mode 100755 index 0000000..2db176c --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PO3Module.java @@ -0,0 +1,115 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Po3Control; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by lixuesong on 2016/11/21. + */ +@ReactModule(name = "PO3Module") +public class PO3Module extends iHealthBaseModule { + private static final String modelName = "PO3Module"; + private static final String TAG = "PO3Module"; + + private static final String EVENT_NOTIFY = "event_notify_po3"; + + public PO3Module(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + private static Po3Control getControl(String mac) { + return iHealthDevicesManager.getInstance().getPo3Control(mac); + } + + @ReactMethod + public void getBattery(String mac) { + Po3Control po3Control = getControl(mac); + if (po3Control != null) { + po3Control.getBattery(); + } else { + Log.e(TAG, "Can not find PO3 Control mac:" + mac); + } + } + + @ReactMethod + public void startMeasure(String mac) { + Po3Control po3Control = getControl(mac); + if (po3Control != null) { + po3Control.startMeasure(); + } else { + Log.e(TAG, "Can not find PO3 Control mac:" + mac); + } + } + + @ReactMethod + public void getHistoryData(String mac) { + Po3Control po3Control = getControl(mac); + if (po3Control != null) { + po3Control.getHistoryData(); + } else { + Log.e(TAG, "Can not find PO3 Control mac:" + mac); + } + } + + @ReactMethod + public void disconnect(String mac) { + Po3Control po3Control = getControl(mac); + if (po3Control != null) { + po3Control.disconnect(); + } else { + Log.e(TAG, "Can not find PO3 Control mac:" + mac); + } + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getPo3Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/POProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/POProfileModule.java new file mode 100755 index 0000000..ca6a962 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/POProfileModule.java @@ -0,0 +1,78 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.PoProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by lixuesong on 15/11/2016. + */ +@ReactModule(name = "POProfileModule") +public class POProfileModule extends ReactContextBaseJavaModule { + private static final String modelName = "POProfileModule"; + private static final String TAG = "POProfileModule"; + + private static final String ACTION_BATTERY_PO = "ACTION_BATTERY_PO"; + private static final String BATTERY_PO = "BATTERY_PO"; + + private static final String ACTION_LIVEDA_PO = "ACTION_LIVEDA_PO"; + private static final String PULSE_WAVE_PO = "PULSE_WAVE_PO"; + private static final String PI_PO = "PI_PO"; + private static final String PULSE_STRENGTH_PO = "PULSE_STRENGTH_PO"; + private static final String BLOOD_OXYGEN_PO = "BLOOD_OXYGEN_PO"; + private static final String PULSE_RATE_PO = "PULSE_RATE_PO"; + + private static final String ACTION_RESULTDATA_PO = "ACTION_RESULTDATA_PO"; + private static final String DATAID = "DATAID"; + + private static final String ACTION_OFFLINEDATA_PO = "ACTION_OFFLINEDATA_PO"; + private static final String OFFLINEDATA_PO = "OFFLINEDATA_PO"; + private static final String MEASURE_DATE_PO = "MEASURE_DATE_PO"; + + private static final String ACTION_NO_OFFLINEDATA_PO = "ACTION_NO_OFFLINEDATA_PO"; + private static final String ACTION_ERROR_PO = "ACTION_ERROR_PO"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + + public POProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_BATTERY_PO, PoProfile.ACTION_BATTERY_PO); + constants.put(BATTERY_PO, PoProfile.BATTERY_PO); + + constants.put(ACTION_LIVEDA_PO, PoProfile.ACTION_LIVEDA_PO); + constants.put(PULSE_WAVE_PO, PoProfile.PULSE_WAVE_PO); + constants.put(PI_PO, PoProfile.PI_PO); + constants.put(PULSE_STRENGTH_PO, PoProfile.PULSE_STRENGTH_PO); + constants.put(BLOOD_OXYGEN_PO, PoProfile.BLOOD_OXYGEN_PO); + constants.put(PULSE_RATE_PO, PoProfile.PULSE_RATE_PO); + + constants.put(ACTION_RESULTDATA_PO, PoProfile.ACTION_RESULTDATA_PO); + constants.put(DATAID, PoProfile.DATAID); + + constants.put(ACTION_OFFLINEDATA_PO, PoProfile.ACTION_OFFLINEDATA_PO); + constants.put(OFFLINEDATA_PO, PoProfile.OFFLINEDATA_PO); + constants.put(MEASURE_DATE_PO, PoProfile.MEASURE_DATE_PO); + + constants.put(ACTION_NO_OFFLINEDATA_PO, PoProfile.ACTION_NO_OFFLINEDATA_PO); + constants.put(ACTION_ERROR_PO, PoProfile.ACTION_ERROR_PO); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTModule.java new file mode 100644 index 0000000..cefb077 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTModule.java @@ -0,0 +1,152 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Pt3sbtControl; +import com.ihealth.communication.control.Pt3sbtProfile; +import com.ihealth.communication.control.TS28BControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "PT3SBTModule") +public class PT3SBTModule extends iHealthBaseModule { + + private static final String modelName = PT3SBTModule.class.getSimpleName(); + private static final String TAG = PT3SBTModule.class.getSimpleName(); + + private static final String EVENT_NOTIFY = "event_notify_pt3sbt"; + + public PT3SBTModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void setTime(String mac) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + pt3sbtControl.setTime(); + } + } + + @ReactMethod + public void getBattery(String mac) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + pt3sbtControl.getBattery(); + } + } + + @ReactMethod + public void setUnit(String mac, int unit) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + if (unit == 1) { + pt3sbtControl.setUnit(Pt3sbtProfile.PT3SBT_UNIT.Centigrade); + } else { + pt3sbtControl.setUnit(Pt3sbtProfile.PT3SBT_UNIT.Fahrenheit); + } + } + } + + @ReactMethod + public void getUnit(String mac) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + pt3sbtControl.getUnit(); + } + } + + @ReactMethod + public void getHistoryCount(String mac) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + pt3sbtControl.getHistoryCount(); + } + } + + @ReactMethod + public void getHistoryData(String mac) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + pt3sbtControl.getHistoryData(); + } + } + + @ReactMethod + public void deleteHistory(String mac) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + pt3sbtControl.deleteHistory(); + } + } + + @ReactMethod + public void disconnect(String mac) { + Pt3sbtControl pt3sbtControl = getPt3sbtControl(mac); + if (pt3sbtControl != null) { + pt3sbtControl.disconnect(); + } + } + + private Pt3sbtControl getPt3sbtControl(String mac) { + Pt3sbtControl pt3sbtControl = iHealthDevicesManager.getInstance().getPt3sbtDevice(mac); + if (pt3sbtControl == null) { + senErrMessage(400); + } + return pt3sbtControl; + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getPt3Devices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTProfileModule.java new file mode 100644 index 0000000..7ef1282 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/PT3SBTProfileModule.java @@ -0,0 +1,73 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Pt3sbtProfile; +import com.ihealth.communication.control.TS28BProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +@ReactModule(name = "PT3SBTProfileModule") +public class PT3SBTProfileModule extends ReactContextBaseJavaModule { + + private static final String modelName = PT3SBTProfileModule.class.getSimpleName(); + private static final String TAG = PT3SBTProfileModule.class.getSimpleName(); + + private static final String ACTION_SET_TIME = "ACTION_SET_TIME"; + private static final String ACTION_GET_BATTERY = "ACTION_GET_BATTERY"; + private static final String ACTION_SET_UNIT = "ACTION_SET_UNIT"; + private static final String ACTION_GET_UNIT = "ACTION_GET_UNIT"; + private static final String ACTION_GET_HISTORY_COUNT = "ACTION_GET_HISTORY_COUNT"; + private static final String ACTION_GET_HISTORY_DATA = "ACTION_GET_HISTORY_DATA"; + private static final String ACTION_DELETE_HISTORY_DATA = "ACTION_DELETE_HISTORY_DATA"; + private static final String ACTION_TEMPERATURE_MEASUREMENT = "ACTION_TEMPERATURE_MEASUREMENT"; + private static final String ACTION_PUB_UNIT = "ACTION_PUB_UNIT"; + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + private static final String STATUS = "STATUS"; + private static final String BATTERY = "BATTERY"; + private static final String UNIT = "UNIT"; + private static final String COUNT = "COUNT"; + private static final String TEMPERATURE = "TEMPERATURE"; + private static final String TS = "TS"; + private static final String HISTORY = "HISTORY"; + + public PT3SBTProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_SET_TIME, Pt3sbtProfile.ACTION_SET_TIME); + constants.put(ACTION_GET_BATTERY, Pt3sbtProfile.ACTION_GET_BATTERY); + constants.put(ACTION_SET_UNIT, Pt3sbtProfile.ACTION_SET_UNIT); + constants.put(ACTION_GET_UNIT, Pt3sbtProfile.ACTION_GET_UNIT); + constants.put(ACTION_GET_HISTORY_COUNT, Pt3sbtProfile.ACTION_GET_HISTORY_COUNT); + constants.put(ACTION_GET_HISTORY_DATA, Pt3sbtProfile.ACTION_GET_HISTORY_DATA); + constants.put(ACTION_DELETE_HISTORY_DATA, Pt3sbtProfile.ACTION_DELETE_HISTORY_DATA); + constants.put(ACTION_TEMPERATURE_MEASUREMENT, Pt3sbtProfile.ACTION_TEMPERATURE_MEASUREMENT); + constants.put(ACTION_PUB_UNIT, Pt3sbtProfile.ACTION_PUB_UNIT); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + + constants.put(STATUS, Pt3sbtProfile.STATUS); + constants.put(BATTERY, Pt3sbtProfile.BATTERY); + constants.put(UNIT, Pt3sbtProfile.UNIT); + constants.put(TS, Pt3sbtProfile.TS); + constants.put(COUNT, Pt3sbtProfile.COUNT); + constants.put(TEMPERATURE, Pt3sbtProfile.TEMPERATURE); + constants.put(HISTORY, Pt3sbtProfile.HISTORY); + + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BModule.java new file mode 100644 index 0000000..a6c2ed5 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BModule.java @@ -0,0 +1,98 @@ +package com.ihealth.ihealthlibrary; + +import android.text.TextUtils; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.TS28BControl; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@ReactModule(name = "TS28BModule") +public class TS28BModule extends iHealthBaseModule { + + private static final String modelName = "TS28BModule"; + private static final String TAG = "TS28BModule"; + + private static final String EVENT_NOTIFY = "event_notify_ts28b"; + + public TS28BModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Override + public Map getConstants() { + Map map = new HashMap<>(); + map.put("Event_Notify", EVENT_NOTIFY); + return map; + } + + @ReactMethod + public void measure(String mac) { + TS28BControl ts28bControl = getTs28bControl(mac); + if (ts28bControl != null) { + ts28bControl.getMeasurement(); + } + } + + @ReactMethod + public void disconnect(String mac) { + TS28BControl ts28bControl = getTs28bControl(mac); + if (ts28bControl != null) { + ts28bControl.disconnect(); + } + } + + private TS28BControl getTs28bControl(String mac) { + TS28BControl ts28bControl = iHealthDevicesManager.getInstance().getTS28BControl(mac); + if (ts28bControl == null) { + senErrMessage(400); + } + return ts28bControl; + } + + private void senErrMessage(int errId) { + WritableMap params = Arguments.createMap(); + params.putInt("errorid", errId); + sendEvent(EVENT_NOTIFY, params); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + WritableMap params = Arguments.createMap(); + params.putString("action", action); + params.putString("mac", mac); + params.putString("type", deviceType); + if (!TextUtils.isEmpty(message)) { + Utils.jsonToMap(message, params); + } + sendEvent(EVENT_NOTIFY, params); + } + + @ReactMethod + public void getAllConnectedDevices() { + List devices = iHealthDevicesManager.getInstance().getTS28BDevices(); + WritableMap params = Arguments.createMap(); + if (devices.size() > 0) { + WritableArray array = Arguments.createArray(); + for (String device : devices) { + array.pushString(device); + } + params.putArray("devices", array); + params.putString("action", ACTION_GET_ALL_CONNECTED_DEVICES); + } + sendEvent(EVENT_NOTIFY, params); + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BProfileModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BProfileModule.java new file mode 100644 index 0000000..4becc24 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/TS28BProfileModule.java @@ -0,0 +1,52 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.TS28BProfile; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +@ReactModule(name = "TS28BProfileModule") +public class TS28BProfileModule extends ReactContextBaseJavaModule { + + private static final String modelName = "TS28BProfileModule"; + private static final String TAG = "TS28BProfileModule"; + + private static final String ACTION_MEASUREMENT_RESULT = "ACTION_MEASUREMENT_RESULT"; + private static final String UNIT_FLAG = "unit_flag"; + private static final String RESULT = "result"; + private static final String TS_FLAG = "ts_flag"; + private static final String TS = "ts"; + private static final String THERMOMETER_TYPE_FLAG = "thermometer_type_flag"; + private static final String THERMOMETER_TYPE = "thermometer_type"; + + private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES"; + + public TS28BProfileModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return modelName; + } + + @Nullable + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + constants.put(ACTION_MEASUREMENT_RESULT, TS28BProfile.ACTION_MEASUREMENT_RESULT); + constants.put(UNIT_FLAG, TS28BProfile.UNIT_FLAG); + constants.put(RESULT, TS28BProfile.RESULT); + constants.put(TS_FLAG, TS28BProfile.TS_FLAG); + constants.put(TS, TS28BProfile.TS); + constants.put(THERMOMETER_TYPE_FLAG, TS28BProfile.THERMOMETER_TYPE_FLAG); + constants.put(THERMOMETER_TYPE, TS28BProfile.THERMOMETER_TYPE); + constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES); + return constants; + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/Utils.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/Utils.java new file mode 100755 index 0000000..8d95011 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/Utils.java @@ -0,0 +1,123 @@ +package com.ihealth.ihealthlibrary; + + + +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + + +import java.util.Iterator; + + +/** + * Created by jing on 16/11/10. + */ + + +public class Utils { + + private static final String TAG = "Utils"; + + + public static void jsonToMap(String jsonString, WritableMap writableMap) { + JSONObject jsonObject = null; + try { + jsonObject = new JSONObject(jsonString); + + if (jsonObject.length()>0) { + for (Iterator keys=jsonObject.keys(); keys.hasNext();) { + String key = keys.next(); + try { + Object object = jsonObject.get(key); + if (object instanceof JSONObject) { + writableMap.putMap(key, getMapFromJSONObject((JSONObject) object)); + } else if (object instanceof JSONArray) { + writableMap.putArray(key, getWritableArrayFromJSONArray((JSONArray) object)); + } else { + objectToMap(object, writableMap, key); + } + } catch (JSONException e) { + e.printStackTrace(); + } + } + } + + } catch (JSONException e) { + e.printStackTrace(); + } + } + + public static WritableMap getMapFromJSONObject(JSONObject object) { + WritableMap map = Arguments.createMap(); + Iterator keyIterator = object.keys(); + while (keyIterator.hasNext()) { + String key = keyIterator.next(); + try { + Object value = object.get(key); + if (value instanceof JSONObject) { + // value is JSONObject case + map.putMap(key, getMapFromJSONObject((JSONObject) value)); + } else if (value instanceof JSONArray) { + // value is JSONArray case + map.putArray(key, getWritableArrayFromJSONArray((JSONArray) value)); + } else { + // Normal object case + objectToMap(value, map, key); + } + } catch (JSONException e) { + e.printStackTrace(); + } + } + return map; + } + + public static WritableArray getWritableArrayFromJSONArray(JSONArray array) { + WritableArray writableArray = Arguments.createArray(); + for (int i = 0; i < array.length(); i++) { + try { + Object objectInArray = array.get(i); + if (objectInArray instanceof JSONObject) { + writableArray.pushMap(getMapFromJSONObject((JSONObject) objectInArray)); + } else if (objectInArray instanceof Boolean) { + writableArray.pushBoolean((Boolean) objectInArray); + } else if(objectInArray instanceof Integer) { + writableArray.pushInt((Integer) objectInArray); + } else if(objectInArray instanceof Double) { + writableArray.pushDouble((Double) objectInArray); + } else if(objectInArray instanceof String) { + writableArray.pushString((String) objectInArray); + } else if(objectInArray instanceof Long) { + writableArray.pushDouble((Long) objectInArray); + } else { + Log.e(TAG, "Unknown type : " + objectInArray.getClass().getSimpleName()); + } + } catch (JSONException e) { + e.printStackTrace(); + } + } + return writableArray; + } + + private static void objectToMap(Object object, WritableMap writableMap, String key) { + if (object instanceof Boolean) { + writableMap.putBoolean(key, (Boolean) object); + } else if(object instanceof Integer) { + writableMap.putInt(key, (Integer) object); + } else if(object instanceof Double) { + writableMap.putDouble(key, (Double) object); + } else if(object instanceof String) { + writableMap.putString(key, (String) object); + } else if(object instanceof Long) { + writableMap.putDouble(key, (Long) object); + } else { + Log.e(TAG, "Unknown type : " + object.getClass().getSimpleName()); + } + } +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthBaseModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthBaseModule.java new file mode 100755 index 0000000..3b41d55 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthBaseModule.java @@ -0,0 +1,40 @@ +package com.ihealth.ihealthlibrary; + +import android.util.Log; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.facebook.react.modules.core.DeviceEventManagerModule; + +/** + * Created by Jeepend on 21/11/2016. + * Base class for iHealth Modules, provide sendEvent method for you. + */ +@ReactModule(name = "iHealthBaseModule") +public abstract class iHealthBaseModule extends ReactContextBaseJavaModule { + + private final String TAG; + private DeviceEventManagerModule.RCTDeviceEventEmitter mEmitter = null; + public static final String ACTION_GET_ALL_CONNECTED_DEVICES = "action_get_all_connected_devices"; + + public iHealthBaseModule(String tag, ReactApplicationContext reactContext) { + super(reactContext); + TAG = tag; + } + + void sendEvent(String eventName, WritableMap data) { + if (mEmitter == null) { + mEmitter = getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class); + } + if (mEmitter != null) { + mEmitter.emit(eventName, data); + } else { + Log.e(TAG, "mEmitter is null, can't send event."); + } + } + + public abstract void handleNotify(String mac, String deviceType, String action, String message); +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerModule.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerModule.java new file mode 100644 index 0000000..b752d27 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerModule.java @@ -0,0 +1,734 @@ +package com.ihealth.ihealthlibrary; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.text.TextUtils; +import android.util.Log; + +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.LifecycleEventListener; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; +import com.ihealth.communication.control.Bg1Control; +import com.ihealth.communication.control.Bg1Profile; +import com.ihealth.communication.manager.DiscoveryTypeEnum; +import com.ihealth.communication.manager.iHealthDevicesCallback; +import com.ihealth.communication.manager.iHealthDevicesManager; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Created by jing on 16/10/20. + */ +@ReactModule(name = "iHealthDeviceManagerModule") +public class iHealthDeviceManagerModule extends iHealthBaseModule implements LifecycleEventListener { + + private static final String modelName = "iHealthDeviceManagerModule"; + private static final String TAG = "iHealthModel"; + + private final static String AM3S = "AM3S"; + private final static String AM4 = "AM4"; + private final static String AM5 = "AM5"; + private final static String PO3 = "PO3"; + private final static String BP5 = "BP5"; + private final static String BP5S = "BP5S"; + private final static String BP3L = "BP3L"; + private final static String BP7 = "BP7"; + private final static String BP7S = "BP7S"; + private final static String KN550 = "KN550"; + private final static String HS2 = "HS2"; + private final static String HS2S = "HS2S"; + private final static String HS4 = "HS4"; + private final static String HS4S = "HS4S"; + // private final static String HS6 = "HS6"; + private final static String BG1 = "BG1"; + private final static String BG1S = "BG1S"; + private final static String BG5 = "BG5"; + private final static String BG5S = "BG5S"; + private final static String BG5L = "BG5L"; + private final static String BTM = "BTM"; + private final static String ECG3 = "ECG3"; + private final static String ECG3USB = "ECG3USB"; + + private final static String PT3SBT = "PT3SBT"; + private final static String TS28B = "TS28B"; + private final static String NT13B = "NT13B"; + private final static String PO1 = "PO1"; + + + private final static String Event_Scan_Device = "event_scan_device"; + private final static String Event_Scan_Finish = "event_scan_finish"; + private final static String Event_Device_Connected = "event_device_connected"; + private final static String Event_Device_Connect_Failed = "event_device_connect_failed"; + private final static String Event_Device_Disconnect = "event_device_disconnect"; + private final static String Event_Authenticate_Result = "event_authenticate_result"; + + private static int callbackId; + private ReactApplicationContext mContext; + private String userName; + private String mac = "";//macAddressForBg1 + private static final String DESCRIPTION = "description"; + private static final String IDPS = "idps"; + private String idps = ""; + + public iHealthDeviceManagerModule(ReactApplicationContext reactContext) { + super(TAG, reactContext); + mContext = reactContext; + reactContext.addLifecycleEventListener(this); + + // SDK init deferred to ensureInitialized() — called lazily on first startDiscovery + } + + private iHealthDevicesCallback miHealthDevicesCallback = new iHealthDevicesCallback() { + + @Override + public void onScanDevice(String mac, String deviceType, int rssi, Map manufactorData) { + WritableMap params = Arguments.createMap(); + params.putString("mac", mac); + if (deviceType.equals("ECGUSB")) { + params.putString("type", "ECG3USB"); + + } else if (deviceType.equals("KN-550BT")) { + params.putString("type", "KN550"); + + } else { + params.putString("type", deviceType); + } + params.putInt("rssi", rssi); + sendEvent(Event_Scan_Device, params); + } + + @Override + public void onDeviceConnectionStateChange(String mac, String deviceType, int status, int errorID, Map manufactorData) { + String eventName = null; + if (status == iHealthDevicesManager.DEVICE_STATE_CONNECTED) { + eventName = Event_Device_Connected; + } else if (status == iHealthDevicesManager.DEVICE_STATE_CONNECTIONFAIL) { + eventName = Event_Device_Connect_Failed; + } else if (status == iHealthDevicesManager.DEVICE_STATE_DISCONNECTED) { + eventName = Event_Device_Disconnect; + } + if (eventName != null) { + WritableMap params = Arguments.createMap(); + params.putString("mac", mac); + if (deviceType.equals("ECGUSB")) { + params.putString("type", "ECG3USB"); + + } else if (deviceType.equals("KN-550BT")) { + params.putString("type", "KN550"); + + } else { + params.putString("type", deviceType); + } + params.putInt("errorid", errorID); + sendEvent(eventName, params); + } + } + + @Override + public void onUserStatus(String username, int userStatus) { + WritableMap params = Arguments.createMap(); + params.putInt("authen", userStatus); + sendEvent(Event_Authenticate_Result, params); + } + + @Override + public void onDeviceNotify(String mac, String deviceType, String action, String message) { + commandHandleDeviceNotify(mac, deviceType, action, message); + } + + @Override + public void onScanFinish() { + sendEvent(Event_Scan_Finish, null); + } + + }; + + private void commandHandleDeviceNotify(String mac, String deviceType, String action, String message) { + //为了与iOS返回值保持一致,需要进行二次加工 + iHealthBaseModule module = null; + switch (deviceType) { + case iHealthDevicesManager.TYPE_BP5: + module = getReactApplicationContext().getNativeModule(BP5Module.class); + break; + + case iHealthDevicesManager.TYPE_BP5S: + module = getReactApplicationContext().getNativeModule(BP5SModule.class); + break; + + case iHealthDevicesManager.TYPE_BP3L: + module = getReactApplicationContext().getNativeModule(BP3LModule.class); + break; + + case iHealthDevicesManager.TYPE_550BT: + module = getReactApplicationContext().getNativeModule(BP550BTModule.class); + break; + + case iHealthDevicesManager.TYPE_BP7: + module = getReactApplicationContext().getNativeModule(BP7Module.class); + break; + + case iHealthDevicesManager.TYPE_BP7S: + module = getReactApplicationContext().getNativeModule(BP7SModule.class); + break; + + case iHealthDevicesManager.TYPE_AM3S: + module = getReactApplicationContext().getNativeModule(AM3SModule.class); + break; + + case iHealthDevicesManager.TYPE_AM4: + module = getReactApplicationContext().getNativeModule(AM4Module.class); + break; + + case iHealthDevicesManager.TYPE_AM5: + module = getReactApplicationContext().getNativeModule(AM5Module.class); + break; + + case iHealthDevicesManager.TYPE_PO3: + module = getReactApplicationContext().getNativeModule(PO3Module.class); + break; + + case iHealthDevicesManager.TYPE_HS2: + module = getReactApplicationContext().getNativeModule(HS2Module.class); + break; + + case iHealthDevicesManager.TYPE_HS2S: + case iHealthDevicesManager.TYPE_HS2S_PRO: + module = getReactApplicationContext().getNativeModule(HS2SModule.class); + break; + + case iHealthDevicesManager.TYPE_HS4: + case iHealthDevicesManager.TYPE_HS4S: + module = getReactApplicationContext().getNativeModule(HS4SModule.class); + break; + + case iHealthDevicesManager.TYPE_HS6: + break; + + case iHealthDevicesManager.TYPE_BG1: + break; + + case iHealthDevicesManager.TYPE_BG1S: + module = getReactApplicationContext().getNativeModule(BG1SModule.class); + break; + + case iHealthDevicesManager.TYPE_BG5: + module = getReactApplicationContext().getNativeModule(BG5Module.class); + break; + + case iHealthDevicesManager.TYPE_BG5S: + module = getReactApplicationContext().getNativeModule(BG5SModule.class); + break; + + case iHealthDevicesManager.TYPE_FDIR_V3: + module = getReactApplicationContext().getNativeModule(BTMModule.class); + break; + + case iHealthDevicesManager.TYPE_ECG3: + module = getReactApplicationContext().getNativeModule(ECGModule.class); + break; + + case iHealthDevicesManager.TYPE_ECG3_USB: + module = getReactApplicationContext().getNativeModule(ECGUSBModule.class); + break; + + case iHealthDevicesManager.TYPE_PT3SBT: + module = getReactApplicationContext().getNativeModule(PT3SBTModule.class); + break; + + case iHealthDevicesManager.TYPE_TS28B: + module = getReactApplicationContext().getNativeModule(TS28BModule.class); + break; + + case iHealthDevicesManager.TYPE_NT13B: + module = getReactApplicationContext().getNativeModule(NT13BModule.class); + break; + + case iHealthDevicesManager.TYPE_PO1: + module = getReactApplicationContext().getNativeModule(PO1Module.class); + break; + + default: + module = null; + break; + } + if (module != null) { + module.handleNotify(mac, deviceType, action, message); + } else { + Log.e(TAG, "We do not support this type: " + deviceType); + } + } + + @Nullable + @Override + public Map getConstants() { + final Map constants = new HashMap<>(); + constants.put(AM3S, iHealthDevicesManager.DISCOVERY_AM3S); + constants.put(AM4, iHealthDevicesManager.DISCOVERY_AM4); + constants.put(AM5, iHealthDevicesManager.DISCOVERY_AM5); + constants.put(PO3, iHealthDevicesManager.DISCOVERY_PO3); + constants.put(BP5, iHealthDevicesManager.DISCOVERY_BP5); + constants.put(BP5S, iHealthDevicesManager.DISCOVERY_BP5S); + constants.put(BP3L, iHealthDevicesManager.DISCOVERY_BP3L); + constants.put(BP7, iHealthDevicesManager.DISCOVERY_BP7); + constants.put(BP7S, iHealthDevicesManager.DISCOVERY_BP7S); + constants.put(KN550, iHealthDevicesManager.DISCOVERY_BP550BT); + constants.put(HS2, iHealthDevicesManager.DISCOVERY_HS2); + constants.put(HS2S, iHealthDevicesManager.DISCOVERY_HS2S); + constants.put(HS4, iHealthDevicesManager.DISCOVERY_HS4); + constants.put(HS4S, iHealthDevicesManager.DISCOVERY_HS4S); + constants.put(BG1, (double) 110); + constants.put(BG1S, iHealthDevicesManager.DISCOVERY_BG1S); + constants.put(BG5, iHealthDevicesManager.DISCOVERY_BG5); + constants.put(BG5S, iHealthDevicesManager.DISCOVERY_BG5S); + constants.put(BTM, iHealthDevicesManager.DISCOVERY_FDIR_V3); + constants.put(ECG3, iHealthDevicesManager.DISCOVERY_ECG3); + constants.put(ECG3USB, iHealthDevicesManager.DISCOVERY_ECG3_USB); + constants.put(PT3SBT, iHealthDevicesManager.DISCOVERY_PT3SBT); + constants.put(TS28B, iHealthDevicesManager.DISCOVERY_TS28B); + constants.put(NT13B, iHealthDevicesManager.DISCOVERY_NT13B); + constants.put(PO1, iHealthDevicesManager.DISCOVERY_PO1); + constants.put(PO3, iHealthDevicesManager.DISCOVERY_PO3); + + constants.put("Event_Scan_Device", Event_Scan_Device); + constants.put("Event_Scan_Finish", Event_Scan_Finish); + constants.put("Event_Device_Connected", Event_Device_Connected); + constants.put("Event_Device_Connect_Failed", Event_Device_Connect_Failed); + constants.put("Event_Device_Disconnect", Event_Device_Disconnect); + constants.put("Event_Authenticate_Result", Event_Authenticate_Result); + + return constants; + } + + @Override + public String getName() { + return modelName; + } + + + @Override + public void onHostResume() { + if (callbackId == 0) { + android.app.Activity activity = getCurrentActivity(); + android.app.Application app = activity != null ? activity.getApplication() : (android.app.Application) mContext.getApplicationContext(); + iHealthDevicesManager.getInstance().init(app, Log.VERBOSE, Log.VERBOSE); + Bg1Control.getInstance().init(mContext, "", 0, true); + callbackId = iHealthDevicesManager.getInstance().registerClientCallback(miHealthDevicesCallback); + } + } + + @Override + public void onHostPause() { + Log.i(TAG, "onHostPause"); + } + + @Override + public void onHostDestroy() { + Log.e(TAG, "onHostDestroy"); + + if (mBroadcastReceiverRegistered) { + unRegisterReceiver(); + } + callbackId = 0; + iHealthDevicesManager.getInstance().unRegisterClientCallback(callbackId); + iHealthDevicesManager.getInstance().destroy(); + } + + private DiscoveryTypeEnum getDiscoveryType(String type) { + + switch (type) { + case "AM3S": + return DiscoveryTypeEnum.AM3S; + + case "AM4": + return DiscoveryTypeEnum.AM4; + + case "AM5": + return DiscoveryTypeEnum.AM5; + + case "BG1S": + return DiscoveryTypeEnum.BG1S; + + case "BG5": + return DiscoveryTypeEnum.BG5; + + case "BG5S": + return DiscoveryTypeEnum.BG5S; + + case "BP3L": + return DiscoveryTypeEnum.BP3L; + + case "BP5": + return DiscoveryTypeEnum.BP5; + + case "BP5S": + return DiscoveryTypeEnum.BP5S; + + case "BP7": + return DiscoveryTypeEnum.BP7; + + case "KN550": + return DiscoveryTypeEnum.BP550BT; + + case "HS2": + return DiscoveryTypeEnum.HS2; + + case "HS2S": + return DiscoveryTypeEnum.HS2S; + + case "HS4": + return DiscoveryTypeEnum.HS4; + + case "HS4S": + return DiscoveryTypeEnum.HS4S; + + case "PO1": + return DiscoveryTypeEnum.PO1; + + case "PO3": + return DiscoveryTypeEnum.PO3; + + case "PT3SBT": + return DiscoveryTypeEnum.PT3SBT; + + case "NT13B": + return DiscoveryTypeEnum.NT13B; + + case "TS28B": + return DiscoveryTypeEnum.TS28B; + + default: + return DiscoveryTypeEnum.All; + + } + } + + private void ensureInitialized() { + if (callbackId == 0) { + android.app.Activity activity = getCurrentActivity(); + if (activity != null) { + iHealthDevicesManager.getInstance().init(activity.getApplication(), Log.VERBOSE, Log.VERBOSE); + } else { + iHealthDevicesManager.getInstance().init((android.app.Application) mContext.getApplicationContext(), Log.VERBOSE, Log.VERBOSE); + } + Bg1Control.getInstance().init(mContext, "", 0, true); + callbackId = iHealthDevicesManager.getInstance().registerClientCallback(miHealthDevicesCallback); + android.util.Log.e("iHealthScanner", "=== SDK initialized from ensureInitialized, callbackId=" + callbackId + " ==="); + } + } + + @ReactMethod + public void startDiscovery(String type) { + ensureInitialized(); + if (type.equals("BG1")) { + registerReceiver();//scan BG1 + } else { + iHealthDevicesManager.getInstance().startDiscovery(getDiscoveryType(type)); + } + } + + @ReactMethod + public void stopDiscovery() { + iHealthDevicesManager.getInstance().stopDiscovery(); + } + + @ReactMethod + public void connectDevice(String mac, String type) { + if (type.equals(BG1)) { + Bg1Control.getInstance().connect(); + } else if (type.equals(iHealthDevicesManager.TYPE_FDIR_V3)) { + connectTherm(this.userName, mac, type, 1, 1, 2, 0, 1, 0); + } else { + if (type.equals("KN550")) { + iHealthDevicesManager.getInstance().connectDevice(this.userName, mac, iHealthDevicesManager.TYPE_550BT); + } else { + iHealthDevicesManager.getInstance().connectDevice(this.userName, mac, type); + } + + } + } + + @ReactMethod + public void connectTherm(String userName, String mac, String type, int unit, int measureTarget, + int functionTarget, int hour, int minute, int second) { + iHealthDevicesManager.getInstance().connectTherm(userName, mac, type, + unit, measureTarget, functionTarget, hour, minute, second); + } + + @ReactMethod + public void authenConfigureInfo(String userName, String clientID, String clientSecret) { + this.userName = userName; + iHealthDevicesManager.getInstance().sdkUserInAuthor(mContext, userName, clientID, clientSecret, callbackId); + } + + @ReactMethod + public void authenAppSecret(String appSecret, Callback callback) { + boolean authenResult = iHealthDevicesManager.getInstance().sdkAuthWithAppSecret(mContext, appSecret); + callback.invoke(authenResult); + } + + @ReactMethod + public void getDevicesIDPS(String mac, Callback callback) { + String idpsInfo = iHealthDevicesManager.getInstance().getDevicesIDPS(mac); + WritableMap writableMap = Arguments.createMap(); + Utils.jsonToMap(idpsInfo, writableMap); + callback.invoke(writableMap); + } + + @Override + public void handleNotify(String mac, String deviceType, String action, String message) { + //Do nothing + } + + + private void registerReceiver() { + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(Intent.ACTION_HEADSET_PLUG); + intentFilter.addAction(Bg1Profile.ACTION_BG1_CONNECT_RESULT); + intentFilter.addAction(Bg1Profile.ACTION_BG1_SENDCODE_RESULT); + intentFilter.addAction(Bg1Profile.ACTION_BG1_MEASURE_ERROR); + intentFilter.addAction(Bg1Profile.ACTION_BG1_MEASURE_STANDBY); + intentFilter.addAction(Bg1Profile.ACTION_BG1_MEASURE_RESULT); + intentFilter.addAction(Bg1Profile.ACTION_BG1_MEASURE_STRIP_IN); + intentFilter.addAction(Bg1Profile.ACTION_BG1_MEASURE_GET_BLOOD); + intentFilter.addAction(Bg1Profile.ACTION_BG1_MEASURE_STRIP_OUT); + intentFilter.addAction(Bg1Profile.ACTION_BG1_IDPS); + mContext.registerReceiver(broadcastReceiver, intentFilter); + mBroadcastReceiverRegistered = true; + } + + synchronized private void unRegisterReceiver() { + mContext.unregisterReceiver(broadcastReceiver); + mBroadcastReceiverRegistered = false; + } + + private boolean mBroadcastReceiverRegistered = false; + private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (!TextUtils.isEmpty(intent.getAction())) { + iHealthBaseModule module = getReactApplicationContext().getNativeModule(BG1Module.class); + WritableMap params = Arguments.createMap(); + params.putString("action", intent.getAction()); + params.putString("mac", mac); + params.putString("type", BG1); + try { + JSONObject jsonObject = new JSONObject(); + switch (intent.getAction()) { + case Intent.ACTION_HEADSET_PLUG: + Log.e(TAG, "headset state -----> " + intent.getExtras().getInt("state")); + Log.e(TAG, "has microphone ----> " + intent.getExtras().getInt("microphone")); + Log.e(TAG, "headset name ------> " + intent.getExtras().getString("name")); + + jsonObject.put("state", intent.getExtras().getInt("state")); + Utils.jsonToMap(jsonObject.toString(), params); + + if (intent.getExtras().getInt("state") == 1) { + if (intent.getExtras().getInt("microphone") == 1) {//1 if headset has a microphone, 0 otherwise + sendEvent(Event_Scan_Device, params); + } else { + Log.e(TAG, "headSet has no microphone"); + } + + } else { + sendEvent(Event_Device_Disconnect, params); + Bg1Control.getInstance().disconnect(); + module.handleNotify(mac, BG1, Event_Device_Disconnect, jsonObject.toString()); + + } + sendEvent(Event_Scan_Finish, null); + + break; + case Bg1Profile.ACTION_BG1_CONNECT_RESULT: + int connectFlag = intent.getIntExtra(Bg1Profile.BG1_CONNECT_RESULT, -1); + jsonObject.put(Bg1Profile.BG1_CONNECT_RESULT, connectFlag); + jsonObject.put(DESCRIPTION, getErrorDescription(Bg1Profile.ACTION_BG1_CONNECT_RESULT, connectFlag)); + if (formatIdps(idps) != null) { + jsonObject.put(IDPS, formatIdps(idps)); + } + Utils.jsonToMap(jsonObject.toString(), params); + if (connectFlag == 0) { + sendEvent(Event_Device_Connected, params); + } else { + sendEvent(Event_Device_Connect_Failed, params); + } + break; + case Bg1Profile.ACTION_BG1_SENDCODE_RESULT: + int sendCodeFlag = intent.getIntExtra(Bg1Profile.BG1_SENDCODE_RESULT, -1); + jsonObject.put(Bg1Profile.BG1_SENDCODE_RESULT, sendCodeFlag); + jsonObject.put(DESCRIPTION, getErrorDescription(Bg1Profile.ACTION_BG1_SENDCODE_RESULT, sendCodeFlag)); + //Utils.jsonToMap(jsonObject.toString(), params); + + module.handleNotify(mac, BG1, Bg1Profile.ACTION_BG1_SENDCODE_RESULT, jsonObject.toString()); + break; + case Bg1Profile.ACTION_BG1_MEASURE_ERROR: + int errorNumber = intent.getIntExtra(Bg1Profile.BG1_MEASURE_ERROR, -1); + jsonObject.put(Bg1Profile.BG1_MEASURE_ERROR, errorNumber); + jsonObject.put(DESCRIPTION, getErrorDescription(Bg1Profile.ACTION_BG1_MEASURE_ERROR, errorNumber)); + module.handleNotify(mac, BG1, Bg1Profile.ACTION_BG1_MEASURE_ERROR, jsonObject.toString()); + break; + + case Bg1Profile.ACTION_BG1_MEASURE_RESULT: + int measureResult = intent.getIntExtra(Bg1Profile.BG1_MEASURE_RESULT, -1); + jsonObject.put(Bg1Profile.BG1_MEASURE_RESULT, measureResult); + module.handleNotify(mac, BG1, Bg1Profile.ACTION_BG1_MEASURE_RESULT, jsonObject.toString()); + break; + case Bg1Profile.ACTION_BG1_IDPS: + idps = intent.getStringExtra(Bg1Profile.BG1_IDPS); + mac = getMacFromIdps(idps); + // module.handleNotify(mac, BG1, Bg1Profile.ACTION_BG1_IDPS, intent.getStringExtra(Bg1Profile.BG1_IDPS)); + break; + default: + module.handleNotify(mac, BG1, intent.getAction(), jsonObject.toString()); + break; + + } + } catch (JSONException e) { + e.printStackTrace(); + } + } + } + + String getMacFromIdps(String idps) { + //{"IDPS":[{"DeviceId":"9D300A5682","FirmWare":"13.5.0","HardWare":"13.6.0"}]} + try { + JSONObject sourceObject = new JSONObject(idps); + JSONArray array = sourceObject.getJSONArray("IDPS"); + JSONObject object = (JSONObject) array.get(0); + return object.getString("DeviceId"); + } catch (Exception e) { + + } + return ""; + } + + JSONObject formatIdps(String idps) { + try { + JSONObject sourceObject = new JSONObject(idps); + JSONArray array = sourceObject.getJSONArray("IDPS"); + return (JSONObject) array.get(0); + } catch (Exception e) { + + } + return null; + } + + + String getErrorDescription(String action, int err_num) { + switch (action) { + case Bg1Profile.ACTION_BG1_CONNECT_RESULT: + case Bg1Profile.ACTION_BG1_SENDCODE_RESULT: + if ((err_num >= 6 && err_num <= 13) || (err_num >= 19 && err_num <= 28)) { + return "Send code failed."; + } + switch (err_num) { + case 0: + return "Success."; + case 1: + return "Hand shake timeout."; + case 2: + case 16://1307 + return "Get idps failed."; + case 3: + return "Register clientId failed."; + case 5: + case 17://1307 + return "Identify failed."; + case 32: + return "Connect timeout"; + case 18: + return "Set bottleId failed."; + default: + return "Unknown."; + } + + case Bg1Profile.ACTION_BG1_MEASURE_ERROR: + switch (err_num) { + case 0: + return "Battery is low."; + case 1: + return "Glucose test result is out of the measurement range."; + case 2: + return "Unknown interference detected, please repeat the test."; + case 3: + return "Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip."; + case 4: + return "Communication error,resend the code to repeat the test."; + case 5: + case 6: + return "The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test."; + case 7: + return "Authentication failed more than 10 times."; + case 8: + return "Communication error, please repeat the test."; + case 9: + case 10: + case 11: + return "Communication error, please repeat the test. If the problem persists, contact iHealth customer service for assistance."; + case 12: + return "Glucose test result is low."; + case 13: + return "Glucose test result is high."; + case 400: + return "Parameters out of range."; + case 401: + return "Dolby is on, please turn it off."; + default: + return "Unknown."; + } + default: + return "Unknown."; + } + } + }; + + @ReactMethod + public void disconnectDevice(String mac, String type) { + if (type.equals(BG1)) { + Bg1Control.getInstance().disconnect(); + } else { + iHealthDevicesManager.getInstance().disconnectDevice(mac, type); + } + } + + @ReactMethod + public void sdkAuthWithLicense(String license) { + boolean result = false; + try { + InputStream ins = mContext.getAssets().open(license); + byte[] licenseBuffer = new byte[ins.available()]; + ins.read(licenseBuffer); + ins.close(); + result = iHealthDevicesManager.getInstance().sdkAuthWithLicense(licenseBuffer); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + WritableMap writableMap = Arguments.createMap(); + writableMap.putBoolean("access", result); + sendEvent(Event_Authenticate_Result, writableMap); + } + + @ReactMethod + public void isSupportOTG(Callback callback) { + boolean isSupportOTG = iHealthDevicesManager.getInstance().checkSupportOTG(); + callback.invoke(isSupportOTG); + } + +} diff --git a/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerPackage.java b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerPackage.java new file mode 100644 index 0000000..79bfcb6 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/iHealthDeviceManagerPackage.java @@ -0,0 +1,70 @@ +package com.ihealth.ihealthlibrary; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Created by jing on 16/10/20. + */ + +public class iHealthDeviceManagerPackage implements ReactPackage { + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + modules.add(new iHealthDeviceManagerModule(reactContext)); + modules.add(new AM3SModule(reactContext)); + modules.add(new AM4Module(reactContext)); + modules.add(new AMProfileModule(reactContext)); + modules.add(new AM5Module(reactContext)); + modules.add(new AM5ProfileModule(reactContext)); + modules.add(new BP5Module(reactContext)); + modules.add(new BP5SModule(reactContext)); + modules.add(new BP3LModule(reactContext)); + modules.add(new BP550BTModule(reactContext)); + modules.add(new BP7Module(reactContext)); + modules.add(new BP7SModule(reactContext)); + modules.add(new BPProfileModule(reactContext)); + modules.add(new POProfileModule(reactContext)); + modules.add(new PO3Module(reactContext)); + modules.add(new HS2Module(reactContext)); + modules.add(new HS2SModule(reactContext)); + modules.add(new HS4SModule(reactContext)); + modules.add(new HSProfileModule(reactContext)); + modules.add(new HS2SProfileModule(reactContext)); + modules.add(new BG1Module(reactContext)); + modules.add(new BG1SModule(reactContext)); + modules.add(new BG1ProfileModule(reactContext)); + modules.add(new BG1SProfileModule(reactContext)); + modules.add(new BG5Module(reactContext)); + modules.add(new BG5SModule(reactContext)); + modules.add(new BG5SProfileModule(reactContext)); + modules.add(new BGProfileModule(reactContext)); + modules.add(new HS6Module(reactContext)); + modules.add(new HS6ProfileModule(reactContext)); + modules.add(new BTMModule(reactContext)); + modules.add(new BTMProfileModule(reactContext)); + modules.add(new ECGModule(reactContext)); + modules.add(new ECGProfileModule(reactContext)); + modules.add(new ECGUSBModule(reactContext)); + modules.add(new TS28BModule(reactContext)); + modules.add(new TS28BProfileModule(reactContext)); + modules.add(new NT13BModule(reactContext)); + modules.add(new NT13BProfileModule(reactContext)); + modules.add(new PO1Module(reactContext)); + modules.add(new PO1ProfileModule(reactContext)); + modules.add(new PT3SBTModule(reactContext)); + modules.add(new PT3SBTProfileModule(reactContext)); + return modules; + } + + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } +} diff --git a/libs/ihealth-sdk/android/src/main/res/values/strings.xml b/libs/ihealth-sdk/android/src/main/res/values/strings.xml new file mode 100755 index 0000000..827d429 --- /dev/null +++ b/libs/ihealth-sdk/android/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + iHealthLibrary + diff --git a/libs/ihealth-sdk/android/src/test/java/com/example/jing/ihealthlibrary/ExampleUnitTest.java b/libs/ihealth-sdk/android/src/test/java/com/example/jing/ihealthlibrary/ExampleUnitTest.java new file mode 100755 index 0000000..84a3f08 --- /dev/null +++ b/libs/ihealth-sdk/android/src/test/java/com/example/jing/ihealthlibrary/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.example.jing.ihealthlibrary; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/libs/ihealth-sdk/android/src/test/java/com/ihealth/ihealthlibrary/ExampleUnitTest.java b/libs/ihealth-sdk/android/src/test/java/com/ihealth/ihealthlibrary/ExampleUnitTest.java new file mode 100755 index 0000000..ee64f09 --- /dev/null +++ b/libs/ihealth-sdk/android/src/test/java/com/ihealth/ihealthlibrary/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.ihealth.ihealthlibrary; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/README.md b/libs/ihealth-sdk/doc/README.md new file mode 100755 index 0000000..a862013 --- /dev/null +++ b/libs/ihealth-sdk/doc/README.md @@ -0,0 +1,138 @@ +# iHealth device sdk + +## Installation + +### Using npm + +```shell +npm install --save @ihealth/ihealthlibrary-react-native +``` + +### Using yarn + +```shell +yarn add @ihealth/ihealthlibrary-react-native +``` + +## Usage + +### 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. +![Download](./doc/download.png) + +#### Integrate license file + +For iOS +As shown below, Add your license file to your iOS project. +![integrate ios](./doc/integrate-ios.png) + +For Android +As show below, Add your license file to your asserts folder. +![integrate android](./doc/integrate-android.png) + +#### Using license file + +```js +import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; + +// your license file +const filename = 'license.pem'; +iHealthDeviceManagerModule.sdkAuthWithLicense(filename); +``` + +### Troubleshooting + +#### For Android + +1. Check settings.gradle file in your android project and node_modules, make sure input the correct module path. + +```gradle +include ':ihealthlibrary-react-native' +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') +``` + +3. Import iHealth module in your MainActivity.java + +```java +protected List getPackages() { + return Arrays.asList( + new MainReactPackage(), + new iHealthDeviceManagerPackage() + ); +} +``` + +4. Location permission(in AndroidManifest.xml) + +```xml + + + +``` + +#### For iOS + +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 + +### 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. + +```js +componentDidMount() { + iHealthAPI.addListener(); +} + +componentWillUnmount() { + iHealthAPI.removeListener(); +} +``` + +#### For bluetooth LE or regular bluetooth device + +##### search device + +```js +import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; +const type = 'BP5'; // AM3S, AM4, BG5, BG5S, BP3L, BP5, BP5S, BP7S, HS2, HS4S, PO3,HS2S,BG1S +iHealthDeviceManagerModule.startDiscovery(type); +``` + +##### connect device + +```js +import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; +const mac = 'xxxxxxxxxxxxxx'; +const type = 'BP5'; // AM3S, AM4, BG5, BG5S, BP3L, BP5, BP5S, BP7S, HS2, HS4S, PO3,HS2S,BG1S +iHealthDeviceManagerModule.connectDevice(mac, type); +``` + +##### device workflow + +[AM3S workflow](./doc/am3s.md) +[AM4 workflow](./doc/am4.md) +[BG1 workflow](./doc/bg1.md) +[BG5 workflow](./doc/bg5.md) +[BG5S workflow](./doc/bg5s.md) +[BP3L workflow](./doc/bp3l.md) +[BP5 workflow](./doc/bp5.md) +[BP5S workflow](./doc/bp5s.md) +[BP7S workflow](./doc/bp7s.md) +[HS2 workflow](./doc/hs2.md) +[HS4S workflow](./doc/hs4s.md) +[HS6 workflow](./doc/hs6.md) +[PO3 workflow](./doc/po3.md) +[HS2S workflow](./doc/hs2s.md) +[BG1S workflow](./doc/bg1s.md) diff --git a/libs/ihealth-sdk/doc/am3s.md b/libs/ihealth-sdk/doc/am3s.md new file mode 100644 index 0000000..e9446de --- /dev/null +++ b/libs/ihealth-sdk/doc/am3s.md @@ -0,0 +1,388 @@ +# AM3S Workflow + +## Import AM3S Module + +```js +import { + AM3SModule, + AMProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get all connected am3s devices + +```js +AM3SModule.getAllConnectedDevices(); +``` + +### disconnect a am3s devices + +```js +AM3SModule.disconnect(mac); +``` + +### erase am3s memory + +```js +AM3SModule.reset(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_RESET_AM) { + if (0 === event[AMProfileModule.RESET_AM]) { + console.log('reset fail'); + } else if (1 === event[AMProfileModule.RESET_AM]) { + console.log('reset success'); + } + } +}); +``` + +### get the user id bound to the device + +```js +AM3SModule.getUserId(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_USERID_AM) { + console.log(event[AMProfileModule.USERID_AM]); + } +}); +``` + +### set the user id to the device + +```js +// id: user id, the range is 0~0x7fffffff +AM3SModule.setUserId(mac, id); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### setAlarmClock + +```js + +/** + * id: alarm clock id, you can set up to 3 alarm clocks + * hour: clock hour + * min: clock minates + * isRepeat: one time or repeat + * weeks: available on the day of the week + * isOn: open or close + */ + +AM3SModule.setAlarmClock(mac, 1, 12, 0, true, [1, 1, 1, 1, 1, 0, 0], false); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get alarm clock ids + +```js +AM3SModule.getAlarmClockNum(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { + console.log(event[AMProfileModule.GET_ALARMNUM_AM]); // e.g. 3 + console.log(event[AMProfileModule.GET_ALARMNUM_ID_AM]); // e.g. [1, 2, 3] + } +}); +``` + +### get alarm clock detail + +```js +AM3SModule.getAlarmClockDetail(mac, [1, 3, 2]); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_ALARMINFO_AM) { + let dataArray = event[BPProfileModule.GET_ALARM_CLOCK_DETAIL]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[AMProfileModule.GET_ALARM_ID_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_TIME_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_ISREPEAT_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_WEEK_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_ISON_AM]); + } + } + } +}); +``` + +### delete alarm clock by id + +```js +AM3SModule.deleteAlarmClock(mac, 1); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_DELETE_ALARM_SUCCESS_AM) { + console.log('delete success'); + } +}); +``` + +### set activity reminder interval + +```js +/** + * hour + * min + * isOn: open or close + */ +AM3SModule.setActivityRemind(mac, 0, 30, false); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_ACTIVITYREMIND_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get activity reminder interval + +```js +AM3SModule.getActivityRemind(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_ACTIVITY_REMIND_AM) { + console.log('get success'); + } +}); +``` + +### get am3s information + +```js +AM3SModule.queryAMState(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_QUERY_STATE_AM) { + // 0 indicates waist + // 1 indicates wrist + // 2 indicates sleep + console.log(event[AMProfileModule.QUERY_STATE_AM]); + // battery level 0~10 + console.log(event[AMProfileModule.QUERY_BATTERY_AM]); + } +}); +``` + +### set user id to the am3s device + +```js +// The user id range is from 0 to 0x7fffffff +AM3SModule.setUserId(mac, 8); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### set user information to the am3s device + +```js +/** + * age + * height(cm) + * weight(lbs) + * gender 0: female, 1: male + * unit 0: miles, 1: kilometre + * target the goal of steps, the range is from 4 ~ 65535 + * activityLevel 1: sedentary, 2: active, 3: very active + */ +AM3SModule.setUserInfo(mac, 25, 183, 80, AMProfileModule.AM_SET_MALE, AMProfileModule.AM_SET_UNIT_METRIC, 10000, 1, 30); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_USERINFO_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get user information stored in the am3s device + +```js +AM3SModule.getUserInfo(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_USERINFO_AM) { + console.log(event[AMProfileModule.GET_USER_AGE_AM]); + console.log(event[AMProfileModule.GET_USER_STEP_AM]); + console.log(event[AMProfileModule.GET_USER_HEIGHT_AM]); + console.log(event[AMProfileModule.GET_USER_SEX_AM]); + console.log(event[AMProfileModule.GET_USER_WEIGHT_AM]); + console.log(event[AMProfileModule.GET_USER_UNIT_AM]); + console.log(event[AMProfileModule.GET_USER_AGE_AM]); + console.log(event[AMProfileModule.GET_USER_TARGET1_AM]); + console.log(event[AMProfileModule.GET_USER_TARGET2_AM]); + console.log(event[AMProfileModule.GET_USER_TARGET3_AM]); + } +}); +``` + +### set bmr to the am3s device + +```js +// bmr Basal Metabolic Rate +AM3SModule.setUserBmr(mac, 2000); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_BMR_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get activity steps + +```js +AM3SModule.syncActivityData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_ACTIVITY_DATA_AM) { + let dataArray = event[AMProfileModule.SYNC_ACTIVITY_EACH_DATA_AM]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_TIME_AM]); + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_AM]); + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_CALORIE_AM]); + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_LENGTH_AM]); + console.log(offlineData[AMProfileModule.DATAID]); + } + } + } +}); +``` + +### get current activity steps + +```js +AM3SModule.syncRealData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_REAL_DATA_AM) { + console.log(offlineData[AMProfileModule.SYNC_REAL_STEP_AM]); + console.log(offlineData[AMProfileModule.SYNC_REAL_CALORIE_AM]); + console.log(offlineData[AMProfileModule.SYNC_REAL_TOTALCALORIE_AM]); + } +}); +``` + +### set current time to am3s device + +```js +AM3SModule.syncRealData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_TIME_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### set hour mode (12 or 24) to am3s device + +```js +/** + * AMProfileModule.AM_SET_12_HOUR_MODE(0) + * AMProfileModule.AM_SET_24_HOUR_MODE(1) + * AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE(2) + * AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE(3) + * AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE(4) + * AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE + **/ +AM3SModule.setHourMode(mac, AMProfileModule.AM_SET_24_HOUR_MODE); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_HOUR_MODE_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get hour mode (12 or 24) from am3s device + + +```js +AM3SModule.getHourMode(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_HOUR_MODE_AM) { + console.log(event[AMProfileModule.GET_HOUR_MODE_AM]); + } +}); +``` + +### get sleep data stored in the am3s + +```js +AM3SModule.syncSleepData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_SLEEP_DATA_AM) { + let dataArray = event[AMProfileModule.SYNC_SLEEP_DATA_AM]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[AMProfileModule.SYNC_SLEEP_EACH_DATA_AM]); + console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_TIME_AM]); + console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_LEVEL_AM]); + console.log(offlineData[AMProfileModule.DATAID]); + } + } + } +}); +``` diff --git a/libs/ihealth-sdk/doc/am4.md b/libs/ihealth-sdk/doc/am4.md new file mode 100644 index 0000000..4646f49 --- /dev/null +++ b/libs/ihealth-sdk/doc/am4.md @@ -0,0 +1,388 @@ +# AM4 Workflow + +## Import AM4 Module + +```js +import { + AM4Module, + AMProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get all connected am4 devices + +```js +AM4Module.getAllConnectedDevices(); +``` + +### disconnect a am4 devices + +```js +AM4Module.disconnect(mac); +``` + +### erase am4 memory + +```js +AM4Module.reset(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_RESET_AM) { + if (0 === event[AMProfileModule.RESET_AM]) { + console.log('reset fail'); + } else if (1 === event[AMProfileModule.RESET_AM]) { + console.log('reset success'); + } + } +}); +``` + +### get the user id bound to the device + +```js +AM4Module.getUserId(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_USERID_AM) { + console.log(event[AMProfileModule.USERID_AM]); + } +}); +``` + +### set the user id to the device + +```js +// id: user id, the range is 0~0x7fffffff +AM4Module.setUserId(mac, id); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### setAlarmClock + +```js + +/** + * id: alarm clock id, you can set up to 3 alarm clocks + * hour: clock hour + * min: clock minates + * isRepeat: one time or repeat + * weeks: available on the day of the week + * isOn: open or close + */ + +AM4Module.setAlarmClock(mac, 1, 12, 0, true, [1, 1, 1, 1, 1, 0, 0], false); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get alarm clock ids + +```js +AM4Module.getAlarmClockNum(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { + console.log(event[AMProfileModule.GET_ALARMNUM_AM]); // e.g. 3 + console.log(event[AMProfileModule.GET_ALARMNUM_ID_AM]); // e.g. [1, 2, 3] + } +}); +``` + +### get alarm clock detail + +```js +AM4Module.getAlarmClockDetail(mac, [1, 3, 2]); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_ALARMINFO_AM) { + let dataArray = event[BPProfileModule.GET_ALARM_CLOCK_DETAIL]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[AMProfileModule.GET_ALARM_ID_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_TIME_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_ISREPEAT_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_WEEK_AM]); + console.log(offlineData[AMProfileModule.GET_ALARM_ISON_AM]); + } + } + } +}); +``` + +### delete alarm clock by id + +```js +AM4Module.deleteAlarmClock(mac, 1); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_DELETE_ALARM_SUCCESS_AM) { + console.log('delete success'); + } +}); +``` + +### set activity reminder interval + +```js +/** + * hour + * min + * isOn: open or close + */ +AM4Module.setActivityRemind(mac, 0, 30, false); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_ACTIVITYREMIND_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get activity reminder interval + +```js +AM4Module.getActivityRemind(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_ACTIVITY_REMIND_AM) { + console.log('get success'); + } +}); +``` + +### get am4 information + +```js +AM4Module.queryAMState(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_QUERY_STATE_AM) { + // 0 indicates waist + // 1 indicates wrist + // 2 indicates sleep + console.log(event[AMProfileModule.QUERY_STATE_AM]); + // battery level 0~10 + console.log(event[AMProfileModule.QUERY_BATTERY_AM]); + } +}); +``` + +### set user id to the am4 device + +```js +// The user id range is from 0 to 0x7fffffff +AM4Module.setUserId(mac, 8); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### set user information to the am4 device + +```js +/** + * age + * height(cm) + * weight(lbs) + * gender 0: female, 1: male + * unit 0: miles, 1: kilometre + * target the goal of steps, the range is from 4 ~ 65535 + * activityLevel 1: sedentary, 2: active, 3: very active + */ +AM4Module.setUserInfo(mac, 25, 183, 80, AMProfileModule.AM_SET_MALE, AMProfileModule.AM_SET_UNIT_METRIC, 10000, 1, 30); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_USERINFO_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get user information stored in the am4 device + +```js +AM4Module.getUserInfo(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_USERINFO_AM) { + console.log(event[AMProfileModule.GET_USER_AGE_AM]); + console.log(event[AMProfileModule.GET_USER_STEP_AM]); + console.log(event[AMProfileModule.GET_USER_HEIGHT_AM]); + console.log(event[AMProfileModule.GET_USER_SEX_AM]); + console.log(event[AMProfileModule.GET_USER_WEIGHT_AM]); + console.log(event[AMProfileModule.GET_USER_UNIT_AM]); + console.log(event[AMProfileModule.GET_USER_AGE_AM]); + console.log(event[AMProfileModule.GET_USER_TARGET1_AM]); + console.log(event[AMProfileModule.GET_USER_TARGET2_AM]); + console.log(event[AMProfileModule.GET_USER_TARGET3_AM]); + } +}); +``` + +### set bmr to the am4 device + +```js +// bmr Basal Metabolic Rate +AM4Module.setUserBmr(mac, 2000); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_BMR_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get activity steps + +```js +AM4Module.syncActivityData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_ACTIVITY_DATA_AM) { + let dataArray = event[AMProfileModule.SYNC_ACTIVITY_EACH_DATA_AM]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_TIME_AM]); + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_AM]); + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_CALORIE_AM]); + console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_LENGTH_AM]); + console.log(offlineData[AMProfileModule.DATAID]); + } + } + } +}); +``` + +### get current activity steps + +```js +AM4Module.syncRealData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_REAL_DATA_AM) { + console.log(offlineData[AMProfileModule.SYNC_REAL_STEP_AM]); + console.log(offlineData[AMProfileModule.SYNC_REAL_CALORIE_AM]); + console.log(offlineData[AMProfileModule.SYNC_REAL_TOTALCALORIE_AM]); + } +}); +``` + +### set current time to am4 device + +```js +AM4Module.syncRealData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_TIME_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### set hour mode (12 or 24) to am4 device + +```js +/** + * AMProfileModule.AM_SET_12_HOUR_MODE(0) + * AMProfileModule.AM_SET_24_HOUR_MODE(1) + * AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE(2) + * AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE(3) + * AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE(4) + * AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE + **/ +AM4Module.setHourMode(mac, AMProfileModule.AM_SET_24_HOUR_MODE); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SET_HOUR_MODE_SUCCESS_AM) { + console.log('set success'); + } +}); +``` + +### get hour mode (12 or 24) from am4 device + + +```js +AM4Module.getHourMode(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_GET_HOUR_MODE_AM) { + console.log(event[AMProfileModule.GET_HOUR_MODE_AM]); + } +}); +``` + +### get sleep data stored in the am4 + +```js +AM4Module.syncSleepData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === AMProfileModule.ACTION_SYNC_SLEEP_DATA_AM) { + let dataArray = event[AMProfileModule.SYNC_SLEEP_DATA_AM]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[AMProfileModule.SYNC_SLEEP_EACH_DATA_AM]); + console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_TIME_AM]); + console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_LEVEL_AM]); + console.log(offlineData[AMProfileModule.DATAID]); + } + } + } +}); +``` diff --git a/libs/ihealth-sdk/doc/am5.md b/libs/ihealth-sdk/doc/am5.md new file mode 100644 index 0000000..4465b35 --- /dev/null +++ b/libs/ihealth-sdk/doc/am5.md @@ -0,0 +1,215 @@ +# AM4 Workflow + +## Import AM5 Module + +```js +import { + AM5Module, + AM5ProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get all connected am5 devices + +```js +AM5Module.getAllConnectedDevices(); + +// {"action": "action_get_all_connected_devices", "devices": ["DD4173E7F41E"]} +``` + +### disconnect a am5 devices + +```js +AM5Module.disconnect(mac); +``` + +### Binding apps and devices + +```js +AM5Module.bindDevice(mac); + +// response +// {"action": "action_user_bind", "description": "no error", "mac": "DD4173E7F41E", "status": 3, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === AM5ProfileModule.ACTION_USER_BIND) { + if (3 === event[AM5ProfileModule.OPERATION_STATUS]) { + console.log('bind success'); + } else if (4 === event[AM5ProfileModule.OPERATION_STATUS]) { + console.log('bind fail'); + } + } +}); +``` + +### UnBind apps and devices + +```js +AM5Module.unBindDevice(mac); + +// response +// {"action": "action_user_unbind", "description": "no error", "mac": "DD4173E7F41E", "status": 3, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === AM5ProfileModule.ACTION_USER_UNBIND) { + if (3 === event[AM5ProfileModule.OPERATION_STATUS]) { + console.log('unbind success'); + } else if (4 === event[AM5ProfileModule.OPERATION_STATUS]) { + console.log('unbind fail'); + } + } +}); +``` + +### Get information of the device + +```js +AM5Module.getBasicInfo(mac); + +// response +// {"action": "action_basic_info", "battStatus": 0, "bind_confirm_method": 0, "bind_confirm_timeout": 0, "deivceId": 7041, "energe": 63, "firmwareVersion": 40, "mac": "DD4173E7F41E", "mode": 1, "pairFlag": 0, "reboot": 0, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === AM5ProfileModule.ACTION_BASIC_INFO) { + console.log(AM5ProfileModule.BASIC_ENERGE); + } +}); +``` + +### Set current time of the device + +```js +AM5Module.setTime(mac); + +// response +// {"action": "TIME", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === "TIME") { + console.log('set success'); + } +}); +``` + +### Set user info + +```js +/** + * @param year Year of birth + * @param month Month of birth + * @param day Day of birth + * @param weight weight + * @param height height + * @param gender gender male: 1, female: 2 + */ +AM5Module.setUserInfo(mac, 1990, 1, 1, 75, 176, 1); + +// response +// {"action": "USER_INFO", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === "USER_INFO") { + console.log('set success'); + } +}); +``` + +### Set unit + +```js +/** + * When you never set them, treat them as defaults + * @param {string} mac Device's mac address + * @param type 0: Distance unit unit: 0 default ; 1 KM ; 2 MI + * @param type 1: Wight unit unit: 0 default ; 1 KG ; 2 LB ; 3 ST + * @param type 2: Temperature unit unit: 0 default ; 1 °C ; 2 °F + * @param type 3: Distance at each step unit: distance (cm) (default 0cm) + * @param type 4: Language unit: 0 default ; 1 zh ; 2 en ; 3 fr ; 4 de ; 5 it ; 6 es ; 7 ja ; 8 po ; 9 cz + * @param type 5: Time Mode unit: 0 default ; 1 24 hour system ; 2 12 hour system + * @param type 6: Distance at each step of run unit: distance (cm) (default 0cm) + * @param type 7: GPS calibration switch unit: 0 default ; 1 open ; 2 close +*/ +AM5Module.setUnit(mac, [1, 3, 2]); + +// response +// {"action": "UNIT", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === "UNIT") { + console.log('set success'); + } +}); +``` + +### Set Hand Wear Mode + +```js +/** + * @param {string} mac Device's mac address + * @param mode 0 left-hand 1 right-hand + */ +AM5Module.setHandWearMode(mac, 1); + +// response +// {"action": "HAND_MODE", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { + if (event.action === "HAND_MODE") { + console.log('set success'); + } +}); +``` + +### Get the live data of the device + +```js +/** + * @param {string} mac Device's mac address + */ +AM5Module.getLiveData(mac); + +// response +// {"action": "action_live_data", "dbp": 0, "heartRate": 0, "mac": "DD4173E7F41E", "sbp": 0, "totalActiveTime": 0, "totalCalories": 0, "totalDistances": 0, "totalStep": 0, "type": "AM5"} +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === AM5ProfileModule.ACTION_LIVE_DATA) { + console.log('set success'); + } +}); +``` + +### Sync health data from device + +```js +/** + * @param {string} mac Device's mac address + */ +AM5Module.syncHealthData(mac); + +// response + +// 1. {"action": "action_sync_health_data", "mac": "DD4173E7F41E", "status": 0, "type": "AM5"} +// 2. {"action": "action_sync_health_data", "mac": "DD4173E7F41E", "progress": 2, "status": 2, "type": "AM5"} + +// 3. {"action": "action_sync_health_data_sport", "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "items": [ {"activeTime": 0, "calory": 0, "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "distance": 0, "month": 8, "sportDataId": 1, "stepCount": 0, "year": 2021}], "mac": "DD4173E7F41E", "month": 8, "sportDataId": 3, "startTime": 0, "timeSpace": 15, "totalActiveTime": 473, "totalCalory": 40, "totalDistance": 718, "totalStepCount": 998, "type": "AM5", "year": 2021} + +// 4. {"action": "action_sync_health_data_sleep", "awakeCount": 2, "dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27,"deepSleepCount": 7, "deepSleepMinutes": 157, "items": +// [{"dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27, "month": 8, "offsetMinute": 19, "sleepDataId": 2, "sleepStatus": 2, "year": 2021}, +// {"dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27, "month": 8, "offsetMinute": 28, "sleepDataId": 3, "sleepStatus": 3, "year": 2021}, {"dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27, "month": 8, "offsetMinute": 56, "sleepDataId": 4, "sleepStatus": 2, "year": 2021}], "lightSleepCount": 9, "lightSleepMinutes": 327, "mac": "DD4173E7F41E", "month": 8, "sleepDataId": 1, "sleepEndedTimeH": 9, "sleepEndedTimeM": 10, "totalSleepMinutes": 533, "type": "AM5", "year": 2021} + +// 5. {"action": "action_sync_health_data_heart_rate", "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "items": [ {"activeTime": 0, "calory": 0, "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "distance": 0, "month": 8, "sportDataId": 1, "stepCount": 0, "year": 2021}]} + +// 6. {"action": "action_sync_health_data", "mac": "DD4173E7F41E", "progress": 100, "status": 3, "type": "AM5"} + +notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { + if (event.action === AM5ProfileModule.ACTION_SYNC_HEALTH_DATA) { + console.log('get success'); + } +}); +``` diff --git a/libs/ihealth-sdk/doc/bg1.md b/libs/ihealth-sdk/doc/bg1.md new file mode 100644 index 0000000..e69de29 diff --git a/libs/ihealth-sdk/doc/bg1s.md b/libs/ihealth-sdk/doc/bg1s.md new file mode 100644 index 0000000..9622f29 --- /dev/null +++ b/libs/ihealth-sdk/doc/bg1s.md @@ -0,0 +1,66 @@ +# BG1S Workflow + +## Import BG1S Module + +```js +import { + BG1SModule, + BG1SProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get function + +Set current time to BG1S and return battery level, bg1s code version. + +```js +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]); + console.log(event[BG1SProfileModule.INFO_VERSION_CODE_BLOOD_BG1S]); + console.log(event[BG1SProfileModule.INFO_VERSION_CODE_CTL_BG1S]); + } +}); +``` + +### start a measurement + +```js +// 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_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/libs/ihealth-sdk/doc/bg5.md b/libs/ihealth-sdk/doc/bg5.md new file mode 100644 index 0000000..38493ad --- /dev/null +++ b/libs/ihealth-sdk/doc/bg5.md @@ -0,0 +1,195 @@ +# BG5 Workflow + +## Import BG5 Module + +```js +import { + BG5Module, + BGProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### set time + +If you use new bg5 or it has not been used for a long time. You should sync current time with bg5. + +```js +BG5Module.setTime(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_SET_TIME) { + console.log("set time"); + } +}); +``` + +### set unit + +The API can change the unit of the bg5 display. + +```js +// 1: mmol/L 2: mg/dL +BG5Module.setUnit(mac, 1); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_SET_UNIT) { + console.log("set unit"); + } +}); +``` + +### get bottle information from barcode + +When you scan the barcode at the top of bottle, you can get a string. Pass the string to this API, you can get bottle id, Number of the strips and expire day. + +```js +BG5Module.getBottleInfoFromQR(QRCode); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_CODE_ANALYSIS) { + console.log(event[BGProfileModule.STRIP_NUM_BG]); + console.log(event[BGProfileModule.STRIP_EXPIRETIME_BG]); + console.log(event[BGProfileModule.BOTTLEID_BG]); + } +}); +``` + +### set bottle id + +```js +BG5Module.getBottleInfoFromQR(QRCode); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_SET_BOTTLEID) { + console.log("Set bottleID"); + } +}); +``` + +### get bottle id + +```js +BG5Module.getBottleInfoFromQR(QRCode); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_GET_BOTTLEID) { + console.log(event[BGProfileModule.GET_BOTTLEID]); + } +}); +``` + +### Set bottle message + +When you use a new bg5 device or you open a new strip bottle, must set bottle message to bg5 device. + +```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. + */ +BG5Module.setBottleMessage(mac, 1, 1, QRCode, 25, "2027-07-15"); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_SET_BOTTLEMESSAGE) { + console.log("set bottle message success"); + } +}); +``` + +### get bottle message + +```js +BG5Module.getBottleMessage(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_GET_BOTTLEMESSAGE) { + console.log(event[BGProfileModule.GET_EXPIRECTIME]); + console.log(event[BGProfileModule.GET_USENUM]); + } +}); +``` + +### start a measurement + +```js +// * measureType 1: measure with real blood, 2: measure with control solution +BG5Module.startMeasure(mac, 1); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_STRIP_IN) { + console.log("strip in"); + + } else if (event.action === BGProfileModule.ACTION_STRIP_OUT) { + console.log("strip out"); + + } else if (event.action === BGProfileModule.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]); + } +}); +``` + +### get data stored in the bg5 device + +```js +BG5Module.getOfflineData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_GET_OFFLINEDATA_COUNT) { + console.log(event[BGProfileModule.GET_OFFLINEDATA_COUNT]); + console.log(event[BGProfileModule.GET_OFFLINEDATA]); + } +}); +``` + +### delete the data stored in the bg5 device + +```js +BG5Module.deleteOfflineData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { + if (event.action === BGProfileModule.ACTION_DELETE_OFFLINEDATA) { + console.log("delete data"); + } +}); +``` + +### keep link with phone + +The BG5 use regular bluetooth communicate with phone. For save the power, if there is no communication, bg5 will turn off. +The api is used to keep link with phone. + +```js +BG5Module.holdLink(mac); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/bg5s.md b/libs/ihealth-sdk/doc/bg5s.md new file mode 100644 index 0000000..06bc6d4 --- /dev/null +++ b/libs/ihealth-sdk/doc/bg5s.md @@ -0,0 +1,176 @@ +# BG5S Workflow + +## Import BG5S Module + +```js +import { + BG5SModule, + BG5SProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### Set time + +If you use new bg5 or it has not been used for a long time. You should sync current time with bg5. + +```js +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"); + } +}); +``` + +### Set Unit + +The API can change the unit of the bg5 display. + +```js +// 1: mmol/L 2: mg/dL +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"); + } +}); +``` + +### get bg5s status information + +```js +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_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]); + } +}); +``` + +### delete userd strip + +```js +BG5SModule.deleteUsedStrip(QRCode); + +// response +// {"type":"BG5S","mac":"5C0272267365","action":"action_delete_used_strip"} +notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { + if (event.action === BG5SProfileModule.ACTION_DELETE_USED_STRIP) { + + } +}); +``` + +### delete offline data + +```js +BG5SModule.deleteOfflineData(QRCode); + +// response +// {"type":"BG5S","mac":"5C0272267365","action":"action_delete_offline_data"} +notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { + if (event.action === BG5SProfileModule.ACTION_DELETE_OFFLINE_DATA) { + + } +}); +``` + +### get offline data + +```js +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 === BG5SProfileModule.ACTION_GET_OFFLINE_DATA) { + console.log(event[BG5SProfileModule.OFFLINE_DATA]); + } +}); +``` + +### adjust offline data + +```js +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 === "action_adjust_offline_data") { + console.log(event[BG5SProfileModule.OFFLINE_DATA]); + } +}); +``` + +### start a measurement + +```js +// * measureType 1: measure with real blood, 2: measure with control solution +BG5SModule.startMeasure(mac, 1); + +// response +notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { + if (event.action === BG5SProfileModule.ACTION_STRIP_IN) { + console.log("strip in"); + + } else if (event.action === BG5SProfileModule.ACTION_STRIP_OUT) { + console.log("strip out"); + + } else if (event.action === BG5SProfileModule.ACTION_GET_BLOOD) { + console.log("analysis blood"); + + } 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]); + } +}); +``` + +### get data stored in the bg5 device + +```js +BG5SModule.setOfflineModel(mac, true); + +// response +// // {"type":"BG5S","mac":"5C0272267365","action":"action_delete_offline_data"} +notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { + if (event.action === BG5SProfileModule.ACTION_SET_OFFLINE_MEASUREMENT_MODE) { + + } +}); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/bp3l.md b/libs/ihealth-sdk/doc/bp3l.md new file mode 100644 index 0000000..37e51ed --- /dev/null +++ b/libs/ihealth-sdk/doc/bp3l.md @@ -0,0 +1,161 @@ +# BP3L Workflow + +## import BP3L module + +```js +import { + BP3LModule, + BPProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### start a measurement + +The API is asyn function. It will return message until finish measurement. + +```js +BP3LModule.startMeasure(mac); + +notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_ZOREING_BP) { + console.log("zero adjustment"); + + } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { + console.log("zero adjustment is done"); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); + console.log(event[BPProfileModule.PULSEWAVE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { + console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.PULSE_BP]); + console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(event[BPProfileModule.DATAID]); + + } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { + console.log(event[BPProfileModule.ERROR_NUM_BP]); + console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); + } +}); +``` + +### cancel current measurement + +```js +BP3LModule.stopMeasure(mac); +``` + +### get battery + +```js +BP3LModule.getBattery(mac); + +notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_BATTERY_BP) { + console.log(event[BPProfileModule.BATTERY_BP]); + } +}); +``` + +### enable offline mode + +```js +BP3LModule.enbleOffline(mac); +``` + +### disable offline mode + +```js +BP3LModule.disableOffline(mac); +``` + +### is enable offline mode + +```js +BP3LModule.isEnableOffline(mac); + +notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { + console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); + } +}); +``` + +### get quantity of data stored in the bp5 device + +```js +BP3LModule.getOfflineNum(mac); + +notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { + console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); + } +}); +``` + +### get data stored in the bp5 device + +```js +BP3LModule.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { + let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + + console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); + console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.PULSE_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); + console.log(offlineData[BPProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP3LModule.disConnect(mac); +``` + +### get device information + +```js +iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { + console.info(event); +}) +``` + +### get all connected devices + +```js +BP3LModule.getAllConnectedDevices(); +``` diff --git a/libs/ihealth-sdk/doc/bp5.md b/libs/ihealth-sdk/doc/bp5.md new file mode 100644 index 0000000..9829b05 --- /dev/null +++ b/libs/ihealth-sdk/doc/bp5.md @@ -0,0 +1,161 @@ +# BP5 Workflow + +## import BP5 module + +```js +import { + BP5Module, + BPProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### start a measurement + +The API is asyn function. It will return message until finish measurement. + +```js +BP5Module.startMeasure(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_ZOREING_BP) { + console.log("zero adjustment"); + + } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { + console.log("zero adjustment is done"); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); + console.log(event[BPProfileModule.PULSEWAVE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { + console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.PULSE_BP]); + console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(event[BPProfileModule.DATAID]); + + } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { + console.log(event[BPProfileModule.ERROR_NUM_BP]); + console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); + } +}); +``` + +### cancel current measurement + +```js +BP5Module.stopMeasure(mac); +``` + +### get battery + +```js +BP5Module.getBattery(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_BATTERY_BP) { + console.log(event[BPProfileModule.BATTERY_BP]); + } +}); +``` + +### enable offline mode + +```js +BP5Module.enbleOffline(mac); +``` + +### disable offline mode + +```js +BP5Module.disableOffline(mac); +``` + +### is enable offline mode + +```js +BP5Module.isEnableOffline(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { + console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); + } +}); +``` + +### get quantity of data stored in the bp5 device + +```js +BP5Module.getOfflineNum(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { + console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); + } +}); +``` + +### get data stored in the bp5 device + +```js +BP5Module.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { + let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + + console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); + console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.PULSE_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); + console.log(offlineData[BPProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP5Module.disConnect(mac); +``` + +### get device information + +```js +iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { + console.info(event); +}) +``` + +### get all connected devices + +```js +BP5Module.getAllConnectedDevices(); +``` diff --git a/libs/ihealth-sdk/doc/bp5s.md b/libs/ihealth-sdk/doc/bp5s.md new file mode 100644 index 0000000..f6aa39d --- /dev/null +++ b/libs/ihealth-sdk/doc/bp5s.md @@ -0,0 +1,153 @@ +# BP5S Workflow + +## Import BP5S Module + +```js +import { + BP5SModule, + BPProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### start a measurement + +The API is asyn function. It will return message until finish measurement. + +```js +BP5SModule.startMeasure(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_ZOREING_BP) { + console.log("zero adjustment"); + + } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { + console.log("zero adjustment is done"); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); + console.log(event[BPProfileModule.PULSEWAVE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { + console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.PULSE_BP]); + console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(event[BPProfileModule.DATAID]); + + } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { + console.log(event[BPProfileModule.ERROR_NUM_BP]); + console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); + } +}); +``` + +### cancel current measurement + +```js +BP5SModule.stopMeasure(mac); +``` + +### get battery + +```js +BP5SModule.getBattery(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_BATTERY_BP) { + console.log(event[BPProfileModule.BATTERY_BP]); + } +}); +``` + +### enable offline mode + +```js +BP5SModule.enbleOffline(mac); +``` + +### disable offline mode + +```js +BP5SModule.disableOffline(mac); +``` + +### is enable offline mode + +```js +BP5SModule.isEnableOffline(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { + console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); + } +}); +``` + +### get quantity of data stored in the bp5 device + +```js +BP5SModule.getOfflineNum(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { + console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); + } +}); +``` + +### get data stored in the bp5 device + +```js +BP5SModule.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { + let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + + console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); + console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.PULSE_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); + console.log(offlineData[BPProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP5SModule.disConnect(mac); +``` + +### get all connected devices + +```js +BP5SModule.getAllConnectedDevices(); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/bp7.md b/libs/ihealth-sdk/doc/bp7.md new file mode 100644 index 0000000..1e03e68 --- /dev/null +++ b/libs/ihealth-sdk/doc/bp7.md @@ -0,0 +1,175 @@ +# BP7 Workflow + +## import BP7 module + +```js +import { + BP7Module, + BPProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BP7Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### start a measurement + +The API is asyn function. It will return message until finish measurement. + +```js +// When you start a measurement, need call startMeasure function firstly, you will get angle of BP7 +// make sure your angle is below the 30 degree, then call conformAngle function, the BP7 will start a measurement. +BP5Module.startMeasure(mac); + +BP5Module.conformAngle(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_ANGLE_BP) { + // {"which_arm":0,"value":22} + console.log(event[BPProfileModule.WHICH_ARM]); + console.log(event[BPProfileModule.ANGLE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ZOREING_BP) { + console.log("zero adjustment"); + + } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { + console.log("zero adjustment is done"); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { + // {"pressure":3} + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { + // {"pressure":31,"heartbeat":false,"wave":"[15,15,15,15,15,15,15,15]"} + console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); + console.log(event[BPProfileModule.PULSEWAVE_BP]); + + } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { + // {"sys":122,"dia":87,"heartRate":75,"arrhythmia":false,"hsd":false,"dataID":"E3FC99C20A7FA7F7B7F8FC4B9DD059DF"} + console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(event[BPProfileModule.PULSE_BP]); + console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(event[BPProfileModule.DATAID]); + + } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { + console.log(event[BPProfileModule.ERROR_NUM_BP]); + console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); + } +}); +``` + +### cancel current measurement + +```js +BP5Module.stopMeasure(mac); +``` + +### get battery + +```js +BP5Module.getBattery(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_BATTERY_BP) { + console.log(event[BPProfileModule.BATTERY_BP]); + } +}); +``` + +### enable offline mode + +```js +BP5Module.enbleOffline(mac); +``` + +### disable offline mode + +```js +BP5Module.disableOffline(mac); +``` + +### is enable offline mode + +```js +BP5Module.isEnableOffline(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { + console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); + } +}); +``` + +### get quantity of data stored in the bp5 device + +```js +BP5Module.getOfflineNum(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { + // {"offlinenum":2} + console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); + } +}); +``` + +### get data stored in the bp5 device + +```js +BP5Module.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { + // {"data":[{"time":"2009-01-02 15:12:00","sys":120,"dia":72,"heartRate":71,"arrhythmia":false,"hsd":false,"dataID":"F77B50204315322FAB3B31548E6CDC4E"},{"time":"2009-01-02 15:13:00","sys":115,"dia":73,"heartRate":68,"arrhythmia":false,"hsd":false,"dataID":"F75BC53C3E43ACC3BA3DE1343B317398"}]} + if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { + let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + + console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); + console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.PULSE_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); + console.log(offlineData[BPProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP5Module.disConnect(mac); +``` + +### get device information + +```js +iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { + console.info(event); +}) +``` + +### get all connected devices + +```js +BP5Module.getAllConnectedDevices(); +``` diff --git a/libs/ihealth-sdk/doc/bp7s.md b/libs/ihealth-sdk/doc/bp7s.md new file mode 100644 index 0000000..178b5e1 --- /dev/null +++ b/libs/ihealth-sdk/doc/bp7s.md @@ -0,0 +1,129 @@ +# BP7S Workflow + +## Import BP7S Module + +```js +import { + BP7SModule, + BPProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get battery + +```js +BP7SModule.getBattery(mac); + +notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_BATTERY_BP) { + console.log(event[BPProfileModule.BATTERY_BP]); + } +}); +``` + +### set unit + +The API can change the unit of the bg5 display. + +```js +// unit :0 mmHg;1 kPa +BP7SModule.setUnit(mac, 1); + +// response +notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_SET_UNIT_SUCCESS_BP) { + console.log("set Unit"); + } +}); +``` + +### get quantity of data stored in the bp5 device + +```js +BP7SModule.getOfflineNum(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { + console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); + } +}); +``` + +### get data stored in the bp5 device + +```js +BP7SModule.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { + let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + + console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); + console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.PULSE_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); + console.log(offlineData[BPProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP7SModule.disConnect(mac); +``` + +### set angle range + +```js +/** + * leftHigh the maximum measure angle of left hand, the maximum value must less than 90 + * leftLow the minimum measure angle of left hand, the minimum value must more than 0, and less than leftUpper + * rightHigh the maximum measure angle of right hand, the maximum value must less than 90 + * leftLow the minimum measure angle of right hand, the minimum value must more than 0, and less than rightUpper + */ +BP7SModule.angleSet(mac, 80, 30, 80, 30); + +// response +notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_SET_ANGLE_SUCCESS_BP) { + console.log("set angle"); + } +}); +``` + +### get bp7s device information + +```js +BP7SModule.getFunctionInfo(mac); +``` + +### get all connected devices + +```js +BP7SModule.getAllConnectedDevices(); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/download.png b/libs/ihealth-sdk/doc/download.png new file mode 100644 index 0000000..e12b973 Binary files /dev/null and b/libs/ihealth-sdk/doc/download.png differ diff --git a/libs/ihealth-sdk/doc/ecg.md b/libs/ihealth-sdk/doc/ecg.md new file mode 100644 index 0000000..2dbba6a --- /dev/null +++ b/libs/ihealth-sdk/doc/ecg.md @@ -0,0 +1,69 @@ +# ECG3 Workflow + +## import ECG3 module + +```js +import { + ECGModule, + ECGProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get all connected devices + +```js +ECGModule.getAllConnectedDevices(); +``` + +### start a measurement + +```js +ECGModule.startMeasure(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { + if (event.action === ECGModule.ACTION_ELECTRODE_STATUS) { + console.log(event[ECGProfileModule.ELECTRODE_STATUS]); + console.log(event[ECGProfileModule.ERROR_DESCRIPTION_ECG]); + } +}); +``` + +### cancel a measurement + +```js +ECGModule.stopMeasure(mac); +``` + +### get battery + +```js +ECGModule.getBattery(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { + if (event.action === ECGModule.ACTION_BATTERY_ECG) { + console.log(event[ECGProfileModule.BATTERY_ECG]) + } +}); +``` + +### set current time to device + +```js +ECGModule.sysTime(mac); +``` diff --git a/libs/ihealth-sdk/doc/ecgusb.md b/libs/ihealth-sdk/doc/ecgusb.md new file mode 100644 index 0000000..7fe7b10 --- /dev/null +++ b/libs/ihealth-sdk/doc/ecgusb.md @@ -0,0 +1,76 @@ +# ECG3 Workflow + +## import ECG3 module + +```js +import { + ECGModule, + ECGProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get device information + +```js +ECGUSBModule.getIdps() +``` + +### get all connected devices + +```js +ECGUSBModule.getAllConnectedDevices(); +``` + +### get data stored in the ecg3 device + +```js +ECGUSBModule.syncData(); +``` + +### delete data stored in the ecg3 device + +```js +ECGUSBModule.deleteData(); +``` + +### splice data + +```js +ECGUSBModule.spliceData(["ECGSDK_20160420025256", + "ECGSDK_20160420025453", + "ECGSDK_20160420030824", + "ECGSDK_20160420082435"]); +``` + +### get cache + +```js +ECGUSBModule.getCache(); +``` + +### delete cache data + +```js +ECGUSBModule.deleteCacheData(); +``` + +### get filter data + +```js +ECGUSBModule.getFilterDataByFileName("ECG_Total_Data_20160420025256.dat","ECG_Total_Mark_20160420025256.txt"); +``` + diff --git a/libs/ihealth-sdk/doc/hs2.md b/libs/ihealth-sdk/doc/hs2.md new file mode 100644 index 0000000..c393577 --- /dev/null +++ b/libs/ihealth-sdk/doc/hs2.md @@ -0,0 +1,84 @@ +# HS2 Workflow + +## import HS2 module + +```js +import { + HS2Module, + HSProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(HS2Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### start a measurement + +The API is asyn function. It will return message until finish measurement. + +```js +HS2Module.startMeasure(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2Module.Event_Notify, (event) => { + if (event.action === HSProfileModule.ACTION_ONLINE_RESULT_HS) { + console.log(event[HSProfileModule.DATAID]); + console.log(event[HSProfileModule.WEIGHT_HS]); + console.log(event[HSProfileModule.FAT_HS]); + console.log(event[HSProfileModule.WATER_HS]); + console.log(event[HSProfileModule.MUSCLE_HS]); + console.log(event[HSProfileModule.SKELETON_HS]); + console.log(event[HSProfileModule.FATELEVEL_HS]); + console.log(event[HSProfileModule.DCI_HS]); + } +}); +``` + +### get data stored in the HS2 device + +```js +HS2Module.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2Module.Event_Notify, (event) => { + if (event.action === HSProfileModule.ACTION_HISTORICAL_DATA_HS) { + let dataArray = event[HSProfileModule.HISTORDATA_HS]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[HSProfileModule.MEASUREMENT_DATE_HS]); + console.log(offlineData[HSProfileModule.WEIGHT_HS]); + console.log(offlineData[HSProfileModule.FAT_HS]); + console.log(offlineData[HSProfileModule.WATER_HS]); + console.log(offlineData[HSProfileModule.MUSCLE_HS]); + console.log(offlineData[HSProfileModule.SKELETON_HS]); + console.log(offlineData[HSProfileModule.FATELEVEL_HS]); + console.log(offlineData[HSProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP3LModule.disConnect(mac); +``` + +### get all connected devices + +```js +BP3LModule.getAllConnectedDevices(); +``` diff --git a/libs/ihealth-sdk/doc/hs2s.md b/libs/ihealth-sdk/doc/hs2s.md new file mode 100644 index 0000000..b72995a --- /dev/null +++ b/libs/ihealth-sdk/doc/hs2s.md @@ -0,0 +1,307 @@ +# HS2S Workflow + +## import HS2S module + +```js +import { + HS2SModule, + HS2SProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get device information + +```js +HS2SModule.getDeviceInfo(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_get_device_info") { + console.log(event["battery"]); + console.log(event["unit_current"]); + console.log(event["user_count"]); + } +} +``` + +### get device battery + +```js +HS2SModule.getBattery(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_get_battery_hs") { + console.log(event["battery_hs"]); + } +} +``` + +### set Unit + +```js +HS2SModule.setUnit(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_set_unit") { + console.log(event["result"]); + } +} +``` + +### get user information + +```js +HS2SModule.getUserInfo(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_get_user_info") { + console.log(event["user_info-count"]); + let array = event["user_info_array"]; + console.log(array["body_building"]); + console.log(array["impedance"]); + console.log(array["height"]); + console.log(array["age"]); + console.log(array["gender"]); + console.log(array["weight"]); + console.log(array["create_time"]); + console.log(array["user_id"]); + } +} +``` + +### create user + +```js +HS2SModule.updateUserInfo(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_create_or_update_user_info") { + console.log(event["result"]); + } +} +``` + +### delete user + +```js +HS2SModule.deleteUser(mac, userId); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_delete_user_info") { + console.log(event["result"]); + } +} +``` + +### get the number of offline data + +```js +HS2SModule.getMemoryDataCount(mac, userId); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_history_data_num") { + console.log(event["history_data_count"]); + } +} +``` + +### get offline data + +```js +HS2SModule.getMemoryData(mac, userId); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_history_data") { + let arr = event["history_data"]; + arr.forEach(function(result) { + console.log(result["fat_weight"]); + console.log(result["fat_control"]; + console.log(result["weight_control"]; + console.log(result["standard_weight"]; + console.log(result["skeletal_muscle_mass"]; + console.log(result["body_water_rate"]; + console.log(result["muscle_mas"]; + console.log(result["instruction_type"]; + console.log(result["body_building"]; + console.log(result["height"]; + console.log(result["gender"]; + console.log(result["muscle_control"]; + console.log(result["physical_age"]; + console.log(result["visceral_fat_grade"]; + console.log(result["protein_rate"]; + console.log(result["bone_salt_content"]; + console.log(result["visceral_fat_grade"]; + console.log(result["measure_time"]; + console.log(result["age"]; + console.log(result["impedance"]; + console.log(result["weight"]; + }) + } +} +``` + +### delete offline data by user id + +```js +HS2SModule.deleteMemoryData(mac, userId); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_delete_history_data") { + console.log(event["result"]); + } +} +``` + +### get the number of anonymous offline data + +```js +HS2SModule.getAnonymousMemoryDataCount(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_anonymous_data_num") { + console.log(event["anonymous_data_count"]); + } +} +``` + +### get anonymous offline data + +```js +HS2SModule.getAnonymousMemoryData(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_anonymous_data") { + let arr = event["history_data"]; + arr.forEach(function(result) { + console.log(result["instruction_type"]; + console.log(result["body_building"]; + console.log(result["height"]; + console.log(result["gender"]; + console.log(result["measure_time"]; + console.log(result["age"]; + console.log(result["impedance"]; + console.log(result["weight"]; + }) + } +} +``` + +### delete anonymous offline data + +```js +HS2SModule.deleteAnonymousMemoryData(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_delete_anonymous_data") { + console.log(event["result"]); + } +} +``` + +### start a online measurement + +The API is asyn function. It will return message until finish measurement. + +```js +HS2SModule.measure(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_specify_users") { + console.log(event["result"]); + // 1: success, 0: failure + + } else if (event.action === "action_online_real_time_weight") { + console.log(event["weight"]); + + } else if (event.action === "action_online_result") { + console.log(event["weight"]); + + } else if (event.action === "action_body_fat_result") { + let bodyFat = event["data_body_fat_result"]; + let fat_weight = bodyFat["fat_weight"]; + let fat_control = bodyFat["fat_control"]; + let weight_control = bodyFat["weight_control"]; + let standard_weight = bodyFat["standard_weight"]; + let skeletal_muscle_mass = bodyFat["skeletal_muscle_mass"]; + let body_water_rate = bodyFat["body_water_rate"]; + let muscle_mas = bodyFat["muscle_mas"]; + let instruction_type = bodyFat["instruction_type"]; + let body_building = bodyFat["body_building"]; + let height = bodyFat["height"]; + let gender = bodyFat["gender"]; + let muscle_control = bodyFat["muscle_control"]; + let physical_age = bodyFat["physical_age"]; + let visceral_fat_grade = bodyFat["visceral_fat_grade"]; + let protein_rate = bodyFat["protein_rate"]; + let bone_salt_content = bodyFat["bone_salt_content"]; + let visceral_fat_grade = bodyFat["visceral_fat_grade"]; + let measure_time = bodyFat["measure_time"]; + let age = bodyFat["age"]; + let impedance = bodyFat["impedance"]; + let weight = bodyFat["weight"]; + + } else if (event.action === "action_measure_finish_at_critical") { } +}); +``` + +### start heart rate measurement mode + +```js +HS2SModule.resetDevice(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === HS2SProfileModule.ACTION_HS2S_MEASURE_HEARTRATE) { + + } +} +``` + +### stop heart rate measurement mode + +```js +HS2SModule.resetDevice(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === HS2SProfileModule.ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS) { + // {"status":0,"heartrate":78} + console.log(event.message); + } +} +``` + +### reset device + +```js +HS2SModule.resetDevice(mac); + +notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { + if (event.action === "action_restore_factory_settings") { + console.log(event["result"]); + } +} +``` + +### disconnect device + +```js +HS2SModule.disConnect(mac); +``` + +### get all connected devices + +```js +HS2SModule.getAllConnectedDevices(); +``` diff --git a/libs/ihealth-sdk/doc/hs4s.md b/libs/ihealth-sdk/doc/hs4s.md new file mode 100644 index 0000000..5cc7446 --- /dev/null +++ b/libs/ihealth-sdk/doc/hs4s.md @@ -0,0 +1,84 @@ +# HS4S Workflow + +## import HS4S module + +```js +import { + HS4SModule, + HSProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### start a measurement + +The API is asyn function. It will return message until finish measurement. + +```js +HS4SModule.startMeasure(mac); + +notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { + if (event.action === HSProfileModule.ACTION_ONLINE_RESULT_HS) { + console.log(event[HSProfileModule.DATAID]); + console.log(event[HSProfileModule.WEIGHT_HS]); + console.log(event[HSProfileModule.FAT_HS]); + console.log(event[HSProfileModule.WATER_HS]); + console.log(event[HSProfileModule.MUSCLE_HS]); + console.log(event[HSProfileModule.SKELETON_HS]); + console.log(event[HSProfileModule.FATELEVEL_HS]); + console.log(event[HSProfileModule.DCI_HS]); + } +}); +``` + +### get data stored in the HS4S device + +```js +HS4SModule.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { + if (event.action === HSProfileModule.ACTION_HISTORICAL_DATA_HS) { + let dataArray = event[HSProfileModule.HISTORDATA_HS]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[HSProfileModule.MEASUREMENT_DATE_HS]); + console.log(offlineData[HSProfileModule.WEIGHT_HS]); + console.log(offlineData[HSProfileModule.FAT_HS]); + console.log(offlineData[HSProfileModule.WATER_HS]); + console.log(offlineData[HSProfileModule.MUSCLE_HS]); + console.log(offlineData[HSProfileModule.SKELETON_HS]); + console.log(offlineData[HSProfileModule.FATELEVEL_HS]); + console.log(offlineData[HSProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP3LModule.disConnect(mac); +``` + +### get all connected devices + +```js +BP3LModule.getAllConnectedDevices(); +``` diff --git a/libs/ihealth-sdk/doc/hs6.md b/libs/ihealth-sdk/doc/hs6.md new file mode 100644 index 0000000..c951baa --- /dev/null +++ b/libs/ihealth-sdk/doc/hs6.md @@ -0,0 +1,137 @@ +# HS6 Workflow + +## import HS6 module + +```js +import { + HS6Module, + HS6ProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### init hs6 + +```js +// need the ihealth account, apply from ihealth developer website +HS6Module.init("xxx.xxx@xxx.com"); +``` + +### set wifi for hs6 + +The api only support the 2.4G wifi. + +```js +HS6Module.setWifi("xxxx", "1234567890"); + +// response +notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { + if (event.action === HS6ProfileModule.ACTION_HS6_SETWIFI) { + console.log(event[HS6ProfileModule.SETWIFI_RESULT]); + } +}); +``` + +### bind user with hs6 + +```js +/** + * birthday + * weight(kg) + * height(cm) + * isSporter + * gender + * serialNumber + */ +HS6Module.bindDeviceHS6("1979-02-26 12:20:10", 85.0, 180, 2, 1, "ACCF2337A952"); + +// response +notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { + if (event.action === HS6ProfileModule.ACTION_HS6_BIND) { + console.log(event[HS6ProfileModule.HS6_BIND_EXTRA]); + // 1: bind success, 2: the scale has no empty position, 3: bind fail + console.log(event[HS6ProfileModule.BIND_HS6_RESULT]); + console.log(event[HS6ProfileModule.HS6_MODEL]); + // The range is from 1~10 + console.log(event[HS6ProfileModule.HS6_POSITION]); + // 1: setted, 0: not + console.log(event[HS6ProfileModule.HS6_SETTED_WIFI]); + } +}); +``` + +### unbind hs6 + +```js +HS6Module.unBindDeviceHS6("ACCF2337A952"); + +// response +notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { + if (event.action === HS6ProfileModule.ACTION_HS6_UNBIND) { + console.log(event[HS6ProfileModule.HS6_UNBIND_RESULT]); + } +}); +``` + +### get token + +```js +/** + * clientId, + * clientSecret, + * username, + * clientPara +`*/ +HS6Module.getToken("xxx", "xxx", "xxx.xxx@xxx.com", "random_str"); + +// response +notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { + if (event.action === HS6ProfileModule.ACTION_HS6_GET_TOKEN) { + console.log(event[HS6ProfileModule.GET_TOKEN_RESULT]); + } +}); +``` + +### set unit + +```js +/** + * username + * unitType 0: Kg 1: lbs 2: st +`*/ +HS6Module.setUnit("xxx.xxx@xxx.com", 0); + +// response +notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { + if (event.action === HS6ProfileModule.ACTION_HS6_SET_UNIT) { + console.log(event[HS6ProfileModule.SET_UNIT_RESULT]); + } +}); +``` + +### get data stored in cloud + +```js +HS6Module.getCloudData("xxx", "xxx", "xxx.xxx@xxx.com", 0, 10); + +// response +notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { + if (event.action === HSProfileModule.ACTION_HS6_GET_CLOUDDATA) { + + } +}); +``` + diff --git a/libs/ihealth-sdk/doc/integrate-android.png b/libs/ihealth-sdk/doc/integrate-android.png new file mode 100644 index 0000000..c10ea67 Binary files /dev/null and b/libs/ihealth-sdk/doc/integrate-android.png differ diff --git a/libs/ihealth-sdk/doc/integrate-ios.png b/libs/ihealth-sdk/doc/integrate-ios.png new file mode 100644 index 0000000..9087e02 Binary files /dev/null and b/libs/ihealth-sdk/doc/integrate-ios.png differ diff --git a/libs/ihealth-sdk/doc/kn550.md b/libs/ihealth-sdk/doc/kn550.md new file mode 100644 index 0000000..f6e8bad --- /dev/null +++ b/libs/ihealth-sdk/doc/kn550.md @@ -0,0 +1,114 @@ +# KN550 Workflow + +## import KN550 module + +```js +import { + BP550BTModule, + BPProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get battery + +```js +BP550BTModule.getBattery(mac); + +notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_BATTERY_BP) { + console.log(event[BPProfileModule.BATTERY_BP]); + } +}); +``` + +### get KN550 function + +```js +BP550BTModule.getFunctionInfo(mac); + +notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_FUNCTION_INFORMATION_BP) { + console.log(event[BPProfileModule.FUNCTION_IS_UPAIR_MEASURE]); + console.log(event[BPProfileModule.FUNCTION_IS_ARM_MEASURE]); + console.log(event[BPProfileModule.FUNCTION_HAVE_ANGLE_SENSOR]); + console.log(event[BPProfileModule.FUNCTION_HAVE_OFFLINE]); + console.log(event[BPProfileModule.FUNCTION_HAVE_HSD]); + console.log(event[BPProfileModule.FUNCTION_HAVE_ANGLE_SETTING]); + console.log(event[BPProfileModule.FUNCTION_IS_MULTI_UPLOAD]); + console.log(event[BPProfileModule.FUNCTION_HAVE_SELF_UPDATE]); + } +}); +``` + +### get quantity of data stored in the KN550 device + +```js +BP550BTModule.getOfflineNum(mac); + +notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { + if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { + console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); + } +}); +``` + +### get data stored in the KN550 device + +```js +BP550BTModule.getOfflineData(mac); + +notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { + if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { + let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; + if (dataArray == undefined) { + result = "There is not offline data in device" + }else { + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + + console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); + console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(offlineData[BPProfileModule.PULSE_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); + console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); + console.log(offlineData[BPProfileModule.DATAID]); + } + } + } +}); +``` + +### disconnect device + +```js +BP550BTModule.disconnect(mac); +``` + +### get device information + +```js +iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { + console.info(event); +}) +``` + +### get all connected devices + +```js +BP550BTModule.getAllConnectedDevices(); +``` diff --git a/libs/ihealth-sdk/doc/nt13b.md b/libs/ihealth-sdk/doc/nt13b.md new file mode 100644 index 0000000..6fd45ee --- /dev/null +++ b/libs/ihealth-sdk/doc/nt13b.md @@ -0,0 +1,38 @@ +# NT13B Workflow + +## Import NT13B Module + +```js +import { + NT13BModule, + NT13BProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### set measurement listener + +```js +NT13BModule.measure(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify, (event) => { + if (event.action === NT13BProfileModule.ACTION_MEASUREMENT_RESULT) { + console.log(event[NT13BProfileModule.RESULT]); + console.log(event[NT13BProfileModule.UNIT_FLAG]); + } +}); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/po1.md b/libs/ihealth-sdk/doc/po1.md new file mode 100644 index 0000000..27f7e2a --- /dev/null +++ b/libs/ihealth-sdk/doc/po1.md @@ -0,0 +1,54 @@ +# PO1 Workflow + +## Import PO1 Module + +```js +import { + PO1Module, + PO1ProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(PO1Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get battery + +```js +PO1Module.getBattery(mac); + +// response +// {battery: 32, type: "PO1", mac: "004D320C41BE", action: "action_get_battery"} +notifyListener = DeviceEventEmitter.addListener(PO1Module.Event_Notify, (event) => { + if (event.action === PO1ProfileModule.ACTION_GET_BATTERY) { + console.log(event[PO1ProfileModule.BATTERY]); + } +}); +``` + +### online measurement + +```js +// response +// {type: "PO1", mac: "004D320C41BE", action: "action_bo_measurement", "po1_blood_oxygen":97,"po1_pulse":61,"po1_pulse_force":7.800000190734863,"po1_pi":3,"po1_wave":[42,69,95,95,78]} +notifyListener = DeviceEventEmitter.addListener(PO1Module.Event_Notify, (event) => { + if (event.action === PO1ProfileModule.ACTION_BO_MEASUREMENT) { + console.log(event[PO1ProfileModule.PO1_BLOOD_OXYGEN]); + console.log(event[PO1ProfileModule.PO1_PULSE]); + console.log(event[PO1ProfileModule.PO1_PULSE_FORCE]); + console.log(event[PO1ProfileModule.PO1_PI]); + console.log(event[PO1ProfileModule.PO1_WAVE]); + } +}); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/po3.md b/libs/ihealth-sdk/doc/po3.md new file mode 100644 index 0000000..1a11df1 --- /dev/null +++ b/libs/ihealth-sdk/doc/po3.md @@ -0,0 +1,87 @@ +# PO3 Workflow + +## Import PO3 Module + +```js +import { + PO3Module, + POProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### get battery + +```js +PO3Module.getBattery(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { + if (event.action === POProfileModule.ACTION_BATTERY_PO) { + console.log(event[POProfileModule.BATTERY_PO]); + } +}); +``` + +### start a measurement with app + +```js +PO3Module.startMeasure(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { + if (event.action === POProfileModule.ACTION_LIVEDA_PO) { + console.log(event[POProfileModule.PULSE_WAVE_PO]); + console.log(event[POProfileModule.PI_PO]); + console.log(event[POProfileModule.PULSE_STRENGTH_PO]); + console.log(event[POProfileModule.BLOOD_OXYGEN_PO]); + console.log(event[POProfileModule.PULSE_RATE_PO]); + } else if(){ + // final result + console.log(event[POProfileModule.PULSE_WAVE_PO]); + console.log(event[POProfileModule]); + console.log(event[POProfileModule.PI_PO]); + console.log(event[POProfileModule.PULSE_STRENGTH_PO]); + console.log(event[POProfileModule.BLOOD_OXYGEN_PO]); + console.log(event[POProfileModule.PULSE_RATE_PO]); + } +}); +``` + +### get data stored in the po3 device + +```js +PO3Module.getHistoryData(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { + if (event.action === POProfileModule.ACTION_NO_OFFLINEDATA_PO) { + console.log("There is no more data stored in the po3 device."); + } else if (event.action === POProfileModule.ACTION_OFFLINEDATA_PO) { + const dataArray = event[POProfileModule.OFFLINEDATA_PO]; + for (let i = 0; i < dataArray.length; i++) { + let offlineData = dataArray[i]; + console.log(offlineData[POProfileModule.MEASUREMENT_DATE_BP]); + console.log(offlineData[POProfileModule.HIGH_BLOOD_PRESSURE_BP]); + console.log(offlineData[POProfileModule.LOW_BLOOD_PRESSURE_BP]); + console.log(offlineData[POProfileModule.PULSE_BP]); + console.log(offlineData[POProfileModule.MEASUREMENT_AHR_BP]); + console.log(offlineData[POProfileModule.MEASUREMENT_HSD_BP]); + console.log(offlineData[POProfileModule.DATAID]); + } + } +}); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/doc/pt3sbt.md b/libs/ihealth-sdk/doc/pt3sbt.md new file mode 100644 index 0000000..97f2296 --- /dev/null +++ b/libs/ihealth-sdk/doc/pt3sbt.md @@ -0,0 +1,142 @@ +# PT3SBT Workflow + +## Import PT3SBT Module + +```js +import { + PT3SBTModule, + PT3SBTProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### set time + +```js +PT3SBTModule.setTime(mac); + +// response +// {status: "success", type: "PT3SBT", mac: "004D320C41BE", action: "action_set_time"} +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_SET_TIME) { + console.log(event[NT13BProfileModule.STATUS]); + } +}); +``` + +### get battery + +```js +PT3SBTModule.getBattery(mac); + +// response +// { battery: 70, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_battery"} +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_GET_BATTERY) { + console.log(event[PT3SBTProfileModule.BATTERY]); + } +}); +``` + +### set unit + +```js +// 1: centigrade, 2: fahrenheit +PT3SBTModule.setUnit(mac, unit); + +// response +// {status: "success", type: "PT3SBT", mac: "004D320C41BE", action: "action_set_unit"} +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_SET_UNIT) { + console.log(event[PT3SBTProfileModule.STATUS]); + } +}); +``` + +### get unit + +```js +PT3SBTModule.getUnit(mac); + +// response +// {unit: 2, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_unit"} +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_GET_UNIT) { + console.log(event[PT3SBTProfileModule.UNIT]); + } +}); +``` + +### get history data count + +```js +PT3SBTModule.getHistoryCount(mac); + +// response +// {count: 37, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_history_count"} +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_GET_HISTORY_COUNT) { + console.log(event[PT3SBTProfileModule.COUNT]); + } +}); +``` + +### get history data + +**Note: After call get history data, must to delele history data. If don't, the PT3SBT will keep on offline mode.** + +```js +PT3SBTModule.getHistoryData(mac); + +// response +// {history: Array, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_history_data"} +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_GET_HISTORY_DATA) { + const arr = event[PT3SBTProfileModule.HISTORY]; + arr.foreach(item => { + console.log(item[PT3SBTProfileModule.TEMPERATURE]); + console.log(item[PT3SBTProfileModule.TS]); + }) + } +}); +``` + +### delete history data + +```js +PT3SBTModule.deleteHistoryData(mac); + +// response +// {status: "success", type: "PT3SBT", mac: "004D320C41BE", action: "action_delete_history_data"} +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_DELETE_HISTORY_DATA) { + console.log(event[PT3SBTProfileModule.STATUS]); + } +}); +``` + +### online measurement + +```js +// response +// {Tbody: 3845", type: "PT3SBT", mac: "004D320C41BE", action: "action_temperature_measurement"} +// the real temperature is Tbody / 100, this is centigrade +notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { + if (event.action === PT3SBTProfileModule.ACTION_TEMPERATURE_MEASUREMENT) { + console.log(event[PT3SBTProfileModule.TEMPERATURE]); + } +}); +``` diff --git a/libs/ihealth-sdk/doc/ts28b.md b/libs/ihealth-sdk/doc/ts28b.md new file mode 100644 index 0000000..0b1a5ac --- /dev/null +++ b/libs/ihealth-sdk/doc/ts28b.md @@ -0,0 +1,38 @@ +# TS28B Workflow + +## Import TS28B Module + +```js +import { + TS28BModule, + TS28BProfileModule +} from '@ihealth/ihealthlibrary-react-native'; +``` + +## APIs + +### Add and remove listener + +```js +// add +notifyListener = DeviceEventEmitter.addListener(TS28BModule.Event_Notify, (event) => { + console.log(event); +}); + +// remove +notifyListener.remove(); +``` + +### set measurement listener + +```js +TS28BModule.measure(mac); + +// response +notifyListener = DeviceEventEmitter.addListener(TS28BModule.Event_Notify, (event) => { + if (event.action === TS28BProfileModule.ACTION_MEASUREMENT_RESULT) { + console.log(event[TS28BProfileModule.RESULT]); + console.log(event[TS28BProfileModule.UNIT_FLAG]); + } +}); +``` \ No newline at end of file diff --git a/libs/ihealth-sdk/index.js b/libs/ihealth-sdk/index.js new file mode 100755 index 0000000..cfff7f4 --- /dev/null +++ b/libs/ihealth-sdk/index.js @@ -0,0 +1,49 @@ +'use strict'; + +var Component = { + iHealthDeviceManagerModule: require('./module/iHealthDeviceManagerModule'), + BP5Module: require('./module/BP5Module'), + BP5SModule: require('./module/BP5SModule'), + BP3LModule: require('./module/BP3LModule'), + BP550BTModule: require('./module/BP550BTModule'), + BP7Module: require('./module/BP7Module'), + BP7SModule: require('./module/BP7SModule'), + BPProfileModule: require('./module/BPProfileModule'), + AM3SModule: require('./module/AM3SModule'), + AM4Module: require('./module/AM4Module'), + AMProfileModule: require('./module/AMProfileModule'), + AM5Module: require('./module/AM5Module'), + AM5ProfileModule: require('./module/AM5ProfileModule'), + PO3Module: require('./module/PO3Module'), + POProfileModule: require('./module/POProfileModule'), + HS2Module: require('./module/HS2Module'), + HS2SModule: require('./module/HS2SModule'), + HS4SModule: require('./module/HS4SModule'), + HSProfileModule: require('./module/HSProfileModule'), + HS2SProfileModule: require('./module/HS2SProfileModule'), + BG1Module: require('./module/BG1Module'), + BG1ProfileModule: require('./module/BG1ProfileModule'), + HS6Module: require('./module/HS6Module'), + HS6ProfileModule: require('./module/HS6ProfileModule'), + BG5Module:require('./module/BG5Module'), + BG5SModule:require('./module/BG5SModule'), + BG5SProfileModule:require('./module/BG5SProfileModule'), + BGProfileModule:require('./module/BGProfileModule'), + BTMModule:require('./module/BTMModule'), + BTMProfileModule:require('./module/BTMProfileModule'), + ECGModule:require('./module/ECGModule'), + ECGUSBModule:require('./module/ECGUSBModule'), + ECGProfileModule:require('./module/ECGProfileModule'), + TS28BModule:require('./module/TS28BModule'), + TS28BProfileModule:require('./module/TS28BProfileModule'), + NT13BModule:require('./module/NT13BModule'), + NT13BProfileModule:require('./module/NT13BProfileModule'), + BG1SModule:require('./module/BG1SModule'), + BG1SProfileModule:require('./module/BG1SProfileModule'), + PO1Module:require('./module/PO1Module'), + PO1ProfileModule:require('./module/PO1ProfileModule'), + PT3SBTModule:require('./module/PT3SBTModule'), + PT3SBTProfileModule:require('./module/PT3SBTProfileModule'), +} + +module.exports = Component; diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj new file mode 100755 index 0000000..410724b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.pbxproj @@ -0,0 +1,849 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 182D028B1DE57A2F00E9B783 /* iHealthDeviceManagerModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 182D028A1DE57A2F00E9B783 /* iHealthDeviceManagerModule.m */; }; + 183FB1681FF508300040009B /* BTMProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 183FB1661FF5082F0040009B /* BTMProfileModule.m */; }; + 183FB1691FF508300040009B /* BTMModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 183FB1671FF5082F0040009B /* BTMModule.m */; }; + 1875101F1DE5E374005E66B1 /* BPProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 1875101E1DE5E374005E66B1 /* BPProfileModule.m */; }; + 187510221DE5E399005E66B1 /* BP550BTModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 187510211DE5E399005E66B1 /* BP550BTModule.m */; }; + 187510251DE5E3CA005E66B1 /* BP7SModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 187510241DE5E3CA005E66B1 /* BP7SModule.m */; }; + 187510281DE5E3E3005E66B1 /* BP5Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 187510271DE5E3E3005E66B1 /* BP5Module.m */; }; + 1875102B1DE5E3FB005E66B1 /* BP3LModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 1875102A1DE5E3FB005E66B1 /* BP3LModule.m */; }; + 1875102E1DE5E411005E66B1 /* AMProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 1875102D1DE5E410005E66B1 /* AMProfileModule.m */; }; + 187510311DE5E424005E66B1 /* AM4Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 187510301DE5E424005E66B1 /* AM4Module.m */; }; + 187510341DE5E439005E66B1 /* AM3SModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 187510331DE5E439005E66B1 /* AM3SModule.m */; }; + 18B752C41FFF61C500DE2629 /* ECGModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 18B752C31FFF61C500DE2629 /* ECGModule.m */; }; + 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 */; }; + 4565653F26E0BDE7007DA850 /* AM5Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 4565653D26E0BDE6007DA850 /* AM5Module.m */; }; + 4565654026E0BDE7007DA850 /* AM5ProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 4565653E26E0BDE7007DA850 /* AM5ProfileModule.m */; }; + 456565E426E0C90D007DA850 /* iHealthSDK2.7.5.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 456565E326E0C90D007DA850 /* iHealthSDK2.7.5.a */; }; + 45A72D18256E5FCB00825201 /* BP7Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 45A72D16256E5FCB00825201 /* BP7Module.m */; }; + 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 */; }; + 9F3D8E1B1E0B6CDB00BA44B1 /* BG1Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F3D8E121E0B6CDB00BA44B1 /* BG1Module.m */; }; + 9F3D8E1C1E0B6CDB00BA44B1 /* BG1ProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F3D8E141E0B6CDB00BA44B1 /* BG1ProfileModule.m */; }; + 9F3D8E1E1E0B6CDB00BA44B1 /* BG5Module.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F3D8E181E0B6CDB00BA44B1 /* BG5Module.m */; }; + 9F3D8E1F1E0B6CDB00BA44B1 /* BGProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F3D8E1A1E0B6CDB00BA44B1 /* BGProfileModule.m */; }; + AF1B3F141DF9482100DFDB23 /* HS4SModule.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1B3F111DF9482100DFDB23 /* HS4SModule.m */; }; + AF1B3F151DF9482100DFDB23 /* HSProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1B3F131DF9482100DFDB23 /* HSProfileModule.m */; }; + AF1B3F3A1DFE72BD00DFDB23 /* HS6Module.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1B3F391DFE72BD00DFDB23 /* HS6Module.m */; }; + CE6054B025482CC90059E83A /* BG5SModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE60549C25482CC70059E83A /* BG5SModule.m */; }; + CE6054B125482CC90059E83A /* BP5SModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE60549D25482CC70059E83A /* BP5SModule.m */; }; + CE6054B225482CC90059E83A /* BG1SModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE60549F25482CC80059E83A /* BG1SModule.m */; }; + CE6054B325482CC90059E83A /* BG5SProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054A025482CC80059E83A /* BG5SProfileModule.m */; }; + CE6054B425482CC90059E83A /* NT13BProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054A225482CC80059E83A /* NT13BProfileModule.m */; }; + CE6054B525482CC90059E83A /* TS28BModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054A525482CC80059E83A /* TS28BModule.m */; }; + CE6054B625482CC90059E83A /* HS2SProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054A625482CC80059E83A /* HS2SProfileModule.m */; }; + CE6054B725482CC90059E83A /* NT13BModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054A825482CC80059E83A /* NT13BModule.m */; }; + CE6054B825482CC90059E83A /* BG1SProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054AA25482CC80059E83A /* BG1SProfileModule.m */; }; + CE6054B925482CC90059E83A /* HS2SModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054AB25482CC90059E83A /* HS2SModule.m */; }; + CE6054BA25482CC90059E83A /* TS28BProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054AE25482CC90059E83A /* TS28BProfileModule.m */; }; + CE6054C025482E590059E83A /* PO1Module.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054BD25482E580059E83A /* PO1Module.m */; }; + CE6054C125482E590059E83A /* PO1ProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6054BF25482E590059E83A /* PO1ProfileModule.m */; }; + CEEE2D0D2548F6E4007AC7E4 /* PT3SBTProfileModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEE2D0B2548F6E4007AC7E4 /* PT3SBTProfileModule.m */; }; + CEEE2D0E2548F6E4007AC7E4 /* PT3SBTModule.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEE2D0C2548F6E4007AC7E4 /* PT3SBTModule.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 182D01F81DE565EC00E9B783 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 182D01FA1DE565EC00E9B783 /* libReactNativeIOSLibrary.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativeIOSLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 182D02891DE57A2F00E9B783 /* iHealthDeviceManagerModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iHealthDeviceManagerModule.h; sourceTree = ""; }; + 182D028A1DE57A2F00E9B783 /* iHealthDeviceManagerModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iHealthDeviceManagerModule.m; sourceTree = ""; }; + 183FB1641FF5082E0040009B /* BTMModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTMModule.h; sourceTree = ""; }; + 183FB1651FF5082F0040009B /* BTMProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTMProfileModule.h; sourceTree = ""; }; + 183FB1661FF5082F0040009B /* BTMProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BTMProfileModule.m; sourceTree = ""; }; + 183FB1671FF5082F0040009B /* BTMModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BTMModule.m; sourceTree = ""; }; + 1875101D1DE5E374005E66B1 /* BPProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPProfileModule.h; sourceTree = ""; }; + 1875101E1DE5E374005E66B1 /* BPProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BPProfileModule.m; sourceTree = ""; }; + 187510201DE5E399005E66B1 /* BP550BTModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP550BTModule.h; sourceTree = ""; }; + 187510211DE5E399005E66B1 /* BP550BTModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BP550BTModule.m; sourceTree = ""; }; + 187510231DE5E3CA005E66B1 /* BP7SModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP7SModule.h; sourceTree = ""; }; + 187510241DE5E3CA005E66B1 /* BP7SModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BP7SModule.m; sourceTree = ""; }; + 187510261DE5E3E3005E66B1 /* BP5Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5Module.h; sourceTree = ""; }; + 187510271DE5E3E3005E66B1 /* BP5Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BP5Module.m; sourceTree = ""; }; + 187510291DE5E3FB005E66B1 /* BP3LModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP3LModule.h; sourceTree = ""; }; + 1875102A1DE5E3FB005E66B1 /* BP3LModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BP3LModule.m; sourceTree = ""; }; + 1875102C1DE5E410005E66B1 /* AMProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMProfileModule.h; sourceTree = ""; }; + 1875102D1DE5E410005E66B1 /* AMProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMProfileModule.m; sourceTree = ""; }; + 1875102F1DE5E424005E66B1 /* AM4Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM4Module.h; sourceTree = ""; }; + 187510301DE5E424005E66B1 /* AM4Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AM4Module.m; sourceTree = ""; }; + 187510321DE5E439005E66B1 /* AM3SModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM3SModule.h; sourceTree = ""; }; + 187510331DE5E439005E66B1 /* AM3SModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AM3SModule.m; sourceTree = ""; }; + 18B752C21FFF61C500DE2629 /* ECGModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ECGModule.h; sourceTree = ""; }; + 18B752C31FFF61C500DE2629 /* ECGModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ECGModule.m; sourceTree = ""; }; + 18B752C71FFF67DE00DE2629 /* ECGProfileModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ECGProfileModule.h; sourceTree = ""; }; + 18B752C81FFF67DE00DE2629 /* ECGProfileModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ECGProfileModule.m; sourceTree = ""; }; + 18B752CA1FFF67F100DE2629 /* ECGUSBModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ECGUSBModule.h; sourceTree = ""; }; + 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 = ""; }; + 4565653B26E0BDE6007DA850 /* AM5Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM5Module.h; sourceTree = ""; }; + 4565653C26E0BDE6007DA850 /* AM5ProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM5ProfileModule.h; sourceTree = ""; }; + 4565653D26E0BDE6007DA850 /* AM5Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AM5Module.m; sourceTree = ""; }; + 4565653E26E0BDE7007DA850 /* AM5ProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AM5ProfileModule.m; sourceTree = ""; }; + 4565654F26E0C90A007DA850 /* IDOSyncBpDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncBpDataModel.h; sourceTree = ""; }; + 4565655026E0C90A007DA850 /* BPContinua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPContinua.h; sourceTree = ""; }; + 4565655126E0C90A007DA850 /* IDOWeightBluetoothModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOWeightBluetoothModel.h; sourceTree = ""; }; + 4565655226E0C90A007DA850 /* ScanDeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScanDeviceController.h; sourceTree = ""; }; + 4565655326E0C90A007DA850 /* AM5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM5.h; sourceTree = ""; }; + 4565655426E0C90A007DA850 /* ECGHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECGHeader.h; sourceTree = ""; }; + 4565655526E0C90A007DA850 /* HS5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS5.h; sourceTree = ""; }; + 4565655626E0C90A007DA850 /* DFUHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFUHeader.h; sourceTree = ""; }; + 4565655726E0C90A007DA850 /* AM5Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM5Header.h; sourceTree = ""; }; + 4565655826E0C90A007DA850 /* HS2SController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS2SController.h; sourceTree = ""; }; + 4565655926E0C90A007DA850 /* IDODataExchangeModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDODataExchangeModel.h; sourceTree = ""; }; + 4565655A26E0C90A007DA850 /* BP5CController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5CController.h; sourceTree = ""; }; + 4565655B26E0C90A007DA850 /* BPController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPController.h; sourceTree = ""; }; + 4565655C26E0C90A007DA850 /* HS3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS3Controller.h; sourceTree = ""; }; + 4565655D26E0C90A007DA850 /* IDOGetInfoBluetoothModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOGetInfoBluetoothModel.h; sourceTree = ""; }; + 4565655E26E0C90A007DA850 /* BPBTLEDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPBTLEDevice.h; sourceTree = ""; }; + 4565655F26E0C90A007DA850 /* NT13B.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NT13B.h; sourceTree = ""; }; + 4565656026E0C90A007DA850 /* BP7Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP7Controller.h; sourceTree = ""; }; + 4565656126E0C90A007DA850 /* BPAV10Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPAV10Device.h; sourceTree = ""; }; + 4565656226E0C90A007DA850 /* BGMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGMacroFile.h; sourceTree = ""; }; + 4565656326E0C90A007DA850 /* AM5Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM5Controller.h; sourceTree = ""; }; + 4565656426E0C90A007DA850 /* BG3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG3Controller.h; sourceTree = ""; }; + 4565656526E0C90A007DA850 /* PT3SBT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PT3SBT.h; sourceTree = ""; }; + 4565656626E0C90A007DA850 /* HSMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HSMacroFile.h; sourceTree = ""; }; + 4565656726E0C90A007DA850 /* IDOCalculateBluetoothModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOCalculateBluetoothModel.h; sourceTree = ""; }; + 4565656826E0C90A007DA850 /* AMMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMMacroFile.h; sourceTree = ""; }; + 4565656926E0C90A007DA850 /* IDOTransferFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOTransferFileManager.h; sourceTree = ""; }; + 4565656A26E0C90A007DA850 /* SDKFlowUpdateDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDKFlowUpdateDevice.h; sourceTree = ""; }; + 4565656B26E0C90A007DA850 /* BPDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPDevice.h; sourceTree = ""; }; + 4565656C26E0C90A007DA850 /* POHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = POHeader.h; sourceTree = ""; }; + 4565656D26E0C90A007DA850 /* SDKUpdateDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDKUpdateDevice.h; sourceTree = ""; }; + 4565656E26E0C90A007DA850 /* BP5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5.h; sourceTree = ""; }; + 4565656F26E0C90A007DA850 /* BPHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPHeader.h; sourceTree = ""; }; + 4565657026E0C90A007DA850 /* ABIController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABIController.h; sourceTree = ""; }; + 4565657126E0C90A007DA850 /* TS28B.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TS28B.h; sourceTree = ""; }; + 4565657226E0C90A007DA850 /* HFSmartLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HFSmartLink.h; sourceTree = ""; }; + 4565657326E0C90A007DA850 /* BP5SController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5SController.h; sourceTree = ""; }; + 4565657426E0C90A007DA850 /* ConnectDeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnectDeviceController.h; sourceTree = ""; }; + 4565657526E0C90A007DA850 /* BG5S.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG5S.h; sourceTree = ""; }; + 4565657626E0C90A007DA850 /* BP5S.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5S.h; sourceTree = ""; }; + 4565657726E0C90A007DA850 /* THV3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THV3.h; sourceTree = ""; }; + 4565657826E0C90A007DA850 /* BG1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1.h; sourceTree = ""; }; + 4565657926E0C90A007DA850 /* BG1SController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1SController.h; sourceTree = ""; }; + 4565657A26E0C90A007DA850 /* HS5Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS5Controller.h; sourceTree = ""; }; + 4565657B26E0C90A007DA850 /* BG5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG5.h; sourceTree = ""; }; + 4565657C26E0C90A007DA850 /* ManageDeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManageDeviceController.h; sourceTree = ""; }; + 4565657D26E0C90A007DA850 /* BGDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGDevice.h; sourceTree = ""; }; + 4565657E26E0C90A007DA850 /* IDOErrorCodeToStr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOErrorCodeToStr.h; sourceTree = ""; }; + 4565657F26E0C90A007DA850 /* THV3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THV3Controller.h; sourceTree = ""; }; + 4565658026E0C90A007DA850 /* BP5SRWController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5SRWController.h; sourceTree = ""; }; + 4565658126E0C90A007DA850 /* BG1S.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1S.h; sourceTree = ""; }; + 4565658226E0C90A007DA850 /* HS2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS2.h; sourceTree = ""; }; + 4565658326E0C90A007DA850 /* PO1Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PO1Controller.h; sourceTree = ""; }; + 4565658426E0C90A007DA850 /* BGHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGHeader.h; sourceTree = ""; }; + 4565658526E0C90A007DA850 /* DFUController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFUController.h; sourceTree = ""; }; + 4565658626E0C90A007DA850 /* PO3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PO3.h; sourceTree = ""; }; + 4565658726E0C90A007DA850 /* BP3LController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP3LController.h; sourceTree = ""; }; + 4565658826E0C90A007DA850 /* IDOSyncHeartRateDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncHeartRateDataModel.h; sourceTree = ""; }; + 4565658926E0C90A007DA850 /* NT13BHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NT13BHeader.h; sourceTree = ""; }; + 4565658A26E0C90A007DA850 /* BG5Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG5Controller.h; sourceTree = ""; }; + 4565658B26E0C90A007DA850 /* AM3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM3Controller.h; sourceTree = ""; }; + 4565658C26E0C90A007DA850 /* BPM1AE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPM1AE.h; sourceTree = ""; }; + 4565658D26E0C90A007DA850 /* ABPM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABPM.h; sourceTree = ""; }; + 4565658E26E0C90A007DA850 /* IDOLogEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOLogEnum.h; sourceTree = ""; }; + 4565658F26E0C90A007DA850 /* IDOSyncGpsDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncGpsDataModel.h; sourceTree = ""; }; + 4565659026E0C90A007DA850 /* HealthHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HealthHeader.h; sourceTree = ""; }; + 4565659126E0C90A007DA850 /* IDOSyncPressureDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncPressureDataModel.h; sourceTree = ""; }; + 4565659226E0C90A007DA850 /* IDOSyncSwimDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncSwimDataModel.h; sourceTree = ""; }; + 4565659326E0C90A007DA850 /* HSHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HSHeader.h; sourceTree = ""; }; + 4565659426E0C90A007DA850 /* DFUMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFUMacro.h; sourceTree = ""; }; + 4565659526E0C90A007DA850 /* IDOTranEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOTranEnum.h; sourceTree = ""; }; + 4565659626E0C90A007DA850 /* BG5SController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG5SController.h; sourceTree = ""; }; + 4565659726E0C90A007DA850 /* AM3S_V2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM3S_V2.h; sourceTree = ""; }; + 4565659826E0C90A007DA850 /* IDOCommonMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOCommonMacro.h; sourceTree = ""; }; + 4565659926E0C90A007DA850 /* IDORecordDeviceLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDORecordDeviceLog.h; sourceTree = ""; }; + 4565659A26E0C90A007DA850 /* ABPMController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABPMController.h; sourceTree = ""; }; + 4565659B26E0C90A007DA850 /* NT13BMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NT13BMacroFile.h; sourceTree = ""; }; + 4565659C26E0C90A007DA850 /* POMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = POMacroFile.h; sourceTree = ""; }; + 4565659D26E0C90A007DA850 /* IDOSyncEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncEnum.h; sourceTree = ""; }; + 4565659E26E0C90A007DA850 /* AM3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM3.h; sourceTree = ""; }; + 4565659F26E0C90A007DA850 /* IDOSyncSpo2DataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncSpo2DataModel.h; sourceTree = ""; }; + 456565A026E0C90A007DA850 /* KN550BTController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KN550BTController.h; sourceTree = ""; }; + 456565A126E0C90A007DA850 /* IDODataMigrationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDODataMigrationManager.h; sourceTree = ""; }; + 456565A226E0C90A007DA850 /* BP7S.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP7S.h; sourceTree = ""; }; + 456565A326E0C90B007DA850 /* PO3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PO3Controller.h; sourceTree = ""; }; + 456565A426E0C90B007DA850 /* HS3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS3.h; sourceTree = ""; }; + 456565A526E0C90B007DA850 /* AM4Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM4Controller.h; sourceTree = ""; }; + 456565A626E0C90B007DA850 /* BPV25Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPV25Device.h; sourceTree = ""; }; + 456565A726E0C90B007DA850 /* PT3SBTMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PT3SBTMacroFile.h; sourceTree = ""; }; + 456565A826E0C90B007DA850 /* HS2Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS2Controller.h; sourceTree = ""; }; + 456565A926E0C90B007DA850 /* BP7SController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP7SController.h; sourceTree = ""; }; + 456565AA26E0C90B007DA850 /* BPContinuaController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPContinuaController.h; sourceTree = ""; }; + 456565AB26E0C90B007DA850 /* BP3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP3.h; sourceTree = ""; }; + 456565AC26E0C90B007DA850 /* IDOPeripheralModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOPeripheralModel.h; sourceTree = ""; }; + 456565AD26E0C90B007DA850 /* AMHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMHeader.h; sourceTree = ""; }; + 456565AE26E0C90B007DA850 /* BP3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP3Controller.h; sourceTree = ""; }; + 456565AF26E0C90B007DA850 /* ECGMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECGMacroFile.h; sourceTree = ""; }; + 456565B026E0C90B007DA850 /* BPV24Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPV24Device.h; sourceTree = ""; }; + 456565B126E0C90B007DA850 /* ECG3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECG3.h; sourceTree = ""; }; + 456565B226E0C90B007DA850 /* IDOBluetoothManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOBluetoothManager.h; sourceTree = ""; }; + 456565B326E0C90B007DA850 /* BPMacroFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPMacroFile.h; sourceTree = ""; }; + 456565B426E0C90B007DA850 /* IDOBlueDataResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOBlueDataResponse.h; sourceTree = ""; }; + 456565B526E0C90B007DA850 /* ECG3USBController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECG3USBController.h; sourceTree = ""; }; + 456565B626E0C90B007DA850 /* AM3SController_V2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM3SController_V2.h; sourceTree = ""; }; + 456565B726E0C90B007DA850 /* NT13BController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NT13BController.h; sourceTree = ""; }; + 456565B826E0C90B007DA850 /* ECG3USB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECG3USB.h; sourceTree = ""; }; + 456565B926E0C90B007DA850 /* BP7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP7.h; sourceTree = ""; }; + 456565BA26E0C90B007DA850 /* BGController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGController.h; sourceTree = ""; }; + 456565BB26E0C90B007DA850 /* PT3SBTController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PT3SBTController.h; sourceTree = ""; }; + 456565BC26E0C90B007DA850 /* iHealthHS6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iHealthHS6.h; sourceTree = ""; }; + 456565BD26E0C90B007DA850 /* AM4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AM4.h; sourceTree = ""; }; + 456565BE26E0C90B007DA850 /* BP5SRW.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5SRW.h; sourceTree = ""; }; + 456565BF26E0C90B007DA850 /* BG3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG3.h; sourceTree = ""; }; + 456565C026E0C90B007DA850 /* IDOWatchDialInfoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOWatchDialInfoModel.h; sourceTree = ""; }; + 456565C126E0C90B007DA850 /* DFUServerFirmwareInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFUServerFirmwareInfo.h; sourceTree = ""; }; + 456565C226E0C90B007DA850 /* ABI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABI.h; sourceTree = ""; }; + 456565C326E0C90B007DA850 /* IDOBluetoothEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOBluetoothEngine.h; sourceTree = ""; }; + 456565C426E0C90B007DA850 /* IDOSyncSportDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncSportDataModel.h; sourceTree = ""; }; + 456565C526E0C90B007DA850 /* HS4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS4.h; sourceTree = ""; }; + 456565C626E0C90B007DA850 /* BPBV10Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPBV10Device.h; sourceTree = ""; }; + 456565C726E0C90B007DA850 /* IDOBluetoothBaseModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOBluetoothBaseModel.h; sourceTree = ""; }; + 456565C826E0C90B007DA850 /* IDOFoundationCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOFoundationCommand.h; sourceTree = ""; }; + 456565C926E0C90B007DA850 /* TS28BController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TS28BController.h; sourceTree = ""; }; + 456565CA26E0C90B007DA850 /* IDOWatchDialManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOWatchDialManager.h; sourceTree = ""; }; + 456565CB26E0C90B007DA850 /* IDOSyncSleepDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncSleepDataModel.h; sourceTree = ""; }; + 456565CC26E0C90B007DA850 /* HealthUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HealthUser.h; sourceTree = ""; }; + 456565CD26E0C90B007DA850 /* IDOSetInfoBluetoothModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSetInfoBluetoothModel.h; sourceTree = ""; }; + 456565CE26E0C90B007DA850 /* IDOSyncManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncManager.h; sourceTree = ""; }; + 456565CF26E0C90B007DA850 /* BG1Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1Controller.h; sourceTree = ""; }; + 456565D026E0C90B007DA850 /* IDOBindEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOBindEnum.h; sourceTree = ""; }; + 456565D126E0C90B007DA850 /* HFSmartLinkDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HFSmartLinkDeviceInfo.h; sourceTree = ""; }; + 456565D226E0C90B007DA850 /* BP5Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5Controller.h; sourceTree = ""; }; + 456565D326E0C90B007DA850 /* THV3Macro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THV3Macro.h; sourceTree = ""; }; + 456565D426E0C90B007DA850 /* HS2S.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS2S.h; sourceTree = ""; }; + 456565D526E0C90B007DA850 /* IDOBluetoothServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOBluetoothServices.h; sourceTree = ""; }; + 456565D626E0C90B007DA850 /* PO1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PO1.h; sourceTree = ""; }; + 456565D726E0C90B007DA850 /* HS4Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS4Controller.h; sourceTree = ""; }; + 456565D826E0C90B007DA850 /* IDOBlueEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOBlueEnum.h; sourceTree = ""; }; + 456565D926E0C90B007DA850 /* BP5C.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5C.h; sourceTree = ""; }; + 456565DA26E0C90B007DA850 /* TS28BHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TS28BHeader.h; sourceTree = ""; }; + 456565DB26E0C90B007DA850 /* BP3L.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP3L.h; sourceTree = ""; }; + 456565DC26E0C90B007DA850 /* IHSDKCloudUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IHSDKCloudUser.h; sourceTree = ""; }; + 456565DD26E0C90B007DA850 /* DFUDeviceFirmwareInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFUDeviceFirmwareInfo.h; sourceTree = ""; }; + 456565DE26E0C90B007DA850 /* ECG3Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECG3Controller.h; sourceTree = ""; }; + 456565DF26E0C90B007DA850 /* IDOSyncActivityDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDOSyncActivityDataModel.h; sourceTree = ""; }; + 456565E026E0C90B007DA850 /* KN550BT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KN550BT.h; sourceTree = ""; }; + 456565E126E0C90B007DA850 /* SDKInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDKInfo.h; sourceTree = ""; }; + 456565E226E0C90B007DA850 /* BPLoopMeasureSettingModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BPLoopMeasureSettingModel.h; sourceTree = ""; }; + 456565E326E0C90D007DA850 /* iHealthSDK2.7.5.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = iHealthSDK2.7.5.a; 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 = ""; }; + 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 = ""; }; + 8CCCE9B11E5ADF49007F7FE4 /* POProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = POProfileModule.m; sourceTree = ""; }; + 8CCCE9E11E5E7C58007F7FE4 /* HS6ProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS6ProfileModule.h; sourceTree = ""; }; + 8CCCE9E21E5E7C58007F7FE4 /* HS6ProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HS6ProfileModule.m; sourceTree = ""; }; + 9F3D8E111E0B6CDB00BA44B1 /* BG1Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1Module.h; sourceTree = ""; }; + 9F3D8E121E0B6CDB00BA44B1 /* BG1Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BG1Module.m; sourceTree = ""; }; + 9F3D8E131E0B6CDB00BA44B1 /* BG1ProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1ProfileModule.h; sourceTree = ""; }; + 9F3D8E141E0B6CDB00BA44B1 /* BG1ProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BG1ProfileModule.m; sourceTree = ""; }; + 9F3D8E171E0B6CDB00BA44B1 /* BG5Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG5Module.h; sourceTree = ""; }; + 9F3D8E181E0B6CDB00BA44B1 /* BG5Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BG5Module.m; sourceTree = ""; }; + 9F3D8E191E0B6CDB00BA44B1 /* BGProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGProfileModule.h; sourceTree = ""; }; + 9F3D8E1A1E0B6CDB00BA44B1 /* BGProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BGProfileModule.m; sourceTree = ""; }; + AF1B3F101DF9482100DFDB23 /* HS4SModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS4SModule.h; sourceTree = ""; }; + AF1B3F111DF9482100DFDB23 /* HS4SModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HS4SModule.m; sourceTree = ""; }; + AF1B3F121DF9482100DFDB23 /* HSProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HSProfileModule.h; sourceTree = ""; }; + AF1B3F131DF9482100DFDB23 /* HSProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSProfileModule.m; sourceTree = ""; }; + AF1B3F381DFE72BD00DFDB23 /* HS6Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS6Module.h; sourceTree = ""; }; + AF1B3F391DFE72BD00DFDB23 /* HS6Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HS6Module.m; sourceTree = ""; }; + CE60549A25482CC70059E83A /* TS28BModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TS28BModule.h; sourceTree = ""; }; + CE60549B25482CC70059E83A /* HS2SModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS2SModule.h; sourceTree = ""; }; + CE60549C25482CC70059E83A /* BG5SModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BG5SModule.m; sourceTree = ""; }; + CE60549D25482CC70059E83A /* BP5SModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BP5SModule.m; sourceTree = ""; }; + CE60549E25482CC80059E83A /* BG1SModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1SModule.h; sourceTree = ""; }; + CE60549F25482CC80059E83A /* BG1SModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BG1SModule.m; sourceTree = ""; }; + CE6054A025482CC80059E83A /* BG5SProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BG5SProfileModule.m; sourceTree = ""; }; + CE6054A125482CC80059E83A /* NT13BModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NT13BModule.h; sourceTree = ""; }; + CE6054A225482CC80059E83A /* NT13BProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NT13BProfileModule.m; sourceTree = ""; }; + CE6054A325482CC80059E83A /* TS28BProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TS28BProfileModule.h; sourceTree = ""; }; + CE6054A425482CC80059E83A /* NT13BProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NT13BProfileModule.h; sourceTree = ""; }; + CE6054A525482CC80059E83A /* TS28BModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TS28BModule.m; sourceTree = ""; }; + CE6054A625482CC80059E83A /* HS2SProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HS2SProfileModule.m; sourceTree = ""; }; + CE6054A725482CC80059E83A /* HS2SProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HS2SProfileModule.h; sourceTree = ""; }; + CE6054A825482CC80059E83A /* NT13BModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NT13BModule.m; sourceTree = ""; }; + CE6054A925482CC80059E83A /* BG1SProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG1SProfileModule.h; sourceTree = ""; }; + CE6054AA25482CC80059E83A /* BG1SProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BG1SProfileModule.m; sourceTree = ""; }; + CE6054AB25482CC90059E83A /* HS2SModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HS2SModule.m; sourceTree = ""; }; + CE6054AC25482CC90059E83A /* BG5SModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG5SModule.h; sourceTree = ""; }; + CE6054AD25482CC90059E83A /* BG5SProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BG5SProfileModule.h; sourceTree = ""; }; + CE6054AE25482CC90059E83A /* TS28BProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TS28BProfileModule.m; sourceTree = ""; }; + CE6054AF25482CC90059E83A /* BP5SModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BP5SModule.h; sourceTree = ""; }; + CE6054BC25482E580059E83A /* PO1Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PO1Module.h; sourceTree = ""; }; + CE6054BD25482E580059E83A /* PO1Module.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PO1Module.m; sourceTree = ""; }; + CE6054BE25482E590059E83A /* PO1ProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PO1ProfileModule.h; sourceTree = ""; }; + CE6054BF25482E590059E83A /* PO1ProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PO1ProfileModule.m; sourceTree = ""; }; + CEEE2D092548F6E4007AC7E4 /* PT3SBTModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PT3SBTModule.h; sourceTree = ""; }; + CEEE2D0A2548F6E4007AC7E4 /* PT3SBTProfileModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PT3SBTProfileModule.h; sourceTree = ""; }; + CEEE2D0B2548F6E4007AC7E4 /* PT3SBTProfileModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PT3SBTProfileModule.m; sourceTree = ""; }; + CEEE2D0C2548F6E4007AC7E4 /* PT3SBTModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PT3SBTModule.m; sourceTree = ""; }; + EC8A298C1ED6DCD400143F47 /* RNBGMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBGMacro.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 182D01F71DE565EC00E9B783 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 456565E426E0C90D007DA850 /* iHealthSDK2.7.5.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 182D01F11DE565EC00E9B783 = { + isa = PBXGroup; + children = ( + 182D01FC1DE565EC00E9B783 /* ReactNativeIOSLibrary */, + 182D01FB1DE565EC00E9B783 /* Products */, + ); + sourceTree = ""; + }; + 182D01FB1DE565EC00E9B783 /* Products */ = { + isa = PBXGroup; + children = ( + 182D01FA1DE565EC00E9B783 /* libReactNativeIOSLibrary.a */, + ); + name = Products; + sourceTree = ""; + }; + 182D01FC1DE565EC00E9B783 /* ReactNativeIOSLibrary */ = { + isa = PBXGroup; + children = ( + EC8A298C1ED6DCD400143F47 /* RNBGMacro.h */, + 9F3D8E111E0B6CDB00BA44B1 /* BG1Module.h */, + 9F3D8E121E0B6CDB00BA44B1 /* BG1Module.m */, + 9F3D8E131E0B6CDB00BA44B1 /* BG1ProfileModule.h */, + 9F3D8E141E0B6CDB00BA44B1 /* BG1ProfileModule.m */, + 9F3D8E171E0B6CDB00BA44B1 /* BG5Module.h */, + 9F3D8E181E0B6CDB00BA44B1 /* BG5Module.m */, + 9F3D8E191E0B6CDB00BA44B1 /* BGProfileModule.h */, + 9F3D8E1A1E0B6CDB00BA44B1 /* BGProfileModule.m */, + AF1B3F101DF9482100DFDB23 /* HS4SModule.h */, + AF1B3F111DF9482100DFDB23 /* HS4SModule.m */, + 3F31C42921ABE80400811B02 /* HS2Module.h */, + 3F31C42A21ABE80400811B02 /* HS2Module.m */, + AF1B3F381DFE72BD00DFDB23 /* HS6Module.h */, + AF1B3F391DFE72BD00DFDB23 /* HS6Module.m */, + 8CCCE9E11E5E7C58007F7FE4 /* HS6ProfileModule.h */, + 8CCCE9E21E5E7C58007F7FE4 /* HS6ProfileModule.m */, + AF1B3F121DF9482100DFDB23 /* HSProfileModule.h */, + AF1B3F131DF9482100DFDB23 /* HSProfileModule.m */, + CE60549E25482CC80059E83A /* BG1SModule.h */, + CE60549F25482CC80059E83A /* BG1SModule.m */, + CE6054A925482CC80059E83A /* BG1SProfileModule.h */, + CE6054AA25482CC80059E83A /* BG1SProfileModule.m */, + CE6054AC25482CC90059E83A /* BG5SModule.h */, + CE60549C25482CC70059E83A /* BG5SModule.m */, + CE6054AD25482CC90059E83A /* BG5SProfileModule.h */, + CE6054A025482CC80059E83A /* BG5SProfileModule.m */, + CE6054AF25482CC90059E83A /* BP5SModule.h */, + CE60549D25482CC70059E83A /* BP5SModule.m */, + CE60549B25482CC70059E83A /* HS2SModule.h */, + CE6054AB25482CC90059E83A /* HS2SModule.m */, + CE6054A725482CC80059E83A /* HS2SProfileModule.h */, + CE6054A625482CC80059E83A /* HS2SProfileModule.m */, + CE6054A125482CC80059E83A /* NT13BModule.h */, + CE6054A825482CC80059E83A /* NT13BModule.m */, + CE6054A425482CC80059E83A /* NT13BProfileModule.h */, + CE6054A225482CC80059E83A /* NT13BProfileModule.m */, + CE60549A25482CC70059E83A /* TS28BModule.h */, + CE6054A525482CC80059E83A /* TS28BModule.m */, + CE6054A325482CC80059E83A /* TS28BProfileModule.h */, + CE6054AE25482CC90059E83A /* TS28BProfileModule.m */, + 182D02891DE57A2F00E9B783 /* iHealthDeviceManagerModule.h */, + 182D028A1DE57A2F00E9B783 /* iHealthDeviceManagerModule.m */, + 18B752C21FFF61C500DE2629 /* ECGModule.h */, + 18B752C31FFF61C500DE2629 /* ECGModule.m */, + 18B752C71FFF67DE00DE2629 /* ECGProfileModule.h */, + 18B752C81FFF67DE00DE2629 /* ECGProfileModule.m */, + 18B752CA1FFF67F100DE2629 /* ECGUSBModule.h */, + 18B752CB1FFF67F100DE2629 /* ECGUSBModule.m */, + CE6054BC25482E580059E83A /* PO1Module.h */, + CE6054BD25482E580059E83A /* PO1Module.m */, + CE6054BE25482E590059E83A /* PO1ProfileModule.h */, + CE6054BF25482E590059E83A /* PO1ProfileModule.m */, + 8CCCE9AE1E5ADF49007F7FE4 /* PO3Module.h */, + 8CCCE9AF1E5ADF49007F7FE4 /* PO3Module.m */, + 8CCCE9B01E5ADF49007F7FE4 /* POProfileModule.h */, + 8CCCE9B11E5ADF49007F7FE4 /* POProfileModule.m */, + CEEE2D092548F6E4007AC7E4 /* PT3SBTModule.h */, + CEEE2D0C2548F6E4007AC7E4 /* PT3SBTModule.m */, + CEEE2D0A2548F6E4007AC7E4 /* PT3SBTProfileModule.h */, + CEEE2D0B2548F6E4007AC7E4 /* PT3SBTProfileModule.m */, + 183FB1641FF5082E0040009B /* BTMModule.h */, + 183FB1671FF5082F0040009B /* BTMModule.m */, + 183FB1651FF5082F0040009B /* BTMProfileModule.h */, + 183FB1661FF5082F0040009B /* BTMProfileModule.m */, + 1875101D1DE5E374005E66B1 /* BPProfileModule.h */, + 1875101E1DE5E374005E66B1 /* BPProfileModule.m */, + 187510201DE5E399005E66B1 /* BP550BTModule.h */, + 187510211DE5E399005E66B1 /* BP550BTModule.m */, + 187510231DE5E3CA005E66B1 /* BP7SModule.h */, + 187510241DE5E3CA005E66B1 /* BP7SModule.m */, + 187510261DE5E3E3005E66B1 /* BP5Module.h */, + 187510271DE5E3E3005E66B1 /* BP5Module.m */, + 45A72D17256E5FCB00825201 /* BP7Module.h */, + 45A72D16256E5FCB00825201 /* BP7Module.m */, + 187510291DE5E3FB005E66B1 /* BP3LModule.h */, + 1875102A1DE5E3FB005E66B1 /* BP3LModule.m */, + 1875102C1DE5E410005E66B1 /* AMProfileModule.h */, + 1875102D1DE5E410005E66B1 /* AMProfileModule.m */, + 1875102F1DE5E424005E66B1 /* AM4Module.h */, + 187510301DE5E424005E66B1 /* AM4Module.m */, + 187510321DE5E439005E66B1 /* AM3SModule.h */, + 187510331DE5E439005E66B1 /* AM3SModule.m */, + 4565653B26E0BDE6007DA850 /* AM5Module.h */, + 4565653D26E0BDE6007DA850 /* AM5Module.m */, + 4565653C26E0BDE6007DA850 /* AM5ProfileModule.h */, + 4565653E26E0BDE7007DA850 /* AM5ProfileModule.m */, + 187510351DE5E6A5005E66B1 /* Communication_SDK */, + ); + path = ReactNativeIOSLibrary; + sourceTree = ""; + }; + 187510351DE5E6A5005E66B1 /* Communication_SDK */ = { + isa = PBXGroup; + children = ( + 4565654E26E0C90A007DA850 /* Headers */, + 456565E326E0C90D007DA850 /* iHealthSDK2.7.5.a */, + ); + path = Communication_SDK; + sourceTree = ""; + }; + 4565654E26E0C90A007DA850 /* Headers */ = { + isa = PBXGroup; + children = ( + 4565654F26E0C90A007DA850 /* IDOSyncBpDataModel.h */, + 4565655026E0C90A007DA850 /* BPContinua.h */, + 4565655126E0C90A007DA850 /* IDOWeightBluetoothModel.h */, + 4565655226E0C90A007DA850 /* ScanDeviceController.h */, + 4565655326E0C90A007DA850 /* AM5.h */, + 4565655426E0C90A007DA850 /* ECGHeader.h */, + 4565655526E0C90A007DA850 /* HS5.h */, + 4565655626E0C90A007DA850 /* DFUHeader.h */, + 4565655726E0C90A007DA850 /* AM5Header.h */, + 4565655826E0C90A007DA850 /* HS2SController.h */, + 4565655926E0C90A007DA850 /* IDODataExchangeModel.h */, + 4565655A26E0C90A007DA850 /* BP5CController.h */, + 4565655B26E0C90A007DA850 /* BPController.h */, + 4565655C26E0C90A007DA850 /* HS3Controller.h */, + 4565655D26E0C90A007DA850 /* IDOGetInfoBluetoothModel.h */, + 4565655E26E0C90A007DA850 /* BPBTLEDevice.h */, + 4565655F26E0C90A007DA850 /* NT13B.h */, + 4565656026E0C90A007DA850 /* BP7Controller.h */, + 4565656126E0C90A007DA850 /* BPAV10Device.h */, + 4565656226E0C90A007DA850 /* BGMacroFile.h */, + 4565656326E0C90A007DA850 /* AM5Controller.h */, + 4565656426E0C90A007DA850 /* BG3Controller.h */, + 4565656526E0C90A007DA850 /* PT3SBT.h */, + 4565656626E0C90A007DA850 /* HSMacroFile.h */, + 4565656726E0C90A007DA850 /* IDOCalculateBluetoothModel.h */, + 4565656826E0C90A007DA850 /* AMMacroFile.h */, + 4565656926E0C90A007DA850 /* IDOTransferFileManager.h */, + 4565656A26E0C90A007DA850 /* SDKFlowUpdateDevice.h */, + 4565656B26E0C90A007DA850 /* BPDevice.h */, + 4565656C26E0C90A007DA850 /* POHeader.h */, + 4565656D26E0C90A007DA850 /* SDKUpdateDevice.h */, + 4565656E26E0C90A007DA850 /* BP5.h */, + 4565656F26E0C90A007DA850 /* BPHeader.h */, + 4565657026E0C90A007DA850 /* ABIController.h */, + 4565657126E0C90A007DA850 /* TS28B.h */, + 4565657226E0C90A007DA850 /* HFSmartLink.h */, + 4565657326E0C90A007DA850 /* BP5SController.h */, + 4565657426E0C90A007DA850 /* ConnectDeviceController.h */, + 4565657526E0C90A007DA850 /* BG5S.h */, + 4565657626E0C90A007DA850 /* BP5S.h */, + 4565657726E0C90A007DA850 /* THV3.h */, + 4565657826E0C90A007DA850 /* BG1.h */, + 4565657926E0C90A007DA850 /* BG1SController.h */, + 4565657A26E0C90A007DA850 /* HS5Controller.h */, + 4565657B26E0C90A007DA850 /* BG5.h */, + 4565657C26E0C90A007DA850 /* ManageDeviceController.h */, + 4565657D26E0C90A007DA850 /* BGDevice.h */, + 4565657E26E0C90A007DA850 /* IDOErrorCodeToStr.h */, + 4565657F26E0C90A007DA850 /* THV3Controller.h */, + 4565658026E0C90A007DA850 /* BP5SRWController.h */, + 4565658126E0C90A007DA850 /* BG1S.h */, + 4565658226E0C90A007DA850 /* HS2.h */, + 4565658326E0C90A007DA850 /* PO1Controller.h */, + 4565658426E0C90A007DA850 /* BGHeader.h */, + 4565658526E0C90A007DA850 /* DFUController.h */, + 4565658626E0C90A007DA850 /* PO3.h */, + 4565658726E0C90A007DA850 /* BP3LController.h */, + 4565658826E0C90A007DA850 /* IDOSyncHeartRateDataModel.h */, + 4565658926E0C90A007DA850 /* NT13BHeader.h */, + 4565658A26E0C90A007DA850 /* BG5Controller.h */, + 4565658B26E0C90A007DA850 /* AM3Controller.h */, + 4565658C26E0C90A007DA850 /* BPM1AE.h */, + 4565658D26E0C90A007DA850 /* ABPM.h */, + 4565658E26E0C90A007DA850 /* IDOLogEnum.h */, + 4565658F26E0C90A007DA850 /* IDOSyncGpsDataModel.h */, + 4565659026E0C90A007DA850 /* HealthHeader.h */, + 4565659126E0C90A007DA850 /* IDOSyncPressureDataModel.h */, + 4565659226E0C90A007DA850 /* IDOSyncSwimDataModel.h */, + 4565659326E0C90A007DA850 /* HSHeader.h */, + 4565659426E0C90A007DA850 /* DFUMacro.h */, + 4565659526E0C90A007DA850 /* IDOTranEnum.h */, + 4565659626E0C90A007DA850 /* BG5SController.h */, + 4565659726E0C90A007DA850 /* AM3S_V2.h */, + 4565659826E0C90A007DA850 /* IDOCommonMacro.h */, + 4565659926E0C90A007DA850 /* IDORecordDeviceLog.h */, + 4565659A26E0C90A007DA850 /* ABPMController.h */, + 4565659B26E0C90A007DA850 /* NT13BMacroFile.h */, + 4565659C26E0C90A007DA850 /* POMacroFile.h */, + 4565659D26E0C90A007DA850 /* IDOSyncEnum.h */, + 4565659E26E0C90A007DA850 /* AM3.h */, + 4565659F26E0C90A007DA850 /* IDOSyncSpo2DataModel.h */, + 456565A026E0C90A007DA850 /* KN550BTController.h */, + 456565A126E0C90A007DA850 /* IDODataMigrationManager.h */, + 456565A226E0C90A007DA850 /* BP7S.h */, + 456565A326E0C90B007DA850 /* PO3Controller.h */, + 456565A426E0C90B007DA850 /* HS3.h */, + 456565A526E0C90B007DA850 /* AM4Controller.h */, + 456565A626E0C90B007DA850 /* BPV25Device.h */, + 456565A726E0C90B007DA850 /* PT3SBTMacroFile.h */, + 456565A826E0C90B007DA850 /* HS2Controller.h */, + 456565A926E0C90B007DA850 /* BP7SController.h */, + 456565AA26E0C90B007DA850 /* BPContinuaController.h */, + 456565AB26E0C90B007DA850 /* BP3.h */, + 456565AC26E0C90B007DA850 /* IDOPeripheralModel.h */, + 456565AD26E0C90B007DA850 /* AMHeader.h */, + 456565AE26E0C90B007DA850 /* BP3Controller.h */, + 456565AF26E0C90B007DA850 /* ECGMacroFile.h */, + 456565B026E0C90B007DA850 /* BPV24Device.h */, + 456565B126E0C90B007DA850 /* ECG3.h */, + 456565B226E0C90B007DA850 /* IDOBluetoothManager.h */, + 456565B326E0C90B007DA850 /* BPMacroFile.h */, + 456565B426E0C90B007DA850 /* IDOBlueDataResponse.h */, + 456565B526E0C90B007DA850 /* ECG3USBController.h */, + 456565B626E0C90B007DA850 /* AM3SController_V2.h */, + 456565B726E0C90B007DA850 /* NT13BController.h */, + 456565B826E0C90B007DA850 /* ECG3USB.h */, + 456565B926E0C90B007DA850 /* BP7.h */, + 456565BA26E0C90B007DA850 /* BGController.h */, + 456565BB26E0C90B007DA850 /* PT3SBTController.h */, + 456565BC26E0C90B007DA850 /* iHealthHS6.h */, + 456565BD26E0C90B007DA850 /* AM4.h */, + 456565BE26E0C90B007DA850 /* BP5SRW.h */, + 456565BF26E0C90B007DA850 /* BG3.h */, + 456565C026E0C90B007DA850 /* IDOWatchDialInfoModel.h */, + 456565C126E0C90B007DA850 /* DFUServerFirmwareInfo.h */, + 456565C226E0C90B007DA850 /* ABI.h */, + 456565C326E0C90B007DA850 /* IDOBluetoothEngine.h */, + 456565C426E0C90B007DA850 /* IDOSyncSportDataModel.h */, + 456565C526E0C90B007DA850 /* HS4.h */, + 456565C626E0C90B007DA850 /* BPBV10Device.h */, + 456565C726E0C90B007DA850 /* IDOBluetoothBaseModel.h */, + 456565C826E0C90B007DA850 /* IDOFoundationCommand.h */, + 456565C926E0C90B007DA850 /* TS28BController.h */, + 456565CA26E0C90B007DA850 /* IDOWatchDialManager.h */, + 456565CB26E0C90B007DA850 /* IDOSyncSleepDataModel.h */, + 456565CC26E0C90B007DA850 /* HealthUser.h */, + 456565CD26E0C90B007DA850 /* IDOSetInfoBluetoothModel.h */, + 456565CE26E0C90B007DA850 /* IDOSyncManager.h */, + 456565CF26E0C90B007DA850 /* BG1Controller.h */, + 456565D026E0C90B007DA850 /* IDOBindEnum.h */, + 456565D126E0C90B007DA850 /* HFSmartLinkDeviceInfo.h */, + 456565D226E0C90B007DA850 /* BP5Controller.h */, + 456565D326E0C90B007DA850 /* THV3Macro.h */, + 456565D426E0C90B007DA850 /* HS2S.h */, + 456565D526E0C90B007DA850 /* IDOBluetoothServices.h */, + 456565D626E0C90B007DA850 /* PO1.h */, + 456565D726E0C90B007DA850 /* HS4Controller.h */, + 456565D826E0C90B007DA850 /* IDOBlueEnum.h */, + 456565D926E0C90B007DA850 /* BP5C.h */, + 456565DA26E0C90B007DA850 /* TS28BHeader.h */, + 456565DB26E0C90B007DA850 /* BP3L.h */, + 456565DC26E0C90B007DA850 /* IHSDKCloudUser.h */, + 456565DD26E0C90B007DA850 /* DFUDeviceFirmwareInfo.h */, + 456565DE26E0C90B007DA850 /* ECG3Controller.h */, + 456565DF26E0C90B007DA850 /* IDOSyncActivityDataModel.h */, + 456565E026E0C90B007DA850 /* KN550BT.h */, + 456565E126E0C90B007DA850 /* SDKInfo.h */, + 456565E226E0C90B007DA850 /* BPLoopMeasureSettingModel.h */, + ); + path = Headers; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 182D01F91DE565EC00E9B783 /* ReactNativeIOSLibrary */ = { + isa = PBXNativeTarget; + buildConfigurationList = 182D02031DE565EC00E9B783 /* Build configuration list for PBXNativeTarget "ReactNativeIOSLibrary" */; + buildPhases = ( + 182D01F61DE565EC00E9B783 /* Sources */, + 182D01F71DE565EC00E9B783 /* Frameworks */, + 182D01F81DE565EC00E9B783 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ReactNativeIOSLibrary; + productName = ReactNativeIOSLibrary; + productReference = 182D01FA1DE565EC00E9B783 /* libReactNativeIOSLibrary.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 182D01F21DE565EC00E9B783 /* Project object */ = { + isa = PBXProject; + attributes = { + KnownAssetTags = ( + New, + ); + LastUpgradeCheck = 0810; + ORGANIZATIONNAME = daiqingquan; + TargetAttributes = { + 182D01F91DE565EC00E9B783 = { + CreatedOnToolsVersion = 8.1; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 182D01F51DE565EC00E9B783 /* Build configuration list for PBXProject "ReactNativeIOSLibrary" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + ); + mainGroup = 182D01F11DE565EC00E9B783; + productRefGroup = 182D01FB1DE565EC00E9B783 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 182D01F91DE565EC00E9B783 /* ReactNativeIOSLibrary */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 182D01F61DE565EC00E9B783 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 18B752C91FFF67DE00DE2629 /* ECGProfileModule.m in Sources */, + 9F3D8E1C1E0B6CDB00BA44B1 /* BG1ProfileModule.m in Sources */, + 8CCCE9E31E5E7C58007F7FE4 /* HS6ProfileModule.m in Sources */, + 1875102E1DE5E411005E66B1 /* AMProfileModule.m in Sources */, + 183FB1681FF508300040009B /* BTMProfileModule.m in Sources */, + CE6054BA25482CC90059E83A /* TS28BProfileModule.m in Sources */, + CE6054B625482CC90059E83A /* HS2SProfileModule.m in Sources */, + 1875102B1DE5E3FB005E66B1 /* BP3LModule.m in Sources */, + CE6054B925482CC90059E83A /* HS2SModule.m in Sources */, + 182D028B1DE57A2F00E9B783 /* iHealthDeviceManagerModule.m in Sources */, + CE6054B325482CC90059E83A /* BG5SProfileModule.m in Sources */, + 4565653F26E0BDE7007DA850 /* AM5Module.m in Sources */, + 4565654026E0BDE7007DA850 /* AM5ProfileModule.m in Sources */, + 8CCCE9B21E5ADF49007F7FE4 /* PO3Module.m in Sources */, + AF1B3F151DF9482100DFDB23 /* HSProfileModule.m in Sources */, + CE6054B425482CC90059E83A /* NT13BProfileModule.m in Sources */, + 187510251DE5E3CA005E66B1 /* BP7SModule.m in Sources */, + CE6054B025482CC90059E83A /* BG5SModule.m in Sources */, + 9F3D8E1B1E0B6CDB00BA44B1 /* BG1Module.m in Sources */, + 1875101F1DE5E374005E66B1 /* BPProfileModule.m in Sources */, + CE6054B125482CC90059E83A /* BP5SModule.m in Sources */, + 3F31C42B21ABE80400811B02 /* HS2Module.m in Sources */, + CE6054B725482CC90059E83A /* NT13BModule.m in Sources */, + 187510221DE5E399005E66B1 /* BP550BTModule.m in Sources */, + CE6054C025482E590059E83A /* PO1Module.m in Sources */, + CEEE2D0E2548F6E4007AC7E4 /* PT3SBTModule.m in Sources */, + 8CCCE9B31E5ADF49007F7FE4 /* POProfileModule.m in Sources */, + 9F3D8E1F1E0B6CDB00BA44B1 /* BGProfileModule.m in Sources */, + 187510341DE5E439005E66B1 /* AM3SModule.m in Sources */, + CE6054C125482E590059E83A /* PO1ProfileModule.m in Sources */, + 18B752CC1FFF67F100DE2629 /* ECGUSBModule.m in Sources */, + 183FB1691FF508300040009B /* BTMModule.m in Sources */, + 9F3D8E1E1E0B6CDB00BA44B1 /* BG5Module.m in Sources */, + CEEE2D0D2548F6E4007AC7E4 /* PT3SBTProfileModule.m in Sources */, + 18B752C41FFF61C500DE2629 /* ECGModule.m in Sources */, + CE6054B525482CC90059E83A /* TS28BModule.m in Sources */, + AF1B3F141DF9482100DFDB23 /* HS4SModule.m in Sources */, + AF1B3F3A1DFE72BD00DFDB23 /* HS6Module.m in Sources */, + 45A72D18256E5FCB00825201 /* BP7Module.m in Sources */, + CE6054B825482CC90059E83A /* BG1SProfileModule.m in Sources */, + 187510311DE5E424005E66B1 /* AM4Module.m in Sources */, + CE6054B225482CC90059E83A /* BG1SModule.m in Sources */, + 187510281DE5E3E3005E66B1 /* BP5Module.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 182D02011DE565EC00E9B783 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 182D02021DE565EC00E9B783 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 182D02041DE565EC00E9B783 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../react-native/React/**"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/ReactNativeIOSLibrary/Communication_SDK", + "$(PROJECT_DIR)/ReactNativeIOSLibrary", + ); + MODULEMAP_PRIVATE_FILE = ""; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 182D02051DE565EC00E9B783 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../react-native/React/**"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/ReactNativeIOSLibrary/Communication_SDK", + "$(PROJECT_DIR)/ReactNativeIOSLibrary", + ); + MODULEMAP_PRIVATE_FILE = ""; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 182D01F51DE565EC00E9B783 /* Build configuration list for PBXProject "ReactNativeIOSLibrary" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 182D02011DE565EC00E9B783 /* Debug */, + 182D02021DE565EC00E9B783 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 182D02031DE565EC00E9B783 /* Build configuration list for PBXNativeTarget "ReactNativeIOSLibrary" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 182D02041DE565EC00E9B783 /* Debug */, + 182D02051DE565EC00E9B783 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 182D01F21DE565EC00E9B783 /* Project object */; +} diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100755 index 0000000..fbca893 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.h new file mode 100755 index 0000000..f1f40ed --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.h @@ -0,0 +1,20 @@ +// +// AM3SModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + + +@interface AM3SModule : RCTEventEmitter + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.m new file mode 100644 index 0000000..f6fcff4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM3SModule.m @@ -0,0 +1,788 @@ +// +// AM3SModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "AM3SModule.h" +#import "AMProfileModule.h" +#import "AMMacroFile.h" +#import "AM3SController_V2.h" +#import "AM3S_V2.h" + +#define EVENT_NOTIFY @"event_notify_am3s" + +@implementation AM3SModule + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify": EVENT_NOTIFY + + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceConnectForAM3S:) name:AM3SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceDisConnectForAM3S:) name:AM3SDisConnectNoti object:nil]; + + [AM3SController_V2 shareIHAM3SController]; + + } + return self; +} + +-(AM3S_V2*)getAM3SWithMac:(NSString*)mac{ + + AM3SController_V2 *controller = [AM3SController_V2 shareIHAM3SController]; + NSArray *amDeviceArray = [controller getAllCurrentAM3SInstace]; + + for(AM3S_V2 *tempAM3S in amDeviceArray){ + if([mac isEqualToString:tempAM3S.serialNumber]){ + + return tempAM3S; + break; + } + } + + return nil; +} + +#pragma mark +#pragma mark - Notification +#pragma mark - AM3S + +-(void)DeviceConnectForAM3S:(NSNotification *)tempNoti{ + AM3SController_V2 *controller = [AM3SController_V2 shareIHAM3SController]; + NSArray *amDeviceArray = [controller getAllCurrentAM3SInstace]; + + AM3S_V2 *AMInstance = [amDeviceArray objectAtIndex:0]; +} + +-(void)DeviceDisConnectForAM3S:(NSNotification *)tempNoti{ + AM3SController_V2 *controller = [AM3SController_V2 shareIHAM3SController]; + + +} +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*am3sarray= [[AM3SController_V2 shareIHAM3SController] getAllCurrentAM3SInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[am3sarray count]; i++) { + + AM3S_V2*am3s=[am3sarray objectAtIndex:i]; + + [deviceMacArray addObject:am3s.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + +#pragma mark-恢复出厂 +RCT_EXPORT_METHOD(reset:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SResetDevice:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"reset_am",@"reset":[NSNumber numberWithInteger:resetSuc]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 得到用户ID +RCT_EXPORT_METHOD(getUserId:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SGetDeviceUserID:^(unsigned int userID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"userid_am",@"userid":[NSNumber numberWithInteger:userID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + + } +} +#pragma mark - 设置用户ID +RCT_EXPORT_METHOD(setUserId:(nonnull NSString *)mac :(nonnull NSNumber *)uesrID){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SSetUserID:uesrID withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_userid_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 同步时间 +RCT_EXPORT_METHOD(syncRealTime:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SSyncTime:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_sync_time_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM3SErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 设置用户信息 +RCT_EXPORT_METHOD(setUserInfo:(nonnull NSString *)mac :(nonnull NSNumber *)age :(nonnull NSNumber *)height :(nonnull NSNumber *)weight :(nonnull NSNumber *)gender :(nonnull NSNumber *)unit :(nonnull NSNumber *)target :(nonnull NSNumber *)activityLevel){ + + if ([self getAM3SWithMac:mac]!=nil) { + + HealthUser *myUser = [[HealthUser alloc]init]; + myUser.age = age; + myUser.sex = UserSex_Male; + myUser.height = height; + myUser.weight = weight; + myUser.activityLevel = activityLevel; + + NSDictionary *dic = [[NSMutableDictionary alloc]init]; + [[self getAM3SWithMac:mac] commandAM3SSetUserInfo:myUser withUnit:unit withActiveGoal:target withSetUserInfoFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_userinfo_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withSetBMR:^(BOOL resetSuc) { + + + } withErrorBlock:^(AM3SErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 得到用户信息 +RCT_EXPORT_METHOD(getUserInfo:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SGetUserInfo:^(NSDictionary *userInfo) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_userinfo_am",@"age":[userInfo valueForKey:@"Age"],@"step":[userInfo valueForKey:@"Step"],@"height":[userInfo valueForKey:@"Height"],@"gender":[userInfo valueForKey:@"Gender"],@"weight":[userInfo valueForKey:@"Weight"],@"unit":[userInfo valueForKey:@"Unit"],@"target1":[userInfo valueForKey:@"TotalStep1"],@"target2":[userInfo valueForKey:@"TotalStep2"],@"target3":[userInfo valueForKey:@"TotalStep3"]}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 得到闹钟个数 +RCT_EXPORT_METHOD(getAlarmClockNum:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SGetTotoalAlarmInfo:^(NSMutableArray *totoalAlarmArray) { + + NSMutableArray * IDArray = [[NSMutableArray alloc]init]; + + if (totoalAlarmArray.count > 0){ + + for (NSDictionary *dic in totoalAlarmArray) { + [IDArray addObject:[dic valueForKey:@"AlarmId"]]; + } + } + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_alarmnum_am",@"alarmclocknumber":[NSNumber numberWithInt:IDArray.count],@"alarmclocknumberid":IDArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 得到闹钟信息 +RCT_EXPORT_METHOD(getAlarmClockDetail:(nonnull NSString *)mac :(nonnull NSArray *)alarmIDS){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SGetTotoalAlarmInfo:^(NSMutableArray *totoalAlarmArray) { + + NSMutableArray * alarmInfoArray = [[NSMutableArray alloc]init]; + + if (totoalAlarmArray.count > 0){ + + for (NSDictionary *dic in totoalAlarmArray) { + + + NSMutableDictionary *alartDic = [[NSMutableDictionary alloc]init]; + + for (NSNumber * alarmID in alarmIDS) { + + NSNumber *deviceAlarmID = [dic valueForKey:@"AlarmId"]; + + if(deviceAlarmID.intValue == alarmID.intValue){ + + [alartDic setValue:[dic valueForKey:@"AlarmId"] forKey:@"alarmid"]; + + NSDate *date = [dic valueForKey:@"Time"]; + NSDateFormatter *dateFormater=[[NSDateFormatter alloc]init]; + [dateFormater setTimeZone:[NSTimeZone defaultTimeZone]]; + [dateFormater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [dateFormater setDateFormat:@"HH:mm"]; + NSString *dateString = [dateFormater stringFromDate:date]; + + [alartDic setValue:dateString forKey:@"time"]; + [alartDic setValue:[dic valueForKey:@"IsRepeat"] forKey:@"repeat"]; + + NSMutableDictionary * weekDic = [[NSMutableDictionary alloc]init]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:0] forKey:@"sun"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:1] forKey:@"mon"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:2] forKey:@"tue"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:3] forKey:@"wed"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:4] forKey:@"thu"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:5] forKey:@"fri"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:6] forKey:@"sat"]; + + [alartDic setValue:weekDic forKey:@"get_alarm_week"]; + [alartDic setValue:[dic valueForKey:@"Switch"] forKey:@"switch"]; + [alarmInfoArray addObject:alartDic]; + + } + } + } + + } + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_alarminfo_am",@"alarmclockdetail":alarmInfoArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 设置闹钟信息 +RCT_EXPORT_METHOD(setAlarmClock:(nonnull NSString *)mac :(nonnull NSNumber *)alarmID :(nonnull NSNumber *)hour :(nonnull NSNumber *)min :(nonnull NSNumber*)isRepeat :(nonnull NSArray *)weekArray :(nonnull NSNumber *)isOn){ + + if ([self getAM3SWithMac:mac]!=nil) { + + if(alarmID.integerValue < 0 || alarmID.integerValue > 3 || + hour.integerValue > 23 || hour.integerValue < 0 || + min.integerValue > 59 || min.integerValue < 0){ + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:400]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + return; + } + + NSDateFormatter *formater=[[NSDateFormatter alloc]init]; + [formater setTimeZone:[NSTimeZone defaultTimeZone]]; + [formater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [formater setDateFormat:@"HH-mm"]; + NSString * timeStr = [NSString stringWithFormat:@"%@-%@",hour,min]; + NSDate *date = [formater dateFromString:timeStr]; + + + NSDictionary *dic = [[NSDictionary alloc]initWithObjectsAndKeys:alarmID,@"AlarmId",date,@"Time",isRepeat,@"IsRepeat",weekArray,@"Week",isOn,@"Switch", nil]; + + + [[self getAM3SWithMac:mac] commandAM3SSetAlarmDictionary:dic withFinishResult:^(BOOL resetSuc) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_alarminfo_success_am"}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 删除闹钟信息 +RCT_EXPORT_METHOD(deleteAlarmClock:(nonnull NSString *)mac :(nonnull NSNumber *)alarmID){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SDeleteAlarmID:alarmID withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"delete_alarm_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 查询提醒信息 +RCT_EXPORT_METHOD(getActivityRemind:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SGetReminderInfo:^(NSArray *remindInfo) { + + NSDictionary *dic = [remindInfo objectAtIndex:0]; + + NSDate *date = [dic valueForKey:@"Time"]; + NSDateFormatter *dateFormater=[[NSDateFormatter alloc]init]; + [dateFormater setTimeZone:[NSTimeZone defaultTimeZone]]; + [dateFormater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [dateFormater setDateFormat:@"HH:mm"]; + NSString *dateString = [dateFormater stringFromDate:date]; + + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_activity_remind_am",@"time":dateString,@"switch":[dic valueForKey:@"Switch"]}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 设置提醒信息 +RCT_EXPORT_METHOD(setActivityRemind:(nonnull NSString *)mac :(nonnull NSNumber *)hour :(nonnull NSNumber *)min :(nonnull NSNumber *)isOn){ + + if ([self getAM3SWithMac:mac]!=nil) { + + if(hour.integerValue > 23 || hour.integerValue < 0 || + min.integerValue > 59 || min.integerValue < 0){ + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:400]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + return; + } + + NSDateFormatter *formater=[[NSDateFormatter alloc]init]; + [formater setTimeZone:[NSTimeZone defaultTimeZone]]; + [formater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [formater setDateFormat:@"HH-mm"]; + NSString * timeStr = [NSString stringWithFormat:@"%@-%@",hour,min]; + NSDate *date = [formater dateFromString:timeStr]; + + + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:date,@"Time",isOn,@"Switch", nil]; + + [[self getAM3SWithMac:mac] commandAM3SSetReminderDictionary:dic withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_activityremind_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 同步运动 +RCT_EXPORT_METHOD(syncActivityData:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SStartSyncActiveData:^(NSDictionary *startDataDictionary) { + + + + } withActiveHistoryData:^(NSArray *historyDataArray) { + + NSMutableArray *lastArray = [[NSMutableArray alloc]init]; + for (NSDictionary *dic in historyDataArray) { + + NSMutableDictionary * lastDic = [[NSMutableDictionary alloc]init]; + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:AMDate]]; + + [lastDic setValue:locationString forKey:@"time"]; + + [lastDic setValue:[dic valueForKey:AMStepSize] forKey:@"stepsize"]; + [lastDic setValue:[dic valueForKey:AMCalorie] forKey:@"calorie"]; + [lastDic setValue:[dic valueForKey:AMStepNum] forKey:@"step"]; + [lastDic setValue:[dic valueForKey:@"dataID"] forKey:@"dataID"]; + [lastArray addObject:lastDic]; + } + + NSDictionary *dictionary = [NSDictionary dictionaryWithObject:lastArray forKey:@"activity_each_data"]; + NSArray *array = [NSArray arrayWithObjects:dictionary, nil]; + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_activity_data_am",@"activity":array}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withActiveFinishTransmission:^{ + + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 同步睡眠 +RCT_EXPORT_METHOD(syncSleepData:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SStartSyncSleepData:^(NSDictionary *startDataDictionary) { + + + } withSleepHistoryData:^(NSArray *historyDataArray) { + + NSMutableArray *lastArray = [[NSMutableArray alloc]init]; + + + for (NSArray *array in historyDataArray) { + + for (NSDictionary *dic in array) { + + NSMutableDictionary * lastDic = [[NSMutableDictionary alloc]init]; + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:AMDate]]; + + [lastDic setValue:locationString forKey:@"time"]; [lastDic setValue:[dic valueForKey:@"SleepData"] forKey:@"level"]; + [lastDic setValue:[dic valueForKey:@"dataID"] forKey:@"dataID"]; + [lastArray addObject:lastDic]; + + } + } + + NSDictionary *dictionary = [NSDictionary dictionaryWithObject:lastArray forKey:@"sleep_each_data"]; + NSArray *array = [NSArray arrayWithObjects:dictionary, nil]; + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_sleep_data_am",@"sleep":array}; + + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + + } withSleepFinishTransmission:^{ + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 同步阶段性 +RCT_EXPORT_METHOD(syncStageReportData:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SStartSyncStageData:^(NSArray *measureDataArray) { + + NSMutableArray *lastArray = [[NSMutableArray alloc]init]; + + + NSPredicate *pre = [NSPredicate predicateWithFormat:@"ReportState == 1"]; + NSArray *workoutArray = [measureDataArray filteredArrayUsingPredicate:pre]; + if (workoutArray.count != 0) + { + for (NSDictionary *dic in workoutArray) { + + NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]init]; + [dictionary setValue:@"stage_data_type_workout" forKey:@"type"]; + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:Work_outMeasureDate]]; + + + + [dictionary setValue:locationString forKey:@"stoptime"]; + [dictionary setValue:[dic valueForKey:Work_outTimeNumber] forKey:@"usedtime"]; + [dictionary setValue:[dic valueForKey:Work_outStepNumber] forKey:@"stage_data_workout_step"]; + [dictionary setValue:[dic valueForKey:Work_outLengthNumber] forKey:@"stage_data_distance"]; + [dictionary setValue:[dic valueForKey:Work_outCalories] forKey:@"calorie"]; + [dictionary setValue:[dic valueForKey:@"dataID"] forKey:@"dataID"]; + [lastArray addObject:dictionary]; + } + } + + NSPredicate *predicateSleep = [NSPredicate predicateWithFormat:@"ReportState == 2"]; + NSArray *sleepArray = [measureDataArray filteredArrayUsingPredicate:predicateSleep]; + if (sleepArray.count != 0) + { + for (NSDictionary *dic in sleepArray) { + + + + + NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]init]; + [dictionary setValue:@"sleep" forKey:@"type"]; + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:Sleep_summaryMeasureDate]]; + + + [dictionary setValue:locationString forKey:@"stoptime"]; + [dictionary setValue:[dic valueForKey:Sleep_summarySleepTime] forKey:@"usedtime"]; + [dictionary setValue:[dic valueForKey:Sleep_summarysleepEfficiency] forKey:@"sleepefficiency"]; + [dictionary setValue:[dic valueForKey:Sleep_summarysleepAddMinute] forKey:@"is50min"]; + [lastArray addObject:dictionary]; + } + + } + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_stage_data_am",@"stage_data":lastArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + + } withStageDataFinishTransmission:^(BOOL resetSuc) { + + + + + } withErrorBlock:^(AM3SErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 同步阶实时数据 +RCT_EXPORT_METHOD(syncRealData:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SStartSyncCurrentActiveData:^(NSDictionary *activeDictionary) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_real_data_am",@"step":[activeDictionary valueForKey:@"Step"],@"calorie":[activeDictionary valueForKey:@"Calories"],@"totalcalories":[activeDictionary valueForKey:@"TotalCalories"]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 查询状态 +RCT_EXPORT_METHOD(queryAMState:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + __block NSInteger index; + + [[self getAM3SWithMac:mac] commandAM3SGetDeviceStateInfo:^(AM3SQueryState queryState) { + + index = queryState; + + } withBattery:^(NSNumber *battery) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"query_state_am",@"query_state":[NSNumber numberWithInteger:index],@"battery":battery}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 设置BMR +RCT_EXPORT_METHOD(setUserBmr:(nonnull NSString *)mac :(nonnull NSNumber *)bmr){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SSetBMR:bmr withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_bmr_success_am"}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 随机数 +RCT_EXPORT_METHOD(sendRandom:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SSetRandomNumber:^(NSString *randomNumString) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_random_am",@"random":randomNumString}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 断开 +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SDisconnect:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + + + + +#pragma mark-设置小时制 +RCT_EXPORT_METHOD(setHourMode:(nonnull NSString *)mac :(nonnull NSNumber*)hourMode){ + + if ([self getAM3SWithMac:mac]!=nil) { + + AM3STimeFormatAndNation formatAndNation; + formatAndNation = hourMode.intValue; + + [[self getAM3SWithMac:mac]commandAM3SSetTimeFormatAndNation:hourMode.intValue withFinishResult:^(BOOL resetSuc) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_hour_mode_success_am"}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark-得到小时制 +RCT_EXPORT_METHOD(getHourMode:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SGetTimeFormatAndNation:^(AM3STimeFormatAndNation timeFormatAndNation) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_hour_mode_am",@"hourtype":[NSNumber numberWithInt:timeFormatAndNation]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-设置图片 +RCT_EXPORT_METHOD(setPicture:(nonnull NSString *)mac :(nonnull NSNumber *)index){ + + if ([self getAM3SWithMac:mac]!=nil) { + + + if((index.intValue !=0) && (index.intValue !=1)){ + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:400]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + return; + } + + + AM3SPicture piction; + piction = index.intValue; + + [[self getAM3SWithMac:mac] commandAM3SSetPicture:piction withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_picture_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-得到图片 +RCT_EXPORT_METHOD(getPicture:(nonnull NSString *)mac){ + + if ([self getAM3SWithMac:mac]!=nil) { + + [[self getAM3SWithMac:mac] commandAM3SGetPicture:^(AM3SPicture picture) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_picture_am",@"get_picture_am":[NSNumber numberWithInt:picture]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM3SErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.h new file mode 100755 index 0000000..3057818 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.h @@ -0,0 +1,19 @@ +// +// AM4Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface AM4Module : RCTEventEmitter + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.m new file mode 100644 index 0000000..6bb6e96 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM4Module.m @@ -0,0 +1,854 @@ +// +// AM4Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "AM4Module.h" +#import "AMProfileModule.h" +#import "AMMacroFile.h" +#import "AM4Controller.h" +#import "AM4.h" + +#define EVENT_NOTIFY @"event_notify_am4" + +@implementation AM4Module + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify": EVENT_NOTIFY + + }; + + +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceConnectForAM4:) name:AM4ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceDisConnectForAM4:) name:AM4DisConnectNoti object:nil]; + + [AM4Controller shareIHAM4Controller]; + + } + return self; +} + +-(AM4*)getAM4WithMac:(NSString*)mac{ + + AM4Controller *controller = [AM4Controller shareIHAM4Controller]; + NSArray *amDeviceArray = [controller getAllCurrentAM4Instace]; + + for(AM4 *tempAM4 in amDeviceArray){ + if([mac isEqualToString:tempAM4.serialNumber]){ + + return tempAM4; + break; + } + } + + return nil; +} + +#pragma mark +#pragma mark - Notification +#pragma mark - AM4 + +-(void)DeviceConnectForAM4:(NSNotification *)tempNoti{ + AM4Controller *controller = [AM4Controller shareIHAM4Controller]; + NSArray *amDeviceArray = [controller getAllCurrentAM4Instace]; + + AM4 *AMInstance = [amDeviceArray objectAtIndex:0]; + +} + +-(void)DeviceDisConnectForAM4:(NSNotification *)tempNoti{ + AM4Controller *controller = [AM4Controller shareIHAM4Controller]; + + +} + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*am4array= [[AM4Controller shareIHAM4Controller] getAllCurrentAM4Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[am4array count]; i++) { + + AM4*am4=[am4array objectAtIndex:i]; + + [deviceMacArray addObject:am4.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + +#pragma mark - 恢复出厂 +RCT_EXPORT_METHOD(reset:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4ResetDevice:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"reset_am",@"reset":[NSNumber numberWithInteger:resetSuc]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-得到用户ID +RCT_EXPORT_METHOD(getUserId:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4GetDeviceUserID:^(unsigned int userID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"userid_am",@"userid":[NSNumber numberWithInteger:userID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + + } +} + +#pragma mark-设置用户ID +RCT_EXPORT_METHOD(setUserId:(nonnull NSString *)mac :(nonnull NSNumber *)uesrID){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4SetUserID:uesrID withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_userid_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-同步时间 +RCT_EXPORT_METHOD(syncRealTime:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4SyncTime:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_sync_time_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-设置用户信息 +RCT_EXPORT_METHOD(setUserInfo:(nonnull NSString *)mac :(nonnull NSNumber *)age :(nonnull NSNumber *)height :(nonnull NSNumber *)weight :(nonnull NSNumber *)gender :(nonnull NSNumber *)unit :(nonnull NSNumber *)target :(nonnull NSNumber *)activityLevel :(nonnull NSNumber *)min){ + + if ([self getAM4WithMac:mac]!=nil) { + + HealthUser *myUser = [[HealthUser alloc]init]; + myUser.age = age; + myUser.sex = UserSex_Male; + myUser.height = height; + myUser.weight = weight; + myUser.activityLevel = activityLevel; + + NSDictionary *dic = [[NSMutableDictionary alloc]init]; + [[self getAM4WithMac:mac] commandAM4SetUserInfo:myUser withUnit:unit withActiveGoal:target withSwimmingGoal:min withSetUserInfoFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_userinfo_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withSetBMR:^(BOOL resetSuc) { + + + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark-得到用户信息 +RCT_EXPORT_METHOD(getUserInfo:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4GetUserInfo:^(NSDictionary *userInfo) { + + NSNumber *swimGoal = [userInfo valueForKey:@"SwimmingGoal"]; + if (swimGoal != nil || swimGoal == 0){ + swimGoal = @0; + } + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_userinfo_am",@"age":[userInfo valueForKey:@"Age"],@"step":[userInfo valueForKey:@"Step"],@"height":[userInfo valueForKey:@"Height"],@"gender":[userInfo valueForKey:@"Gender"],@"weight":[userInfo valueForKey:@"Weight"],@"unit":[userInfo valueForKey:@"Unit"],@"target1":[userInfo valueForKey:@"TotalStep1"],@"target2":[userInfo valueForKey:@"TotalStep2"],@"target3":[userInfo valueForKey:@"TotalStep3"],@"swim_target":swimGoal}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-得到闹钟数量 +RCT_EXPORT_METHOD(getAlarmClockNum:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4GetTotoalAlarmInfo:^(NSMutableArray *totoalAlarmArray) { + + NSMutableArray * IDArray = [[NSMutableArray alloc]init]; + + if (totoalAlarmArray.count > 0){ + + for (NSDictionary *dic in totoalAlarmArray) { + [IDArray addObject:[dic valueForKey:@"AlarmId"]]; + } + } + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_alarmnum_am",@"alarmclocknumber":[NSNumber numberWithInt:IDArray.count],@"alarmclocknumberid":IDArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-查闹钟信息 +RCT_EXPORT_METHOD(getAlarmClockDetail:(nonnull NSString *)mac :(nonnull NSArray *)alarmIDS){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4GetTotoalAlarmInfo:^(NSMutableArray *totoalAlarmArray) { + + NSMutableArray * alarmInfoArray = [[NSMutableArray alloc]init]; + + if (totoalAlarmArray.count > 0){ + + for (NSDictionary *dic in totoalAlarmArray) { + + + NSMutableDictionary *alartDic = [[NSMutableDictionary alloc]init]; + + for (NSNumber * alarmID in alarmIDS) { + + NSNumber *deviceAlarmID = [dic valueForKey:@"AlarmId"]; + + if(deviceAlarmID.intValue == alarmID.intValue){ + + [alartDic setValue:[dic valueForKey:@"AlarmId"] forKey:@"alarmid"]; + + NSDate *date = [dic valueForKey:@"Time"]; + NSDateFormatter *dateFormater=[[NSDateFormatter alloc]init]; + [dateFormater setTimeZone:[NSTimeZone defaultTimeZone]]; + [dateFormater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [dateFormater setDateFormat:@"HH:mm"]; + NSString *dateString = [dateFormater stringFromDate:date]; + + [alartDic setValue:dateString forKey:@"time"]; + [alartDic setValue:[dic valueForKey:@"IsRepeat"] forKey:@"repeat"]; + + NSMutableDictionary * weekDic = [[NSMutableDictionary alloc]init]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:0] forKey:@"sun"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:1] forKey:@"mon"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:2] forKey:@"tue"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:3] forKey:@"wed"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:4] forKey:@"thu"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:5] forKey:@"fri"]; + [weekDic setValue:[[dic valueForKey:@"Week"] objectAtIndex:6] forKey:@"sat"]; + + [alartDic setValue:weekDic forKey:@"get_alarm_week"]; + [alartDic setValue:[dic valueForKey:@"Switch"] forKey:@"switch"]; + [alarmInfoArray addObject:alartDic]; + + } + } + } + + } + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_alarminfo_am",@"alarmclockdetail":alarmInfoArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-设置闹钟 +RCT_EXPORT_METHOD(setAlarmClock:(nonnull NSString *)mac :(nonnull NSNumber *)alarmID :(nonnull NSNumber *)hour :(nonnull NSNumber *)min :(nonnull NSNumber*)isRepeat :(nonnull NSArray *)weekArray :(nonnull NSNumber *)isOn){ + + if ([self getAM4WithMac:mac]!=nil) { + + if(alarmID.integerValue < 0 || alarmID.integerValue > 3 || + hour.integerValue > 23 || hour.integerValue < 0 || + min.integerValue > 59 || min.integerValue < 0){ + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:400]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + return; + } + + NSDateFormatter *formater=[[NSDateFormatter alloc]init]; + [formater setTimeZone:[NSTimeZone defaultTimeZone]]; + [formater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [formater setDateFormat:@"HH-mm"]; + NSString * timeStr = [NSString stringWithFormat:@"%@-%@",hour,min]; + NSDate *date = [formater dateFromString:timeStr]; + + + NSDictionary *dic = [[NSDictionary alloc]initWithObjectsAndKeys:alarmID,@"AlarmId",date,@"Time",isRepeat,@"IsRepeat",weekArray,@"Week",isOn,@"Switch", nil]; + + [[self getAM4WithMac:mac] commandAM4SetAlarmDictionary:dic withFinishResult:^(BOOL resetSuc) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_alarminfo_success_am"}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-删除闹钟 +RCT_EXPORT_METHOD(deleteAlarmClock:(nonnull NSString *)mac :(nonnull NSNumber *)alarmID){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4DeleteAlarmID:alarmID withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"delete_alarm_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-得闹钟信息 +RCT_EXPORT_METHOD(getActivityRemind:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4GetReminderInfo:^(NSArray *remindInfo) { + + NSDictionary *dic = [remindInfo objectAtIndex:0]; + + NSDate *date = [dic valueForKey:@"Time"]; + NSDateFormatter *dateFormater=[[NSDateFormatter alloc]init]; + [dateFormater setTimeZone:[NSTimeZone defaultTimeZone]]; + [dateFormater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [dateFormater setDateFormat:@"HH:mm"]; + NSString *dateString = [dateFormater stringFromDate:date]; + + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_activity_remind_am",@"time":dateString,@"switch":[dic valueForKey:@"Switch"]}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-设置提醒 +RCT_EXPORT_METHOD(setActivityRemind:(nonnull NSString *)mac :(nonnull NSNumber *)hour :(nonnull NSNumber *)min :(nonnull NSNumber *)isOn){ + + if ([self getAM4WithMac:mac]!=nil) { + + + + if(hour.integerValue > 23 || hour.integerValue < 0 || + min.integerValue > 59 || min.integerValue < 0){ + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:400]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + return; + } + + + + NSDateFormatter *formater=[[NSDateFormatter alloc]init]; + [formater setTimeZone:[NSTimeZone defaultTimeZone]]; + [formater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [formater setDateFormat:@"HH-mm"]; + NSString * timeStr = [NSString stringWithFormat:@"%@-%@",hour,min]; + NSDate *date = [formater dateFromString:timeStr]; + + + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:date,@"Time",isOn,@"Switch", nil]; + + [[self getAM4WithMac:mac] commandAM4SetReminderDictionary:dic withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_activityremind_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark - 运动数据 +RCT_EXPORT_METHOD(syncActivityData:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4StartSyncActiveData:^(NSDictionary *startDataDictionary) { + + + + } withActiveHistoryData:^(NSArray *historyDataArray) { + + NSMutableArray *lastArray = [[NSMutableArray alloc]init]; + for (NSDictionary *dic in historyDataArray) { + + NSMutableDictionary * lastDic = [[NSMutableDictionary alloc]init]; + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:AMDate]]; + + [lastDic setValue:locationString forKey:@"time"]; + [lastDic setValue:[dic valueForKey:AMStepSize] forKey:@"stepsize"]; + [lastDic setValue:[dic valueForKey:AMCalorie] forKey:@"calorie"]; + [lastDic setValue:[dic valueForKey:AMStepNum] forKey:@"step"]; + [lastDic setValue:[dic valueForKey:@"dataID"] forKey:@"dataID"]; + [lastArray addObject:lastDic]; + } + + NSDictionary *dictionary = [NSDictionary dictionaryWithObject:lastArray forKey:@"activity_each_data"]; + NSArray *array = [NSArray arrayWithObjects:dictionary, nil]; + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_activity_data_am",@"activity":array}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withActiveFinishTransmission:^{ + + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} +#pragma mark - 睡眠数据 +RCT_EXPORT_METHOD(syncSleepData:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4StartSyncSleepData:^(NSDictionary *startDataDictionary) { + + + } withSleepHistoryData:^(NSArray *historyDataArray) { + + NSMutableArray *lastArray = [[NSMutableArray alloc]init]; + + + for (NSArray *array in historyDataArray) { + + for (NSDictionary *dic in array) { + + NSMutableDictionary * lastDic = [[NSMutableDictionary alloc]init]; + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:AMDate]]; + + [lastDic setValue:locationString forKey:@"time"]; + + + [lastDic setValue:[dic valueForKey:@"SleepData"] forKey:@"level"]; + [lastDic setValue:[dic valueForKey:@"dataID"] forKey:@"dataID"]; + [lastArray addObject:lastDic]; + + } + } + + NSDictionary *dictionary = [NSDictionary dictionaryWithObject:lastArray forKey:@"sleep_each_data"]; + NSArray *array = [NSArray arrayWithObjects:dictionary, nil]; + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_sleep_data_am",@"sleep":array}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + + } withSleepFinishTransmission:^{ + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-阶段性数据 +RCT_EXPORT_METHOD(syncStageReportData:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4StartSyncStageData:^(NSArray *measureDataArray) { + + NSMutableArray *lastArray = [[NSMutableArray alloc]init]; + + + NSPredicate *pre = [NSPredicate predicateWithFormat:@"ReportState == 1"]; + NSArray *workoutArray = [measureDataArray filteredArrayUsingPredicate:pre]; + if (workoutArray.count != 0) + { + for (NSDictionary *dic in workoutArray) { + + NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]init]; + [dictionary setValue:@"stage_data_type_workout" forKey:@"type"]; + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:Work_outMeasureDate]]; + + + + + [dictionary setValue:locationString forKey:@"stoptime"]; + [dictionary setValue:[dic valueForKey:Work_outTimeNumber] forKey:@"usedtime"]; + [dictionary setValue:[dic valueForKey:Work_outStepNumber] forKey:@"stage_data_workout_step"]; + [dictionary setValue:[dic valueForKey:Work_outLengthNumber] forKey:@"stage_data_distance"]; + [dictionary setValue:[dic valueForKey:Work_outCalories] forKey:@"calorie"]; + [dictionary setValue:[dic valueForKey:@"dataID"] forKey:@"dataID"]; + [lastArray addObject:dictionary]; + } + } + + NSPredicate *predicateSwim = [NSPredicate predicateWithFormat:@"ReportState == 0"]; + NSArray *swimArray = [measureDataArray filteredArrayUsingPredicate:predicateSwim]; + if (swimArray.count != 0) + { + for (NSDictionary *dic in swimArray) { + + NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]init]; + [dictionary setValue:@"swim" forKey:@"type"]; + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:AM4SwimmingMeasureDate]]; + + + [dictionary setValue:locationString forKey:@"stoptime"]; + [dictionary setValue:[dic valueForKey:AM4SwimmingTimeNumber] forKey:@"usedtime"]; + [dictionary setValue:[dic valueForKey:AM4SwimmingTimes] forKey:@"number of strokes"]; + [dictionary setValue:[dic valueForKey:AM4Swimmingcalories] forKey:@"calorie"]; + [dictionary setValue:[dic valueForKey:AM4SwimmingAct] forKey:@"swimming stroke"]; + [dictionary setValue:[dic valueForKey:AM4SwimmingCircleCount] forKey:@"number of turns"]; + [dictionary setValue:[dic valueForKey:AM4SwimmingPoollength] forKey:@"stage_data_swimpool_length"]; + [dictionary setValue:[dic valueForKey:AM4EnterSwimmingTime] forKey:@"stage_data_cutindif"]; + [dictionary setValue:[dic valueForKey:AM4OutSwimmingTime] forKey:@"stage_data_cutoutdif"]; + [dictionary setValue:[dic valueForKey:AM4SwimmingProcessMark] forKey:@"stage_data_processflag"]; + [dictionary setValue:[dic valueForKey:@"dataID"] forKey:@"dataID"]; + + [lastArray addObject:dictionary]; + } + + } + + NSPredicate *predicateSleep = [NSPredicate predicateWithFormat:@"ReportState == 2"]; + NSArray *sleepArray = [measureDataArray filteredArrayUsingPredicate:predicateSleep]; + if (sleepArray.count != 0) + { + for (NSDictionary *dic in sleepArray) { + + NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]init]; + [dictionary setValue:@"sleep" forKey:@"type"]; + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[dic valueForKey:Sleep_summaryMeasureDate]]; + + + [dictionary setValue:locationString forKey:@"stoptime"]; + [dictionary setValue:[dic valueForKey:Sleep_summarySleepTime] forKey:@"usedtime"]; + [dictionary setValue:[dic valueForKey:Sleep_summarysleepEfficiency] forKey:@"sleepefficiency"]; + [dictionary setValue:[dic valueForKey:Sleep_summarysleepAddMinute] forKey:@"is50min"]; + [lastArray addObject:dictionary]; + } + + } + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_stage_data_am",@"stage_data":lastArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + + } withStageDataFinishTransmission:^(BOOL resetSuc) { + + + + + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark - 实时数据 +RCT_EXPORT_METHOD(syncRealData:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4StartSyncCurrentActiveData:^(NSDictionary *activeDictionary) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"sync_real_data_am",@"step":[activeDictionary valueForKey:@"Step"],@"calorie":[activeDictionary valueForKey:@"Calories"],@"totalcalories":[activeDictionary valueForKey:@"TotalCalories"]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark - 查询状态 +RCT_EXPORT_METHOD(queryAMState:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + __block NSInteger index; + + [[self getAM4WithMac:mac] commandAM4GetDeviceStateInfo:^(AM4QueryState queryState) { + + index = queryState; + + } withBattery:^(NSNumber *battery) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"query_state_am",@"query_state":[NSNumber numberWithInteger:index],@"battery":battery}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark - 设置BMR +RCT_EXPORT_METHOD(setUserBmr:(nonnull NSString *)mac :(nonnull NSNumber *)bmr){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4SetBMR:bmr withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_bmr_success_am"}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-发随机数 +RCT_EXPORT_METHOD(sendRandom:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4SetRandomNumber:^(NSString *randomNumString) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_random_am",@"random":randomNumString}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-断开 +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4Disconnect:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-设置游泳 +RCT_EXPORT_METHOD(setSwimPara:(nonnull NSString *)mac :(nonnull BOOL *)isOpen :(nonnull NSNumber *)poolLength :(nonnull NSNumber *)hours :(nonnull NSNumber *)minutes :(nonnull NSNumber *)unit ){ + + if ([self getAM4WithMac:mac]!=nil) { + + NSDateFormatter *formater=[[NSDateFormatter alloc]init]; + [formater setTimeZone:[NSTimeZone defaultTimeZone]]; + [formater setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; + [formater setDateFormat:@"HH-mm"]; + NSString * timeStr = [NSString stringWithFormat:@"%@-%@",hours,minutes]; + NSDate *date = [formater dateFromString:timeStr]; + + + [[self getAM4WithMac:mac] commandAM4SetSwimmingState:isOpen withSwimmingPoolLength:poolLength withNOSwimmingTime:date withUnit:unit.integerValue withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_swiminfo_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }]; + } +} + +#pragma mark-获取游泳信息 +RCT_EXPORT_METHOD(checkSwimPara:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4GetSwimmingInfo:^(BOOL swimmingIsOpen, NSNumber *swimmingLaneLength, NSNumber *NOSwimmingTime, AM4SwimmingUnit unit) { + + int hour = NOSwimmingTime.intValue / 60; + int min = NOSwimmingTime.intValue % 60; + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_swiminfo_am",@"get_swimlane_length":swimmingLaneLength,@"get_swim_unit_am":[NSNumber numberWithInt:unit],@"get_swim_switch_am":@"swimmingIsOpen",@"get_swim_cutout_hour_am":[NSNumber numberWithInt:hour],@"get_swim_cutout_min_am":[NSNumber numberWithInt:min]}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + +#pragma mark-设置时间制 +RCT_EXPORT_METHOD(setHourMode:(nonnull NSString *)mac :(nonnull NSNumber *)hourMode){ + + if ([self getAM4WithMac:mac]!=nil) { + + AM4TimeFormatAndNation formatAndNation; + formatAndNation = hourMode.intValue; + + [[self getAM4WithMac:mac] commandAM4SetTimeFormatAndNation:formatAndNation withFinishResult:^(BOOL resetSuc) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"set_hour_mode_success_am"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(AM4ErrorID errorID) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + + } +} + +#pragma mark-得到时间制 +RCT_EXPORT_METHOD(getHourMode:(nonnull NSString *)mac){ + + if ([self getAM4WithMac:mac]!=nil) { + + [[self getAM4WithMac:mac] commandAM4GetTimeFormatAndNation:^(AM4TimeFormatAndNation timeFormatAndNation) { + + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"get_hour_mode_am",@"hourtype":[NSNumber numberWithInt:timeFormatAndNation]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } withErrorBlock:^(AM4ErrorID errorID) { + NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"error_am",@"error":[NSNumber numberWithInteger:errorID]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + } +} + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.h new file mode 100755 index 0000000..c9b327b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.h @@ -0,0 +1,19 @@ +// +// AM5Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface AM5Module : RCTEventEmitter + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m new file mode 100644 index 0000000..24751a1 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m @@ -0,0 +1,542 @@ +// +// AM5Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "AM5Module.h" +#import "AM5.h" +#import "AM5Controller.h" +#import "AM5ProfileModule.h" +#import "AM5Header.h" +@implementation AM5Module{ + + + NSMutableDictionary*resultDic; + +} + +#define EVENT_NOTIFY @"event_notify_am5" +#define kMAC_KEY @"mac" +#define kACTION_KEY @"action" + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +#pragma mark +#pragma mark - constantsToExport +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": EVENT_NOTIFY }; + +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +-(void)dealloc{ + [[NSNotificationCenter defaultCenter]removeObserver:self]; +} + +-(AM5*)getAM5WithMac:(NSString*)mac{ + + AM5Controller *controller = [AM5Controller shareAM5Controller]; + NSArray *poDeviceArray = [controller getAllCurrentAM5Instace]; + + for(AM5 *tempAM5 in poDeviceArray){ + if([mac isEqualToString:tempAM5.serialNumber]){ + + return tempAM5; + break; + } + } + + return nil; +} + +#pragma mark +#pragma mark - Method + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*AM5array= [[AM5Controller shareAM5Controller] getAllCurrentAM5Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[AM5array count]; i++) { + + AM5*am5=[AM5array objectAtIndex:i]; + + [deviceMacArray addObject:am5.serialNumber]; + + } + + NSDictionary* deviceInfo = @{kACTION_KEY:kACTION_GET_ALL_CONNECTED_DEVICES,@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + +#pragma mark 绑定 +RCT_EXPORT_METHOD(bindDevice:(nonnull NSString *)mac){ + + + if ([self getAM5WithMac:mac]) { + __weak typeof(self) weakSelf = self; + + + [[self getAM5WithMac:mac] commandBindingDevice:^(BOOL result) { + + NSLog(@"BindingDevice:%d",result); + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_USER_BIND, + OPERATION_STATUS:@3, + TYPE:@"AM5", + ERROR_DESCRIPTION:@"no error" + }]; + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + +} + +} +#pragma mark 解除绑定 +RCT_EXPORT_METHOD(unBindDevice:(nonnull NSString *)mac){ + + + if ([self getAM5WithMac:mac]) { + __weak typeof(self) weakSelf = self; + + + [[self getAM5WithMac:mac] commandUnBindingDevice:^(BOOL result) { + + NSLog(@"BindingDevice:%d",result); + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_USER_UNBIND, + OPERATION_STATUS:@3, + TYPE:@"AM5", + ERROR_DESCRIPTION:@"no error" + }]; + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + +} + +} + +#pragma mark 获取设备信息 +RCT_EXPORT_METHOD(getBasicInfo:(nonnull NSString *)mac){ +//Mode:Device mode BatteryStatus:Battery status BatteryLevel:Battery level RebootFlag:Whether to restart BindTimeStr:Binding timestamp BindState:Binding status + + if ([self getAM5WithMac:mac]) { + __weak typeof(self) weakSelf = self; + + + [[self getAM5WithMac:mac] commandGetDeviceInfo:^(NSMutableDictionary *DeviceInfo) { + + NSLog(@"DeviceINfo:%@",DeviceInfo); + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_BASIC_INFO, + TYPE:@"AM5", + BASIC_BATTSTATUS:[DeviceInfo valueForKey:@"BatteryStatus"], + BASIC_DEIVCEID:@"7041", + BASIC_ENERGE:[DeviceInfo valueForKey:@"BatteryLevel"], + BASIC_FIRMWAREVERSION:@"40", + BASIC_MODE:[DeviceInfo valueForKey:@"Mode"], + BASIC_PAIRFLAG:[DeviceInfo valueForKey:@"BindState"], + BASIC_REBOOT:[DeviceInfo valueForKey:@"RebootFlag"], + + }]; + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + + + }]; + + +} + +} + +#pragma mark 设置时间 +RCT_EXPORT_METHOD(setTime:(nonnull NSString *)mac){ + + + if ([self getAM5WithMac:mac]) { + __weak typeof(self) weakSelf = self; + + + [[self getAM5WithMac:mac] commandSetCurrentTime:^(BOOL result) { + if (result==YES) { + NSLog(@"SetCurrentTimeSucess"); + }else{ + + NSLog(@"SetCurrentTimeFaild"); + } + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_TIME, + TYPE:@"AM5", + RESULT:@1 + }]; + + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + +} + +} +#pragma mark 设置用户信息 +RCT_EXPORT_METHOD(setUserInfo:(nonnull NSString *)mac :(nonnull NSNumber *)year:(nonnull NSNumber *)month:(nonnull NSNumber *)day:(nonnull NSNumber *)weight:(nonnull NSNumber *)height :(nonnull NSNumber *)gender){ + + if ([self getAM5WithMac:mac]) { + + __weak typeof(self) weakSelf = self; + + IDOSetUserInfoBuletoothModel * userModel= [IDOSetUserInfoBuletoothModel currentModel]; + + userModel.year=[year integerValue]; + + userModel.month=[month integerValue]; + + userModel.day=[day integerValue]; + + userModel.weight=[weight integerValue]; + + userModel.height=[height integerValue]; + + userModel.gender=[gender integerValue]; + + + [[self getAM5WithMac:mac] commandSetUserInfo:userModel setResult:^(BOOL result) { + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_USER_INFO, + TYPE:@"AM5", + RESULT:@1 + }]; + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + + } +} + +#pragma mark 设置单位 +RCT_EXPORT_METHOD(setUnit:(nonnull NSString *)mac :(nonnull NSNumber *)type :(nonnull NSNumber *)unit){ + + if ([self getAM5WithMac:mac]) { + + __weak typeof(self) weakSelf = self; + + IDOSetUnitInfoBluetoothModel * unitInfo = [IDOSetUnitInfoBluetoothModel currentModel]; + + if ([type intValue]==0) { + unitInfo.distanceUnit =[unit integerValue]; + }else if ([type intValue]==1) { + unitInfo.weightUnit =[unit integerValue]; + }else { + unitInfo.tempUnit =[unit integerValue]; + } + + [[self getAM5WithMac:mac] commandSetUnit:unitInfo setResult:^(BOOL result) { + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_UNIT, + TYPE:@"AM5", + RESULT:@1 + }]; + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + } +} + +#pragma mark Hand Wear Mode +RCT_EXPORT_METHOD(setHandWearMode:(nonnull NSString *)mac :(nonnull NSNumber *)model){ + + if ([self getAM5WithMac:mac]) { + + __weak typeof(self) weakSelf = self; + + IDOSetLeftOrRightInfoBuletoothModel * leftOrRightModel = [IDOSetLeftOrRightInfoBuletoothModel currentModel]; + + if ([model intValue]==1) { + leftOrRightModel.isRight=YES; + }else{ + + leftOrRightModel.isRight=NO; + } + + + + [[self getAM5WithMac:mac] commandSetLeftRightHand:leftOrRightModel setResult:^(BOOL result) { + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_HAND_WEAR_MODE, + TYPE:@"AM5", + RESULT:@1 + }]; + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + } +} + +#pragma mark 获取live数据 +RCT_EXPORT_METHOD(getLiveData:(nonnull NSString *)mac){ + +//Step:Step count Calorie:Calorie Distances:distance ActiveTime:Duration of activity HeartRate:Heart rate + if ([self getAM5WithMac:mac]) { + + __weak typeof(self) weakSelf = self; + + [[self getAM5WithMac:mac] commandGetLiveData:^(NSMutableDictionary *liveDataDic) { + + NSLog(@"liveDataDic:%@",liveDataDic); + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_LIVE_DATA, + TYPE:@"AM5", + LIVE_DATA_HEARTRATE:[liveDataDic valueForKey:@"HeartRate"], + LIVE_DATA_STEP:[liveDataDic valueForKey:@"Step"], + LIVE_DATA_CALORIE:[liveDataDic valueForKey:@"Calorie"], + LIVE_DATA_DISTANCES:[liveDataDic valueForKey:@"Distances"], + LIVE_DATA_ACTIVETIME:[liveDataDic valueForKey:@"ActiveTime"], + }]; + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + } +} + +#pragma mark Sync health data from device + +//syncActivityDataDic +//{ +// head = { +// day = 3; +// "items_count" = 96; +// "key_word" = 0; +// length = 16; +// "minute_offset" = 0; +// month = 9; +// "packets_count" = 34; +// "per_minute" = 15; +// reserved = 0; +// serial = 1; +// "total_active_time" = 0; +// "total_cal" = 0; +// "total_distances" = 0; +// "total_step" = 0; +// year = 2021; +// }; +// items = ( +// { +// "active_time" = 0; +// calories = 0; +// distance = 0; +// mode = 0; +// "sport_count" = 0; +// }, +// { +// "active_time" = 0; +// calories = 0; +// distance = 0; +// mode = 0; +// "sport_count" = 0; +// }, +// { +// "active_time" = 0; +// calories = 0; +// distance = 0; +// mode = 0; +// "sport_count" = 0; +// }, +// +// ); +// type = "sport_step"; +//} +// +//syncHeartRateDataDic:{ +// head = { +// "aerobic_mins" = 0; +// "aerobic_threshold" = 154; +// "anaerobic_mins" = 0; +// "anaerobic_threshold" = 0; +// "burn_fat_mins" = 0; +// "burn_fat_threshold" = 132; +// day = 3; +// "items_count" = 0; +// length = 16; +// "limit_mins" = 0; +// "limit_threshold" = 198; +// "minute_offset" = 0; +// month = 9; +// "packets_count" = 2; +// serial = 1; +// "silent_heart_rate" = 62; +// "user_max_hr" = 0; +// "warm_up_mins" = 0; +// "warm_up_threshold" = 0; +// year = 2021; +// }; +// items = ( +// ); +// "offset_type" = minute; +// type = "heart_rate"; +//} +// +//syncSleepDataDic:{ +// head = { +// day = 0; +// "deep_sleep_count" = 0; +// "deep_sleep_minute" = 0; +// "end_time_hour" = 0; +// "end_time_minute" = 0; +// "items_count" = 0; +// length = 16; +// "light_sleep_count" = 0; +// "ligth_sleep_minute" = 0; +// month = 0; +// "packet_count" = 2; +// serial = 1; +// "sleep_item_count" = 0; +// "sleep_score" = 0; +// "total_minute" = 0; +// "wake_count" = 0; +// year = 0; +// }; +// items = ( +// ); +// type = sleep; +//} + +RCT_EXPORT_METHOD(syncHealthData:(nonnull NSString *)mac){ + + if ([self getAM5WithMac:mac]) { + + __weak typeof(self) weakSelf = self; + + [[self getAM5WithMac:mac] commandSyncData:^(NSDictionary *syncDataDic) { + + NSLog(@"syncHeartRateDataDic:%@",syncDataDic); + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SYNC_HEALTH_DATA_HEART_RATE, + TYPE:@"AM5", + DATA:syncDataDic, + }]; + + } syncSleepData:^(NSDictionary *syncDataDic) { + + NSLog(@"syncSleepDataDic:%@",syncDataDic); + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SYNC_HEALTH_DATA_SLEEP, + TYPE:@"AM5", + DATA:syncDataDic, + }]; + + } syncActivityData:^(NSDictionary *syncDataDic) { + + NSLog(@"syncActivityDataDic:%@",syncDataDic); + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SYNC_HEALTH_DATA_SPORT, + TYPE:@"AM5", + DATA:syncDataDic, + }]; + + } syncDataProgress:^(NSNumber *syncDataProgress) { + + NSLog(@"syncDataProgress:%@",syncDataProgress); + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SYNC_HEALTH_DATA, + TYPE:@"AM5", + PROGRESS:syncDataProgress, + OPERATION_STATUS:@3, + }]; + + } syncDataSuccess:^{ + + NSLog(@"syncDataSuccess"); + + } DiaposeErrorBlock:^(AM5DeviceError errorID) { + + }]; + + } +} + + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + + if ([self getAM5WithMac:mac]!=nil) { + + [[self getAM5WithMac:mac] commandAM5Disconnect]; + + }else{ + + + + } + + + +} + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.h new file mode 100755 index 0000000..bdbb511 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.h @@ -0,0 +1,128 @@ +// +// AM5ProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif +@interface AM5ProfileModule : NSObject + + +#define kACTION_ERROR @"ACTION_ERROR" + +#define ERROR_NUM @"ERROR_NUM" + +#define ERROR_DESCRIPTION @"description" + +#define kACTION_USER_BIND @"action_user_bind" + +#define kACTION_USER_UNBIND @"action_user_unbind" + +#define kACTION_FUNCTION_SUPPORT @"ACTION_FUNCTION_SUPPORT" + +#define kACTION_BASIC_INFO @"action_basic_info" + +#define MAC_ADDRESS @"mac" + +#define BASIC_BATTSTATUS @"battStatus" + +#define BASIC_DEIVCEID @"deivceId" + +#define BASIC_ENERGE @"energe" + +#define BASIC_FIRMWAREVERSION @"firmwareVersion" + +#define BASIC_MODE @"mode" + +#define BASIC_PAIRFLAG @"pairFlag" + +#define BASIC_REBOOT @"reboot" + +#define kACTION_LIVE_DATA @"action_live_data" + +#define LIVE_DATA_HEARTRATE @"heartRate" + +#define LIVE_DATA_STEP @"totalStep" + +#define LIVE_DATA_DISTANCES @"totalDistances" + +#define LIVE_DATA_ACTIVETIME @"activeTime" + +#define LIVE_DATA_CALORIE @"calorie" + + +#define kACTION_ACTIVITY_COUNT @"action_live_count" + +#define kACTION_SET_TIME @"TIME" + +#define kACTION_SET_ALARM @"action_basic_info" + +#define kACTION_SET_GOAL @"action_basic_info" + +#define kACTION_SET_LONG_SIT @"action_basic_info" + +#define kACTION_SET_USER_INFO @"USER_INFO" + +#define kACTION_SET_UNIT @"UNIT" + +#define kACTION_SET_HAND_WEAR_MODE @"HAND_MODE" + +#define kACTION_SET_UP_HAND_GESTURE @"action_basic_info" + +#define kACTION_SET_HEART_RATE_INTERVAL @"action_basic_info" + +#define kACTION_SET_HEART_RATE_MEASURE_MODE @"action_basic_info" + +#define kACTION_SET_ONE_KEY_RESET @"action_basic_info" + +#define kACTION_SET_NOT_DISTURB @"action_basic_info" + +#define kACTION_SET_SPORT_MODE @"action_basic_info" + +#define OPERATION_RESULT @"action_basic_info" + +#define OPERATION_ACTION @"action_basic_info" + +#define kACTION_NOTICE_COMMING_CALL @"action_basic_info" + +#define kACTION_NOTICE_COMMING_CALL_STOP @"action_basic_info" + +#define kACTION_NOTICE_NEW_MESSAGE @"action_basic_info" + +#define kACTION_SYNC_ACTIVITY @"action_basic_info" + +#define kACTION_SYNC_ACTIVITY_DATA @"action_basic_info" + +#define kACTION_SYNC_CONFIG @"action_basic_info" + +#define kACTION_SYNC_HEALTH_DATA @"action_sync_health_data" + +#define kACTION_SYNC_HEALTH_DATA_SPORT @"action_sync_health_data_sport" + +#define kACTION_SYNC_HEALTH_DATA_SLEEP @"action_sync_health_data_sleep" + +#define kACTION_SYNC_HEALTH_DATA_HEART_RATE @"action_sync_health_data_heart_rate" + +#define kACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE @"action_basic_info" + +#define OPERATION_STATUS @"status" + +#define TYPE @"type" + +#define DATA @"data" + +#define PROGRESS @"PROGRESS" + +#define RESULT @"result" + + +#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.m new file mode 100755 index 0000000..9003665 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5ProfileModule.m @@ -0,0 +1,87 @@ +// +// Am5ProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "AM5ProfileModule.h" + +@implementation AM5ProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"ACTION_ERROR":kACTION_ERROR, + @"ERROR_NUM":ERROR_NUM, + @"ERROR_DESCRIPTION":ERROR_DESCRIPTION, + @"ACTION_USER_BIND":kACTION_USER_BIND, + @"ACTION_USER_UNBIND":kACTION_USER_UNBIND, + @"ACTION_FUNCTION_SUPPORT":kACTION_FUNCTION_SUPPORT, + @"ACTION_BASIC_INFO":kACTION_BASIC_INFO, + @"ACTION_MAC_ADDRESS":MAC_ADDRESS, + @"MAC_ADDRESS":MAC_ADDRESS, + @"BASIC_BATTSTATUS":BASIC_BATTSTATUS, + @"BASIC_DEIVCEID":BASIC_DEIVCEID, + @"BASIC_ENERGE":BASIC_ENERGE, + @"BASIC_FIRMWAREVERSION":BASIC_FIRMWAREVERSION, + @"BASIC_MODE":BASIC_MODE, + @"BASIC_PAIRFLAG":BASIC_PAIRFLAG, + @"BASIC_REBOOT":BASIC_REBOOT, + @"ACTION_LIVE_DATA":kACTION_LIVE_DATA, + @"HEARTRATE":LIVE_DATA_HEARTRATE, + @"STEP":LIVE_DATA_STEP, + @"DISTANCES":LIVE_DATA_DISTANCES, + @"ACTIVETIME":LIVE_DATA_ACTIVETIME, + @"CALORIE":LIVE_DATA_CALORIE, + @"ACTION_ACTIVITY_COUNT":kACTION_ACTIVITY_COUNT, + @"ACTION_SET_TIME":kACTION_SET_TIME, + @"ACTION_SET_ALARM":kACTION_SET_ALARM, + @"ACTION_SET_GOAL":kACTION_SET_GOAL, + @"ACTION_SET_LONG_SIT":kACTION_SET_LONG_SIT, + @"ACTION_SET_USER_INFO":kACTION_SET_USER_INFO, + @"ACTION_SET_UNIT":kACTION_SET_UNIT, + @"ACTION_SET_HAND_WEAR_MODE":kACTION_SET_HAND_WEAR_MODE, + @"ACTION_SET_UP_HAND_GESTURE":kACTION_SET_UP_HAND_GESTURE, + @"ACTION_SET_HEART_RATE_INTERVAL":kACTION_SET_HEART_RATE_INTERVAL, + @"ACTION_SET_HEART_RATE_MEASURE_MODE":kACTION_SET_HEART_RATE_MEASURE_MODE, + @"ACTION_SET_ONE_KEY_RESET":kACTION_SET_ONE_KEY_RESET, + @"ACTION_SET_NOT_DISTURB":kACTION_SET_NOT_DISTURB, + @"ACTION_SET_SPORT_MODE":kACTION_SET_SPORT_MODE, + @"OPERATION_RESULT":OPERATION_RESULT, + @"OPERATION_ACTION":OPERATION_ACTION, + @"ACTION_NOTICE_COMMING_CALL":kACTION_NOTICE_COMMING_CALL, + @"ACTION_NOTICE_COMMING_CALL_STOP":kACTION_NOTICE_COMMING_CALL_STOP, + @"ACTION_NOTICE_NEW_MESSAGE":kACTION_NOTICE_NEW_MESSAGE, + @"ACTION_SYNC_ACTIVITY":kACTION_SYNC_ACTIVITY, + @"ACTION_SYNC_ACTIVITY_DATA":kACTION_SYNC_ACTIVITY_DATA, + @"ACTION_SYNC_CONFIG":kACTION_SYNC_CONFIG, + @"ACTION_SYNC_HEALTH_DATA":kACTION_SYNC_HEALTH_DATA, + @"ACTION_SYNC_HEALTH_DATA_SPORT":kACTION_SYNC_HEALTH_DATA_SPORT, + @"ACTION_SYNC_HEALTH_DATA_SLEEP":kACTION_SYNC_HEALTH_DATA_SLEEP, + @"ACTION_SYNC_HEALTH_DATA_HEART_RATE":kACTION_SYNC_HEALTH_DATA_HEART_RATE, + @"ACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE":kACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE, + @"OPERATION_STATUS":OPERATION_STATUS, + @"PROGRESS":PROGRESS, + @"TYPE":TYPE, + @"DATA":DATA, + @"RESULT":RESULT, + @"ACTION_GET_ALL_CONNECTED_DEVICES":kACTION_ERROR, + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.h new file mode 100755 index 0000000..f27c20b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.h @@ -0,0 +1,18 @@ +// +// AMProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + +@interface AMProfileModule : NSObject + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.m new file mode 100755 index 0000000..4f6a4be --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AMProfileModule.m @@ -0,0 +1,248 @@ +// +// AMProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "AMProfileModule.h" + +@implementation AMProfileModule + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + +- (NSDictionary *)constantsToExport + +{ + return @{ + + @"ACTION_ERROR_AM":@"error_am", + + + @"ACTION_RESET_AM":@"reset_am", + @"ACTION_USERID_AM":@"userid_am", + @"ACTION_SET_USERID_SUCCESS_AM":@"set_userid_success_am", + @"ACTION_SYNC_TIME_SUCCESS_AM":@"set_sync_time_success_am", + @"ACTION_SET_USERINFO_SUCCESS_AM":@"set_userinfo_success_am", + @"ACTION_GET_USERINFO_AM":@"get_userinfo_am", + @"ACTION_GET_ALARMNUM_AM":@"get_alarmnum_am", + @"ACTION_GET_ALARMINFO_AM":@"get_alarminfo_am", + @"ACTION_SET_ALARMINFO_SUCCESS_AM":@"set_alarminfo_success_am", + @"ACTION_DELETE_ALARM_SUCCESS_AM":@"delete_alarm_success_am", + @"ACTION_GET_ACTIVITY_REMIND_AM":@"get_activity_remind_am", + @"ACTION_SET_ACTIVITYREMIND_SUCCESS_AM":@"set_activityremind_success_am", + @"ACTION_SYNC_ACTIVITY_DATA_AM":@"sync_activity_data_am", + @"ACTION_SYNC_SLEEP_DATA_AM":@"sync_sleep_data_am", + @"ACTION_SYNC_STAGE_DATA_AM":@"sync_stage_data_am", + @"ACTION_SYNC_REAL_DATA_AM":@"sync_real_data_am", + @"ACTION_QUERY_STATE_AM":@"query_state_am", + @"ACTION_SET_BMR_SUCCESS_AM":@"set_bmr_success_am", + @"ACTION_GET_RANDOM_AM":@"get_random_am", + @"ACTION_SET_SWIMINFO_AM":@"set_swiminfo_am", + @"ACTION_GET_SWIMINFO_AM":@"get_swiminfo_am", + @"ACTION_SET_HOUR_MODE_SUCCESS_AM":@"set_hour_mode_success_am", + @"ACTION_GET_HOUR_MODE_AM":@"get_hour_mode_am", + + + @"ACTION_SET_DEVICE_MODE_AM":@"set_device_mode_am", + @"ACTION_SET_PICTURE_SUCCESS_AM":@"set_picture_success_am", + @"ACTION_GET_PICTURE_AM":@"get_picture_am", + + @"ACTION_CLOUD_BINDING_AM_SUCCESS":@"cloud_bind_am_success", + @"ACTION_CLOUD_BINDING_AM_FAIL":@"cloud_bind_am_fail", + @"ACTION_CLOUD_UNBINDING_AM_SUCCESS":@"cloud_unbind_am_success", + @"ACTION_CLOUD_UNBINDING_AM_FAIL":@"cloud_unbind_am_fail", + @"ACTION_CLOUD_SEARCH_AM":@"cloud_search_am", + @"ACTION_CLOUD_SEARCH_FAIL_AM":@"cloud_search_fail", + @"ACTION_GET_ALL_CONNECTED_DEVICES":@"ACTION_GET_ALL_CONNECTED_DEVICES", + + + + @"ERROR_NUM_AM":@"error", + @"ERROR_DESCRIPTION_AM":@"description", + + + @"ERROR_ID_ILLEGAL_ARGUMENT":@"ERROR_ID_ILLEGAL_ARGUMENT", + @"ERROR_ID_VERSION_NOT_SUPPORT":@"ERROR_ID_VERSION_NOT_SUPPORT", + + @"RESET_AM":@"reset", + @"USERID_AM":@"userid", + @"GET_USER_AGE_AM":@"age", + @"GET_USER_STEP_AM":@"step", + @"GET_USER_HEIGHT_AM":@"height", + @"GET_USER_SEX_AM":@"gender", + @"GET_USER_WEIGHT_AM":@"weight", + @"GET_USER_UNIT_AM":@"unit", + @"GET_USER_TARGET1_AM":@"target1", + @"GET_USER_TARGET2_AM":@"target2", + @"GET_USER_TARGET3_AM":@"target3", + @"GET_USER_SWIMTARGET_AM":@"swim_target", + @"GET_ALARMNUM_AM":@"alarmclocknumber", + @"GET_ALARMNUM_ID_AM":@"alarmclocknumberid", + @"GET_ALARM_CLOCK_DETAIL":@"alarmclockdetail", + @"GET_ALARM_ID_AM":@"alarmid", + @"GET_ALARM_TIME_AM":@"time", + @"GET_ALARM_ISREPEAT_AM":@"repeat", + @"GET_ALARM_WEEK_AM":@"get_alarm_week", + @"GET_ALARM_WEEK_SUNDAY_AM":@"sun", + @"GET_ALARM_WEEK_MONDAY_AM":@"mon", + @"GET_ALARM_WEEK_TUESDAY_AM":@"tue", + @"GET_ALARM_WEEK_WEDNESDAY_AM":@"wed", + @"GET_ALARM_WEEK_THURSDAY_AM":@"thu", + @"GET_ALARM_WEEK_FRIDAY_AM":@"fri", + @"GET_ALARM_WEEK_SATURDAY_AM":@"sat", + @"GET_ALARM_ISON_AM":@"switch", + @"GET_ACTIVITY_REMIND_TIME_AM":@"time", + @"GET_ACTIVITY_REMIND_ISON_AM":@"switch", + @"SYNC_ACTIVITY_DATA_AM":@"activity", + @"SYNC_ACTIVITY_DATA_TIME_AM":@"time", + @"SYNC_ACTIVITY_DATA_STEP_AM":@"step", + @"SYNC_ACTIVITY_DATA_STEP_LENGTH_AM":@"stepsize", + @"SYNC_ACTIVITY_DATA_CALORIE_AM":@"calorie", + @"SYNC_ACTIVITY_EACH_DATA_AM":@"activity_each_data", + @"DATAID":@"dataID", + @"SYNC_SLEEP_DATA_AM":@"sleep", + @"SYNC_SLEEP_DATA_TIME_AM":@"time", + @"SYNC_SLEEP_DATA_LEVEL_AM":@"level", + @"SYNC_SLEEP_EACH_DATA_AM":@"sleep_each_data", + @"SYNC_STAGE_DATA_AM":@"stage_data", + @"SYNC_STAGE_DATA_TYPE_WORKOUT_AM":@"stage_data_type_workout", + @"SYNC_STAGE_DATA_TYPE_AM":@"type", + @"SYNC_STAGE_DATA_WORKOUT_STEP_AM":@"stage_data_workout_step", + @"SYNC_STAGE_DATA_STOP_TIME_AM":@"stoptime", + @"SYNC_STAGE_DATA_USED_TIME_AM":@"usedtime", + @"SYNC_STAGE_DATA_DISTANCE_AM":@"stage_data_distance", + @"SYNC_STAGE_DATA_CALORIE_AM":@"calorie", + @"SYNC_STAGE_DATA_SWIM_CUTINDIF_AM":@"stage_data_cutindif", + @"SYNC_STAGE_DATA_TYPE_SWIM_AM":@"swim", + @"SYNC_STAGE_DATA_SWIM_PULL_TIMES_AM":@"number of strokes", + @"SYNC_STAGE_DATA_SWIM_STROKE_AM":@"swimming stroke", + @"SYNC_STAGE_DATA_SWIM_TURNS_AM":@"number of turns", + @"SYNC_STAGE_DATA_SWIMPOOL_LENGTH_AM":@"stage_data_swimpool_length", + @"SYNC_STAGE_DATA_SWIM_CUTOUTDIF_AM":@"stage_data_cutoutdif", + @"SYNC_STAGE_DATA_SWIM_PROCESSFLAG_AM":@"stage_data_processflag", + @"SYNC_STAGE_DATA_TYPE_SLEEP_AM":@"sleep", + @"SYNC_STAGE_DATA_SLEEP_EFFICIENCY_AM":@"sleepefficiency", + @"SYNC_STAGE_DATA_SLEEP_IS50MIN_AM":@"is50min", + @"SYNC_STAGE_DATA_TYPE_PAGE_VIEW_SUMMARY":@"page_view_summary", + @"SYNC_STAGE_DATA_VIEW_SUMMARY_DATE_AM":@"stage_data_view_summary_date", + @"SYNC_STAGE_DATA_VIEW_SUMMARY_STEP_AM":@"stage_data_view_summary_step", + @"SYNC_STAGE_DATA_VIEW_SUMMARY_DISTANCE_AM":@"stage_data_view_summary_distance", + @"SYNC_STAGE_DATA_VIEW_SUMMARY_CALORIE_AM":@"stage_data_view_summary_calorie", + @"SYNC_STAGE_DATA_VIEW_SUMMARY_TARGET_AM":@"stage_data_view_summary_target", + @"SYNC_STAGE_DATA_VIEW_SUMMARY_SWIM_AM":@"stage_data_view_summary_swim", + @"SYNC_REAL_STEP_AM":@"step", + @"SYNC_REAL_CALORIE_AM":@"calorie", + @"SYNC_REAL_TOTALCALORIE_AM":@"totalcalories", + @"QUERY_STATE_AM":@"query_state", + @"QUERY_BATTERY_AM":@"battery", + @"GET_RANDOM_AM":@"random", + @"GET_SWIMLANE_LENGTH_AM":@"get_swimlane_length", + @"GET_SWIM_UNIT_AM":@"get_swim_unit_am", + @"GET_SWIM_SWITCH_AM":@"get_swim_switch_am", + @"GET_SWIM_CUTOUT_HOUR_AM":@"get_swim_cutout_hour_am", + @"GET_SWIM_CUTOUT_MINUTE_AM":@"get_swim_cutout_min_am", + @"GET_PICTURE_AM":@"get_picture_am", + + + + @"AM_SET_MALE":@1, + @"AM_SET_FEMALE":@0, + @"AM_SET_UNIT_METRIC":@1, + @"AM_SET_UNIT_IMPERIAL_STANDARD":@0, + @"AM_SET_12_HOUR_MODE":@0, + @"AM_SET_24_HOUR_MODE":@1, + @"AM_SET_EUROPE_12_HOUR_MODE":@3, + @"AM_SET_EUROPE_24_HOUR_MODE":@5, + @"AM_SET_EXCEPT_EUROPE_12_HOUR_MODE":@2, + @"AM_SET_EXCEPT_EUROPE_24_HOUR_MODE":@4, + @"GET_HOUR_MODE_AM":@"hourtype", + @"AM_DEVICE_MODE_SLEEP":@0, + @"AM_DEVICE_MODE_ACTIVITY":@1, + @"AM_DEVICE_MODE_FLIGHT":@2, + @"AM_DEVICE_MODE_DRIVING":@3, + }; +}; + + + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.h new file mode 100755 index 0000000..79622cb --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.h @@ -0,0 +1,22 @@ +// +// BG1Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface BG1Module : RCTEventEmitter + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.m new file mode 100644 index 0000000..c5c33d3 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1Module.m @@ -0,0 +1,236 @@ +// +// BG1Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BG1Module.h" +#import "BG1ProfileModule.h" +#import "BGMacroFile.h" +#import "BG1Controller.h" +#import "BG1.h" +#define EVENT_NOTIFY @"event_notify_bg1" + +@implementation BG1Module + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":@"event_notify_bg1", + + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + + [BG1Controller shareBG1Controller]; + + } + return self; +} + + + +-(BG1*)getBG1Instance{ + + BG1Controller *controller = [BG1Controller shareBG1Controller]; + BG1 *bg1Instance = [controller getCurrentBG1Instance]; + if(bg1Instance != nil) + { + return bg1Instance; + } + else + { + return nil; + } + +} + + +#pragma mark +#pragma mark - Method + + +RCT_EXPORT_METHOD(sendCode:(nonnull NSString *)QR:(nonnull NSNumber *)codeType:(nonnull NSNumber *)testType){ + + + if ([self getBG1Instance]!=nil) { + + if (QR ==nil || QR.length<30) { + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_error_for_bg1",@"action_measure_error_for_bg1":@400,@"description":@"Parameter input error."}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + return; + } + + NSDictionary *codeDic = [[self getBG1Instance]codeStripStrAnalysis:QR]; + NSNumber *bottleID = [codeDic objectForKey:@"bottleId"]; + NSDate *dueDate = [codeDic objectForKey:@"overDate"]; + NSNumber *remainNum = [codeDic objectForKey:@"stripNum"]; + + BGMeasureMode bgMeasureModel = BGMeasureMode_Blood; + if(codeType.integerValue == 2) + { + bgMeasureModel = BGMeasureMode_NoBlood; + } + + BGCodeMode bgCodeModel =BGCodeMode_GOD; + if(codeType.integerValue == 2) + { + bgCodeModel = BGCodeMode_GDH; + } + [[self getBG1Instance] commandBG1MeasureMode:bgMeasureModel withCodeMode:bgCodeModel withCodeString:QR withSendCodeResultBlock:^{ + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_sendcode_result_for_bg1",@"set_bottle_message":@true}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withStripInBlock:^{ + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_strip_in_for_bg1"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withBloodBlock:^{ + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_get_blood_for_bg1"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withResultBlock:^(NSDictionary *result) { + + NSDate *measureDate = [result objectForKey:@"Date"]; + + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:measureDate]; + + NSDictionary *resultDic = [NSDictionary dictionaryWithObjectsAndKeys:dateStr,@"date",[result objectForKey:@"Result"],@"value",[result objectForKey:@"dataID"],@"dataID", nil]; + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_result_for_bg1",@"result":resultDic}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withStripOutBlock:^{ + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_strip_out_for_bg1"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(BG1Error errorID) { + + + NSString *descriptionStr = @""; + + switch (errorID) { + case BG1Error_LowBattery: + descriptionStr=@"Battery is low."; + break; + case BG1Error_ResultOutOfMeasurementRage: + descriptionStr=@"Glucose test result is out of the measurement range."; + break; + case BG1Error_UnvalidReferenceVoltage: + descriptionStr=@"2.5V reference voltage error, not normal measurement, please repeat the test."; + break; + case BG1Error_StripUsed: + descriptionStr=@"Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip."; + break; + case BG1Error_CodeError: + descriptionStr=@"CODE value check error. This error need let user scan code and call the send code function again,no alert need to show."; + break; + case BG1Error_RoomTemperatureOutOfRange1: + case BG1Error_RoomTemperatureOutOfRange2: + descriptionStr=@"The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test."; + break; + case BG1Error_ResultLow: + descriptionStr=@"Glucose test result is low."; + break; + case BG1Error_ResultHigh: + descriptionStr=@"Glucose test result is high."; + break; + case BG1Error_DisConnented: + descriptionStr=@"BG disConnented."; + break; + case BG1Error_SleepingMode: + descriptionStr=@"BG sleeping mode."; + break; + case BG1Error_ParameterError: + descriptionStr=@"Parameter input error."; + break; + default: + descriptionStr=@"BG unknown."; + break; + } + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_error_for_bg1",@"action_measure_error_for_bg1":[NSNumber numberWithInt:errorID],@"description":descriptionStr}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }]; + + + + + + }else{ + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_error_for_bg1",@"action_measure_error_for_bg1":@100,@"description":@"BG disConnented." }; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + +} + + + + + +RCT_EXPORT_METHOD(getBottleInfoFromQR:(nonnull NSString *)QR){ + + + if ([self getBG1Instance]!=nil) { + + NSDictionary *codeDic = [[self getBG1Instance]codeStripStrAnalysis:QR]; + NSDate *tempDate = [codeDic objectForKey:@"DueDate"]; + + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSTimeZone *dongBaTimeZone = [NSTimeZone timeZoneForSecondsFromGMT:8*60*60]; + [mydateFormatter setTimeZone:dongBaTimeZone]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + + NSNumber *bottleID = [codeDic objectForKey:@"BottleID"]; + NSNumber *remainNum = [codeDic objectForKey:@"StripNum"]; + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_code_analysis_bg",@"stripNum":remainNum,@"overDate":dateStr,@"bottleId":bottleID}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }else{ + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_error_for_bg1",@"action_measure_error_for_bg1":@100,@"description":@"BG disConnented."}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + +} + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.h new file mode 100755 index 0000000..02bf97f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.h @@ -0,0 +1,18 @@ +// +// BG1ProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif +@interface BG1ProfileModule : NSObject + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.m new file mode 100755 index 0000000..c7410a0 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1ProfileModule.m @@ -0,0 +1,84 @@ +// +// BG1ProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BG1ProfileModule.h" + +@implementation BG1ProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + + @"ACTION_ERROR_BG":@"action_measure_error", + @"ACTION_GET_BATTERY":@"action_battery_bg", + @"ACTION_KEEP_LINK":@"action_keep_link", + @"ACTION_SET_TIME":@"action_set_time", + @"ACTION_SET_UNIT":@"action_set_unit", + @"ACTION_START_MEASURE":@"action_start_measure", + @"ACTION_GET_OFFLINEDATA_COUNT":@"action_historicalnum_bg", + @"ACTION_GET_OFFLINEDATA":@"action_historicaldata_bg", + @"ACTION_DELETE_OFFLINEDATA":@"action_delete_historical_data", + @"ACTION_SET_BOTTLEMESSAGE":@"action_set_bottle_message_success", + @"ACTION_GET_BOTTLEMESSAGE":@"action_get_codeinfo", + @"ACTION_SET_BOTTLEID":@"action_set_bottle_message_success", + @"ACTION_GET_BOTTLEID":@"action_get_bottleid", + + @"ACTION_BG1_SENDCODE_RESULT":@"action_sendcode_result_for_bg1", + @"ACTION_BG1_MEASURE_ERROR":@"action_measure_error_for_bg1", + @"ACTION_BG1_MEASURE_STRIP_IN":@"action_measure_strip_in_for_bg1", + @"ACTION_BG1_MEASURE_GET_BLOOD":@"action_measure_get_blood_for_bg1", + @"ACTION_BG1_MEASURE_RESULT":@"action_measure_result_for_bg1", + @"ACTION_BG1_MEASURE_STRIP_OUT":@"action_measure_strip_out_for_bg1", + @"ACTION_BG1_MEASURE_STANDBY":@"action_measure_standby_for_bg1", + @"ACTION_CODE_ANALYSIS":@"action_code_analysis_bg", + + + @"BG1_SENDCODE_RESULT":@"sendcode_result_for_bg1", + @"BG1_MEASURE_ERROR":@"action_measure_error_for_bg1", + @"BG1_MEASURE_RESULT":@"measure_result_for_bg1", + @"DATA_ID":@"dataID", + + @"STRIP_NUM_BG":@"stripNum", + @"STRIP_EXPIRETIME_BG":@"overDate", + @"BOTTLEID_BG":@"bottleId", + + + @"ERROR_NUM_BG":@"error", + @"GET_BATTERY":@"battery", + @"KEEP_LINK":@"keep_link", + @"SET_TIME":@"set_time", + @"SET_UNIT":@"set_unit", + @"START_MEASURE":@"start_measure", + @"GET_OFFLINEDATA_COUNT":@"count", + @"GET_OFFLINEDATA":@"his_data_bg", + @"DELETE_OFFLINEDATA":@"delete_historical_data", + @"GET_USENUM":@"usenum", + @"SET_BOTTLEMESSAGE":@"set_bottle_message", + @"GET_BOTTLEID":@"bottleid", + @"SET_BOTTLEID":@"set_bottle_message" + + + + + }; +}; + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.h new file mode 100644 index 0000000..f7a3d09 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.h @@ -0,0 +1,20 @@ +// +// BG1SModule.h +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/12. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface BG1SModule : RCTEventEmitter + +@end + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.m new file mode 100644 index 0000000..f841037 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SModule.m @@ -0,0 +1,224 @@ +// +// BG1SModule.m +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/12. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "BG1SModule.h" +#import "BG1S.h" +#import "BG1SController.h" +#import "BG1SProfileModule.h" + +#import "BGHeader.h" + +@implementation BG1SModule +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": BG1S_EVENT_NOTIFY , + + }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + + +-(BG1S*)getDeviceWithMac:(NSString*)mac{ + + BG1SController *controller = [BG1SController shareIHBG1SController]; + NSArray *BG1SDeviceArray = [controller getAllCurrentBG1SInstace]; + + for(BG1S *tempDevice in BG1SDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + + return tempDevice; + } + } + return nil; +} + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*BG1SDeviceArray= [[BG1SController shareIHBG1SController] getAllCurrentBG1SInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[BG1SDeviceArray count]; i++) { + + BG1S *BG1S = [BG1SDeviceArray objectAtIndex:i]; + + [deviceMacArray addObject:BG1S.serialNumber]; + + } + + NSDictionary* deviceInfo = @{BG1S_ACTION:kACTION_GET_ALL_CONNECTED_DEVICES,BG1S_DEVICE:deviceMacArray}; + + [self sendEventWithName:BG1S_EVENT_NOTIFY body:deviceInfo]; +} + +RCT_EXPORT_METHOD(measure:(nonnull NSString *)mac measureMode:(nonnull NSNumber *)testType){ + + + 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 sendEventWithName: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 sendEventWithName: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 sendEventWithName:BG1S_EVENT_NOTIFY body:@{ + BG1S_ACTION:ACTION_GET_BLOOD, + BG1S_KEY_MAC:mac, + BG1S_TYPE:@"BG1S", + OPERATION_DESCRIBE:@"get blood" + }]; + + } DisposeBGResultBlock:^(NSDictionary *result) { + + + [self sendEventWithName: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]; + + }]; + + + } + +} + +//getFunction +RCT_EXPORT_METHOD(getFunction:(nonnull NSString *)mac){ + if ([self getDeviceWithMac:mac]!=nil) { + + + [[self getDeviceWithMac:mac] commandFunction:^(NSDictionary *functionDict) { + + + [self sendEventWithName:BG1S_EVENT_NOTIFY body:@{ + 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]; + + }]; + + + } +} + +//断开连接 +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + + [[self getDeviceWithMac:mac] commandDisconnectDevice]; + } + +} + +-(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 sendEventWithName:BG1S_EVENT_NOTIFY body:deviceInfo]; + + +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.h new file mode 100644 index 0000000..ab9abc4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.h @@ -0,0 +1,61 @@ +// +// BG1SProfileModule.h +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/14. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + + +@interface BG1SProfileModule : NSObject + +#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 OPERATION_DESCRIBE @"describe" + +#define STRIP_INSERTION_STATUS @"insertion_status" + +#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" + +#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 ACTION_STRIP_INSERTION_STATUS @"action_strip_insertion_status" + +#define ACTION_GET_BLOOD @"action_get_blood" + +#define ACTION_MEASURE_RESULT @"action_measure_result" + + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.m new file mode 100644 index 0000000..a3f153b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG1SProfileModule.m @@ -0,0 +1,50 @@ +// +// BG1SProfileModule.m +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/14. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "BG1SProfileModule.h" + +@implementation BG1SProfileModule + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + 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, + @"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 + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.h new file mode 100755 index 0000000..2b51c47 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.h @@ -0,0 +1,23 @@ +// +// BG5Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface BG5Module : RCTEventEmitter + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.m new file mode 100644 index 0000000..c0a7fcf --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5Module.m @@ -0,0 +1,643 @@ +// +// BG5Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BG5Module.h" +#import "BGProfileModule.h" +#import "BGMacroFile.h" +#import "BG5Controller.h" +#import "BG5.h" + +#define EVENT_NOTIFY @"event_notify_bg5" +#define kMAC_KEY @"mac" +#define kACTION_KEY @"action" + +@interface BG5Module() + +/** + 保存设备回复的开机模式 + */ +@property (assign, nonatomic) NSInteger deviceSelectedOpenMode; + +/** + 保存用户传入的测量模式 + */ +@property (assign, nonatomic) NSInteger userSelectedMeasureMode; + +@end + +@implementation BG5Module + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport{ + return @{ + @"Event_Notify":EVENT_NOTIFY, + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark - Objc Method +-(id)init{ + self = [super init]; + if (self) { + [BG5Controller shareIHBg5Controller]; + self.deviceSelectedOpenMode = 0;// 初始化时,将开机模式设置为0;目的是,在用户调用开始测量方法时,判断用户是否已经调用过发码方法。调用过发码方法后,openMode的值是1或2 + self.userSelectedMeasureMode = 0;// 初始化时,将开机模式设置为0;目的是,在用户调用开始测量方法时,判断用户发码时传入的测量模式 是否等于 开始测量传入的测量模式 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clear) name:BG5DisConnectNoti object:nil]; + } + return self; +} + +-(void)dealloc{ + [[NSNotificationCenter defaultCenter]removeObserver:self]; +} + +- (void)clear{ + self.deviceSelectedOpenMode = 0; + self.userSelectedMeasureMode = 0; +} + +/** + 返回传入的Mac地址对应的BG5对象 + + @param mac mac地址,需要完整的mac地址 + @return BG5对象;如果没有匹配mac地址的BG5对象,那么返回nil + */ +-(BG5*)getDeviceWithMac:(NSString*)mac{ + + BG5Controller *controller = [BG5Controller shareIHBg5Controller]; + NSArray *BGDeviceArray = [controller getAllCurrentBG5Instace]; + NSLog(@"%@",BGDeviceArray); + for(BG5 *tempBG5 in BGDeviceArray){ + if([mac isEqualToString:tempBG5.serialNumber]){ + return tempBG5; + } + } + return nil; +} + +- (void)sendMeasureErrorEventWithMac:(NSString *)mac errorId:(NSNumber *)errorId{ + + + NSString *errorDescription = @""; + + switch (errorId.integerValue) { + case 0: + errorDescription = @"Battery is low."; + break; + case 1: + errorDescription = @"Glucose test result is out of the measurement range."; + break; + case 2: + errorDescription = @"Unknown interference detected, please repeat the test."; + break; + case 3: + errorDescription = @"Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip."; + break; + case 4: + errorDescription = @"Reading transmission error. Repeat the test with a new test strip. If the problem persists, contact iHealth customer service for assistance."; + break; + case 5: + errorDescription = @"The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test."; + break; + case 6: + errorDescription = @"The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test."; + break; + case 7: + errorDescription = @"Test strip coding error."; + break; + case 8: + errorDescription = @"Communication error, press \"START\" or rescan the code to repeat the test."; + break; + case 9: + errorDescription = @"Strip removed in the middle of reading, repeat the test with a new strip."; + break; + case 10: + errorDescription = @"Insert a new test strip and repeat the test."; + break; + case 11: + errorDescription = @"Cannot write to SN or KEY."; + break; + case 12: + errorDescription = @"Please set time."; + break; + case 13: + errorDescription = @"0 test strips remaining."; + break; + case 14: + errorDescription = @"Test strip expired."; + break; + case 15: + errorDescription = @"Unplug the charging cable before testing."; + break; + case 18: + errorDescription = @"Unplug the charging cable before read the history data"; + break; + case 19: + errorDescription = @"Charging line is inserted"; + break; + case 20: + errorDescription = @"Charging line pull out"; + break; + case 21: + errorDescription = @"The bluetooth module failure"; + break; + case 22: + errorDescription = @"Need to set time at first."; + break; + case 30: + errorDescription = @"BG Over Time Error."; + break; + case 112: + errorDescription = @"Device don't support to query energy."; + break; + case RNBGError_InputParameterError: + errorDescription = @"Parameters out of range."; + break; + case RNBGError_FunctionCallOrderError: + errorDescription = @"The order of call is wrong."; + break; + case RNBGError_MeasureModeNotMatched: + errorDescription = @"Measure Mode is not matched in fucntion call (setBottleMessageWithInfo and startMeasure)"; + break; + case RNBGError_DisconnectFunctionNotSupportIniOSPlatform: + errorDescription = @"Function(disConnect) is not supported in iOS platform."; + break; + case RNBGError_getBottleInfoFromQRFunctionInpurParameterError: + errorDescription = @"Function(getBottleInfoFromQR) Input Parameter Error"; + break; + default: + break; + } + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ERROR_BG, + kERROR_NUM_BG:errorId, + kERROR_DESCRIPTION_BG:errorDescription + }]; +} + +- (void)sendNoMatchedDeviceEventWithMac:(NSString *)mac{ + if (mac && mac.length > 0) { + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ERROR_BG, + kERROR_NUM_BG:@100 + }]; + } else { + [self sendEventWithName:EVENT_NOTIFY body:@{ + kACTION_KEY:kACTION_ERROR_BG, + kERROR_NUM_BG:@100 + }]; + } + +} + +- (void)sendInputParameterErrorEventWithMac:(NSString *)mac{ + if (mac && mac.length > 0) { + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ERROR_BG, + kERROR_NUM_BG:@400, + kERROR_DESCRIPTION_BG:@"Parameters out of range." + }]; + } else { + [self sendEventWithName:EVENT_NOTIFY body:@{ + kACTION_KEY:kACTION_ERROR_BG, + kERROR_NUM_BG:@400, + kERROR_DESCRIPTION_BG:@"Parameters out of range." + }]; + } + +} + +#pragma mark - Objc method for BG5Module.js function + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*bg5array= [[BG5Controller shareIHBg5Controller] getAllCurrentBG5Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[bg5array count]; i++) { + + BG5*bg5=[bg5array objectAtIndex:i]; + + [deviceMacArray addObject:bg5.serialNumber]; + + } + + NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + +#pragma mark 保持连接 +RCT_EXPORT_METHOD(holdLink:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandKeepConnect:^(BOOL sendOk) { + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_KEEP_LINK, + }]; + } DisposeErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +#pragma mark 获得电池电量 +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandQueryBattery:^(NSNumber *energy) { + NSLog(@"电量"); + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_GET_BATTERY, + kGET_BATTERY:energy + }]; + + } DisposeErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} +#pragma mark 设置时间 +RCT_EXPORT_METHOD(setTime:(nonnull NSString *)mac){ + + + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandBGSetTime:^(BOOL setResult) { + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_TIME, + }]; + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + + } +} + +#pragma mark 设置单位 +RCT_EXPORT_METHOD(setUnit:(nonnull NSString *)mac unitType:(nonnull NSNumber *)type){ +#warning 下位机回复是否表示设置成功 + if ([self getDeviceWithMac:mac]) { + + BGUnit tempUnit = BGUnit_mmolPL; + if ([type isEqual:@(BGUnit_mmolPL)]) { + tempUnit = BGUnit_mmolPL; + } else if([type isEqual:@(BGUnit_mgPmL)]) { + tempUnit = BGUnit_mgPmL; + } else { + [self sendInputParameterErrorEventWithMac:mac]; + return; + } + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandBGSetUnit:tempUnit DisposeSetUnitResult:^(BOOL setResult) { + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_UNIT, + }]; + + } DisposeBGErrorBlock:^(NSNumber *errorID) { + + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +#pragma mark 获得Bottle ID +RCT_EXPORT_METHOD(getBottleId:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac]commandBGGetBottleID:^(NSNumber *bottleID) { + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_GET_BOTTLEID, + kGET_BOTTLEID:bottleID, + }]; + + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +#pragma mark 开始测量 +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac measureType:(nonnull NSNumber *)measureType){ + + + if ([self getDeviceWithMac:mac]) { + + /* 优先判断输入参数的内容正确性 */ + if (![measureType isEqual: @(BGMeasureMode_Blood)] && ![measureType isEqual: @(BGMeasureMode_NoBlood)]) { + //输入参数错误 + [self sendInputParameterErrorEventWithMac:mac]; + return; + } + + /* 再检查setBottleMessageWithInfo方法中传入的测量模式和本次传入的一致一致性 */ + if (self.userSelectedMeasureMode != measureType.integerValue) { + [self sendMeasureErrorEventWithMac:mac errorId:@(RNBGError_MeasureModeNotMatched)]; + return; + } + + if (self.deviceSelectedOpenMode == 0) { + [self sendMeasureErrorEventWithMac:mac errorId:@(RNBGError_FunctionCallOrderError)]; + return; + } + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_START_MEASURE, + }]; + }else{ + + [self sendNoMatchedDeviceEventWithMac:mac]; + } + +} + +#pragma mark 获得离线数据 +RCT_EXPORT_METHOD(getOfflineData:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac]commandTransferMemorryData:^(NSNumber *dataCount) { + + NSDictionary *deviceInfo = @{@"mac":mac,@"action":kACTION_GET_OFFLINEDATA_COUNT,kGET_OFFLINEDATA_COUNT:dataCount,@"type":@"BG5"}; + + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } DisposeBGHistoryData:^(NSDictionary *historyDataDic) { + + NSArray *historyArr = [NSArray arrayWithArray:[historyDataDic objectForKey:@"ResultList"]]; + NSMutableArray * tempArr = [[NSMutableArray alloc]init]; + + for(NSDictionary *history in historyArr) { + NSDate *tempDate = [history objectForKey:@"Date"]; + + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:dateStr,@"date",[history objectForKey:@"Result"],@"value",[history objectForKey:@"dataID"],@"dataID", nil]; + + [tempArr addObject:dic]; + } + + NSDictionary*hisDic=[NSDictionary dictionaryWithObjectsAndKeys:tempArr,@"history", nil]; + + + NSDictionary *deviceInfo = @{@"mac":mac,@"action":kACTION_GET_OFFLINEDATA,kGET_OFFLINEDATA:hisDic,@"type":@"BG5"}; + + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +#pragma mark 删除离线数据 +RCT_EXPORT_METHOD(deleteOfflineData:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]) { + + [[self getDeviceWithMac:mac] commandDeleteMemorryData:^(BOOL deleteOk) { + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_DELETE_OFFLINEDATA, + }]; + + } DisposeBGErrorBlock:^(NSNumber *errorID) { + + }]; + + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +#pragma mark 发Code信息方法 +RCT_EXPORT_METHOD(setBottleMessageWithInfo:(nonnull NSString *)mac codeMode:(nonnull NSNumber *)codeType measureMode:(nonnull NSNumber *)testType qrCode:(nonnull NSString *)qrCode stripNum:(nonnull NSNumber *)stripNum overDate:(nonnull NSString *)overDate){ + + + if ([self getDeviceWithMac:mac]) { + // 检查输入参数是否合法,交给SDK的方法去做,不在原生模块中校验,但是SDK中发码方法没有校验,所以先在RN模块中校验 + if ((codeType.integerValue == BGCodeMode_GOD) || (codeType.integerValue == BGCodeMode_GDH)) { + + } else { + [self sendInputParameterErrorEventWithMac:mac]; + return; + } + self.userSelectedMeasureMode = testType.integerValue; + //code的截止时期是东八区的时间,String 转 Date + NSDateFormatter *dongBaFormatter = [[NSDateFormatter alloc] init]; + NSTimeZone *dongBaTimeZone = [NSTimeZone timeZoneForSecondsFromGMT:8*60*60]; + [dongBaFormatter setTimeZone:dongBaTimeZone]; + [dongBaFormatter setDateFormat:@"yyyy-MM-dd"]; + NSCalendar *canlendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + [dongBaFormatter setCalendar:canlendar]; + NSDate *dueDate = [dongBaFormatter dateFromString:overDate];//过期时间 + + NSDictionary *codeDic = [[self getDeviceWithMac:mac]codeStripStrAnalysis:qrCode]; + NSNumber *bottleID = [codeDic objectForKey:@"BottleID"]; + + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac]commandSendBGCodeWithMeasureType:(BGMeasureMode)testType.integerValue + CodeType:(BGCodeMode)codeType.integerValue + CodeString:qrCode + validDate:dueDate + remainNum:stripNum + DisposeBGSendCodeBlock:^(BOOL sendOk) { + // 发码成功,发送事件 + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_BOTTLEMESSAGE, + }]; + } DisposeBGStartModel:^(BGOpenMode mode) { + weakSelf.deviceSelectedOpenMode = mode; + if (mode == BGOpenMode_Strip) { + [[weakSelf getDeviceWithMac:mac]commandCreateBGtestStripInBlock:^{ + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_STRIP_IN, + }]; + } DisposeBGBloodBlock:^{ + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_GET_BLOOD, + }]; + } DisposeBGResultBlock:^(NSDictionary *result) { + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ONLINE_RESULT_BG, + kONLINE_RESULT_BG:[result objectForKey:@"Result"], + kDATA_ID:[result objectForKey:@"dataID"], + }]; + + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + } else { + [[weakSelf getDeviceWithMac:mac]commandCreateBGtestModel:(BGMeasureMode)testType.integerValue DisposeBGStripInBlock:^{ + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_STRIP_IN, + }]; + } DisposeBGBloodBlock:^{ + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_GET_BLOOD, + }]; + } DisposeBGResultBlock:^(NSDictionary *result) { + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ONLINE_RESULT_BG, + kONLINE_RESULT_BG:[result objectForKey:@"Result"], + kDATA_ID:[result objectForKey:@"dataID"], + }]; + + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + } + + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + + + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +#pragma mark 读取试条信息 +RCT_EXPORT_METHOD(getBottleMessage:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac]commandReadBGCodeDic:^(NSDictionary *codeDic) { + + NSDate *tempDate = [codeDic objectForKey:@"Date"]; + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSTimeZone *dongBaTimeZone = [NSTimeZone timeZoneForSecondsFromGMT:8*60*60]; + [mydateFormatter setTimeZone:dongBaTimeZone]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_GET_BOTTLEMESSAGE, + kGET_EXPIRECTIME:dateStr, + kGET_USENUM:[codeDic objectForKey:@"Strips"], + }]; + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + + }else{ + + [self sendNoMatchedDeviceEventWithMac:mac]; + + } + +} + +#pragma mark 设置试条信息 +RCT_EXPORT_METHOD(setBottleId:(nonnull NSString *)mac bottleId:(nonnull NSString *)bottleId){ + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + + [[self getDeviceWithMac:mac] commandSendBottleID:bottleId.longLongValue DisposeBGSendBottleIDBlock:^(BOOL sendOk) { + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_BOTTLEID, + }]; + } DisposeBGErrorBlock:^(NSNumber *errorID) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:errorID]; + }]; + } else { + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +#pragma mark 断开连接 +RCT_EXPORT_METHOD(disConnect:(nonnull NSString *)mac){ + [self sendMeasureErrorEventWithMac:mac errorId:@(RNBGError_DisconnectFunctionNotSupportIniOSPlatform)]; +} + +#pragma mark 二维码解析 +RCT_EXPORT_METHOD(getBottleInfoFromQR:(NSString *)qrCode){ + BG5 *bg = [BG5 new]; + NSDictionary *codeDic = [bg codeStripStrAnalysis:qrCode]; + if (codeDic) { + + NSDate *tempDate = [codeDic objectForKey:@"DueDate"]; + + + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kACTION_KEY:kACTION_CODE_ANALYSIS, + kSTRIP_NUM_BG:codeDic[@"StripNum"], + kSTRIP_EXPIRETIME_BG:dateStr, + kBOTTLEID_BG:[NSString stringWithFormat:@"%@",codeDic[@"BottleID"]],// String + }]; + } else { + [self sendMeasureErrorEventWithMac:nil errorId:@(RNBGError_getBottleInfoFromQRFunctionInpurParameterError)]; + } + +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.h new file mode 100755 index 0000000..0d7b0fd --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.h @@ -0,0 +1,19 @@ +// +// BG5SModule.h +// ReactNativeIOSLibrary +// +// Created by soso on 2019/4/24. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface BG5SModule : RCTEventEmitter + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.m new file mode 100644 index 0000000..0857956 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SModule.m @@ -0,0 +1,529 @@ +// +// BG5SModule.m +// ReactNativeIOSLibrary +// +// Created by soso on 2019/4/24. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "BG5SModule.h" + +#import "BG5SProfileModule.h" +#import "BGMacroFile.h" +#import "BG5SController.h" +#import "BG5S.h" +#import "ManageDeviceController.h" + + +#define EVENT_NOTIFY @"event_notify_bg5s" +#define kMAC_KEY @"mac" +#define kACTION_KEY @"action" + +#define kFUNCTION_BatteryValue @"batteryValue" +#define kFUNCTION_DeviceDate @"deviceDate" +#define kFUNCTION_DeviceTimeZone @"deviceTimeZone" +#define kFUNCTION_StripUsedValue @"stripUsedValue" +#define kFUNCTION_OfflineDataQuantity @"offlineDataQuantity" +#define kFUNCTION_BloodCodeVersion @"bloodCodeVersion" +#define kFUNCTION_CtlCodeVersion @"ctlCodeVersion" +#define kFUNCTION_Unit @"unit" + + +@interface BG5SModule () +@property (nonatomic, assign) BOOL isMeasuring; + +@end +@implementation BG5SModule +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": EVENT_NOTIFY }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + + +-(BG5S*)getDeviceWithMac:(NSString*)mac{ + + BG5SController *controller = [BG5SController sharedController]; + NSArray *bgDeviceArray = [controller getAllCurrentInstace]; + + for(BG5S *tempDevice in bgDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + tempDevice.delegate = self; + return tempDevice; + } + } + return nil; +} + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*bgDeviceArray= [[BG5SController sharedController] getAllCurrentInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[bgDeviceArray count]; i++) { + + BG5S *bg5s = [bgDeviceArray objectAtIndex:i]; + + [deviceMacArray addObject:bg5s.serialNumber]; + + } + + NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName: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) { + + + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:stateInfo.deviceDate]; + + NSDictionary* response = @{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_GET_STATUS_INFO, + 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 sendEventWithName:EVENT_NOTIFY body:response]; + + + } errorBlock:^(BG5SError error, NSString *detailInfo) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:error]; + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac: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:mydate timezone:[timezone floatValue] successBlock:^{ + [weakSelf sendEventWithName: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(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 sendEventWithName: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]) { + + BGUnit tempUnit = BGUnit_mmolPL; + if ([type isEqual:@(BGUnit_mmolPL)]) { + tempUnit = BGUnit_mmolPL; + } else if([type isEqual:@(BGUnit_mgPmL)]) { + tempUnit = BGUnit_mgPmL; + } else { + [self sendNoMatchedDeviceEventWithMac:mac]; + return; + } + __weak typeof(self) weakSelf = self; + + [[self getDeviceWithMac:mac] setUnit:tempUnit successBlock:^{ + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_UNIT, + }]; + } errorBlock:^(BG5SError error, NSString *detailInfo) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:error]; + + }]; + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +//设置离线模式 Is offline measurement allowed 0:allowed 1:Offline measurement is not allowed +RCT_EXPORT_METHOD(setOfflineModel:(nonnull NSString *)mac type:(nonnull NSNumber *)type){ + if ([self getDeviceWithMac:mac]) { + + BOOL modelType=YES; + + if ([type intValue]==0) { + modelType=NO; + }else{ + + modelType=YES; + } + + + __weak typeof(self) weakSelf = self; + + + [[self getDeviceWithMac:mac] setIsOfflineMeasurementAllowed:modelType successBlock:^{ + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_OFFINEMODEL, + }]; + } errorBlock:^(BG5SError error, NSString *detailInfo) { + + [weakSelf sendMeasureErrorEventWithMac:mac errorId:error]; + }]; + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + + +//删除试条使用条数 +RCT_EXPORT_METHOD(deleteUsedStrip:(nonnull NSString *)mac){ + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] deleteStripUsedInfoWithSuccessBlock:^{ + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_DELETE_USED_STRIP, + }]; + } errorBlock:^(BG5SError error, NSString *detailInfo) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:error]; + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +//删除离线数据 +RCT_EXPORT_METHOD(deleteOfflineData:(nonnull NSString *)mac){ + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] deleteRecordWithSuccessBlock:^{ + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_DELETE_OFFLINE_DATA, + }]; + } errorBlock:^(BG5SError error, NSString *detailInfo) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:error]; + + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + + +//同步离线数据 +RCT_EXPORT_METHOD(getOfflineData:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] queryRecordWithSuccessBlock:^(NSArray *array) { + + NSMutableArray * tempArr = [[NSMutableArray alloc]init]; + + for(BG5SRecordModel *model in array) { + NSDate *tempDate = model.measureDate; + BOOL flag = model.canCorrect; + + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + + 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]; + } + + NSDictionary*hisDic=[NSDictionary dictionaryWithObjectsAndKeys:tempArr,@"history", nil]; + + + NSDictionary *deviceInfo = @{@"mac":mac,@"action":kACTION_GET_OFFLINE_DATA,kGET_OFFLINEDATA:hisDic,@"type":@"BG5S"}; + + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } errorBlock:^(BG5SError error, NSString *detailInfo) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:error]; + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + + } +} + + +//开始测量 +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac type:(nonnull NSNumber *)type){ + if ([self getDeviceWithMac:mac]) { + __weak typeof(self) weakSelf = self; + + BGMeasureMode measureMode = BGMeasureMode_Blood; + if ([type isEqual:@(BGMeasureMode_Blood)]) { + measureMode = BGMeasureMode_Blood; + } else if([type isEqual:@(BGMeasureMode_NoBlood)]) { + measureMode = BGMeasureMode_NoBlood; + } else { + [self sendNoMatchedDeviceEventWithMac:mac]; + return; + } + + [[self getDeviceWithMac:mac] startMeasure:measureMode withSuccessBlock:^{ + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_START_MEASURE, + }]; + } errorBlock:^(BG5SError error, NSString *detailInfo) { + [weakSelf sendMeasureErrorEventWithMac:mac errorId:error]; + + }]; + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + } +} + +- (void)device:(BG5S *)device occurError:(BG5SError)error errorDescription:(NSString *)errorDescription{ + NSLog(@"下位机主发的错误信息:%d",(int)error); + [self sendMeasureErrorEventWithMac:device.serialNumber errorId:error]; + +} +- (void)device:(BG5S *)device stripStateDidUpdate:(BG5SStripState)state{ + NSLog(@"试条状态:%@",(state == BG5SStripState_Insert)?@"插入":@"拔出"); + + if (state == BG5SStripState_Insert) { + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:device.serialNumber, + kACTION_KEY:kACTION_STRIP_IN, + }]; + }else{ + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:device.serialNumber, + kACTION_KEY:kACTION_STRIP_OUT, + }]; + } + + +} +- (void)deviceDropBlood:(BG5S *)device{ + NSLog(@"滴血"); + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:device.serialNumber, + kACTION_KEY:kACTION_GET_BLOOD, + }]; +} +- (void)device:(BG5S *)device dataID:(NSString *)dataID measureReult:(NSInteger)result{ + NSLog(@"结果:%d",(int)result); +// NSDictionary *resultDic = [NSDictionary dictionaryWithObjectsAndKeys:@(result),@"value",dataID,@"dataID", nil]; + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:device.serialNumber, + 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 sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:device.serialNumber, + kACTION_KEY:kACTION_ENTER_CHARGED_STATE, + }]; + }else{ + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:device.serialNumber, + kACTION_KEY:kACTION_LEAVE_CHARGED_STATE, + }]; + + } + +} + + +//断开连接 +RCT_EXPORT_METHOD(disConnect:(nonnull NSString *)mac){ + if ([self getDeviceWithMac:mac]!=nil) { + + [[self getDeviceWithMac:mac] disconnectDevice]; + }else{ + + } +} + +//开始离线数据修正 +RCT_EXPORT_METHOD(adjustOfflineData:(nonnull NSString *)mac timeString:(nonnull NSString *)timeString array:(nonnull NSArray *)array ){ + if ([self getDeviceWithMac:mac]!=nil) { + + if (array.count > 0 ) { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSDate *date = [formatter dateFromString:timeString]; + + NSArray *correctArray = [[self getDeviceWithMac:mac] processData:array deviceDate:date]; + } + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ADJUST_OFFLINE_DATA, + }]; + + }else{ + [self sendNoMatchedDeviceEventWithMac:mac]; + + } +} + +- (void)sendMeasureErrorEventWithMac:(NSString *)mac errorId:(BG5SError)errorId{ + + + NSString *errorDescription = @""; + + switch (errorId) { + case 0: + errorDescription = @"Only showed in BG5S's screen and need charging."; + break; + case 1: + errorDescription = @"Strip removed in the middle of reading, repeat the test with a new strip."; + break; + case 2: + errorDescription = @"Reference voltage error, not normal measurement, please repeat the test."; + break; + case 3: + errorDescription = @"Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip."; + break; + case 4: + errorDescription = @"Reading transmission error. Repeat the test with a new test strip. If the problem persists, contact iHealth customer service for assistance."; + break; + case 5: + errorDescription = @"The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test."; + break; + case 6: + errorDescription = @"The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test."; + break; + case 7: + errorDescription = @"Only showed in BG5S's screen."; + break; + case 8: + errorDescription = @"Glucose test result is low."; + break; + case 9: + errorDescription = @"Glucose test result is high."; + break; + case 10: + errorDescription = @"Reset and if the problem persists, contact iHealth customer service for assistance."; + break; + case 400: + errorDescription = @"arameter input error."; + break; + case 401: + errorDescription = @"Quantity not match"; + break; + case 402: + errorDescription = @"Single packet is not full."; + break; + case 403: + errorDescription = @"Packet index not match."; + break; + case 500: + errorDescription = @"Command timeout"; + break; + case 501: + errorDescription = @"Command is not supported for current device."; + break; + default: + break; + } + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ERROR_BG, + kERROR_NUM_BG:@(errorId), + kERROR_DESCRIPTION_BG:errorDescription + }]; +} + + +- (void)sendNoMatchedDeviceEventWithMac:(NSString *)mac{ + if (mac && mac.length > 0) { + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_ERROR_BG, + kERROR_NUM_BG:@100 + }]; + } else { + [self sendEventWithName:EVENT_NOTIFY body:@{ + kACTION_KEY:kACTION_ERROR_BG, + + kERROR_NUM_BG:@100, + kERROR_DESCRIPTION_BG:@"Device disconnect." + + }]; + } +} + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.h new file mode 100644 index 0000000..e26770a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.h @@ -0,0 +1,85 @@ +// +// BG5SProfileModule.h +// ReactNativeIOSLibrary +// +// Created by soso on 2019/4/24. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + + +// Commom in BG5Module.js & BG5LModule.js +#define kACTION_ERROR_BG @"ACTION_ERROR_BG" +#define kACTION_GET_STATUS_INFO @"ACTION_GET_STATUS_INFO" +#define kACTION_SET_TIME @"ACTION_SET_TIME" +#define kACTION_SET_UNIT @"ACTION_SET_UNIT" +#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_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" +#define kACTION_GET_BOTTLEID @"ACTION_GET_BOTTLEID" +#define kACTION_STRIP_IN @"ACTION_STRIP_IN" +#define kACTION_STRIP_OUT @"ACTION_STRIP_OUT" +#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 kERROR_NUM_BG @"ERROR_NUM_BG" +#define kERROR_DESCRIPTION_BG @"ERROR_DESCRIPTION_BG" +#define kGET_BATTERY @"GET_BATTERY" +#define kGET_OFFLINEDATA_COUNT @"GET_OFFLINEDATA_COUNT" +#define kGET_OFFLINEDATA @"GET_OFFLINEDATA" +#define kSET_BOTTLEMESSAGE @"SET_BOTTLEMESSAGE" +#define kSTART_MODE @"START_MODE" +#define kGET_EXPIRECTIME @"GET_EXPIRECTIME" +#define kGET_USENUM @"GET_USENUM" +#define kGET_BOTTLEID @"GET_BOTTLEID" +#define kONLINE_RESULT_BG @"ONLINE_RESULT_BG" +#define kDATA_ID @"DATA_ID" +#define kACTION_CODE_ANALYSIS @"ACTION_CODE_ANALYSIS" +#define kSTRIP_NUM_BG @"STRIP_NUM_BG" +#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, + RNBGError_InputParameterError = 400, + RNBGError_FunctionCallOrderError = 402, + RNBGError_MeasureModeNotMatched = 403, + RNBGError_DisconnectFunctionNotSupportIniOSPlatform = 404, // only for BG5s + RNBGError_getBottleInfoFromQRFunctionInpurParameterError = 405, +}; + +@interface BG5SProfileModule : NSObject + +@end + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.m new file mode 100644 index 0000000..a80fcd2 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BG5SProfileModule.m @@ -0,0 +1,84 @@ +// +// BG5SProfileModule.m +// ReactNativeIOSLibrary +// +// Created by soso on 2019/4/24. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "BG5SProfileModule.h" +#import "RNBGMacro.h" + +@implementation BG5SProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + + + + return @{ + @"Event_Notify":@"event_notify_bg5s", + kRN_ACTION_ERROR_BG :kACTION_ERROR_BG, + kRN_ACTION_SET_TIME :kACTION_SET_TIME, + kRN_ACTION_SET_UNIT :kACTION_SET_UNIT, + 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_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, + kRN_ACTION_GET_BOTTLEID :kACTION_GET_BOTTLEID, + kRN_ACTION_STRIP_IN :kACTION_STRIP_IN, + kRN_ACTION_STRIP_OUT :kACTION_STRIP_OUT, + kRN_ACTION_GET_BLOOD :kACTION_GET_BLOOD, + kRN_ACTION_ONLINE_RESULT_BG :kACTION_ONLINE_RESULT_BG, + kRN_ACTION_CODE_ANALYSIS :kACTION_CODE_ANALYSIS, + kRN_ACTION_GET_ALL_CONNECTED_DEVICES :kACTION_GET_ALL_CONNECTED_DEVICES, + kRN_ERROR_NUM_BG :kERROR_NUM_BG, + kRN_ERROR_DESCRIPTION_BG :kERROR_DESCRIPTION_BG, + kRN_GET_BATTERY :kGET_BATTERY, + kRN_GET_OFFLINEDATA_COUNT :kGET_OFFLINEDATA_COUNT, + kRN_GET_OFFLINEDATA :kGET_OFFLINEDATA, + kRN_SET_BOTTLEMESSAGE :kSET_BOTTLEMESSAGE, + kRN_START_MODE :kSTART_MODE, + kRN_GET_EXPIRECTIME :kGET_EXPIRECTIME, + kRN_GET_USENUM :kGET_USENUM, + kRN_GET_BOTTLEID :kGET_BOTTLEID, + kRN_ONLINE_RESULT_BG :kONLINE_RESULT_BG, + kRN_DATA_ID :kDATA_ID, + kRN_STRIP_NUM_BG :kSTRIP_NUM_BG, + kRN_STRIP_EXPIRETIME_BG :kSTRIP_EXPIRETIME_BG, + kRN_BOTTLEID_BG :kBOTTLEID_BG, + kRN_ACTION_DELETE_USED_STRIP :kACTION_DELETE_USED_STRIP, + kRN_ACTION_ADJUST_OFFLINE_DATA :kACTION_ADJUST_OFFLINE_DATA, + 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, + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.h new file mode 100755 index 0000000..0c6f3b0 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.h @@ -0,0 +1,65 @@ +// +// BGProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + + +// Commom in BG5Module.js & BG5LModule.js +#define kACTION_ERROR_BG @"ACTION_ERROR_BG" +#define kACTION_KEEP_LINK @"ACTION_KEEP_LINK" +#define kACTION_SET_TIME @"ACTION_SET_TIME" +#define kACTION_SET_UNIT @"ACTION_SET_UNIT" +#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_SET_BOTTLEMESSAGE @"ACTION_SET_BOTTLEMESSAGE" +#define kACTION_GET_BOTTLEMESSAGE @"ACTION_GET_BOTTLEMESSAGE" +#define kACTION_SET_BOTTLEID @"ACTION_SET_BOTTLEID" +#define kACTION_GET_BOTTLEID @"ACTION_GET_BOTTLEID" +#define kACTION_STRIP_IN @"ACTION_STRIP_IN" +#define kACTION_STRIP_OUT @"ACTION_STRIP_OUT" +#define kACTION_GET_BLOOD @"ACTION_GET_BLOOD" +#define kACTION_ONLINE_RESULT_BG @"ACTION_ONLINE_RESULT_BG" +#define kACTION_CODE_ANALYSIS @"ACTION_CODE_ANALYSIS" +#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" + +#define kERROR_NUM_BG @"ERROR_NUM_BG" +#define kERROR_DESCRIPTION_BG @"ERROR_DESCRIPTION_BG" +#define kGET_BATTERY @"GET_BATTERY" +#define kGET_OFFLINEDATA_COUNT @"GET_OFFLINEDATA_COUNT" +#define kGET_OFFLINEDATA @"GET_OFFLINEDATA" +#define kSET_BOTTLEMESSAGE @"SET_BOTTLEMESSAGE" +#define kSTART_MODE @"START_MODE" +#define kGET_EXPIRECTIME @"GET_EXPIRECTIME" +#define kGET_USENUM @"GET_USENUM" +#define kGET_BOTTLEID @"GET_BOTTLEID" +#define kONLINE_RESULT_BG @"ONLINE_RESULT_BG" +#define kDATA_ID @"DATA_ID" +#define kSTRIP_NUM_BG @"STRIP_NUM_BG" +#define kSTRIP_EXPIRETIME_BG @"STRIP_EXPIRETIME_BG" +#define kBOTTLEID_BG @"BOTTLEID_BG" + +typedef NS_ENUM(NSInteger,RNBGError) { + RNBGError_Unknown = -1, + RNBGError_InputParameterError = 400, + RNBGError_FunctionCallOrderError = 402, + RNBGError_MeasureModeNotMatched = 403, + RNBGError_DisconnectFunctionNotSupportIniOSPlatform = 404, // only for BG5 + RNBGError_getBottleInfoFromQRFunctionInpurParameterError = 405, +}; + +@interface BGProfileModule : NSObject + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.m new file mode 100755 index 0000000..fd7a27c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BGProfileModule.m @@ -0,0 +1,69 @@ +// +// BGProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BGProfileModule.h" +#import "RNBGMacro.h" + +@implementation BGProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":@"event_notify_bg5", + kRN_ACTION_ERROR_BG :kACTION_ERROR_BG, + kRN_ACTION_KEEP_LINK :kACTION_KEEP_LINK, + kRN_ACTION_SET_TIME :kACTION_SET_TIME, + kRN_ACTION_SET_UNIT :kACTION_SET_UNIT, + 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_SET_BOTTLEMESSAGE :kACTION_SET_BOTTLEMESSAGE, + kRN_ACTION_GET_BOTTLEMESSAGE :kACTION_GET_BOTTLEMESSAGE, + kRN_ACTION_SET_BOTTLEID :kACTION_SET_BOTTLEID, + kRN_ACTION_GET_BOTTLEID :kACTION_GET_BOTTLEID, + kRN_ACTION_STRIP_IN :kACTION_STRIP_IN, + kRN_ACTION_STRIP_OUT :kACTION_STRIP_OUT, + kRN_ACTION_GET_BLOOD :kACTION_GET_BLOOD, + kRN_ACTION_ONLINE_RESULT_BG :kACTION_ONLINE_RESULT_BG, + kRN_ACTION_CODE_ANALYSIS :kACTION_CODE_ANALYSIS, + kRN_ACTION_GET_ALL_CONNECTED_DEVICES:kACTION_GET_ALL_CONNECTED_DEVICES, + + kRN_ERROR_NUM_BG :kERROR_NUM_BG, + kRN_ERROR_DESCRIPTION_BG :kERROR_DESCRIPTION_BG, + kRN_GET_BATTERY :kGET_BATTERY, + kRN_GET_OFFLINEDATA_COUNT :kGET_OFFLINEDATA_COUNT, + kRN_GET_OFFLINEDATA :kGET_OFFLINEDATA, + kRN_SET_BOTTLEMESSAGE :kSET_BOTTLEMESSAGE, + kRN_START_MODE :kSTART_MODE, + kRN_GET_EXPIRECTIME :kGET_EXPIRECTIME, + kRN_GET_USENUM :kGET_USENUM, + kRN_GET_BOTTLEID :kGET_BOTTLEID, + kRN_ONLINE_RESULT_BG :kONLINE_RESULT_BG, + kRN_DATA_ID :kDATA_ID, + kRN_STRIP_NUM_BG :kSTRIP_NUM_BG, + kRN_STRIP_EXPIRETIME_BG :kSTRIP_EXPIRETIME_BG, + kRN_BOTTLEID_BG :kBOTTLEID_BG, + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.h new file mode 100755 index 0000000..afb5df9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.h @@ -0,0 +1,19 @@ +// +// BP3LModule.h +// ReactNativeIOSLibrary +// +// Created by Liu Yanbo on 2016/12/05. +// Copyright © 2016年 Liu Yanbo. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface BP3LModule : RCTEventEmitter + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.m new file mode 100755 index 0000000..05adb0c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP3LModule.m @@ -0,0 +1,226 @@ +// +// BP3LModule.m +// ReactNativeIOSLibrary +// +// Created by Liu Yanbo on 2016/12/05. +// Copyright © 2016年 Liu Yanbo. All rights reserved. +// + +#import "BP3LModule.h" +#import "BPProfileModule.h" +#import "BPMacroFile.h" +#import "BP3LController.h" +#import "BP3L.h" +#import "iHealthDeviceManagerModule.h" + +#import "ScanDeviceController.h" +#import "ConnectDeviceController.h" +#define EVENT_NOTIFY @"BP3L.MODULE.NOTIFY" + +@interface BP3LModule () +@property (nonatomic, assign) BOOL isMeasuring; + +@end + +@implementation BP3LModule +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":EVENT_NOTIFY, + + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +-(BP3L*)getDeviceWithMac:(NSString*)mac{ + + BP3LController *controller = [BP3LController shareBP3LController]; + NSArray *bpDeviceArray = [controller getAllCurrentBP3LInstace]; + + for(BP3L *tempDevice in bpDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + + return tempDevice; + } + } + + return nil; +} + + +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*bp3larray= [[BP3LController shareBP3LController] getAllCurrentBP3LInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[bp3larray count]; i++) { + + BP3L*bp3l=[bp3larray objectAtIndex:i]; + + [deviceMacArray addObject:bp3l.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + + +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + + [[self getDeviceWithMac:mac] commandStartMeasureWithZeroingState:^(BOOL isComplete) { + weakSelf.isMeasuring = YES; + NSDictionary* response = @{ + kACTION:isComplete ? kACTION_ZOREING_BP : kACTION_ZOREOVER_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } pressure:^(NSArray *pressureArr) { + weakSelf.isMeasuring = YES; + NSLog(@"pressure %@",pressureArr); + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_PRESSURE_BP, + kBLOOD_PRESSURE_BP:pressureArr.firstObject, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } waveletWithHeartbeat:^(NSArray *waveletArr) { + weakSelf.isMeasuring = YES; + NSLog(@"xiaoboWithHeart %@",waveletArr); + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_PULSEWAVE_BP, + kFLAG_HEARTBEAT_BP:@(1), + kPULSEWAVE_BP:waveletArr + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } waveletWithoutHeartbeat:^(NSArray *waveletArr) { + weakSelf.isMeasuring = YES; + NSLog(@"xiaoboNoHeart %@",waveletArr); + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_PULSEWAVE_BP, + kFLAG_HEARTBEAT_BP:@(0), + kPULSEWAVE_BP:waveletArr + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } result:^(NSDictionary *resultDict) { + weakSelf.isMeasuring = NO; + NSLog(@"result %@",resultDict); + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_RESULT_BP, + kHIGH_BLOOD_PRESSURE_BP:resultDict[@"sys"], + kLOW_BLOOD_PRESSURE_BP:resultDict[@"dia"], + kPULSE_BP:resultDict[@"heartRate"], + kMEASUREMENT_AHR_BP:resultDict[@"irregular"], + kDATAID:resultDict[@"dataID"], + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + weakSelf.isMeasuring = NO; + NSLog(@"error %d",error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + }else{ + self.isMeasuring = NO; + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + + +RCT_EXPORT_METHOD(stopMeasure:(nonnull NSString *)mac){ + if (!self.isMeasuring) { + NSLog(@"error %d",401); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:401]; + return; + } + __weak typeof(self) weakSelf = self; + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] stopBPMeassureSuccessBlock:^{ + + weakSelf.isMeasuring = NO; + NSDictionary* response = @{ + kACTION:kACTION_INTERRUPTED_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + NSLog(@"error %d",error); + weakSelf.isMeasuring = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + + }else{ + weakSelf.isMeasuring = NO; + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandEnergy:^(NSNumber *energyValue) { + NSDictionary* response = @{ + kACTION:kACTION_BATTERY_BP, + kBATTERY_BP:energyValue + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %d",error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] commandDisconnectDevice]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.h new file mode 100755 index 0000000..ab2b804 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.h @@ -0,0 +1,23 @@ +// +// BP550BTModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + + +@interface BP550BTModule : RCTEventEmitter +{ + +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.m new file mode 100755 index 0000000..e8976be --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP550BTModule.m @@ -0,0 +1,318 @@ +// +// BP550BTModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BP550BTModule.h" +#import "KN550BT.h" +#import "KN550BTController.h" +#import "BPProfileModule.h" +#import "iHealthDeviceManagerModule.h" +#import "ScanDeviceController.h" +#import "ConnectDeviceController.h" +#define EVENT_NOTIFY @"event_notify_bp550bt" + +@implementation BP550BTModule + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":EVENT_NOTIFY, + + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + +// [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceConnectForKN550BT:) name:KN550BTConnectNoti object:nil]; +// [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceDisConnectForKN550BT:) name:KN550BTDisConnectNoti object:nil]; + + [KN550BTController shareKN550BTController]; + + } + return self; +} + + +-(KN550BT*)getDeviceWithMac:(NSString*)mac{ + + KN550BTController *controller = [KN550BTController shareKN550BTController]; + NSArray *bpDeviceArray = [controller getAllCurrentKN550BTInstace]; + + for(KN550BT *tempDevice in bpDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + +// tempDevice.reactNativeFlg = @YES; + return tempDevice; + } + } + + return nil; +} + + +//-(void)DeviceConnectForKN550BT:(NSNotification *)tempNoti{ +// KN550BTController *controller = [KN550BTController shareKN550BTController]; +// NSArray *BPDeviceArray = [controller getAllCurrentKN550BTInstace]; +// +// KN550BT *bpInstance = [BPDeviceArray objectAtIndex:0]; +// NSString *mac = bpInstance.currentUUID; +// NSDictionary *IDPSDic = [tempNoti userInfo]; +// +// NSDictionary* deviceInfo = @{ +// kACTION:@"kn550bt_connected_bg",@"idps":IDPSDic }; +// [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; +// +//} +// +//-(void)DeviceDisConnectForKN550BT:(NSNotification *)tempNoti{ +// +// NSDictionary *IDPSDic = [tempNoti userInfo]; +// NSString *mac = [IDPSDic objectForKey:@"SerialNumber"]; +// +// NSDictionary* deviceInfo = @{@"mac":mac,@"action":@"kn550bt_disconnected_bg",@"idps":IDPSDic}; +// [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +// +//} + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*bp550array= [[KN550BTController shareKN550BTController] getAllCurrentKN550BTInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[bp550array count]; i++) { + + KN550BT*kn550bt=[bp550array objectAtIndex:i]; + + [deviceMacArray addObject:kn550bt.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + + +#pragma mark - Method + +RCT_EXPORT_METHOD(getFunctionInfo:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandFunction:^(NSDictionary *dic) { + + NSDictionary* response = @{ + kACTION:kACTION_FUNCTION_INFORMATION_BP, + kFUNCTION_IS_UPAIR_MEASURE: [dic objectForKey:@"upAirMeasureFlg"], + kFUNCTION_IS_ARM_MEASURE: [dic objectForKey:@"armMeasureFlg"], + kFUNCTION_HAVE_ANGLE_SENSOR: [dic objectForKey:@"haveAngleSensor"], + kFUNCTION_HAVE_OFFLINE: [dic objectForKey:@"haveOffline"], + kFUNCTION_HAVE_HSD: [dic objectForKey:@"haveHSD"], + kFUNCTION_HAVE_ANGLE_SETTING: [dic objectForKey:@"haveAngleSet"], + kFUNCTION_IS_MULTI_UPLOAD: [dic objectForKey:@"mutableUpload"], + kFUNCTION_HAVE_SELF_UPDATE: [dic objectForKey: @"selfUpdate"], + kType:@"KN550", + kMAC:mac + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + }else{ + + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + + } + + +} + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandEnergy:^(NSNumber *energyValue) { + + NSDictionary* response = @{ + kACTION:kACTION_BATTERY_BP, + kBATTERY_BP:energyValue, + kType:@"KN550", + kMAC:mac + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + NSLog(@"%@",response); + + } errorBlock:^(BPDeviceError error) { + + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + }else{ + + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +RCT_EXPORT_METHOD(getOffLineNum:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac]commandTransferMemoryTotalCount:^(NSNumber *num) { + + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_NUM_BP, + kHISTORICAL_NUM_BP:num, + kType:@"KN550", + kMAC:mac + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + + } + + +} + +RCT_EXPORT_METHOD(getOffLineData:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + + [[self getDeviceWithMac:mac] commandTransferMemoryDataWithTotalCount:^(NSNumber *count) { + if ([count integerValue] == 0) { + NSDictionary* response = @{kACTION:kACTION_HISTORICAL_DATA_BP }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + } progress:^(NSNumber *progress) { + + } dataArray:^(NSArray *array) { + NSMutableArray * tempArr = [[NSMutableArray alloc]init]; + + for(NSDictionary *history in array) + { + NSDate *tempDate = [history objectForKey:@"time"]; + + //将时间格式转化成字符串,适配plugin和react native【 + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + + NSNumber*bpHSD=[history valueForKey:@"hsdValue"]; + NSDictionary *dic=[NSDictionary dictionary]; + if (bpHSD!=nil) { + dic = @{ + kMEASUREMENT_DATE_BP: dateStr, + kLOW_BLOOD_PRESSURE_BP: [history objectForKey:@"dia"], + kHIGH_BLOOD_PRESSURE_BP: [history objectForKey:@"sys"], + kMEASUREMENT_AHR_BP: [history objectForKey:@"irregular"], + kPULSE_BP: [history objectForKey:@"heartRate"], + kDATAID: [history objectForKey:@"dataID"], + kMEASUREMENT_HSD_BP: history[@"hsdValue"], + kType:@"KN550", + kMAC:mac + }; + }else{ + + + dic = @{ + kMEASUREMENT_DATE_BP: dateStr, + kLOW_BLOOD_PRESSURE_BP: [history objectForKey:@"dia"], + kHIGH_BLOOD_PRESSURE_BP: [history objectForKey:@"sys"], + kMEASUREMENT_AHR_BP: [history objectForKey:@"irregular"], + kPULSE_BP: [history objectForKey:@"heartRate"], + kDATAID: [history objectForKey:@"dataID"], + kType:@"KN550", + kMAC:mac + + }; + } + + + + [tempArr addObject:dic]; + + } + + if (tempArr.count > 0) { + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_DATA_BP, + kHISTORICAL_DATA_BP:[tempArr copy], + kType:@"KN550", + kMAC:mac + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + }else{ + + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + + [[self getDeviceWithMac:mac] commandDisconnectDevice]; + + }else{ + + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + + } + + +} + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.h new file mode 100755 index 0000000..0f49db2 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.h @@ -0,0 +1,23 @@ +// +// BP5Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface BP5Module : RCTEventEmitter + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.m new file mode 100644 index 0000000..4804e9c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5Module.m @@ -0,0 +1,501 @@ +// +// BP5Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BP5Module.h" +#import "BPProfileModule.h" +#import "BPMacroFile.h" +#import "BP5Controller.h" +#import "BP5.h" +#import "iHealthDeviceManagerModule.h" + +@interface BP5Module() +@property (nonatomic, strong) NSNumber* previousPressure; +@property (nonatomic, assign) BOOL startSendWavelet; +@property (nonatomic, assign) BOOL isMeasuring; + +@end +@implementation BP5Module +#define EVENT_NOTIFY @"BP5.MODULE.NOTIFY" +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":EVENT_NOTIFY, + + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +#pragma mark +#pragma mark - Init + +-(BP5*)getBP5WithMac:(NSString*)mac{ + + BP5Controller *controller = [BP5Controller shareBP5Controller]; + NSArray *bpDeviceArray = [controller getAllCurrentBP5Instace]; + + for(BP5 *tempDevice in bpDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + + return tempDevice; + } + } + + return nil; + +// static BP5* bp5Device = nil; +// if (!bp5Device) { +// BP5Controller *controller = [BP5Controller shareBP5Controller]; +// NSArray *bpDeviceArray = [controller getAllCurrentBP5Instace]; +// +// for(BP5 *tempBP5 in bpDeviceArray){ +// if([mac isEqualToString:tempBP5.serialNumber]){ +// +// bp5Device = tempBP5; +// break; +// } +// } +// } +// +// +// return bp5Device; +} + +#pragma mark +#pragma mark - Notification +#pragma mark - BP5 +//-(void)DeviceConnectForBP5:(NSNotification *)tempNoti{ +// BP5Controller *controller = [BP5Controller shareBP5Controller]; +// NSArray *bpDeviceArray = [controller getAllCurrentBP5Instace]; +// +// BP5 *bpInstance = [bpDeviceArray objectAtIndex:0]; +// +//} +// +//- (void)DeviceDisConnectForBP5:(NSNotification*)tempNoti{ +// +//} + + + + +#pragma mark +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*bp5array= [[BP5Controller shareBP5Controller] getAllCurrentBP5Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[bp5array count]; i++) { + + BP5*bp5=[bp5array objectAtIndex:i]; + + [deviceMacArray addObject:bp5.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + + + +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac){ + + _previousPressure = @(0); + self.startSendWavelet = NO; + if ([self getBP5WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP5WithMac:mac] commandStartMeasureWithZeroingState:^(BOOL isComplete) { + weakSelf.isMeasuring = YES; + NSDictionary* response = @{ + kACTION:isComplete ? kACTION_ZOREING_BP : kACTION_ZOREOVER_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } pressure:^(NSArray *pressureArr) { + NSLog(@"pressure %@",pressureArr); + weakSelf.isMeasuring = YES; + [weakSelf sendPresssre:pressureArr.firstObject wavelet:nil isHeartPulse:NO]; + } waveletWithHeartbeat:^(NSArray *waveletArr) { + NSLog(@"xiaoboWithHeart %@",waveletArr); + weakSelf.isMeasuring = YES; + [weakSelf sendPresssre:nil wavelet:waveletArr isHeartPulse:YES]; + } waveletWithoutHeartbeat:^(NSArray *waveletArr) { + weakSelf.isMeasuring = YES; + NSLog(@"xiaoboNoHeart %@",waveletArr); + [weakSelf sendPresssre:nil wavelet:waveletArr isHeartPulse:NO]; + } result:^(NSDictionary *resultDict) { + NSLog(@"result %@",resultDict); + weakSelf.startSendWavelet = NO; + weakSelf.isMeasuring = NO; + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_RESULT_BP, + kHIGH_BLOOD_PRESSURE_BP:resultDict[@"sys"], + kLOW_BLOOD_PRESSURE_BP:resultDict[@"dia"], + kPULSE_BP:resultDict[@"heartRate"], + kMEASUREMENT_AHR_BP:resultDict[@"irregular"], + kDATAID:resultDict[@"dataID"], + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %lu",(unsigned long)error); + weakSelf.startSendWavelet = NO; + weakSelf.isMeasuring = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + + }else{ + + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + self.isMeasuring = NO; + } + + +} + +- (void)sendPresssre:(NSNumber*)pressure wavelet:(NSArray*)waveletArray isHeartPulse:(BOOL)heartPulse{ + + if (pressure) { + self.previousPressure = pressure; + } + if (waveletArray.count > 0) { + self.startSendWavelet = YES; + } + if (pressure && !self.startSendWavelet) { + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_PRESSURE_BP, + kBLOOD_PRESSURE_BP:pressure, + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + }else if (waveletArray.count > 0 && self.startSendWavelet){ + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_PULSEWAVE_BP, + kBLOOD_PRESSURE_BP:self.previousPressure, + kFLAG_HEARTBEAT_BP:@(heartPulse), + kPULSEWAVE_BP:waveletArray + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } +} + + +RCT_EXPORT_METHOD(stopMeasure:(nonnull NSString *)mac){ + + if (!self.isMeasuring) { + NSLog(@"error %d",401); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:401]; + return; + } + if ([self getBP5WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + + [[self getBP5WithMac:mac] stopBPMeassureSuccessBlock:^{ + + } errorBlock:^(BPDeviceError error) { + + NSLog(@"error %lu",(unsigned long)error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + NSDictionary* response = @{ + kACTION:kACTION_INTERRUPTED_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + weakSelf.isMeasuring = NO; + }); + }else{ + + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + self.isMeasuring = NO; + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + + } + +} + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + + if ([self getBP5WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP5WithMac:mac] commandEnergy:^(NSNumber *energyValue) { + NSDictionary* response = @{ + kACTION:kACTION_BATTERY_BP, + kBATTERY_BP:energyValue + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %lu",(unsigned long)error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + }else{ + + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + + } + + + + +} + + +RCT_EXPORT_METHOD(enbleOffline:(nonnull NSString *)mac){ + + + if ([self getBP5WithMac:mac]!=nil) { + __block BOOL success = YES; + __weak typeof(self) weakSelf = self; + [[self getBP5WithMac:mac] commandSetOffline:YES errorBlock:^(BPDeviceError error) { + success = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (success) { + NSDictionary* response = @{ + kACTION:kACTION_ENABLE_OFFLINE_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + }); + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + +} + + +RCT_EXPORT_METHOD(disableOffline:(nonnull NSString *)mac){ + + + if ([self getBP5WithMac:mac]!=nil) { + __block BOOL success = YES; + __weak typeof(self) weakSelf = self; + [[self getBP5WithMac:mac] commandSetOffline:NO errorBlock:^(BPDeviceError error) { + success = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (success) { + NSDictionary* response = @{ + kACTION:kACTION_DISENABLE_OFFLINE_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + }); + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + + +RCT_EXPORT_METHOD(isEnableOffline:(nonnull NSString *)mac){ + + + if ([self getBP5WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP5WithMac:mac] commandFunction:^(NSDictionary *dic) { + NSDictionary* response = @{ + kACTION:kACTION_IS_ENABLE_OFFLINE, + kIS_ENABLE_OFFLINE:dic[@"offlineOpen"] + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + +} + + + +RCT_EXPORT_METHOD(getOfflineNum:(nonnull NSString *)mac){ + + + + if ([self getBP5WithMac:mac]!=nil) { + + __weak typeof(self) weakSelf = self; + + [[self getBP5WithMac:mac] commandTransferMemoryTotalCount:^(NSNumber *count) { + + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_NUM_BP, + kHISTORICAL_NUM_BP:count + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + }]; + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + + +// if ([self getBP5WithMac:mac]!=nil) { +// __weak typeof(self) weakSelf = self; +// +// [[self getBP5WithMac:mac] commandBatchUpload:^(NSNumber *count) { +// NSDictionary* response = @{ +// kACTION:kACTION_HISTORICAL_NUM_BP, +// kHISTORICAL_NUM_BP:count +// }; +// [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; +// +// } progress:^(NSNumber *progressValue) { +// +// } dataArray:^(NSArray *bachArray) { +// NSMutableArray * historyDataArray = [NSMutableArray array]; +// +// for(NSDictionary *dataDict in bachArray) +// { +// +// NSDate *date = [dataDict objectForKey:@"time"]; +// +// //将时间格式转化成字符串,适配plugin和react native +// NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; +// [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; +// NSString *dateStr = [mydateFormatter stringFromDate:date]; +// NSDictionary* historyDataDict = @{ +// kMEASUREMENT_DATE_BP:dateStr, +// kHIGH_BLOOD_PRESSURE_BP:dataDict[@"sys"], +// kLOW_BLOOD_PRESSURE_BP:dataDict[@"dia"], +// kPULSE_BP:dataDict[@"heartRate"], +// kMEASUREMENT_AHR_BP:dataDict[@"irregular"], +// // kMEASUREMENT_HSD_BP:dataDict[@"hsdValue"], +// kDATAID:dataDict[@"dataID"] +// }; +// [historyDataArray addObject:historyDataDict]; +// +// +// } +// +// if (historyDataArray.count > 0) { +// NSDictionary* deviceInfo = @{kACTION:kACTION_HISTORICAL_DATA_BP,kHISTORICAL_DATA_BP:[historyDataArray copy] }; +// [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:deviceInfo]; +// } +// +// } errorBlock:^(BPDeviceError error) { +// [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; +// +// }]; +// +// }else{ +// [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; +// } +} + + + +RCT_EXPORT_METHOD(getOfflineData:(nonnull NSString *)mac){ + + + if ([self getBP5WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP5WithMac:mac] commandBatchUpload:^(NSNumber *count) { + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_NUM_BP, + kHISTORICAL_NUM_BP:count + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } progress:^(NSNumber *progressValue) { + + } dataArray:^(NSArray *bachArray) { + NSMutableArray * historyDataArray = [NSMutableArray array]; + + for(NSDictionary *dataDict in bachArray) + { + + NSDate *date = [dataDict objectForKey:@"time"]; + + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:date]; + NSDictionary* historyDataDict = @{ + kMEASUREMENT_DATE_BP:dateStr, + kHIGH_BLOOD_PRESSURE_BP:dataDict[@"sys"], + kLOW_BLOOD_PRESSURE_BP:dataDict[@"dia"], + kPULSE_BP:dataDict[@"heartRate"], + kMEASUREMENT_AHR_BP:dataDict[@"irregular"], + // kMEASUREMENT_HSD_BP:dataDict[@"hsdValue"], + kDATAID:dataDict[@"dataID"] + }; + [historyDataArray addObject:historyDataDict]; + + + } + + if (historyDataArray.count > 0) { + NSDictionary* deviceInfo = @{kACTION:kACTION_HISTORICAL_DATA_BP,kHISTORICAL_DATA_BP:[historyDataArray copy] }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:deviceInfo]; + } + + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + +} + + + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + NSLog(@"iOS doesn't support disconnect normal BT devices"); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:900]; + +} + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.h new file mode 100644 index 0000000..f2ff6ba --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.h @@ -0,0 +1,19 @@ +// +// BP5SModule.h +// ReactNativeIOSLibrary +// +// Created by soso on 2019/4/17. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface BP5SModule : RCTEventEmitter + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.m new file mode 100644 index 0000000..332fe67 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP5SModule.m @@ -0,0 +1,426 @@ +// +// BP5SModule.m +// ReactNativeIOSLibrary +// +// Created by soso on 2019/4/17. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "BP5SModule.h" + +#import "BPProfileModule.h" +#import "BPMacroFile.h" +#import "BP5SController.h" +#import "BP5S.h" +#import "iHealthDeviceManagerModule.h" + +#import "ScanDeviceController.h" +#import "ConnectDeviceController.h" +#define EVENT_NOTIFY @"BP5S.MODULE.NOTIFY" + +@interface BP5SModule () +@property (nonatomic, assign) BOOL isMeasuring; + +@end + + +@implementation BP5SModule +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":EVENT_NOTIFY, + + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +-(BP5S*)getDeviceWithMac:(NSString*)mac{ + + BP5SController *controller = [BP5SController sharedController]; + NSArray *bpDeviceArray = [controller getAllCurrentInstance]; + + for(BP5S *tempDevice in bpDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + + return tempDevice; + } + } + + return nil; +} + + +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray *bp5sArray= [[BP5SController sharedController] getAllCurrentInstance]; + + NSMutableArray *deviceMacArray = [NSMutableArray array]; + + for (int i=0; i<[bp5sArray count]; i++) { + + BP5S *bp5s=[bp5sArray objectAtIndex:i]; + + [deviceMacArray addObject:bp5s.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + +} + + +//开始测量 +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + + [[self getDeviceWithMac:mac] commandStartMeasureWithZeroingState:^(BOOL isComplete) { + weakSelf.isMeasuring = YES; + NSDictionary* response = @{ + @"mac":mac, + kACTION:isComplete ? kACTION_ZOREING_BP : kACTION_ZOREOVER_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } pressure:^(NSArray *pressureArr) { + weakSelf.isMeasuring = YES; + NSLog(@"pressure %@",pressureArr); + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_ONLINE_PRESSURE_BP, + kBLOOD_PRESSURE_BP:pressureArr.firstObject, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } waveletWithHeartbeat:^(NSArray *waveletArr) { + weakSelf.isMeasuring = YES; + NSLog(@"xiaoboWithHeart %@",waveletArr); + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_ONLINE_PULSEWAVE_BP, + kFLAG_HEARTBEAT_BP:@(1), + kPULSEWAVE_BP:waveletArr + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } waveletWithoutHeartbeat:^(NSArray *waveletArr) { + weakSelf.isMeasuring = YES; + NSLog(@"xiaoboNoHeart %@",waveletArr); + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_ONLINE_PULSEWAVE_BP, + kFLAG_HEARTBEAT_BP:@(0), + kPULSEWAVE_BP:waveletArr + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } result:^(NSDictionary *resultDict) { + weakSelf.isMeasuring = NO; + NSLog(@"result %@",resultDict); + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_ONLINE_RESULT_BP, + kHIGH_BLOOD_PRESSURE_BP:resultDict[@"sys"], + kLOW_BLOOD_PRESSURE_BP:resultDict[@"dia"], + kPULSE_BP:resultDict[@"heartRate"], + kMEASUREMENT_AHR_BP:resultDict[@"irregular"], + kDATAID:resultDict[@"dataID"], + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + weakSelf.isMeasuring = NO; + NSLog(@"error %lu",(unsigned long)error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + }else{ + self.isMeasuring = NO; + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } +} + +//停止测量 +RCT_EXPORT_METHOD(stopMeasure:(nonnull NSString *)mac){ + if (!self.isMeasuring) { + NSLog(@"error %d",401); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:401]; + return; + } + __weak typeof(self) weakSelf = self; + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] stopBPMeassureSuccessBlock:^{ + + weakSelf.isMeasuring = NO; + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_INTERRUPTED_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + NSLog(@"error %lu",(unsigned long)error); + weakSelf.isMeasuring = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + + }else{ + weakSelf.isMeasuring = NO; + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +//删除功能 +RCT_EXPORT_METHOD(deleteData:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandDeleteDataSuccessBlock:^{ + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_Delete_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %lu",(unsigned long)error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } +} + +//设置离线功能 +RCT_EXPORT_METHOD(enbleOffline:(nonnull NSString *)mac mode:(nonnull NSNumber *)mode){ + + if ([self getDeviceWithMac:mac]!=nil) { + __block BOOL success = YES; + __weak typeof(self) weakSelf = self; + + BOOL flag; + + if ([mode boolValue] == YES) { + flag = YES; + }else{ + flag = NO; + } + + [[self getDeviceWithMac:mac] commandSetOffline:flag success:^{ + + if (flag == YES) { + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_ENABLE_OFFLINE_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + }else{ + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_DISENABLE_OFFLINE_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + + } error:^(BPDeviceError error) { + success = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } +} + + +//查电量 +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandEnergy:^(NSNumber *energyValue) { + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_BATTERY_BP, + kBATTERY_BP:energyValue + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %lu",(unsigned long)error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } +} + +//查数据数量 +RCT_EXPORT_METHOD(getOffLineNum:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac]commandTransferMemoryTotalCount:^(NSNumber *num) { + + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_HISTORICAL_NUM_BP, + kHISTORICAL_NUM_BP:num + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } +} + + +//查离线数据 +RCT_EXPORT_METHOD(getOffLineData:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + + [[self getDeviceWithMac:mac] commandTransferMemoryDataWithTotalCount:^(NSNumber *count) { + if ([count integerValue] == 0) { + NSDictionary* response = @{@"mac":mac,kACTION:kACTION_HISTORICAL_DATA_BP }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + } progress:^(NSNumber *progress) { + + } dataArray:^(NSArray *array) { + NSMutableArray * tempArr = [[NSMutableArray alloc]init]; + + for(NSDictionary *history in array) + { + + NSNumber *dateNum = [history objectForKey:@"time"]; + + NSDate *tempDate = [NSDate dateWithTimeIntervalSince1970:[dateNum integerValue]]; + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + + NSNumber*bpHSD=[history valueForKey:@"hsdValue"]; + NSDictionary *dic=[NSDictionary dictionary]; + if (bpHSD!=nil) { + dic = @{ + @"mac":mac, + kMEASUREMENT_DATE_BP: dateStr, + kLOW_BLOOD_PRESSURE_BP: [history objectForKey:@"dia"], + kHIGH_BLOOD_PRESSURE_BP: [history objectForKey:@"sys"], + kMEASUREMENT_AHR_BP: [history objectForKey:@"irregular"], + kPULSE_BP: [history objectForKey:@"heartRate"], + kDATAID: [history objectForKey:@"dataID"], + kMEASUREMENT_HSD_BP: history[@"hsdValue"] + }; + }else{ + + + dic = @{ + @"mac":mac, + kMEASUREMENT_DATE_BP: dateStr, + kLOW_BLOOD_PRESSURE_BP: [history objectForKey:@"dia"], + kHIGH_BLOOD_PRESSURE_BP: [history objectForKey:@"sys"], + kMEASUREMENT_AHR_BP: [history objectForKey:@"irregular"], + kPULSE_BP: [history objectForKey:@"heartRate"], + kDATAID: [history objectForKey:@"dataID"] + + }; + } + [tempArr addObject:dic]; + } + + if (tempArr.count > 0) { + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_HISTORICAL_DATA_BP, + kHISTORICAL_DATA_BP:[tempArr copy] + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + }else{ + + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +//查询功能 +RCT_EXPORT_METHOD(getFunctionInfo:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getDeviceWithMac:mac] commandFunction:^(NSDictionary *dic) { + + NSDictionary* response = @{ + @"mac":mac, + kACTION:kACTION_FUNCTION_INFORMATION_BP, + kFUNCTION_IS_UPAIR_MEASURE: [dic objectForKey:@"upAirMeasureFlg"], + kFUNCTION_IS_ARM_MEASURE: [dic objectForKey:@"armMeasureFlg"], + kFUNCTION_HAVE_ANGLE_SENSOR: [dic objectForKey:@"haveAngleSensor"], + kFUNCTION_HAVE_OFFLINE: [dic objectForKey:@"haveOffline"], + kFUNCTION_HAVE_HSD: [dic objectForKey:@"haveHSD"], + kFUNCTION_IS_MULTI_UPLOAD: [dic objectForKey:@"mutableUpload"], + kFUNCTION_HAVE_SELF_UPDATE: [dic objectForKey: @"selfUpdate"]}; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + }else{ + + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } +} + +//离线数据 +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] commandDisconnectDevice]; + }else{ + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } +} + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.h new file mode 100755 index 0000000..cc6aedc --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.h @@ -0,0 +1,23 @@ +// +// BP5Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface BP7Module : RCTEventEmitter + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.m new file mode 100644 index 0000000..7745c0c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7Module.m @@ -0,0 +1,521 @@ +// +// BP7Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BP7Module.h" +#import "BPProfileModule.h" +#import "BPMacroFile.h" +#import "BP7Controller.h" +#import "BP7.h" +#import "iHealthDeviceManagerModule.h" + +@interface BP7Module() +@property (nonatomic, strong) NSNumber* previousPressure; +@property (nonatomic, assign) BOOL startSendWavelet; +@property (nonatomic, assign) BOOL isMeasuring; + +@end +@implementation BP7Module +#define EVENT_NOTIFY @"BP7.MODULE.NOTIFY" +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":EVENT_NOTIFY, + + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +#pragma mark +#pragma mark - Init + +-(BP7*)getBP7WithMac:(NSString*)mac{ + + BP7Controller *controller = [BP7Controller shareBP7Controller]; + NSArray *bpDeviceArray = [controller getAllCurrentBP7Instace]; + + for(BP7 *tempDevice in bpDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + + return tempDevice; + } + } + + return nil; + + +} + +#pragma mark +#pragma mark - Notification +#pragma mark - BP7 + + + + + +#pragma mark +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*bp7array= [[BP7Controller shareBP7Controller] getAllCurrentBP7Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[bp7array count]; i++) { + + BP7*bp7=[bp7array objectAtIndex:i]; + + [deviceMacArray addObject:bp7.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + +RCT_EXPORT_METHOD(conformAngle:(nonnull NSString *)mac){ + + + if ([self getBP7WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + + + [[self getBP7WithMac:mac] commandStartGetAngle:^(NSDictionary *angleDict) { + + + NSDictionary* response = @{ + kACTION:kACTION_ANGLE_BP, + + kANGLE_BP:angleDict[@"angle"], + + kWHICH_ARM:angleDict[@"isLeftHand"] + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + + NSLog(@"error %lu",(unsigned long)error); + + weakSelf.isMeasuring = NO; + + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + + + }else{ + + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + self.isMeasuring = NO; + } + + + + +} + + + + + +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac){ + + _previousPressure = @(0); + self.startSendWavelet = NO; + if ([self getBP7WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP7WithMac:mac] commandStartMeasureWithZeroingState:^(BOOL isComplete) { + weakSelf.isMeasuring = YES; + NSDictionary* response = @{ + kACTION:isComplete ? kACTION_ZOREING_BP : kACTION_ZOREOVER_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } pressure:^(NSArray *pressureArr) { + NSLog(@"pressure %@",pressureArr); + weakSelf.isMeasuring = YES; + [weakSelf sendPresssre:pressureArr.firstObject wavelet:nil isHeartPulse:NO]; + } waveletWithHeartbeat:^(NSArray *waveletArr) { + NSLog(@"xiaoboWithHeart %@",waveletArr); + weakSelf.isMeasuring = YES; + [weakSelf sendPresssre:nil wavelet:waveletArr isHeartPulse:YES]; + } waveletWithoutHeartbeat:^(NSArray *waveletArr) { + weakSelf.isMeasuring = YES; + NSLog(@"xiaoboNoHeart %@",waveletArr); + [weakSelf sendPresssre:nil wavelet:waveletArr isHeartPulse:NO]; + } result:^(NSDictionary *resultDict) { + NSLog(@"result %@",resultDict); + weakSelf.startSendWavelet = NO; + weakSelf.isMeasuring = NO; + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_RESULT_BP, + kHIGH_BLOOD_PRESSURE_BP:resultDict[@"sys"], + kLOW_BLOOD_PRESSURE_BP:resultDict[@"dia"], + kPULSE_BP:resultDict[@"heartRate"], + kMEASUREMENT_AHR_BP:resultDict[@"irregular"], + kDATAID:resultDict[@"dataID"], + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %lu",(unsigned long)error); + weakSelf.startSendWavelet = NO; + weakSelf.isMeasuring = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + + }else{ + + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + self.isMeasuring = NO; + } + + +} + +- (void)sendPresssre:(NSNumber*)pressure wavelet:(NSArray*)waveletArray isHeartPulse:(BOOL)heartPulse{ + + if (pressure) { + self.previousPressure = pressure; + } + if (waveletArray.count > 0) { + self.startSendWavelet = YES; + } + if (pressure && !self.startSendWavelet) { + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_PRESSURE_BP, + kBLOOD_PRESSURE_BP:pressure, + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + }else if (waveletArray.count > 0 && self.startSendWavelet){ + NSDictionary* response = @{ + kACTION:kACTION_ONLINE_PULSEWAVE_BP, + kBLOOD_PRESSURE_BP:self.previousPressure, + kFLAG_HEARTBEAT_BP:@(heartPulse), + kPULSEWAVE_BP:waveletArray + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } +} + + +RCT_EXPORT_METHOD(stopMeasure:(nonnull NSString *)mac){ + + if (!self.isMeasuring) { + NSLog(@"error %d",401); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:401]; + return; + } + if ([self getBP7WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + + [[self getBP7WithMac:mac] stopBPMeassureSuccessBlock:^{ + + } errorBlock:^(BPDeviceError error) { + + NSLog(@"error %lu",(unsigned long)error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + NSDictionary* response = @{ + kACTION:kACTION_INTERRUPTED_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + weakSelf.isMeasuring = NO; + }); + }else{ + + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + self.isMeasuring = NO; + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + + } + +} + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + + if ([self getBP7WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP7WithMac:mac] commandEnergy:^(NSNumber *energyValue) { + NSDictionary* response = @{ + kACTION:kACTION_BATTERY_BP, + kBATTERY_BP:energyValue + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %lu",(unsigned long)error); + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + }else{ + + NSLog(@"error %lu",(unsigned long)BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + + } + + + + +} + + +RCT_EXPORT_METHOD(enbleOffline:(nonnull NSString *)mac){ + + + if ([self getBP7WithMac:mac]!=nil) { + __block BOOL success = YES; + __weak typeof(self) weakSelf = self; + [[self getBP7WithMac:mac] commandSetOffline:YES errorBlock:^(BPDeviceError error) { + success = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (success) { + NSDictionary* response = @{ + kACTION:kACTION_ENABLE_OFFLINE_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + }); + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + +} + + +RCT_EXPORT_METHOD(disableOffline:(nonnull NSString *)mac){ + + + if ([self getBP7WithMac:mac]!=nil) { + __block BOOL success = YES; + __weak typeof(self) weakSelf = self; + [[self getBP7WithMac:mac] commandSetOffline:NO errorBlock:^(BPDeviceError error) { + success = NO; + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (success) { + NSDictionary* response = @{ + kACTION:kACTION_DISENABLE_OFFLINE_BP, + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } + }); + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + + +RCT_EXPORT_METHOD(isEnableOffline:(nonnull NSString *)mac){ + + + if ([self getBP7WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP7WithMac:mac] commandFunction:^(NSDictionary *dic) { + NSDictionary* response = @{ + kACTION:kACTION_IS_ENABLE_OFFLINE, + kIS_ENABLE_OFFLINE:dic[@"offlineOpen"] + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + +} + + + +RCT_EXPORT_METHOD(getOfflineNum:(nonnull NSString *)mac){ + + + + if ([self getBP7WithMac:mac]!=nil) { + + __weak typeof(self) weakSelf = self; + + [[self getBP7WithMac:mac] commandTransferMemoryTotalCount:^(NSNumber *count) { + + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_NUM_BP, + kHISTORICAL_NUM_BP:count + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } errorBlock:^(BPDeviceError error) { + + }]; + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + + +// if ([self getBP7WithMac:mac]!=nil) { +// __weak typeof(self) weakSelf = self; +// +// [[self getBP7WithMac:mac] commandBatchUpload:^(NSNumber *count) { +// NSDictionary* response = @{ +// kACTION:kACTION_HISTORICAL_NUM_BP, +// kHISTORICAL_NUM_BP:count +// }; +// [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; +// +// } progress:^(NSNumber *progressValue) { +// +// } dataArray:^(NSArray *bachArray) { +// NSMutableArray * historyDataArray = [NSMutableArray array]; +// +// for(NSDictionary *dataDict in bachArray) +// { +// +// NSDate *date = [dataDict objectForKey:@"time"]; +// +// //将时间格式转化成字符串,适配plugin和react native +// NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; +// [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; +// NSString *dateStr = [mydateFormatter stringFromDate:date]; +// NSDictionary* historyDataDict = @{ +// kMEASUREMENT_DATE_BP:dateStr, +// kHIGH_BLOOD_PRESSURE_BP:dataDict[@"sys"], +// kLOW_BLOOD_PRESSURE_BP:dataDict[@"dia"], +// kPULSE_BP:dataDict[@"heartRate"], +// kMEASUREMENT_AHR_BP:dataDict[@"irregular"], +// // kMEASUREMENT_HSD_BP:dataDict[@"hsdValue"], +// kDATAID:dataDict[@"dataID"] +// }; +// [historyDataArray addObject:historyDataDict]; +// +// +// } +// +// if (historyDataArray.count > 0) { +// NSDictionary* deviceInfo = @{kACTION:kACTION_HISTORICAL_DATA_BP,kHISTORICAL_DATA_BP:[historyDataArray copy] }; +// [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:deviceInfo]; +// } +// +// } errorBlock:^(BPDeviceError error) { +// [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; +// +// }]; +// +// }else{ +// [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; +// } +} + + + +RCT_EXPORT_METHOD(getOfflineData:(nonnull NSString *)mac){ + + + if ([self getBP7WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getBP7WithMac:mac] commandBatchUpload:^(NSNumber *count) { + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_NUM_BP, + kHISTORICAL_NUM_BP:count + }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:response]; + + } progress:^(NSNumber *progressValue) { + + } dataArray:^(NSArray *bachArray) { + NSMutableArray * historyDataArray = [NSMutableArray array]; + + for(NSDictionary *dataDict in bachArray) + { + + NSDate *date = [dataDict objectForKey:@"time"]; + + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:date]; + NSDictionary* historyDataDict = @{ + kMEASUREMENT_DATE_BP:dateStr, + kHIGH_BLOOD_PRESSURE_BP:dataDict[@"sys"], + kLOW_BLOOD_PRESSURE_BP:dataDict[@"dia"], + kPULSE_BP:dataDict[@"heartRate"], + kMEASUREMENT_AHR_BP:dataDict[@"irregular"], + // kMEASUREMENT_HSD_BP:dataDict[@"hsdValue"], + kDATAID:dataDict[@"dataID"] + }; + [historyDataArray addObject:historyDataDict]; + + + } + + if (historyDataArray.count > 0) { + NSDictionary* deviceInfo = @{kACTION:kACTION_HISTORICAL_DATA_BP,kHISTORICAL_DATA_BP:[historyDataArray copy] }; + [BPProfileModule sendEventToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithDict:deviceInfo]; + } + + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:weakSelf eventNotify:EVENT_NOTIFY WithCode:error]; + + }]; + + }else{ + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + +} + + + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + NSLog(@"iOS doesn't support disconnect normal BT devices"); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:900]; + +} + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.h new file mode 100755 index 0000000..7a3d63f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.h @@ -0,0 +1,19 @@ +// +// BP7SModule.h +// ReactNativeIOSLibrary +// +// Created by Liu Yanbo on 2016/12/05. +// Copyright © 2016年 Liu Yanbo. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface BP7SModule : RCTEventEmitter + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.m new file mode 100755 index 0000000..95986bc --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BP7SModule.m @@ -0,0 +1,284 @@ +// +// BP7SModule.m +// ReactNativeIOSLibrary +// +// Created by Liu Yanbo on 2016/12/05. +// Copyright © 2016年 Liu Yanbo. All rights reserved. +// + +#import "BP7SModule.h" +#import "BPProfileModule.h" +#import "BPMacroFile.h" +#import "BP7SController.h" +#import "BP7S.h" +#import "iHealthDeviceManagerModule.h" +#import "ScanDeviceController.h" +#import "ConnectDeviceController.h" +#define EVENT_NOTIFY @"BP7S.MODULE.NOTIFY" + +@implementation BP7SModule +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"Event_Notify":EVENT_NOTIFY, + + }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +-(BP7S*)getDeviceWithMac:(NSString*)mac{ + + BP7SController *controller = [BP7SController shareBP7SController]; + NSArray *bpDeviceArray = [controller getAllCurrentBP7SInstace]; + + for(BP7S *tempDevice in bpDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + + return tempDevice; + } + } + + return nil; +} + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*bp7Sarray= [[BP7SController shareBP7SController] getAllCurrentBP7SInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[bp7Sarray count]; i++) { + + BP7S*bp7s=[bp7Sarray objectAtIndex:i]; + + [deviceMacArray addObject:bp7s.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + +#pragma mark - Method + +RCT_EXPORT_METHOD(getFunctionInfo:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + + + [[self getDeviceWithMac:mac] commandFunction:^(NSDictionary *dic) { + + NSDictionary* response = @{ + kACTION:kACTION_FUNCTION_INFORMATION_BP, + kFUNCTION_IS_UPAIR_MEASURE:dic[@"upAirMeasureFlg"], + kFUNCTION_IS_ARM_MEASURE:dic[@"armMeasureFlg"], + kFUNCTION_HAVE_ANGLE_SENSOR:dic[@"haveAngleSensor"], + kFUNCTION_HAVE_OFFLINE:dic[@"haveOffline"], + kFUNCTION_HAVE_ANGLE_SETTING:dic[@"haveAngleSet"], + kFUNCTION_IS_MULTI_UPLOAD:dic[@"mutableUpload"], + kFUNCTION_HAVE_SELF_UPDATE:dic[@"selfUpdate"], + kFUNCTION_HAVE_HSD:dic[@"haveHSD"] + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +//getOffLineNum +RCT_EXPORT_METHOD(getOffLineNum:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + + [[self getDeviceWithMac:mac] commandTransferMemoryTotalCount:^(NSNumber *count) { + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_NUM_BP, + kHISTORICAL_NUM_BP:count, + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +//getOffLineData +RCT_EXPORT_METHOD(getOffLineData:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] commandTransferMemoryDataWithTotalCount:^(NSNumber *count) { + if (count.integerValue == 0) { + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_DATA_BP, + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } + } progress:^(NSNumber *progress) { + NSLog(@"pregress %@",progress); + } dataArray:^(NSArray *array) { + NSLog(@"dataArray %@",array); + NSMutableArray* historyDataArray = [NSMutableArray array]; + for (NSDictionary* dataDict in array) { + if ([dataDict isKindOfClass:[NSDictionary class]]) { + NSDate *tempDate = [dataDict objectForKey:@"time"]; + + //将时间格式转化成字符串,适配plugin和react native + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + NSString *dateStr = [mydateFormatter stringFromDate:tempDate]; + NSDictionary* historyDataDict = @{ + kMEASUREMENT_DATE_BP:dateStr, + kHIGH_BLOOD_PRESSURE_BP:dataDict[@"sys"], + kLOW_BLOOD_PRESSURE_BP:dataDict[@"dia"], + kPULSE_BP:dataDict[@"heartRate"], + kMEASUREMENT_AHR_BP:dataDict[@"irregular"], + kMEASUREMENT_HSD_BP:dataDict[@"hsdValue"], + kMEASUREMENT_STRAT_ANGLE_BP: dataDict[@"startAngle"], + kMEASUREMENT_ANGLE_CHANGE_BP:dataDict[@"measureAngleChange"], + kMEASUREMENT_HAND_BP:dataDict[@"chooseHand"], + kDATAID:dataDict[@"dataID"] + }; + [historyDataArray addObject:historyDataDict]; + } + } + if (historyDataArray.count > 0) { + NSDictionary* response = @{ + kACTION:kACTION_HISTORICAL_DATA_BP, + kHISTORICAL_DATA_BP:[historyDataArray copy] + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %d",error); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} +//getBattery +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] commandEnergy:^(NSNumber *energyValue) { + NSLog(@"energyValue %@",energyValue); + NSDictionary* response = @{ + kACTION:kACTION_BATTERY_BP, + kBATTERY_BP:energyValue, + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %d",error); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} +//setUnit +RCT_EXPORT_METHOD(setUnit:(nonnull NSString *)mac unit:(nonnull NSNumber*)unit){ + + if ([unit integerValue] > 1 || [unit integerValue] < 0) { + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPInputParameterError]; + return; + } + + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] commandSetUnit:[unit integerValue] > 0 ? @"kPa" : @"mmHg" disposeSetReslut:^{ + NSLog(@"set unit success"); + NSDictionary* response = @{ + kACTION:kACTION_SET_UNIT_SUCCESS_BP, + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %d",error); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} +//angleSet +RCT_EXPORT_METHOD(angleSet:(nonnull NSString *)mac hl:(nonnull NSNumber*)hl ll:(nonnull NSNumber*)ll hr:(nonnull NSNumber*)hr lr:(nonnull NSNumber*)lr){ + + if ([self getDeviceWithMac:mac]!=nil) { + NSDictionary* dict = @{ + @"highAngleForLeft":hl, + @"lowAngleForLeft":ll, + @"highAngleForRight":hr, + @"lowAngleForRight":lr + }; + + [[self getDeviceWithMac:mac] commandSetAngle:dict disposeSetReslut:^{ + NSDictionary* response = @{ + kACTION:kACTION_SET_ANGLE_SUCCESS_BP, + }; + [BPProfileModule sendEventToEmitter:self eventNotify:EVENT_NOTIFY WithDict:response]; + } errorBlock:^(BPDeviceError error) { + NSLog(@"error %d",error); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:error]; + }]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + if ([self getDeviceWithMac:mac]!=nil) { + [[self getDeviceWithMac:mac] commandDisconnectDevice]; + }else{ + NSLog(@"error %d",BPDidDisconnect); + [BPProfileModule sendErrorToEmitter:self eventNotify:EVENT_NOTIFY WithCode:BPDidDisconnect]; + } + + +} + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.h new file mode 100755 index 0000000..5fa5fd4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.h @@ -0,0 +1,83 @@ +// +// BPProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface BPProfileModule : NSObject + +#define kACTION_ERROR_BP @"error_bp" +#define kERROR_DESCRIPTION_BP @"description" +#define kACTION_BATTERY_BP @"battery_bp" +#define kACTION_ZOREING_BP @"zoreing_bp" +#define kACTION_ZOREOVER_BP @"zoreover_bp" +#define kACTION_ONLINE_PRESSURE_BP @"online_pressure_bp" +#define kACTION_ONLINE_PULSEWAVE_BP @"online_pulsewave_bp" +#define kACTION_ONLINE_RESULT_BP @"online_result_bp" +#define kACTION_HISTORICAL_NUM_BP @"offlinenum" +#define kACTION_HISTORICAL_DATA_BP @"historicaldata_bp" +#define kACTION_HISTORICAL_OVER_BP @"get_historical_over_bp" +#define kACTION_FUNCTION_INFORMATION_BP @"function_info_bp" +#define kACTION_SET_UNIT_SUCCESS_BP @"set_unit_success" +#define kACTION_SET_ANGLE_SUCCESS_BP @"set_angle_success" +#define kACTION_INTERRUPTED_BP @"interrupted_bp" +#define kACTION_Delete_BP @"delete_bp" + + +#define kACTION_ENABLE_OFFLINE_BP @"enable_offline_bp" +#define kACTION_DISENABLE_OFFLINE_BP @"disenable_offline_bp" +#define kACTION_IS_ENABLE_OFFLINE @"offlinestatus" + +#define kMessage @"Message" +#define kIDPS @"idps" +#define kACTION @"action" +#define kERROR_NUM_BP @"error" +#define kBATTERY_BP @"battery" +#define kBLOOD_PRESSURE_BP @"pressure" +#define kFLAG_HEARTBEAT_BP @"heartbeat" +#define kPULSEWAVE_BP @"wave" +#define kHIGH_BLOOD_PRESSURE_BP @"sys" +#define kLOW_BLOOD_PRESSURE_BP @"dia" +#define kPULSE_BP @"heartRate" +#define kMEASUREMENT_DATE_BP @"date" +#define kMEASUREMENT_AHR_BP @"arrhythmia" +#define kMEASUREMENT_HSD_BP @"hsd" +#define kMEASUREMENT_STRAT_ANGLE_BP @"startAngle" +#define kMEASUREMENT_ANGLE_CHANGE_BP @"measureAngleChange" +#define kMEASUREMENT_HAND_BP @"chooseHand" +#define kDATAID @"dataID" +#define kHISTORICAL_NUM_BP @"offlinenum" +#define kHISTORICAL_DATA_BP @"data" +#define kIS_ENABLE_OFFLINE @"offlinestatus" + +#define kFUNCTION_IS_UPAIR_MEASURE @"upAirMeasureFlg" +#define kFUNCTION_IS_ARM_MEASURE @"armMeasureFlg" +#define kFUNCTION_HAVE_ANGLE_SENSOR @"haveAngleSensor" +#define kFUNCTION_HAVE_OFFLINE @"haveOffline" +#define kFUNCTION_HAVE_ANGLE_SETTING @"haveAngleSet" +#define kFUNCTION_IS_MULTI_UPLOAD @"mutableUpload" +#define kFUNCTION_HAVE_SELF_UPDATE @"selfUpdate" +#define kFUNCTION_HAVE_HSD @"haveHSD" + +#define kANGLE_BP @"angle" + +#define kWHICH_ARM @"which_arm" + +#define kACTION_ANGLE_BP @"angle_bp" + +#define kMAC @"mac" +#define kType @"type" + + ++ (void)sendErrorToEmitter:(RCTEventEmitter *)emitter eventNotify:(NSString*)eventNotify WithCode:(NSInteger)errorCode; ++ (void)sendEventToEmitter:(RCTEventEmitter *)emitter eventNotify:(NSString*)eventNotify WithDict:(NSDictionary*)dict; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.m new file mode 100755 index 0000000..6417dc5 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BPProfileModule.m @@ -0,0 +1,182 @@ +// +// BPProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BPProfileModule.h" +#import "BPMacroFile.h" +@implementation BPProfileModule + + + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"ACTION_ERROR_BP":kACTION_ERROR_BP, + @"ACTION_BATTERY_BP":kACTION_BATTERY_BP, + @"ACTION_ZOREING_BP":kACTION_ZOREING_BP, + @"ACTION_ZOREOVER_BP":kACTION_ZOREOVER_BP, + @"ACTION_ONLINE_PRESSURE_BP":kACTION_ONLINE_PRESSURE_BP, + @"ACTION_ONLINE_PULSEWAVE_BP":kACTION_ONLINE_PULSEWAVE_BP, + @"ACTION_ONLINE_RESULT_BP":kACTION_ONLINE_RESULT_BP, + @"ACTION_HISTORICAL_NUM_BP":kACTION_HISTORICAL_NUM_BP, + @"ACTION_HISTORICAL_DATA_BP":kACTION_HISTORICAL_DATA_BP, + @"ACTION_HISTORICAL_OVER_BP":kACTION_HISTORICAL_OVER_BP, + @"ACTION_FUNCTION_INFORMATION_BP":kACTION_FUNCTION_INFORMATION_BP, + @"ACTION_SET_UNIT_SUCCESS_BP":kACTION_SET_UNIT_SUCCESS_BP, + @"ACTION_SET_ANGLE_SUCCESS_BP":kACTION_SET_ANGLE_SUCCESS_BP, + @"ACTION_INTERRUPTED_BP":kACTION_INTERRUPTED_BP, + + @"ACTION_ENABLE_OFFLINE_BP":kACTION_ENABLE_OFFLINE_BP, + @"ACTION_DISENABLE_OFFLINE_BP":kACTION_DISENABLE_OFFLINE_BP, + @"ACTION_IS_ENABLE_OFFLINE":kACTION_IS_ENABLE_OFFLINE, + + @"ERROR_NUM_BP":kERROR_NUM_BP, + @"BATTERY_BP":kBATTERY_BP, + @"BLOOD_PRESSURE_BP":kBLOOD_PRESSURE_BP, + @"FLAG_HEARTBEAT_BP":kFLAG_HEARTBEAT_BP, + @"PULSEWAVE_BP":kPULSEWAVE_BP, + @"HIGH_BLOOD_PRESSURE_BP":kHIGH_BLOOD_PRESSURE_BP, + @"LOW_BLOOD_PRESSURE_BP":kLOW_BLOOD_PRESSURE_BP, + @"PULSE_BP":kPULSE_BP, + @"MEASUREMENT_DATE_BP":kMEASUREMENT_DATE_BP, + @"MEASUREMENT_AHR_BP":kMEASUREMENT_AHR_BP, + @"MEASUREMENT_HSD_BP":kMEASUREMENT_HSD_BP, + @"MEASUREMENT_STRAT_ANGLE_BP":kMEASUREMENT_STRAT_ANGLE_BP, + @"MEASUREMENT_ANGLE_CHANGE_BP":kMEASUREMENT_ANGLE_CHANGE_BP, + @"MEASUREMENT_HAND_BP":kMEASUREMENT_HAND_BP, + @"DATAID":kDATAID, + @"IS_ENABLE_OFFLINE":kIS_ENABLE_OFFLINE, + + @"HISTORICAL_NUM_BP":kHISTORICAL_NUM_BP, + @"HISTORICAL_DATA_BP":kHISTORICAL_DATA_BP, + + @"FUNCTION_IS_UPAIR_MEASURE":kFUNCTION_IS_UPAIR_MEASURE, + @"FUNCTION_IS_ARM_MEASURE":kFUNCTION_IS_ARM_MEASURE, + @"FUNCTION_HAVE_ANGLE_SENSOR":kFUNCTION_HAVE_ANGLE_SENSOR, + @"FUNCTION_HAVE_OFFLINE":kFUNCTION_HAVE_OFFLINE, + @"FUNCTION_HAVE_ANGLE_SETTING":kFUNCTION_HAVE_ANGLE_SETTING, + @"FUNCTION_IS_MULTI_UPLOAD":kFUNCTION_IS_MULTI_UPLOAD, + @"FUNCTION_HAVE_SELF_UPDATE":kFUNCTION_HAVE_SELF_UPDATE, + @"FUNCTION_HAVE_HSD":kFUNCTION_HAVE_HSD, + @"ERROR_DESCRIPTION_BP":kERROR_DESCRIPTION_BP, + + @"ACTION_ANGLE_BP":kACTION_ANGLE_BP, + + @"ANGLE_BP":kANGLE_BP, + + @"WHICH_ARM":kWHICH_ARM, + + @"ACTION_GET_ALL_CONNECTED_DEVICES":@"ACTION_GET_ALL_CONNECTED_DEVICES", + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} ++ (NSString*)descriptionForErrorCode:(NSInteger)errorCode{ + switch (errorCode) { + case BPError0: + return @"not find a suitable zero in 20s."; + case BPError1: + return @"not find high pressure."; + case BPError2: + return @"not find low pressure or the high pressure value is lower than the low pressure value."; + case BPError3: + return @"pressurization fast."; + case BPError4: + return @"pressurization slow."; + case BPError5: + return @"pressure exceeds 300mmHg."; + case BPError6: + return @"time of pressure greater than 15 mmHg exceeds 160s."; + case BPError7: + return @"EE read and write error."; + case BPError8: + return @"EE three backup data error."; + case BPError9: + return @"retention."; + case BPError10: + return @"SPAN value error."; + case BPError11: + return @"CRC errors."; + case BPError12: + return @"connect error."; + case BPError13: + return @"low power tips."; + case BPError14: + return @"device bluetooth set failed"; + case BPError15: + return @"high or low pressure value of measurement exceeds the set upper limit."; + case BPError16: + return @"high or low pressure value of measurement exceeds the set lower limit."; + case BPError17: + return @"arm movement during the measurement over the machine set point."; + case BPNormalError: + return @"device error, error message displayed automatically"; + case BPOverTimeError: + return @"abnormal communication"; + case BPNoRespondError: + return @"abnormal communication"; + case BPBeyondRangeError: + return @"device is out of communication range."; + case BPDidDisconnect: + return @"device is disconnected."; + case BPAskToStopMeasure: + return @"measurement has been stopped."; + case BPDeviceBusy: + return @"device is busy doing other things"; + case BPInputParameterError: + return @"the argument of method is illegal."; + case 401: + return @"the operation is illegal"; + case 900: + return @"iOS doesn't support disconnect normal BT devices"; + } + return @"unknown error"; +} + + ++ (void)sendErrorToEmitter:(RCTEventEmitter *)emitter eventNotify:(NSString*)eventNotify WithCode:(NSInteger)errorCode{ + NSDictionary* errorDict; + + + if(errorCode==BPDidDisconnect){ + + + errorDict = @{ + kACTION:kACTION_ERROR_BP, + kERROR_DESCRIPTION_BP:[self descriptionForErrorCode:errorCode] + }; + + }else{ + + + errorDict = @{ + kACTION:kACTION_ERROR_BP, + kERROR_NUM_BP:@(errorCode), + kERROR_DESCRIPTION_BP:[self descriptionForErrorCode:errorCode] + }; + + + } + + [self sendEventToEmitter:emitter eventNotify:eventNotify WithDict:errorDict]; +} + ++ (void)sendEventToEmitter:(RCTEventEmitter *)emitter eventNotify:(NSString*)eventNotify WithDict:(NSDictionary*)dict{ + [emitter sendEventWithName:eventNotify body:dict]; +} + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.h new file mode 100755 index 0000000..dc20029 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.h @@ -0,0 +1,19 @@ +// +// BTMModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface BTMModule : RCTEventEmitter + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.m new file mode 100644 index 0000000..779b141 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMModule.m @@ -0,0 +1,370 @@ +// +// BTMModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BTMModule.h" +#import "THV3.h" +#import "THV3Controller.h" +#import "BTMProfileModule.h" + +@implementation BTMModule{ + + + NSMutableDictionary*resultDic; + +} + +#define EVENT_NOTIFY @"event_notify_po3" + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +#pragma mark +#pragma mark - constantsToExport +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": EVENT_NOTIFY }; + +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(reciveDeviceData:) name:@"THV3NewDataCome" object:nil]; + + } + return self; +} + +-(THV3*)getTHV3WithMac:(NSString*)mac{ + + THV3Controller *controller = [THV3Controller sharedController]; + NSArray *thvDeviceArray = [controller allCurrentInstance]; + + for(THV3 *tempTHV3 in thvDeviceArray){ + if([mac isEqualToString:tempTHV3.serialNumber]){ + + return tempTHV3; + break; + } + } + + return nil; +} + +-(void)reciveDeviceData:(NSNotification *)tempNoti{ + + NSDictionary *infoDic=[tempNoti object]; + + THV3*myTHV3=[self getTHV3WithMac:[infoDic valueForKey:@"SerialNumber"]]; + + THV3RcvDataType rtDataType=myTHV3.rtDataType; + + NSNumber*target; + + if (myTHV3.isTargetHuman) { + + target=@1; + + }else{ + + target=@2; + } + + if (myTHV3!=nil) { + + if (rtDataType==THV3RcvDataRT) { + + THV3HistoryData* rtTemperature=myTHV3.rtTemperature; + + NSDateFormatter *mydateFormatter = [[NSDateFormatter alloc] init]; + [mydateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + + if (rtTemperature.measureDate!=nil) { + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_MEASURE,BTM_TEMPERATURE:[NSNumber numberWithFloat:rtTemperature.temperature],BTM_MEASURE_TIME:[mydateFormatter stringFromDate:rtTemperature.measureDate],BTM_TEMPERATURE_TARGET:target}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } + + + + + }else{ + + + + } + }else{ + + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_ERROR,BTM_ERROR_DESCRIPTION:@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + + + +} + +#pragma mark +#pragma mark - Method + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*thv3array= [[THV3Controller sharedController] allCurrentInstance]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[thv3array count]; i++) { + + THV3*thv3=[thv3array objectAtIndex:i]; + + [deviceMacArray addObject:thv3.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",BTM_DEVICE:deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + BOOL voltIsNormal = [self getTHV3WithMac:mac].voltIsNormal; + + NSNumber*battNum; + + if (voltIsNormal) { + battNum=@1; + }else{ + + battNum=@0; + } + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_BATTERY,BTM_BATTERY:battNum}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + +} + +RCT_EXPORT_METHOD(getMemoryData:(nonnull NSString *)mac){ + + + if ([self getTHV3WithMac:mac]!=nil) { + + [[self getTHV3WithMac:mac] readHistoryDataWithResultBlock:^(NSArray *dataArray) { + + NSMutableArray * tempArr = [[NSMutableArray alloc]init]; + + for (int i=0; i0) { + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_MEMORY,BTM_TEMPERATURE_ARRAY:tempArr,BTM_MEMORY_COUNT:[NSNumber numberWithInt:tempArr.count]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } + + + }]; + + + }else{ + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_ERROR,BTM_ERROR_DESCRIPTION:@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + +} + +RCT_EXPORT_METHOD(setStandbyTime:(nonnull NSString *)mac :(nonnull NSNumber *)hour:(nonnull NSNumber *)min:(nonnull NSNumber *)sec){ + + if ([self getTHV3WithMac:mac]!=nil) { + + [[self getTHV3WithMac:mac] configIdleTime:[[NSDate date]timeIntervalSince1970] withResultBlock:^(BOOL success) { + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_CALLBACK}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }]; + + + }else{ + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_ERROR,BTM_ERROR_DESCRIPTION:@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + + + + + +} +RCT_EXPORT_METHOD(setTemperatureUnit:(nonnull NSString *)mac:(nonnull NSNumber *)unit){ + + if ([self getTHV3WithMac:mac]!=nil) { + + BOOL isUnitC=YES; + + if ([unit intValue]==1) { + + isUnitC=YES; + + }else{ + + isUnitC=NO; + } + + [[self getTHV3WithMac:mac] configTemperUnit:isUnitC withResultBlock:^(BOOL success) { + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_CALLBACK}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }]; + + + }else{ + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_ERROR,BTM_ERROR_DESCRIPTION:@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + + + +} +RCT_EXPORT_METHOD(setMeasuringTarget:(nonnull NSString *)mac :(nonnull NSNumber *)target){ + + if ([self getTHV3WithMac:mac]!=nil) { + + BOOL istarget=YES; + + if ([target intValue]==1) { + + istarget=YES; + + }else{ + + istarget=NO; + } + + [[self getTHV3WithMac:mac] configMeasureTarget:istarget withResultBlock:^(BOOL success) { + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_CALLBACK}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }]; + + + }else{ + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_ERROR,BTM_ERROR_DESCRIPTION:@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + + +} +RCT_EXPORT_METHOD(setOfflineTarget:(nonnull NSString *)mac:(nonnull NSNumber *)target){ + + if ([self getTHV3WithMac:mac]!=nil) { + + BOOL istarget=YES; + + if ([target intValue]==1) { + + istarget=NO; + + }else{ + + istarget=YES; + } + + [[self getTHV3WithMac:mac] configOfflineMode:istarget withResultBlock:^(BOOL success) { + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_CALLBACK}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }]; + + + }else{ + + NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_ERROR,BTM_ERROR_DESCRIPTION:@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + +} + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + + + + if ([self getTHV3WithMac:mac]!=nil) { + + [[self getTHV3WithMac:mac] commandDisconnectDevice]; + +// NSDictionary* deviceInfo = @{BTM_ACTION:BTM_ACTION_CALLBACK}; +// [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }else{ + + + + } + + + +} + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.h new file mode 100755 index 0000000..e19f1a9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.h @@ -0,0 +1,50 @@ +// +// BTMProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif +@interface BTMProfileModule : NSObject + + + +#define BTMACTION @"event_notify_btm" +#define BTM_ACTION @"action" + +#define BTM_BATTERY @"battery" + +#define BTM_ACTION_BATTERY @"battery_btm" + +#define BTM_ACTION_MEMORY @"memory_btm" + +#define BTM_ACTION_MEASURE @"measure_btm" + +#define BTM_ACTION_CALLBACK @"btm_callback" + +#define BTM_ACTION_ERROR @"action_error_btm" + +#define BTM_MEMORY_COUNT @"memory_count" + +#define BTM_TEMPERATURE_ARRAY @"btm_temperature_array" + +#define BTM_TEMPERATURE_TARGET @"btm_temperature_target" + +#define BTM_TEMPERATURE @"btm_temperature" + +#define BTM_MEASURE_TIME @"measure_time" + +#define BTM_ERROR_DESCRIPTION @"description" + +#define BTM_ERROR_NUM @"error_num" + +#define BTM_DEVICE @"devices" + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.m new file mode 100755 index 0000000..61ee3fe --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/BTMProfileModule.m @@ -0,0 +1,47 @@ +// +// BTMProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "BTMProfileModule.h" + +@implementation BTMProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"ACTION_BTM_BATTERY":BTM_ACTION_BATTERY, + @"BTM_BATTERY":BTM_BATTERY, + @"ACTION_BTM_MEMORY":BTM_ACTION_MEMORY, + @"ACTION_BTM_MEASURE":BTM_ACTION_MEASURE, + @"ACTION_BTM_CALLBACK":BTM_ACTION_CALLBACK, + @"ACTION_ERROR_BTM":BTM_ACTION_ERROR, + @"MEMORY_COUNT":BTM_MEMORY_COUNT, + @"BTM_TEMPERATURE_ARRAY":BTM_TEMPERATURE_ARRAY, + @"BTM_TEMPERATURE_TARGET":BTM_TEMPERATURE_TARGET, + @"BTM_TEMPERATURE":BTM_TEMPERATURE, + @"BTM_MEASURE_TIME":BTM_MEASURE_TIME, + @"ERROR_NUM_BTM":BTM_ERROR_NUM, + @"ERROR_DESCRIPTION_BTM":BTM_ERROR_DESCRIPTION, + @"devices":BTM_ERROR_DESCRIPTION, + @"ACTION_GET_ALL_CONNECTED_DEVICES":@"ACTION_GET_ALL_CONNECTED_DEVICES", + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABI.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABI.h new file mode 100644 index 0000000..a4416f9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABI.h @@ -0,0 +1,82 @@ +// +// ABI.h +// iHealthDemoCode +// +// Created by zhiwei jing on 14-11-18. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#import +#import "BPMacroFile.h" + +/** + ABI device class + */ +@interface ABI : NSObject + +@property (assign, nonatomic) BOOL hasLegMonitor; +@property (strong, nonatomic) NSString *currentArmUUID; +@property (strong, nonatomic) NSString *currentLegUUID; +//‘serialNumber’ is for separating different device when multiple device have been connected. +@property (strong, nonatomic) NSString *armSerialNumber; +@property (strong, nonatomic) NSString *legSerialNumber; + +/** + * Query battery remaining energy + * @param armEnergy A block to return battery ratio of upper-arm BPM, 80 means 80%. + * @param legEnergy A block to return battery ratio of ankle BPM, 80 means 80%. + * @param error When error occur, this block will be callback. + */ +-(void)commandQueryEnergy:(BlockEnergyValue)armEnergy leg:(BlockEnergyValue)legEnergy errorBlock:(BlockError)error; + + +/** + * Establish measurement connection and start BP measurement + * @Notice By the first time of new user register via SDK, ‘iHealth disclaimer’ will pop up automatically, and require the user agrees to continue. SDK application requires Internet connection; there is 10-day tryout if SDK cannot connect Internet, SDK is fully functional during tryout period, but will be terminated without verification through Internet after 10 days. + * @param blockZeroState Zeroing state + * @param armPressure Return Upper-arm blood pressure value during measurement, unit as mmHg + * @param legPressure Return Ankle blood pressure value during measurement, unit as mmHg. + * @param blockArmWaveletWithHeartbeat Return Wavelet value of upper-arm BPM, with heartbeats. + * @param blockLegWaveletWithHeartbeat Return Wavelet value of ankle BPM, with heartbeats. + * @param blockArmWaveletWithoutHeartbeat Return Wavelet value of upper-arm BPM, without heartbeats. + * @param blockLegWaveletWithoutHeartbeat Return Wavelet value of ankle BPM, without heartbeats. + * @param armResult Return BP value of upper-arm BPM, including time, sys, dia, heartRate, irregular heartbeat. + * @param legResult Return BP value of ankle BPM, including time, sys, dia, heartRate, irregular heartbeat. + * @param error When error occur, this block will be callback. + */ +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState armPressure:(BlockPressure)armPressure legPressure:(BlockPressure)legPressure armWaveletWithHeartbeat:(BlockWavelet)blockArmWaveletWithHeartbeat legWaveletWithHeartbeat:(BlockWavelet)blockLegWaveletWithHeartbeat armWaveletWithoutHeartbeat:(BlockWavelet)blockArmWaveletWithoutHeartbeat legWaveletWithoutHeartbeat:(BlockWavelet)blockLegWaveletWithoutHeartbeat armResult:(BlockMeasureResult)armResult legResult:(BlockMeasureResult)legResult errorBlock:(BlockError)error; + + +/** + * Measurement termination and stop ABI measurement + */ +-(void)stopABIMeassure; + + + +#pragma mark - Arm Measure Api +/** + * Query battery remaining energy + * @param armEnergy A block to return battery ratio of upper-arm BPM, 80 means 80%. + * @param error When error occur, this block will be callback. + */ +-(void)commandQueryEnergy:(BlockEnergyValue)armEnergy errorBlock:(BlockError)error; + + +/** + * Establish measurement connection and Start upper-arm BPM measurement. + * @param blockZeroState Zeroing state + * @param armPressure Return Upper-arm blood pressure value during measurement, unit as mmHg. + * @param blockArmWaveletWithHeartbeat The Wavelet value of upper-arm BPM, with heartbeats. + * @param blockArmWaveletWithoutHeartbeat The Wavelet value of upper-arm BPM, without heartbeats. + * @param armResult The BP value of upper-arm BPM, including time, sys, dia, heartRate, irregular heartbeat. irregular will be 0 or 1. + * @param error When error occur, this block will be callback. + */ +-(void)commandStartArmMeasureWithZeroingState:(BlockZero)blockZeroState armPressure:(BlockPressure)armPressure armWaveletWithHeartbeat:(BlockWavelet)blockArmWaveletWithHeartbeat armWaveletWithoutHeartbeat:(BlockWavelet)blockArmWaveletWithoutHeartbeat armResult:(BlockMeasureResult)armResult errorBlock:(BlockError)error; + +/** + * Measurement termination and stop upper-arm BPM measurement + */ +-(void)stopABIArmMeassure; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABIController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABIController.h new file mode 100644 index 0000000..5163aa0 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABIController.h @@ -0,0 +1,28 @@ +// +// ABIController.h +// iHealthDemoCode +// +// Created by zhiwei jing on 14-11-18. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#import +#import "ABI.h" + +/** + ABI controller class + */ +@interface ABIController : NSObject + +/** + * Initialize ABI controller class + */ ++(ABIController *)shareABIController; + +/** + * Get ABI instance,Access control class instance after receiving ABIConnectNoti/ArmConnectNoti, then use this instance to call ABI/ABI-Arm related communication methods. + * You can use hasLegMonitor property to distinguish whether connecting both arm&leg or only arm + */ +-(ABI *)currentInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPM.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPM.h new file mode 100644 index 0000000..0a3e74a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPM.h @@ -0,0 +1,144 @@ +// +// ABPM.h +// iHealthSDKStatic +// +// Created by Realank on 2017/9/26. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPBV10Device.h" + +/** + ABPM device class + */ +@interface ABPM : BPBV10Device + + +/** + * Synchronize time and return functions this device supports. + * @param function A block to return the functions and states that the device supports. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Get battery remaining energy by percent + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + +/** + * Get detailed battery remaining energy + * @param energyValueBlock A block to return the device's battery percentage, voltage and measure times left. + * @param errorBlock Operation failed, and returns the error codes. + */ +-(void)commandEnergyDetail:(BlockEnergyDetailValue)energyValueBlock errorBlock:(BlockError)errorBlock; + +/** + * Set units for the Device + * @param UnitName The unit name of the result, must be @"mmHg" or @"kPa". + * @param setResult This block return means set success. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandSetUnit:(NSString *)UnitName disposeSetReslut:(BlockSuccess)setResult errorBlock:(BlockError)error; + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + +/** + * Start BP measurement. + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set including pulse rate + * @param blockWaveletWithoutHeartbeat Wavelet data set without pulse rate + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant keys: time, sys, dia, heartRate, irregular. irregular will be 0 or 1. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + +/** + * Stop measurement + * @param success The block return means measurement has been terminated. + * @param error Operation failed, and returns the error codes. + */ +-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + + +/** + * Upload history data. + * @param totalCount history data total Count. + * @param progress upload completion ratio , from 0.0 to 1.0. + * @param uploadDataArray offline data set, including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment,scheme ID,body movement flag. corresponding KEYs are time, sys, dia, heartRate, irregular,schemeID,bodyMovementFlg. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +-(void)commandTransferMemoryDataAndRawPressureWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +/** + * Upload history data total Count. + * @param totalCount item quantity of total data. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error; + + +/** + Delete all the history memory stored in device + + @param successBlock A block refer to delete complete. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandDeleteAllMemoryWithSuccessBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; + + +/** + Set ID String (eg.patientID, schemeID), length 100 max + + @param idString the content of id + @param successBlock A block refer to success. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandSetIDString:(NSString*)idString successBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; + + +/** + Ask ID String + + @param idStringResultBlock return ID String + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandAskIDStringWithResult:(BlockAskIDString)idStringResultBlock errorBlock:(BlockError)errorBlock; + + +/** + Set auto loop measure scheme + + @param scheme scheme content + @param successBlock A block refer to success. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandSetLoopMeasureScheme:(BPLoopMeasureSettingModel*)scheme successBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; + + +/** + Get auto loop measure scheme + + @param loopMeasureSchemeBlock return auto loop measure scheme content + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandAskLoopMeasureScheme:(BlockAskLoopMeasureScheme)loopMeasureSchemeBlock errorBlock:(BlockError)errorBlock; + + +/** + Change loop measure scheme status + + @param start YES to start, NO to pause + @param successBlock A block refer to success. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandChangeLoopMeasureStatusToStart:(BOOL)start successBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPMController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPMController.h new file mode 100644 index 0000000..36e80fd --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ABPMController.h @@ -0,0 +1,25 @@ +// +// ABPMController.h +// iHealthSDKStatic +// +// Created by Realank on 2017/9/26. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPController.h" + +/** + ABPM controller class + */ +@interface ABPMController : BPController +/** + * Initialize ABPM controller class + */ ++ (ABPMController *)sharedController; + +/** + * Get all ABPM instance,Access control class instance after receiving BP3LConnectNoti then use instance to call ABPM related communication methods. + */ +- (NSArray *)allConnectedInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3.h new file mode 100644 index 0000000..98b62cc --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3.h @@ -0,0 +1,188 @@ +// +// AM3.h +// testShareCommunication +// +// Created by daiqingquan on 13-10-15. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "AMMacroFile.h" + +/** + AM3 + */ +@interface AM3 : NSObject +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *firmwareVersion; + +/** + * Get device userID + * @param getDeviceUserIDBlock get userID + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3GetDeviceUserID:(DisposeAM3GetDeviceUserIDBlock)getDeviceUserIDBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Sync time + * @param syncTimeBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3SyncTime:(DisposeAM3SyncTimeBlock)syncTimeBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Set time format and nation + * @param timeFormat AM3TimeFormat_hh,AM3TimeFormat_HH + * @param setTimeFormatBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + * @Notice Notice: Firmware version 1.1.9 and above supports this function + */ +-(void)commandAM3SetTimeFormatAndNation:(AM3TimeFormat)timeFormat withFinishResult:(DisposeAM3TimeFormatSettingBlock)setTimeFormatBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Binding AM3 to user,Account binding requires an active internet connection. + * @param userID userID, ranging from 1 – 2147483647. + * @param finishResultBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3SetUserID:(NSNumber*)userID withFinishResult:(DisposeAM3SetDeviceUserIDBlock)finishResultBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * AM3 initialization,Must be called the first time to ensure that the AM3 has correct user information, goals, time, battery checks, etc. + * @param user User information, needs to include the following:age(int)、height(cm,1-255)、weight(kg,1-255)、bmr(user basal metabolic)、sex(UserSex_Female or UserSex_Male)、activityLevel (activityLevel=1, Sedentary,spend most of day sitting.activityLevel=2, Active,spend a good part of day doing some physical activity.activityLevel=3, Very Active,spend most of day doing heavy physical activity.) + * @param unit AM3StateUnit_mile or AM3StateUnit_km + * @param activeGoalNumber User goal number of steps,ranging from 4 – 65535. Default is 10,000 + * @param setUserInfoFinishBlock True: Success, False: Failed. + * @param setBMRFinishResultBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3SetUserInfo:(HealthUser *)user withUnit:(AM3StateUnit)unit withActiveGoal:(NSNumber *)activeGoalNumber withSetUserInfoFinishResult:(DisposeAM3SetUserInfoBlock)setUserInfoFinishBlock withSetBMR:(DisposeAM3SetBMRBlock)setBMRFinishResultBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Upload AM3 data,Data type: 5 minutes of active data, total number of steps for the day, and total calories.Also includes the number of steps for the 5 minutes of motion data, total calories for the current time, calories of the steps, and total calories. + * @param activeTransmissionBlock activeTransmission: Start uploading motion data, including parameters:Start date,yyyy-MM-dd(ActiveHistoryDateYear,ActiveHistoryDateMonth,ActiveHistoryDateDay),ActiveStepSize:Length of each step,ActiveHistoryTotoalNum:Number of records. + * @param activeHistoryDataBlock active data,including the following parameters:AMDate、AMCalorie、AMstepNum、AMstepSize、dataID、Start. AMDate:Workout time,AMCalorie: Current time total calories,AMStepNum:Total number of steps,dataID:data ID,Start:represents the beginning of a movement. + * @param activeFinishTransmissionBlock Upload complete. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3StartSyncActiveData:(DisposeAM3ActiveStartTransmission)activeTransmissionBlock withActiveHistoryData:(DisposeAM3ActiveHistoryData)activeHistoryDataBlock withActiveFinishTransmission:(DisposeAM3ActiveFinishTransmission)activeFinishTransmissionBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Upload AM3 data,Data type: 5 minutes of sleep data, + * @param sleepTransmissionBlock sleepTransmission:Start uploading sleep data,, including parameters:SleepHistoryDate、AM3SleepHistoryTotoalNum.SleepHistoryDate:Sleep start time,yyyy-MM-dd HH:mm:ss(SleepHistoryDateYear,SleepHistoryDateMonth,SleepHistoryDateDay,SleepHistoryDateHour,SleepHistoryDateMinute,SleepHistoryDateSeconds).SleepHistoryTotoalNum: Number of records + * @param sleepHistoryDataBlock Sleep data, including the following parameters::AMDate、SleepData、dataID.AMDate:Sleep time, SleepData: Sleep grade, 0: awake, 1: light sleep, 2: deep sleep ,dataID: data ID. + * @param sleepFinishTransmissionBlock Upload complete. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3StartSyncSleepData:(DisposeAM3SleepStartTransmission)sleepTransmissionBlock withSleepHistoryData:(DisposeAM3SleepHistoryData)sleepHistoryDataBlock withSleepFinishTransmission:(DisposeAM3SleepFinishTransmission)sleepFinishTransmissionBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Upload AM3 data,Data type: Sync current active data + * @param currentActiveInfoBlock Total calories and steps for today, including parameters:Step、Calories、TotalCalories.Step:Number of steps taken today.Calories:Number of calories burned today.TotalCalories:Sum calories burned and bmr today. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3StartSyncCurrentActiveData:(DisposeAM3GetCurrentActiveInfo)currentActiveInfoBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Get totoal alarm infomation + * @param totoalAlarmInfoBlock Alarm array contains up to 3 alarms, each one needs the following parameters:AlarmId、Time、Week.AlarmId:1, 2, 3.Time:HH:mm.Week(Sun、Mon、Tue、Wed、Thu、Fri、Sat)True: On, False: Off + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3GetTotoalAlarmInfo:(DisposeAM3TotoalAlarmData)totoalAlarmInfoBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Set alarm. + * @param alarmDic Alarm information, include parameters:AlarmId、Time、IsRepeat、Switch、(Sun、Mon、Tue、Wed、Thu、Fri、Sat) + * @param finishResultBlock True: Alarm set successfully,False: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3SetAlarmDictionary:(NSDictionary *)alarmDic withFinishResult:(DisposeAM3SetAlarmBlock)finishResultBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Delete alarm. + * @param alarmID alarmID:1, 2, 3. + * @param finishResultBlock True: Delete successful,False: Failed + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3DeleteAlarmID:(NSNumber *)alarmID withFinishResult:(DisposeAM3DeleteAlarmBlock)finishResultBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Get reminder. + * @param remindInfoBlock Array containing following parameters:ReminderID、Time、Switch.ReminderID:Reminder ID.Time:format HH:mm, time between reminders (HH*60+mm) minutes.Switch:Reminder on/off,True: On, False: Off. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3GetReminderInfo:(DisposeAM3RemindInfoBlock)remindInfoBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Set reminders. + * @param reminderDic Array containing collowing parameters:Time、Switch。 + * @param finishResultBlock YES: Successfully set, NO: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3SetReminderDictionary:(NSDictionary *)reminderDic withFinishResult:(DisposeAM3SetReminderBlock)finishResultBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Get device state infomation + * @param deviceStateInfoBlock AM status,State_wrist (AM3 being worn on the wrist),State_waist (AM3 worn with belt clip). + * @param batteryBlock AM3 battery percentage, from 0~100. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3GetDeviceStateInfo:(DisposeAM3StateInfoBlock)deviceStateInfoBlock withBattery:(DisposeAM3BatteryBlock)batteryBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Restore factory settings. + * @param resetDeviceBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3ResetDevice:(DisposeAM3ResetDeviceBlock)resetDeviceBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Disconnect AM3 connection. + * @param disconnectBlock True: Success,False: Failed. + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3Disconnect:(DisposeAM3DisconnectBlock)disconnectBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Get time format + * @param timeFormat (AM3TimeFormat_hh,AM3TimeFormat_HH) + * @param errorBlock Communication error codes, see AM3 error descriptions. + * @Notice Notice: Firmware version 1.1.9 and above supports this function + */ +-(void)commandAM3GetTimeFormat:(DisposeAM3TimeFormatBlock)timeFormat withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Get user infomation + * @param userInfoBlock including parameters:Age,Step,Height,Gender,Weight,Unit,goal(TotalStep1、TotalStep2、TotalStep3) + * @param errorBlock Communication error codes, see AM3 error descriptions. + */ +-(void)commandAM3GetUserInfo:(DisposeAM3UserInfoBlock)userInfoBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + +/** + * Set state model + * @param state including AM3SetStateModel_sleep,AM3SetStateModel_active,AM3SetStateModel_fly,AM3SetStateModel_drive + * @param finishResultBlock True: Delete successful,False: Failed + * @param errorBlock Communication error codes, see AM3 error descriptions. + * @Notice Notice: Firmware version 1.1.1 and above supports AM3SetStateModel_drive + */ +-(void)commandAM3SetStateModel:(AM3StateModel)state withFinishResult:(DisposeAM3SetStateModelBlock)finishResultBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; + + +/** + * Set BMR + * @param bmr ranging from 0 – 5000. + * @param finishResultBlock True: Delete successful,False: Failed + * @param errorBlock Communication error codes, see AM3 error descriptions. + * @Notice Notice: Firmware version 1.0.2 and above supports this function + */ +-(void)commandAM3SetBMR:(NSNumber *)bmr withFinishResult:(DisposeAM3SetBMRBlock)finishResultBlock withErrorBlock:(DisposeAM3ErrorBlock)errorBlock; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3Controller.h new file mode 100644 index 0000000..701393a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3Controller.h @@ -0,0 +1,29 @@ +// +// AM3Controller.h +// testShareCommunication +// +// Created by daiqingquan on 13-10-15. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import + +/** + AM3Controller + */ +@interface AM3Controller : NSObject + +/** + * Initialize AM3 controller class + */ ++(AM3Controller *)shareIHAM3Controller; + + +/** + * Access control class instance after receiving AM3ConnectNoti, then use instance to call AM3 related communication methods + */ +-(NSArray *)getAllCurrentAM3Instace; + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3SController_V2.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3SController_V2.h new file mode 100644 index 0000000..17acd64 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3SController_V2.h @@ -0,0 +1,29 @@ +// +// AM3SController_V2.h +// iHealthDemoCode +// +// Created by user on 16/8/12. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + +/** + AM3SController_V2 + */ +@interface AM3SController_V2 : NSObject + +/** + * Initialize AM3S controller class + */ ++(AM3SController_V2 *)shareIHAM3SController; + + +/** + * Access control class instance after receiving AM3SConnectNoti, then use instance to call AM3S related communication methods + */ +-(NSArray *)getAllCurrentAM3SInstace; + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3S_V2.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3S_V2.h new file mode 100644 index 0000000..f3b2e58 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM3S_V2.h @@ -0,0 +1,227 @@ +// +// AM3S_V2.h +// iHealthDemoCode +// +// Created by user on 16/8/12. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import +#import "AMMacroFile.h" +/** + AM3S_V2 + */ +@interface AM3S_V2 : NSObject +@property (strong, nonatomic) NSMutableString *am3SRandomString; +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *firmwareVersion; + + + +/** + * Get device userID + * @param getDeviceUserIDBlock get userID + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SGetDeviceUserID:(DisposeAM3SGetDeviceUserIDBlock)getDeviceUserIDBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + + +/** + * Set RandomNumber + * @param setRandomNumberBlock randomNumber + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SSetRandomNumber:(DisposeAM3SSetRandomNumberBlock)setRandomNumberBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + +/** + * Sync time + * @param syncTimeBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SSyncTime:(DisposeAM3SSyncTimeBlock)syncTimeBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Set time format and nation + * @param timeFormatAndNation AM3STimeFormat_hh,AM3STimeFormat_HH,AM3STimeFormat_NoEuropeAndhh,AM3STimeFormat_EuropeAndhh,AM3STimeFormat_NoEuropeAndHH,AM3STimeFormat_EuropeAndHH, + * @param setTimeFormatBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + * @Notice Notice: Firmware version 1.0.0 and above supports AM3STimeFormat_NoEuropeAndhh,AM3STimeFormat_EuropeAndhh,AM3STimeFormat_NoEuropeAndHH,AM3STimeFormat_EuropeAndHH, + */ +-(void)commandAM3SSetTimeFormatAndNation:(AM3STimeFormatAndNation)timeFormatAndNation withFinishResult:(DisposeAM3STimeFormatAndNationSettingBlock)setTimeFormatBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Binding AM3S to user,Account binding requires an active internet connection. + * @param userID userID, ranging from 1 – 2147483647. + * @param finishResultBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SSetUserID:(NSNumber*)userID withFinishResult:(DisposeAM3SSetDeviceUserIDBlock)finishResultBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * AM3S initialization,Must be called the first time to ensure that the AM3S has correct user information, goals, time, battery checks, etc. + * @param user User information, needs to include the following:age(int)、height(cm,1-255)、weight(kg,1-255)、bmr(user basal metabolic)、sex(UserSex_Female or UserSex_Male)、activityLevel (activityLevel=1, Sedentary,spend most of day sitting.activityLevel=2, Active,spend a good part of day doing some physical activity.activityLevel=3, Very Active,spend most of day doing heavy physical activity.) + * @param unit AM3SKmUnit_mile or AM3SKmUnit_km + * @param activeGoalNumber User goal number of steps,ranging from 4 – 2147483647. Default is 10,000 + * @param setUserInfoFinishBlock True: Success, False: Failed. + * @param setBMRfinishResultBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ + +-(void)commandAM3SSetUserInfo:(HealthUser *)user withUnit:(AM3SKmUnit)unit withActiveGoal:(NSNumber *)activeGoalNumber withSetUserInfoFinishResult:(DisposeAM3SSetUserInfoBlock)setUserInfoFinishBlock withSetBMR:(DisposeAM3SSetBMRBlock)setBMRfinishResultBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + + + + +/** + * Upload AM3S data,Data type: 5 minutes of active data, total number of steps for the day, and total calories.Also includes the number of steps for the 5 minutes of motion data, total calories for the current time, calories of the steps, and total calories. + * @param activeTransmissionBlock activeTransmission: Start uploading motion data, including parameters:Start date,yyyy-MM-dd(ActiveHistoryDateYear,ActiveHistoryDateMonth,ActiveHistoryDateDay),ActiveStepSize:Length of each step,ActiveHistoryTotoalNum:Number of records. + * @param activeHistoryDataBlock active data,including the following parameters:AMDate、AMCalorie、AMstepNum、AMstepSize、dataID、Start. AMDate:Workout time,AMCalorie: Current time total calories,AMStepNum:Total number of steps,dataID:data ID,Start:represents the beginning of a movement. + * @param activeFinishTransmissionBlock Upload complete. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SStartSyncActiveData:(DisposeAM3SActiveStartTransmission)activeTransmissionBlock + withActiveHistoryData:(DisposeAM3SActiveHistoryData)activeHistoryDataBlock + withActiveFinishTransmission:(DisposeAM3SActiveFinishTransmission)activeFinishTransmissionBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; +/** + * Upload AM3S data,Data type: 5 minutes of sleep data + * @param sleepTransmissionBlock sleepTransmission:Start uploading sleep data,, including parameters:SleepHistoryDate、AM3SSleepHistoryTotoalNum.SleepHistoryDate:Sleep start time,yyyy-MM-dd HH:mm:ss(SleepHistoryDateYear,SleepHistoryDateMonth,SleepHistoryDateDay,SleepHistoryDateHour,SleepHistoryDateMinute,SleepHistoryDateSeconds).SleepHistoryTotoalNum: Number of records + * @param sleepHistoryDataBlock Sleep data, including the following parameters::AMDate、SleepData、dataID.AMDate:Sleep time, SleepData: Sleep grade, 0: awake, 1: light sleep, 2: deep sleep ,dataID: data ID. + * @param sleepFinishTransmissionBlock Upload complete. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SStartSyncSleepData:(DisposeAM3SSleepStartTransmission)sleepTransmissionBlock withSleepHistoryData:(DisposeAM3SSleepHistoryData)sleepHistoryDataBlock + withSleepFinishTransmission:(DisposeAM3SSleepFinishTransmission)sleepFinishTransmissionBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Upload AM3S data,Data type: Sync current active data + * @param currentActiveInfoBlock Total calories and steps for today, including parameters:Step、Calories、TotalCalories.Step:Number of steps taken today.Calories:Number of calories burned today.TotalCalories:Sum calories burned and bmr today. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SStartSyncCurrentActiveData:(DisposeAM3SGetCurrentActiveInfo)currentActiveInfoBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + + +/** + * Upload AM3S report data. + * @param stageDataBlock Report data, including parameters:ReportStage_Work_out(1)、ReportStage_Sleep_summary(2).ReportStage_Work_out:Report Stage active,including parameters:Work_outCalories(Workout calories burned)、Work_outLengthNumber(Workout distance)、Work_outMeasureDate(Start time)、Work_outStepNumber(Workout number of steps)、Work_outTimeNumber(Length of workout)、dataID(data ID).ReportStage_Sleep_summary:Report Stage sleep,including parameters:Sleep_summaryMeasureDate(Sleep start time)、Sleep_summarySleepTime(Sleep duration)、Sleep_summarysleepAddMinute(Correct sleep duration length)、Sleep_summarysleepEfficiency(Sleep efficiency percentage, range is 0-100) + * @param stageDataFinishTransmissionBlock YES: Success,NO: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SStartSyncStageData:(DisposeAM3SStageMeasureDataBlock)stageDataBlock withStageDataFinishTransmission:(DisposeAM3SStageMeasureFinishBlock)stageDataFinishTransmissionBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + +/** + * Get totoal alarm infomation + * @param totoalAlarmInfoBlock Alarm array contains up to 3 alarms, each one needs the following parameters:AlarmId、Time、Week.AlarmId:1, 2, 3.Time:HH:mm.Week(Sun、Mon、Tue、Wed、Thu、Fri、Sat)True: On, False: Off + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SGetTotoalAlarmInfo:(DisposeAM3STotoalAlarmData)totoalAlarmInfoBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Set alarm. + * @param alarmDic Alarm information, include parameters:AlarmId(1、2、3)、Time、IsRepeat、Switch、Week(Sun、Mon、Tue、Wed、Thu、Fri、Sat) + * @param finishResultBlock True: Alarm set successfully,False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SSetAlarmDictionary:(NSDictionary *)alarmDic withFinishResult:(DisposeAM3SSetAlarmBlock)finishResultBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + +/** + * Delete alarm. + * @param alarmID alarmID:1, 2, 3. + * @param finishResultBlock True: Delete successful,False: Failed + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SDeleteAlarmID:(NSNumber *)alarmID withFinishResult:(DisposeAM3SDeleteAlarmBlock)finishResultBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Get reminder. + * @param remindInfoBlock Array containing following parameters:ReminderID、Time、Switch.ReminderID:Reminder ID.Time:format HH:mm, time between reminders (HH*60+mm) minutes.Switch:Reminder on/off,True: On, False: Off. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SGetReminderInfo:(DisposeAM3SRemindInfoBlock)remindInfoBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Set reminders. + * @param reminderDic Array containing collowing parameters:Time、Switch。 + * @param finishResultBlock YES: Successfully set, NO: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SSetReminderDictionary:(NSDictionary *)reminderDic withFinishResult:(DisposeAM3SSetReminderBlock)finishResultBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + + +/** + * Get device state infomation + * @param deviceStateInfoBlock AM status,State_wrist (AM3S being worn on the wrist),State_waist (AM3S worn with belt clip). + * @param batteryBlock AM battery percentage, from 0~100. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SGetDeviceStateInfo:(DisposeAM3SStateInfoBlock)deviceStateInfoBlock withBattery:(DisposeAM3SBatteryBlock)batteryBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Restore factory settings. + * @param resetDeviceBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SResetDevice:(DisposeAM3SResetDeviceBlock)resetDeviceBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Disconnect AM3S connection. + * @param disconnectBlock True: Success,False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SDisconnect:(DisposeAM3SDisconnectBlock)disconnectBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + +/** + * Get time format and nation + * @param timeAndNationBlock (AM3STimeFormat_hh,AM3STimeFormat_HH,AM3STimeFormat_NoEuropeAndhh,AM3STimeFormat_EuropeAndhh,AM3STimeFormat_NoEuropeAndHH,AM3STimeFormat_EuropeAndHH) + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SGetTimeFormatAndNation:(DisposeAM3STimeFormatAndNationBlock)timeAndNationBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + + + +/** + * Get user infomation + * @param userInfoBlock including parameters:Age,Step,Height,Gender,Weight,Unit,goal(TotalStep1、TotalStep2、TotalStep3) + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SGetUserInfo:(DisposeAM3SUserInfoBlock)userInfoBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + + +/** + * Set BMR + * @param bmr ranging from 0 – 5000. + * @param finishResultBlock True: Delete successful,False: Failed + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SSetBMR:(NSNumber *)bmr withFinishResult:(DisposeAM3SSetBMRBlock)finishResultBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + + + + + +/** + * Get Picture. + * @param pictureBlock Picture_one,Picture_two + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SGetPicture:(DisposeAM3SGetPictureBlock)pictureBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +/** + * Set Picture. + * @param pictures Picture_one,Picture_two + * @param finishResultBlock True: Success,False: Failed. + * @param errorBlock Communication error codes, see AM3S error descriptions. + */ +-(void)commandAM3SSetPicture:(AM3SPicture)pictures withFinishResult:(DisposeAM3SSetPictureBlock)finishResultBlock withErrorBlock:(DisposeAM3SErrorBlock)errorBlock; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4.h new file mode 100755 index 0000000..f37474e --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4.h @@ -0,0 +1,223 @@ +// +// AM4.h +// iHealthApp2 +// +// Created by 小翼 on 14-7-2. +// Copyright (c) 2014年 andon. All rights reserved. +// + +#import +#import "AMMacroFile.h" + +/** + AM4 + */ +@interface AM4 : NSObject +@property (strong, nonatomic) NSMutableString *am4RandomString; +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *firmwareVersion; + + + +/** + * Get device userID + * @param getDeviceUserIDBlock get userID + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4GetDeviceUserID:(DisposeAM4GetDeviceUserIDBlock)getDeviceUserIDBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + + +/** + Set RandomNumber + + @param setRandomNumberBlock randomNumber + @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SetRandomNumber:(DisposeAM4SetRandomNumberBlock)setRandomNumberBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + +/** + * Sync time + * @param syncTimeBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SyncTime:(DisposeAM4SyncTimeBlock)syncTimeBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Set time format and nation + * @param timeFormatAndNation AM4TimeFormat_hh,AM4TimeFormat_HH,AM4TimeFormat_NoEuropeAndhh,AM4TimeFormat_EuropeAndhh,AM4TimeFormat_NoEuropeAndHH,AM4TimeFormat_EuropeAndHH + * @param setTimeFormatBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SetTimeFormatAndNation:(AM4TimeFormatAndNation)timeFormatAndNation withFinishResult:(DisposeAM4TimeFormatAndNationSettingBlock)setTimeFormatBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; +/** + * Binding AM4 to user,Account binding requires an active internet connection. + * @param userID userID, ranging from 1 – 2147483647. + * @param finishResultBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SetUserID:(NSNumber*)userID withFinishResult:(DisposeAM4SetDeviceUserIDBlock)finishResultBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * AM4 initialization,Must be called the first time to ensure that the AM4 has correct user information, goals, time, battery checks, etc. + * @param user User information, needs to include the following:age(int)、height(cm,1-255)、weight(kg,1-255)、bmr(user basal metabolic)、sex(UserSex_Female or UserSex_Male)、activityLevel (activityLevel=1, Sedentary,spend most of day sitting.activityLevel=2, Active,spend a good part of day doing some physical activity.activityLevel=3, Very Active,spend most of day doing heavy physical activity.) + * @param unit AM4KmUnit_mile or AM4KmUnit_km + * @param activeGoalNumber User goal number of steps,ranging from 4 – 2147483647. Default is 10,000 + * @param swimmingGoal User goal number of swimming.ranging from 1–1439. Default is 30min + * @param setUserInfoFinishBlock True: Success, False: Failed. + * @param setBMRfinishResultBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ + +-(void)commandAM4SetUserInfo:(HealthUser *)user withUnit:(AM4KmUnit)unit withActiveGoal:(NSNumber *)activeGoalNumber withSwimmingGoal:(NSNumber *)swimmingGoal withSetUserInfoFinishResult:(DisposeAM4SetUserInfoBlock)setUserInfoFinishBlock withSetBMR:(DisposeAM4SetBMRBlock)setBMRfinishResultBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + + +/** + * Set swimming + * @param swimmingIsOpen YES:open swimming function NO:close swimming function default:no + * @param swimmingPoolLength swimming Pool Length,ranging from 0 – 255. + * @param noSwimmingDate automatic drop out swim duration + * @param unit swim unit (AM4SwimmingUnit_m or AM4SwimmingUnit_km) + * @param finishResultBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SetSwimmingState:(BOOL)swimmingIsOpen withSwimmingPoolLength:(NSNumber *)swimmingPoolLength withNOSwimmingTime:(NSDate *)noSwimmingDate withUnit:(AM4SwimmingUnit)unit withFinishResult:(DisposeAM4SettingSwimmingBlock)finishResultBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Upload AM4 data,Data type: 5 minutes of active data, total number of steps for the day, and total calories.Also includes the number of steps for the 5 minutes of motion data, total calories for the current time, calories of the steps, and total calories. + * @param activeTransmissionBlock activeTransmission: Start uploading motion data, including parameters:Start date,yyyy-MM-dd(ActiveHistoryDateYear,ActiveHistoryDateMonth,ActiveHistoryDateDay),ActiveStepSize:Length of each step,ActiveHistoryTotoalNum:Number of records. + * @param activeHistoryDataBlock active data,including the following parameters:AMDate、AMCalorie、AMstepNum、AMstepSize、dataID、Start. AMDate:Workout time,AMCalorie: Current time total calories,AMStepNum:Total number of steps,dataID:data ID,Start:represents the beginning of a movement. + * @param activeFinishTransmissionBlock Upload complete. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4StartSyncActiveData:(DisposeAM4ActiveStartTransmission)activeTransmissionBlock + withActiveHistoryData:(DisposeAM4ActiveHistoryData)activeHistoryDataBlock + withActiveFinishTransmission:(DisposeAM4ActiveFinishTransmission)activeFinishTransmissionBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; +/** + * Upload AM4 data,Data type: 5 minutes of sleep data + * @param sleepTransmissionBlock sleepTransmission:Start uploading sleep data,, including parameters:SleepHistoryDate、AM4SleepHistoryTotoalNum.SleepHistoryDate:Sleep start time,yyyy-MM-dd HH:mm:ss(SleepHistoryDateYear,SleepHistoryDateMonth,SleepHistoryDateDay,SleepHistoryDateHour,SleepHistoryDateMinute,SleepHistoryDateSeconds).SleepHistoryTotoalNum: Number of records + * @param sleepHistoryDataBlock Sleep data, including the following parameters::AMDate、SleepData、dataID.AMDate:Sleep time, SleepData: Sleep grade, 0: awake, 1: light sleep, 2: deep sleep ,dataID: data ID. + * @param sleepFinishTransmissionBlock Upload complete. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4StartSyncSleepData:(DisposeAM4SleepStartTransmission)sleepTransmissionBlock withSleepHistoryData:(DisposeAM4SleepHistoryData)sleepHistoryDataBlock + withSleepFinishTransmission:(DisposeAM4SleepFinishTransmission)sleepFinishTransmissionBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Upload AM4 data,Data type: Sync current active data + * @param currentActiveInfoBlock Total calories and steps for today, including parameters:Step、Calories、TotalCalories.Step:Number of steps taken today.Calories:Number of calories burned today.TotalCalories:Sum calories burned and bmr today. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4StartSyncCurrentActiveData:(DisposeAM4GetCurrentActiveInfo)currentActiveInfoBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + + +/** + * Upload AM4 report data. + * @param stageDataBlock Report data, including parameters:ReportStage_Swimming(0)、ReportStage_Work_out(1)、ReportStage_Sleep_summary(2).ReportStage_Swimming:Report Stage Swimming.including parameters:SwimmingMeasureDate(swimming Measure date)、SwimmingTimeNumber(swimming time number)、SwimmingTimes(swimming times)、Swimmingcalories(swimming calories)、SwimmingAct(swimming action)、SwimmingCircleCount(swimming circle count)、SwimmingPoollength(swimming pool length)、EnterSwimmingTime(enter swimming time)、OutSwimmingTime(out swimming time)、SwimmingProcessMark(swimming process mark)、SwimStartTimeStamp(swim start time stamp)、dataID(data ID).ReportStage_Work_out:Report Stage active,including parameters:Work_outCalories(Workout calories burned)、Work_outLengthNumber(Workout distance)、Work_outMeasureDate(Start time)、Work_outStepNumber(Workout number of steps)、Work_outTimeNumber(Length of workout)、dataID(data ID).ReportStage_Sleep_summary:Report Stage sleep,including parameters:Sleep_summaryMeasureDate(Sleep start time)、Sleep_summarySleepTime(Sleep duration)、Sleep_summarysleepAddMinute(Correct sleep duration length)、Sleep_summarysleepEfficiency(Sleep efficiency percentage, range is 0-100) + * @param stageDataFinishTransmissionBlock YES: Success,NO: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4StartSyncStageData:(DisposeAM4StageMeasureDataBlock)stageDataBlock withStageDataFinishTransmission:(DisposeAM4StageMeasureFinishBlock)stageDataFinishTransmissionBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + +/** + * Get totoal alarm infomation + * @param totoalAlarmInfoBlock Alarm array contains up to 3 alarms, each one needs the following parameters:AlarmId、Time、Week.AlarmId:1, 2, 3.Time:HH:mm.Week(Sun、Mon、Tue、Wed、Thu、Fri、Sat)True: On, False: Off + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4GetTotoalAlarmInfo:(DisposeAM4TotoalAlarmData)totoalAlarmInfoBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Set alarm. + * @param alarmDic Alarm information, include parameters:AlarmId(1、2、3)、Time、IsRepeat、Switch、Week(Sun、Mon、Tue、Wed、Thu、Fri、Sat) + * @param finishResultBlock True: Alarm set successfully,False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SetAlarmDictionary:(NSDictionary *)alarmDic withFinishResult:(DisposeAM4SetAlarmBlock)finishResultBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + +/** + * Delete alarm. + * @param alarmID alarmID:1, 2, 3. + * @param finishResultBlock True: Delete successful,False: Failed + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4DeleteAlarmID:(NSNumber *)alarmID withFinishResult:(DisposeAM4DeleteAlarmBlock)finishResultBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Get reminder. + * @param remindInfoBlock Array containing following parameters:ReminderID、Time、Switch.ReminderID:Reminder ID.Time:format HH:mm, time between reminders (HH*60+mm) minutes.Switch:Reminder on/off,True: On, False: Off. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4GetReminderInfo:(DisposeAM4RemindInfoBlock)remindInfoBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Set reminders. + * @param reminderDic Array containing collowing parameters:Time、Switch。 + * @param finishResultBlock YES: Successfully set, NO: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SetReminderDictionary:(NSDictionary *)reminderDic withFinishResult:(DisposeAM4SetReminderBlock)finishResultBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + + +/** + * Get device state infomation + * @param deviceStateInfoBlock AM status,State_wrist (AM4 being worn on the wrist),State_waist (AM4 worn with belt clip). + * @param batteryBlock AM battery percentage, from 0~100. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4GetDeviceStateInfo:(DisposeAM4StateInfoBlock)deviceStateInfoBlock withBattery:(DisposeAM4BatteryBlock)batteryBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Restore factory settings. + * @param resetDeviceBlock True: Success, False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4ResetDevice:(DisposeAM4ResetDeviceBlock)resetDeviceBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Disconnect AM4 connection. + * @param disconnectBlock True: Success,False: Failed. + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4Disconnect:(DisposeAM4DisconnectBlock)disconnectBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + +/** + * Get time format and nation + * @param timeAndNationBlock (AM4TimeFormat_hh,AM4TimeFormat_HH,AM4TimeFormat_NoEuropeAndhh,AM4TimeFormat_EuropeAndhh,AM4TimeFormat_NoEuropeAndHH,AM4TimeFormat_EuropeAndHH) + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4GetTimeFormatAndNation:(DisposeAM4TimeFormatAndNationBlock)timeAndNationBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + + + + +/** + * Get user infomation + * @param userInfoBlock including parameters:Age,Step,Height,Gender,Weight,Unit,goal(TotalStep1、TotalStep2、TotalStep3) + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4GetUserInfo:(DisposeAM4UserInfoBlock)userInfoBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Get swimming infomation + * @param swimmingInfoBlock including parameters:swimmingIsOpen,swimmingLaneLength,NOSwimmingTime,unit + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4GetSwimmingInfo:(DisposeAM4SwimmingBlock)swimmingInfoBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +/** + * Set BMR + * @param bmr ranging from 0 – 5000. + * @param finishResultBlock True: Delete successful,False: Failed + * @param errorBlock Communication error codes, see AM4 error descriptions. + */ +-(void)commandAM4SetBMR:(NSNumber *)bmr withFinishResult:(DisposeAM4SetBMRBlock)finishResultBlock withErrorBlock:(DisposeAM4ErrorBlock)errorBlock; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4Controller.h new file mode 100755 index 0000000..b54a062 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM4Controller.h @@ -0,0 +1,31 @@ +// +// AM4Controller.h +// iHealthApp3 +// +// Created by 小翼 on 15/5/22. +// Copyright (c) 2015年 iHealth. All rights reserved. +// + +#import + +/** + AM4Controller + */ +@interface AM4Controller : NSObject + + + +/** + * Initialize AM4 controller class + */ ++(AM4Controller *)shareIHAM4Controller; + + +/** + * Access control class instance after receiving AM4ConnectNoti, then use instance to call AM4 related communication methods + */ +-(NSArray *)getAllCurrentAM4Instace; + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5.h new file mode 100755 index 0000000..a08f3ae --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5.h @@ -0,0 +1,335 @@ +// +// AM5.h +// iHealthSDKStatic +// +// Created by user on 2019/7/2. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import +#import "AM5Header.h" +#import "AMMacroFile.h" + +@interface AM5 : NSObject + +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; + + +/** + *BindingDevice + + * @param bindingResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandBindingDevice:(DisposeBindingAM5Result)bindingResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + *UnBindingDevice + + * @param unbindingResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandUnBindingDevice:(DisposeUnBindingAM5Result)unbindingResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; +/** + * GetDeviceInfo + + * @param deviceInfo + This dictionary includes key: + Mode:Device mode BatteryStatus:Battery status BatteryLevel:Battery level RebootFlag:Whether to restart BindTimeStr:Binding timestamp BindState:Binding status + * @param disposeErrorBlock error code + */ +-(void)commandGetDeviceInfo:(DisposeGetAM5DeviceInfo)deviceInfo DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; +/** + * Get functional information + + * @param deviceFunctionalInfo + This dictionary includes key: + Steps:Number of steps + SleepDetection:Sleep detection + SingleMovement:Single movement + LiveData:Real-time data + Update:Equipment Update + HeartRate:Heart rate function + Notification:Notification Center + Timeline:Timeline + * @param disposeErrorBlock error code + */ +-(void)commandGetFuncTable:(DisposeGetAM5FuncTable)deviceFunctionalInfo DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; +/** + * GetDeviceMac + + * @param deviceMac This is the MAC for the device + * @param disposeErrorBlock error code + */ +-(void)commandGetDeviceMac:(DisposeGetAM5Mac)deviceMac DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * GetLiveData + + * @param liveData + This dictionary includes key: + Step:Step count Calorie:Calorie Distances:distance ActiveTime:Duration of activity HeartRate:Heart rate + * @param disposeErrorBlock error code + */ +-(void)commandGetLiveData:(DisposeGetAM5LiveData)liveData DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * GetActivityCount + + * @param activityCount + + This dictionary includes key: + + ActivityCount:Number of activities ActivityPacketCount:Number of active packages GpsCount:Number of GPS data GpsPacketCount:Number of GPS packets + + * @param disposeErrorBlock error code + */ +-(void)commandGetActivityCount:(DisposeGetAM5ActivityCount)activityCount DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * setCurrentTime + * @param setCurrentTime Synchronizes the current time to the device YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetCurrentTime:(DisposeAM5SetCurrentTime)setCurrentTime DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * setAlarm + * @param alarm + example code: + IDOSetAlarmInfoBluetoothModel * alarmModel= [IDOSetAlarmInfoBluetoothModel currentModel]; + switch alarmModel.isOpen + Whether the synchronization alarmModel.isSync + Whether or not to delete alarmModel.isDelete + Type alarmModel.type + Hour alarmModel.hour + Minute alarmModel.minute + Repeat alarmModel.repeat + TsnoozeDuration alarmModel.tsnoozeDuration + AlarmId alarmModel.alarmId + + * @param setAlarmResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetAlarm:(IDOSetAlarmInfoBluetoothModel*)alarm setResult:(DisposeAM5SetAlarm)setAlarmResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetUserTarget + * @param target + example code: + IDOSetUserInfoBuletoothModel * userModel= [IDOSetUserInfoBuletoothModel currentModel]; + Target sleep time(hour) userModel.goalSleepDataHour + Target sleep time(minutes) userModel.goalSleepDataMinute + Target steps userModel.goalStepData + Target Calorie userModel.goalCalorieData + Target Distance userModel.goalDistanceData + Target Weight userModel.goalWeightData + Target type userModel.goalType (type: 0: steps 1: calories 2: distance) setting a type of target requires executing a command once + + * @param setUserTargetResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetUserTarget:(IDOSetUserInfoBuletoothModel*)target setResult:(DisposeAM5SetUserTarget)setUserTargetResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetUserInfo + @param userInfo + example code: + IDOSetUserInfoBuletoothModel * userModel= [IDOSetUserInfoBuletoothModel currentModel]; + height userModel.height + weight userModel.weight + gender userModel.gender Gender 1: male 2: female + year userModel.year + month userModel.month + day userModel.day + + * @param setUserInfoResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetUserInfo:(IDOSetUserInfoBuletoothModel*)userInfo setResult:(DisposeAM5SetUserInfo)setUserInfoResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetUnit + @param unit + example code: + IDOSetUnitInfoBluetoothModel * unitInfo = [IDOSetUnitInfoBluetoothModel currentModel]; + From the unit unitInfo.distanceUnit 0x00: invalid, 0x01:km, 0x02:mi + Unit of weight unitInfo.weightUnit 0x00: invalid, 0x01:kg, 0x02:lb, 0x03: st + Temperature of the unit unitInfo.tempUnit 0x00: invalid, 0 x01: ° C, 0 x02: ° F + The language unit unitInfo.languageUnit (Invalid :0, Chinese :1, English :2, French :3, German :4, Italian :5, Spanish :6, Japanese :7,Polish :8, Czech :9, Romania :10, Lithuanian :11, Dutch :12, Slovenia :13,Hungarian :14, Russian :15, Ukrainian :16, slovak :17, Danish :18, Croatian :19) + Walking pace unitInfo.strideWalk Convert to the default value of 90 for men (unit: cm) + Running pace unitInfo.strideRun According to the default value of male conversion 72 (unit: cm) + GPS calibration step size unitInfo.strideGps 0x00: invalid, 0x01: on, 0x02: off + Unit of time unitInfo.timeUnit 0x00: invalid, 0x01:24 hours, 0x02: 12 hours + The beginning of the week unitInfo.weekStart (Sunday: 0, Monday: 1, Tuesday: 2, Wednesday: 3, Thursday: 4, Friday: 5, Saturday: 6) + + * @param setUnitResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetUnit:(IDOSetUnitInfoBluetoothModel*)unit setResult:(DisposeAM5SetUnit)setUnitResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetLongSit + @param longSit + example code: + IDOSetLongSitInfoBuletoothModel * SitInfo = [IDOSetLongSitInfoBuletoothModel currentModel]; + + interval SitInfo.interval + Start(Hour) SitInfo.startHour + Start(minutes) SitInfo.startMinute + End(Hour) SitInfo.endHour + End(minutes) SitInfo.endMinute + Switch SitInfo.isOpen + + * @param setLongSitResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetLongSit:(IDOSetLongSitInfoBuletoothModel*)longSit setResult:(DisposeAM5SetLongSit)setLongSitResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + + +/** + * SetLeftRightHand + @param leftRightHand + example code: + IDOSetLeftOrRightInfoBuletoothModel * leftOrRightModel = [IDOSetLeftOrRightInfoBuletoothModel currentModel]; + + Whether to wear right hand leftOrRightModel.isRight 0:left 1:right + + * @param setLeftRightHandResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetLeftRightHand:(IDOSetLeftOrRightInfoBuletoothModel*)leftRightHand setResult:(DisposeAM5SetLeftRightHand)setLeftRightHandResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetHrInterval + @param hrInterval + example code: + IDOSetHrIntervalInfoBluetoothModel * hrIntervalInfo = [IDOSetHrIntervalInfoBluetoothModel currentModel]; + + Fat burning threshold hrIntervalInfo.burnFat + Aerobic threshold hrIntervalInfo.aerobic + Threshold limit hrIntervalInfo.limitValue + Maximum heart rate hrIntervalInfo.userMaxHr + + * @param setHrIntervalResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetHrInterval:(IDOSetHrIntervalInfoBluetoothModel*)hrInterval setResult:(DisposeAM5SetHrInterval)setHrIntervalResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetHrMode + @param hrMode + example code: + IDOSetHrModeInfoBluetoothModel * hrModeInfo = [IDOSetHrModeInfoBluetoothModel currentModel]; + Heart rate pattern hrModeInfo.modeType 0: turn off heart rate monitoring function 1: manual mode 2: automatic mode (default: automatic mode) + Is there an interval hrModeInfo.isHasTimeRange + Start(Hour) hrModeInfo.startHour + Start(minutes) hrModeInfo.startMinute + End(Hour) hrModeInfo.endHour + End(minutes) hrModeInfo.endMinute + + * @param setHrModeResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetHrMode:(IDOSetHrModeInfoBluetoothModel*)hrMode setResult:(DisposeAM5SetHrMode)setHrModeResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetNoDisturbMode + @param noDisturbMode + example code: + IDOSetNoDisturbModeInfoBluetoothModel * noDisturbModeInfo = [IDOSetNoDisturbModeInfoBluetoothModel currentModel]; + + Is there an interval noDisturbModeInfo.isOpen + Start(Hour) noDisturbModeInfo.startHour + Start(minutes) noDisturbModeInfo.startMinute + End(Hour) noDisturbModeInfo.endHour + End(minutes) noDisturbModeInfo.endMinute + + * @param setNoDisturbModeResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetNoDisturbMode:(IDOSetNoDisturbModeInfoBluetoothModel*)noDisturbMode setResult:(DisposeAM5SetNoDisturbMode)setNoDisturbModeResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; +/** + * SetSportModeSelect + @param sportModeSelect + example code: + IDOSetSportShortcutInfoBluetoothModel * sportShortcutInfo = [IDOSetSportShortcutInfoBluetoothModel currentModel]; + sportShortcutInfo.isWalk + sportShortcutInfo.isRun + sportShortcutInfo.isByBike + sportShortcutInfo.isOnFoot + sportShortcutInfo.isMountainClimbing + sportShortcutInfo.isBadminton + sportShortcutInfo.isSpinning + sportShortcutInfo.isTreadmill + sportShortcutInfo.isFitness + sportShortcutInfo.isYoga + sportShortcutInfo.isBasketball + sportShortcutInfo.isTennis + sportShortcutInfo.isDance + sportShortcutInfo.isFootball + + * @param setSportModeSelectResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetSportModeSelect:(IDOSetSportShortcutInfoBluetoothModel*)sportModeSelect setResult:(DisposeAM5SetSportModeSelect)setSportModeSelectResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetSwitchNotice + @param switchNotice + example code: + IDOSetNoticeInfoBuletoothModel* noticeInfo = [IDOSetNoticeInfoBuletoothModel currentModel]; + noticeInfo.isPairing + noticeInfo.isOnChild + * @param setSwitchNoticeResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetSwitchNotice:(IDOSetNoticeInfoBuletoothModel*)switchNotice setResult:(DisposeAM5SetSwitchNotice)setSwitchNoticeResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * syncConfigComplete + + * @param syncConfigCompleteResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSyncConfigComplete:(DisposeGetAM5SyncConfigComplete)syncConfigCompleteResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * syncData + + * @param heartRateData heartRateData + * @param sleepData sleepData + * @param activityData activityData + * @param syncprogress data progress + * @param syncDataSuccess sync finish + * @param disposeErrorBlock error code + */ +-(void)commandSyncData:(DisposeGetAM5SyncHeartRateData)heartRateData syncSleepData:(DisposeGetAM5SyncSleepData)sleepData syncActivityData:(DisposeGetAM5SyncActivityData)activityData syncDataProgress:(DisposeAM5SyncDataProgress)syncprogress syncDataSuccess:(DisposeAM5SyncDataSuccess)syncDataSuccess DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * setAppReboot + + * @param setAppRebootResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetAppReboot:(DisposeAM5SetAppReboot)setAppRebootResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * SetHandUp + @param setHandUp + example code: + IDOSetHandUpInfoBuletoothModel * handUpModel= [IDOSetHandUpInfoBuletoothModel currentModel]; + handUpModel.isOpen YES:open NO:close + * @param setHandUpResult YES:success NO:failed + * @param disposeErrorBlock error code + */ +-(void)commandSetHandUp:(IDOSetHandUpInfoBuletoothModel*)setHandUp setResult:(DisposeAM5SetHandUp)setHandUpResult DiaposeErrorBlock:(DisposeAM5ErrorBlock)disposeErrorBlock; + +/** + * Disconnect AM5 connection. + */ +-(void)commandAM5Disconnect; + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Controller.h new file mode 100644 index 0000000..4eb42d8 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Controller.h @@ -0,0 +1,30 @@ +// +// AM5Controller.h +// iHealthSDKStatic +// +// Created by user on 2019/7/2. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface AM5Controller : NSObject + +/** + * Initialize AM5 controller class + */ ++(AM5Controller *)shareAM5Controller; + + +/** + * Access control class instance after receiving AM5ConnectNoti, then use instance to call AM5 related communication methods + */ +-(NSArray *)getAllCurrentAM5Instace; + +-(NSMutableDictionary *)getAllDiscoverAM5Instace; + +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Header.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Header.h new file mode 100644 index 0000000..bfe8887 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AM5Header.h @@ -0,0 +1,20 @@ +// +// AM5Header.h +// iHealthSDKStatic +// +// Created by user on 2019/7/4. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#ifndef AM5Header_h +#define AM5Header_h + +#import "IDOBluetoothBaseModel.h" +#import "IDOSetInfoBluetoothModel.h" +#import "IDOBluetoothManager.h" +#import "IDOBluetoothServices.h" +#import "IDOSyncManager.h" +#import "IDOFoundationCommand.h" +#import "IDOErrorCodeToStr.h" + +#endif /* AM5Header_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMHeader.h new file mode 100644 index 0000000..a78ef3a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMHeader.h @@ -0,0 +1,27 @@ +// +// AMHeader.h +// AMDemoCode +// +// Created by zhiwei jing on 14-8-12. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#ifndef AMDemoCode_AMHeader_h +#define AMDemoCode_AMHeader_h + +#import "AM3.h" +#import "AM3S_V2.h" +#import "AM4.h" +#import "AM5.h" +#import "AM5Controller.h" + + +#import "AM3Controller.h" +#import "AM3SController_V2.h" +#import "AM4Controller.h" + + +#import "AMMacroFile.h" +#import "HealthUser.h" + +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMMacroFile.h new file mode 100755 index 0000000..dbe0a96 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/AMMacroFile.h @@ -0,0 +1,1171 @@ +// +// AMMacroFile.h +// AMDemoCode +// +// Created by zhiwei jing on 14-8-12. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#import "HealthUser.h" + +#ifndef AMDemoCode_AMMacroFile_h +#define AMDemoCode_AMMacroFile_h + + +#define AM3Discover @"AM3Discover" +#define AM3ConnectFailed @"AM3ConnectFailed" +#define AM3ConnectNoti @"AM3ConnectNoti" +#define AM3DisConnectNoti @"AM3DisConnectNoti" + +#define AM3SDiscover @"AM3SDiscover" +#define AM3SConnectFailed @"AM3SConnectFailed" +#define AM3SConnectNoti @"AM3SConnectNoti" +#define AM3SDisConnectNoti @"AM3SDisConnectNoti" + +#define AM4Discover @"AM4Discover" +#define AM4ConnectFailed @"AM4ConnectFailed" +#define AM4ConnectNoti @"AM4ConnectNoti" +#define AM4DisConnectNoti @"AM4DisConnectNoti" + +#define AMDeviceID @"ID" +#define AMSDKSportRightApi @"OpenApiActivity" +#define AMSDKSleepRightApi @"OpenApiSleep" + +#define AM5Discover @"AM5Discover" +#define AM5ConnectFailed @"AM5ConnectFailed" +#define AM5ConnectNoti @"AM5ConnectNoti" +#define AM5DisConnectNoti @"AM5DisConnectNoti" +#define AM5Device @"AM5Device" +#define AM5Distance @"AM5Distance" + + +//cloud +#define AMDate @"AMDate" +#define AMCalorie @"AMcalorie" +#define AMStepNum @"AMstepNum" +#define AMStepSize @"AMstepSize" +//cloud + + +/////////////////////////////////////////////////////////////// + +//AM3 + +/////////////////////////////////////////////////////////////// + + +#define AM3TimeInterval @"TimeInterval" + +#define AM3ActiveHistoryDateYear @"ActiveHistoryDateYear" +#define AM3ActiveHistoryDateMonth @"ActiveHistoryDateMonth" +#define AM3ActiveHistoryDateDay @"ActiveHistoryDateDay" +#define AM3ActiveHistoryTotoalNum @"ActiveHistoryTotoalNum" +#define AM3ActiveStepSize @"ActiveStepSize" + +#define AM3SleepHistoryDateYear @"SleepHistoryDateYear" +#define AM3SleepHistoryDateMonth @"SleepHistoryDateMonth" +#define AM3SleepHistoryDateDay @"SleepHistoryDateDay" +#define AM3SleepHistoryDateHour @"SleepHistoryDateHour" +#define AM3SleepHistoryDateMinute @"SleepHistoryDateMinute" +#define AM3SleepHistoryDateSeconds @"SleepHistoryDateSeconds" +#define AM3SleepHistoryTotoalNum @"SleepHistoryTotoalNum" + + +/** + AM3 error code + */ +typedef NS_ENUM(NSUInteger, AM3ErrorID) { + /// Communication error + AM3Error_OverTime = 0, + /// You did not receive a response within a certain period of time, usually clogged Bluetooth + AM3Error_NoRespond, + /// Reset failed + AM3Error_ResetDeviceFaild, + /// AM disconnect + AM3Error_Disconnect, + /// ParameterError + AM3Error_ParameterError = 400, + /// firmware version is not supported + AM3Error_FirmwareVersionIsNotSupported +}; + + +/** + AM3 Time Format + */ +typedef NS_ENUM(NSUInteger, AM3TimeFormat) { + /// 12 + AM3TimeFormat_hh, + /// 24 + AM3TimeFormat_HH +}; + +/** + AM3 State Unit + */ +typedef NS_ENUM(NSUInteger, AM3StateUnit){ + /// mile + AM3StateUnit_mile, + /// km + AM3StateUnit_km +}; + + +/** + AM3 State Model + */ +typedef NS_ENUM(NSUInteger, AM3StateModel){ + /// sleep + AM3StateModel_sleep, + /// active + AM3StateModel_active, + /// fly + AM3StateModel_fly, + /// drive + AM3StateModel_drive +}; + +/** + AM3 State Info + */ +typedef NS_ENUM(NSUInteger, AM3StateInfo){ + /// waist + AM3StateInfo_waist, + /// wrist + AM3StateInfo_wrist, + /// sleep + AM3StateInfo_sleep +}; + + + +/** + Error Block + + @param errorID AM3ErrorID descriptions + */ +typedef void (^DisposeAM3ErrorBlock)(AM3ErrorID errorID); + + +/** + get user ID + + @param userID userID + */ +typedef void (^DisposeAM3GetDeviceUserIDBlock)(unsigned int userID); + + +/** + sync time + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SyncTimeBlock)(BOOL resetSuc); + + +/** + get dateFormatter + + @param timeFormat AM3TimeFormat description + */ +typedef void (^DisposeAM3TimeFormatBlock)(AM3TimeFormat timeFormat); + + + +/** + set timeFormat + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3TimeFormatSettingBlock)(BOOL resetSuc); + + + +/** + set userID + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SetDeviceUserIDBlock)(BOOL resetSuc); + + +/** + set user info + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SetUserInfoBlock)(BOOL resetSuc); + + +/** + set BMR + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SetBMRBlock)(BOOL resetSuc); + + +/** + active start transmission + + @param startDataDictionary including parameters:Start date,yyyy-MM-dd(ActiveHistoryDateYear,ActiveHistoryDateMonth,ActiveHistoryDateDay),ActiveStepSize:Length of each step,ActiveHistoryTotoalNum:Number of records. + */ +typedef void (^DisposeAM3ActiveStartTransmission)(NSDictionary *startDataDictionary); + + +/** + active history data + + @param historyDataArray including the following parameters:AMDate、AMCalorie、AMstepNum、AMstepSize、dataID、Start. AMDate:Workout time,AMCalorie: Current time total calories,AMStepNum:Total number of steps,dataID:data ID,Start:represents the beginning of a movement. + */ +typedef void (^DisposeAM3ActiveHistoryData)(NSArray *historyDataArray); + + + +/** + active finish transmission + */ +typedef void (^DisposeAM3ActiveFinishTransmission)(void); + + + + +/** + sleep start transmission + + @param startDataDictionary including parameters:SleepHistoryDate、AM3SleepHistoryTotoalNum.SleepHistoryDate:Sleep start time,yyyy-MM-dd HH:mm:ss(SleepHistoryDateYear,SleepHistoryDateMonth,SleepHistoryDateDay,SleepHistoryDateHour,SleepHistoryDateMinute,SleepHistoryDateSeconds).SleepHistoryTotoalNum: Number of records + */ +typedef void (^DisposeAM3SleepStartTransmission)(NSDictionary *startDataDictionary); + + +/** + sleep history data + + @param historyDataArray including the following parameters::AMDate、SleepData、dataID.AMDate:Sleep time, SleepData: Sleep grade, 0: awake, 1: light sleep, 2: deep sleep ,dataID: data ID + */ +typedef void (^DisposeAM3SleepHistoryData)(NSArray *historyDataArray); + + +/** + sleep finish transmission + */ +typedef void (^DisposeAM3SleepFinishTransmission)(void); + + +/** + get current active info + + @param activeDictionary Total calories and steps for today, including parameters:Step、Calories、TotalCalories.Step:Number of steps taken today.Calories:Number of calories burned today.TotalCalories:Sum calories burned and bmr today. + */ +typedef void (^DisposeAM3GetCurrentActiveInfo)(NSDictionary *activeDictionary); + + +/** + totoal alarm array + + @param totoalAlarmArray totoalAlarmArray contains up to 3 alarms, each one needs the following parameters:AlarmId、Time、IsRepeat、Switch、(Sun、Mon、Tue、Wed、Thu、Fri、Sat) + */ +typedef void (^DisposeAM3TotoalAlarmData)(NSMutableArray *totoalAlarmArray); + + +/** + set alarm + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SetAlarmBlock)(BOOL resetSuc); + + +/** + delete Alarm + + @param resetSuc yes:success no:fail + + */ +typedef void (^DisposeAM3DeleteAlarmBlock)(BOOL resetSuc); + + +/** + get remind info + + @param remindInfo array containing following parameters:ReminderID、Time、Switch.ReminderID:Reminder ID.Time:format HH:mm, time between reminders (HH*60+mm) minutes.Switch:Reminder on/off,True: On, False: Off. + */ +typedef void (^DisposeAM3RemindInfoBlock)(NSArray *remindInfo); + + + +/** + set reminder + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SetReminderBlock)(BOOL resetSuc); + + +/** + get state info + + @param queryState AM3StateInfo description + */ +typedef void (^DisposeAM3StateInfoBlock)(AM3StateInfo queryState); + + +/** + get battery + + @param battery 1~100 + */ +typedef void (^DisposeAM3BatteryBlock)(NSNumber *battery); + + +/** + reset device + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3ResetDeviceBlock)(BOOL resetSuc); + + +/** + disconnect + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3DisconnectBlock)(BOOL resetSuc); + + +/** + get user info + + @param userInfo including parameters:Age,Step,Height,Gender,Weight,Unit,goal(TotalStep1、TotalStep2、TotalStep3) + */ +typedef void (^DisposeAM3UserInfoBlock)(NSDictionary *userInfo); + + +/** + set State + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SetStateBlock)(BOOL resetSuc); + + +/** + set state model + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SetStateModelBlock)(BOOL resetSuc); +/////////////////////////////////////////////////////////////// + +//AM3S + +/////////////////////////////////////////////////////////////// + +#define AM3STimeInterval @"TimeInterval" + +#define AM3SActiveHistoryDateYear @"ActiveHistoryDateYear" +#define AM3SActiveHistoryDateMonth @"ActiveHistoryDateMonth" +#define AM3SActiveHistoryDateDay @"ActiveHistoryDateDay" +#define AM3SActiveHistoryTotoalNum @"ActiveHistoryTotoalNum" +#define AM3SActiveStepSize @"ActiveStepSize" + +#define AM3SSleepHistoryDateYear @"SleepHistoryDateYear" +#define AM3SSleepHistoryDateMonth @"SleepHistoryDateMonth" +#define AM3SSleepHistoryDateDay @"SleepHistoryDateDay" +#define AM3SSleepHistoryDateHour @"SleepHistoryDateHour" +#define AM3SSleepHistoryDateMinute @"SleepHistoryDateMinute" +#define AM3SSleepHistoryDateSeconds @"SleepHistoryDateSeconds" +#define AM3SSleepHistoryTotoalNum @"SleepHistoryTotoalNum" + + +#define ReportState @"ReportState" + +#define Work_outMeasureDate @"Work_outMeasureDate" +#define Work_outTimeNumber @"Work_outTimeNumber" +#define Work_outStepNumber @"Work_outStepNumber" +#define Work_outLengthNumber @"Work_outLengthNumber" +#define Work_outCalories @"Work_outCalories" +#define Work_outTimeZone @"Work_outTimeZone" + +#define Sleep_summaryMeasureDate @"Sleep_summaryMeasureDate" +#define Sleep_summarySleepTime @"Sleep_summarySleepTime" +#define Sleep_summarysleepEfficiency @"Sleep_summarysleepEfficiency" +#define Sleep_summarysleepAddMinute @"Sleep_summarysleepAddMinute" +#define Sleep_summaryTimeZone @"Sleep_summaryTimeZone" + + +/** + AM3S error code + */ +typedef NS_ENUM(NSUInteger, AM3SErrorID) { + /// Communication error + AM3SError_OverTime = 0, + /// You did not receive a response within a certain period of time, usually clogged Bluetooth + AM3SError_NoRespond, + /// Reset failed + AM3SError_ResetDeviceFaild, + /// AM disconnect + AM3SError_Disconnect, + /// ParameterError + AM3SError_ParameterError = 400, + /// firmware version is not supported + AM3SError_FirmwareVersionIsNotSupported +}; + + + +/** + AM3S Time Format + */ +typedef NS_ENUM(NSUInteger, AM3STimeFormatAndNation) { + /// 12 + AM3STimeFormat_hh = 0, + /// 24 + AM3STimeFormat_HH, + /// No europe and hh + AM3STimeFormat_NoEuropeAndhh, + /// europe and hh + AM3STimeFormat_EuropeAndhh, + /// no europe and HH + AM3STimeFormat_NoEuropeAndHH, + /// europe and HH + AM3STimeFormat_EuropeAndHH, +}; + + +/** + AM3S State Unit + */ +typedef NS_ENUM(NSUInteger, AM3SKmUnit){ + /// mile + AM3SKmUnit_mile, + /// km + AM3SKmUnit_km +}; + + +/** + AM3S Query State + */ +typedef NS_ENUM(NSUInteger, AM3SQueryState){ + /// waist + AM3SState_waist, + /// wrist + AM3SState_wrist, + /// sleep + AM3SState_sleep +}; + + +/** + AM3S Picture + */ +typedef NS_ENUM(NSUInteger, AM3SPicture){ + /// one + AM3SPicture_one, + /// two + AM3SPicture_two, +}; + +/** + AM3S ReportStage + */ +typedef NS_ENUM(NSUInteger, AM3SReportStage){ + /// Work_out + AM3SReportStage_Work_out = 1, + /// Sleep_summary + AM3SReportStage_Sleep_summary, +}; + +/** + AM3S ActiveState + */ +typedef NS_ENUM(NSUInteger, AM3SActiveState){ + /// Active + AM3SActive_State = 0, + /// sleep + AM3SSleep_State = 1, + /// flight + AM3SFly_State = 2, + /// workout + AM3SWorkout_State = 4, +}; + + +/** + get user ID + + @param userID userID + */ +typedef void (^DisposeAM3SGetDeviceUserIDBlock)(unsigned int userID); + +/** + Error Block + + @param errorID AM3SErrorID descriptions + */ +typedef void (^DisposeAM3SErrorBlock)(AM3SErrorID errorID); + + +/** + set random number + + @param randomNumString randomNumString + */ +typedef void (^DisposeAM3SSetRandomNumberBlock)(NSString *randomNumString); +/** + sync time + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SSyncTimeBlock)(BOOL resetSuc); + +/** + set timeFormat and nation + + @param timeFormatAndNation AM3STimeFormatAndNation description + */ +typedef void (^DisposeAM3STimeFormatAndNationBlock)(AM3STimeFormatAndNation timeFormatAndNation); + +/** + set date Formatter + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3STimeFormatAndNationSettingBlock)(BOOL resetSuc); + +/** + set userID + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SSetDeviceUserIDBlock)(BOOL resetSuc); + + +/** + set user info + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SSetUserInfoBlock)(BOOL resetSuc); + +/** + set BMR + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SSetBMRBlock)(BOOL resetSuc); + +/** + active start transmission + + @param startDataDictionary including parameters:Start date,yyyy-MM-dd(ActiveHistoryDateYear,ActiveHistoryDateMonth,ActiveHistoryDateDay),ActiveStepSize:Length of each step,ActiveHistoryTotoalNum:Number of records. + */ +typedef void (^DisposeAM3SActiveStartTransmission)(NSDictionary *startDataDictionary); + + +/** + active history data + + @param historyDataArray including the following parameters:AMDate、AMCalorie、AMstepNum、AMstepSize、dataID、Start. AMDate:Workout time,AMCalorie: Current time total calories,AMStepNum:Total number of steps,dataID:data ID,Start:represents the beginning of a movement. + */ +typedef void (^DisposeAM3SActiveHistoryData)(NSArray *historyDataArray); + +/** + active finish transmission + */ +typedef void (^DisposeAM3SActiveFinishTransmission)(void);// + + +/** + sleep start transmission + + @param startDataDictionary including parameters:SleepHistoryDate、AM3SleepHistoryTotoalNum.SleepHistoryDate:Sleep start time,yyyy-MM-dd HH:mm:ss(SleepHistoryDateYear,SleepHistoryDateMonth,SleepHistoryDateDay,SleepHistoryDateHour,SleepHistoryDateMinute,SleepHistoryDateSeconds).SleepHistoryTotoalNum: Number of records + */ +typedef void (^DisposeAM3SSleepStartTransmission)(NSDictionary *startDataDictionary); +/** + sleep history data + + @param historyDataArray including the following parameters::AMDate、SleepData、dataID.AMDate:Sleep time, SleepData: Sleep grade, 0: awake, 1: light sleep, 2: deep sleep ,dataID: data ID + */ +typedef void (^DisposeAM3SSleepHistoryData)(NSArray *historyDataArray); + +/** + sleep finish transmission + */ +typedef void (^DisposeAM3SSleepFinishTransmission)(void); + +/** + get current active info + + @param activeDictionary Total calories and steps for today, including parameters:Step、Calories、TotalCalories.Step:Number of steps taken today.Calories:Number of calories burned today.TotalCalories:Sum calories burned and bmr today. + */ +typedef void (^DisposeAM3SGetCurrentActiveInfo)(NSDictionary *activeDictionary); + +/** + reset device + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SResetDeviceBlock)(BOOL resetSuc); + +/** + totoal alarm array + + @param totoalAlarmArray totoalAlarmArray contains up to 3 alarms, each one needs the following parameters:AlarmId、Time、IsRepeat、Switch、(Sun、Mon、Tue、Wed、Thu、Fri、Sat) + */ +typedef void (^DisposeAM3STotoalAlarmData)(NSMutableArray *totoalAlarmArray); + + +/** + set alarm + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SSetAlarmBlock)(BOOL resetSuc); +/** + delete Alarm + + @param resetSuc yes:success no:fail + + */ +typedef void (^DisposeAM3SDeleteAlarmBlock)(BOOL resetSuc); + +/** + get remind info + + @param remindInfo array containing following parameters:ReminderID、Time、Switch.ReminderID:Reminder ID.Time:format HH:mm, time between reminders (HH*60+mm) minutes.Switch:Reminder on/off,True: On, False: Off. + */ +typedef void (^DisposeAM3SRemindInfoBlock)(NSArray *remindInfo); + + +/** + set reminder + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SSetReminderBlock)(BOOL resetSuc); + +/** + get state info + + @param queryState AM3StateInfo description + */ +typedef void (^DisposeAM3SStateInfoBlock)(AM3SQueryState queryState); + +/** + get battery + + @param battery 1~100 + */ +typedef void (^DisposeAM3SBatteryBlock)(NSNumber *battery); + +/** + disconnect + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SDisconnectBlock)(BOOL resetSuc); + +/** + stage measure data + + @param measureDataArray including workout and sleepSummary + */ +typedef void (^DisposeAM3SStageMeasureDataBlock)(NSArray *measureDataArray); + + +/** + stage measure dinish + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM3SStageMeasureFinishBlock)(BOOL resetSuc); + + +/** + get user info + + @param userInfo including parameters:Age,Step,Height,Gender,Weight,Unit,goal(TotalStep1、TotalStep2、TotalStep3) + */ +typedef void (^DisposeAM3SUserInfoBlock)(NSDictionary *userInfo); + +/** + query picture + */ +typedef void (^DisposeAM3SGetPictureBlock)(AM3SPicture picture); + +/** + set picture + */ +typedef void (^DisposeAM3SSetPictureBlock)(BOOL resetSuc); + + + +/////////////////////////////////////////////////////////////// + + +//AM4 + +/////////////////////////////////////////////////////////////// + + +#define AM4TimeInterval @"TimeInterval" + +#define AM4ActiveHistoryDateYear @"ActiveHistoryDateYear" +#define AM4ActiveHistoryDateMonth @"ActiveHistoryDateMonth" +#define AM4ActiveHistoryDateDay @"ActiveHistoryDateDay" +#define AM4ActiveHistoryTotoalNum @"ActiveHistoryTotoalNum" +#define AM4ActiveStepSize @"ActiveStepSize" +#define AM4ActiveTimeZone @"ActiveTimeZone" + +#define AM4SleepHistoryDateYear @"SleepHistoryDateYear" +#define AM4SleepHistoryDateMonth @"SleepHistoryDateMonth" +#define AM4SleepHistoryDateDay @"SleepHistoryDateDay" +#define AM4SleepHistoryDateHour @"SleepHistoryDateHour" +#define AM4SleepHistoryDateMinute @"SleepHistoryDateMinute" +#define AM4SleepHistoryDateSeconds @"SleepHistoryDateSeconds" +#define AM4SleepHistoryTotoalNum @"SleepHistoryTotoalNum" +#define AM4SleepHistoryTimeZone @"SleepHistoryTimeZone" + + + +#define AM4SwimmingMeasureDate @"SwimmingMeasureDate" +#define AM4SwimmingTimeNumber @"SwimmingTimeNumber" +#define AM4SwimmingTimes @"SwimmingTimes" +#define AM4Swimmingcalories @"Swimmingcalories" +#define AM4SwimmingAct @"SwimmingAct" +#define AM4SwimmingPoollength @"SwimmingPoollength" +#define AM4SwimmingCircleCount @"SwimmingCircleCount" +#define AM4EnterSwimmingTime @"EnterSwimmingTime" +#define AM4OutSwimmingTime @"OutSwimmingTime" +#define AM4SwimmingProcessMark @"SwimmingProcessMark" +#define AM4SwimStartTimeStamp @"SwimStartTimeStamp" +#define AM4SwimmingTimeZone @"SwimmingTimeZone" + + +/** + AM4 error code + */ +typedef NS_ENUM(NSUInteger, AM4ErrorID) { + /// Communication error + AM4Error_OverTime = 0, + /// You did not receive a response within a certain period of time, usually clogged Bluetooth + AM4Error_NoRespond, + /// Reset failed + AM4Error_ResetDeviceFaild, + /// AM disconnect + AM4Error_Disconnect, + /// ParameterError + AM4Error_ParameterError = 400, + /// firmware version is not supported + AM4Error_FirmwareVersionIsNotSupported +}; + + + +/** + AM4 Time Format + */ +typedef NS_ENUM(NSUInteger, AM4TimeFormatAndNation) { + /// 12 + AM4TimeFormat_hh = 0, + /// 24 + AM4TimeFormat_HH, + /// No europe and hh + AM4TimeFormat_NoEuropeAndhh, + /// europe and hh + AM4TimeFormat_EuropeAndhh, + /// no europe and HH + AM4TimeFormat_NoEuropeAndHH, + /// europe and HH + AM4TimeFormat_EuropeAndHH, +}; + +/** + AM4 State Unit + */ +typedef NS_ENUM(NSUInteger, AM4KmUnit){ + /// mile + AM4KmUnit_mile, + /// km + AM4KmUnit_km +}; + + +/** + AM4 Swimming Unit + */ +typedef NS_ENUM(NSUInteger, AM4SwimmingUnit){ + /// m + AM4SwimmingUnit_m, + /// km + AM4SwimmingUnit_km, +}; + +/** + AM4 Query State + */ +typedef NS_ENUM(NSUInteger, AM4QueryState){ + /// waist + AM4State_waist, + /// waist + AM4State_wrist, + /// waist + AM4State_sleep +}; + +/** + AM4 Swimming Action + */ +typedef NS_ENUM(NSUInteger, AM4SwimmingAction){ + /// Crawl + AM4SwimmingAction_Crawl, + /// Breaststroke + AM4SwimmingAction_Breaststroke, + /// Backstroke + AM4SwimmingAction_Backstroke, + /// Butterfly + AM4SwimmingAction_Butterfly, + /// MixedSwimming + AM4SwimmingAction_MixedSwimming, + /// Unkonw + AM4SwimmingAction_Unkonw +}; + +/** + AM4 Report Stage + */ +typedef NS_ENUM(NSUInteger, AM4ReportStage){ + /// Swimming + AM4ReportStage_Swimming, + /// Work_out + AM4ReportStage_Work_out, + /// summary + AM4ReportStage_Sleep_summary, +}; + +/** + AM4 Active State + */ +typedef NS_ENUM(NSUInteger, AM4ActiveState){ + /// Active_State + AM4Active_State =0, + /// Sleep_State + AM4Sleep_State =1, + /// Fly_State + AM4Fly_State =2, + /// Workout_State + AM4Workout_State=4, + /// Swimming_State + AM4Swimming_State=5, +}; + + + +/** + get user ID + + @param userID userID + */ +typedef void (^DisposeAM4GetDeviceUserIDBlock)(unsigned int userID); + +/** + Error Block + + @param errorID AM4ErrorID descriptions + */ +typedef void (^DisposeAM4ErrorBlock)(AM4ErrorID errorID); + +/** + set random number + + @param randomNumString randomNumString + */ +typedef void (^DisposeAM4SetRandomNumberBlock)(NSString *randomNumString); + +/** + sync time + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4SyncTimeBlock)(BOOL resetSuc); + + +/** + set timeFormat and nation + + @param timeFormatAndNation AM4TimeFormatAndNation description + */ +typedef void (^DisposeAM4TimeFormatAndNationBlock)(AM4TimeFormatAndNation timeFormatAndNation); + + +/** + set date Formatter + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4TimeFormatAndNationSettingBlock)(BOOL resetSuc); + +/** + set userID + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4SetDeviceUserIDBlock)(BOOL resetSuc); + +/** + set user info + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4SetUserInfoBlock)(BOOL resetSuc); + +/** + set BMR + */ +typedef void (^DisposeAM4SetBMRBlock)(BOOL resetSuc); + +/** + active start transmission + + @param startDataDictionary including parameters:Start date,yyyy-MM-dd(ActiveHistoryDateYear,ActiveHistoryDateMonth,ActiveHistoryDateDay),ActiveStepSize:Length of each step,ActiveHistoryTotoalNum:Number of records. + */ +typedef void (^DisposeAM4ActiveStartTransmission)(NSDictionary *startDataDictionary); + +/** + active history data + + @param historyDataArray including the following parameters:AMDate、AMCalorie、AMstepNum、AMstepSize、dataID、Start. AMDate:Workout time,AMCalorie: Current time total calories,AMStepNum:Total number of steps,dataID:data ID,Start:represents the beginning of a movement. + */ +typedef void (^DisposeAM4ActiveHistoryData)(NSArray *historyDataArray); + +/** + active finish transmission + */ +typedef void (^DisposeAM4ActiveFinishTransmission)(void); + +/** + sleep start transmission + + @param startDataDictionary including parameters:SleepHistoryDate、AM3SleepHistoryTotoalNum.SleepHistoryDate:Sleep start time,yyyy-MM-dd HH:mm:ss(SleepHistoryDateYear,SleepHistoryDateMonth,SleepHistoryDateDay,SleepHistoryDateHour,SleepHistoryDateMinute,SleepHistoryDateSeconds).SleepHistoryTotoalNum: Number of records + */ +typedef void (^DisposeAM4SleepStartTransmission)(NSDictionary *startDataDictionary); + +/** + sleep history data + + @param historyDataArray including the following parameters::AMDate、SleepData、dataID.AMDate:Sleep time, SleepData: Sleep grade, 0: awake, 1: light sleep, 2: deep sleep ,dataID: data ID + */ +typedef void (^DisposeAM4SleepHistoryData)(NSArray *historyDataArray); + +/** + sleep finish transmission + */ +typedef void (^DisposeAM4SleepFinishTransmission)(void); + +/** + get current active info + + @param activeDictionary Total calories and steps for today, including parameters:Step、Calories、TotalCalories.Step:Number of steps taken today.Calories:Number of calories burned today.TotalCalories:Sum calories burned and bmr today. + */ +typedef void (^DisposeAM4GetCurrentActiveInfo)(NSDictionary *activeDictionary); + +/** + reset device + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4ResetDeviceBlock)(BOOL resetSuc); + +/** + totoal alarm array + + @param totoalAlarmArray totoalAlarmArray contains up to 3 alarms, each one needs the following parameters:AlarmId、Time、IsRepeat、Switch、(Sun、Mon、Tue、Wed、Thu、Fri、Sat) + */ +typedef void (^DisposeAM4TotoalAlarmData)(NSMutableArray *totoalAlarmArray); + +/** + set alarm + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4SetAlarmBlock)(BOOL resetSuc); + +/** + delete Alarm + + @param resetSuc yes:success no:fail + + */ +typedef void (^DisposeAM4DeleteAlarmBlock)(BOOL resetSuc); + +/** + get remind info + + @param remindInfo array containing following parameters:ReminderID、Time、Switch.ReminderID:Reminder ID.Time:format HH:mm, time between reminders (HH*60+mm) minutes.Switch:Reminder on/off,True: On, False: Off. + */ +typedef void (^DisposeAM4RemindInfoBlock)(NSArray *remindInfo); + +/** + set reminder + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4SetReminderBlock)(BOOL resetSuc); + +/** + get state info + + @param queryState AM3StateInfo description + */ +typedef void (^DisposeAM4StateInfoBlock)(AM4QueryState queryState); + +/** + get battery + + @param battery 1~100 + */ +typedef void (^DisposeAM4BatteryBlock)(NSNumber *battery); + +/** + disconnect + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4DisconnectBlock)(BOOL resetSuc); + + +/** + get Swimming info + + @param swimmingIsOpen yes open ,no close + @param swimmingLaneLength lane length + @param NOSwimmingTime no swimming time + @param unit AM4SwimmingUnit description + */ +typedef void (^DisposeAM4SwimmingBlock)(BOOL swimmingIsOpen, NSNumber * swimmingLaneLength,NSNumber * NOSwimmingTime, AM4SwimmingUnit unit); + + +/** + setting swimming + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4SettingSwimmingBlock)(BOOL resetSuc); + +/** + stage measure data + + @param measureDataArray including workout、swimming and sleepSummary + */ +typedef void (^DisposeAM4StageMeasureDataBlock)(NSArray *measureDataArray); + +/** + stage measure dinish + + @param resetSuc yes:success no:fail + */ +typedef void (^DisposeAM4StageMeasureFinishBlock)(BOOL resetSuc); + + +/** + get user info + + @param userInfo including parameters:Age,Step,Height,Gender,Weight,Unit,goal(TotalStep1、TotalStep2、TotalStep3) + */ +typedef void (^DisposeAM4UserInfoBlock)(NSDictionary *userInfo); + + + +/** + send AM3 data + */ +typedef void (^DisposeSendAM3DataBlock)(void); + +/** + send AM3S data + */ +typedef void (^DisposeSendAM3SDataBlock)(void); + + +/** + send AM4 data + + */ +typedef void (^DisposeSendAM4DataBlock)(void); + + + + +/************AM5**************/ + +typedef NS_ENUM(NSUInteger, AM5DeviceError) { + AM5DeviceError_GetDataFailError = 0, + AM5DeviceError_SetTimeFaild, + AM5DeviceError_SetUnitFaild, + AM5DeviceError_SetUserInfoFaild, + AM5DeviceError_BindFaild, + AM5DeviceError_SyncConfigComplete, +}; + + + + +typedef void (^DisposeAM5ErrorBlock)(AM5DeviceError errorID); + +typedef void (^DisposeBindingAM5Result)(BOOL result); + +typedef void (^DisposeUnBindingAM5Result)(BOOL result); + +typedef void (^DisposeGetAM5DeviceInfo)(NSMutableDictionary * DeviceInfo); + +typedef void (^DisposeGetAM5FuncTable)(NSMutableDictionary * DeviceFuncTable); + +typedef void (^DisposeGetAM5Mac)(NSString* deviceMac); + +typedef void (^DisposeGetAM5LiveData)(NSMutableDictionary * liveDataDic); + +typedef void (^DisposeGetAM5ActivityCount)(NSMutableDictionary * activityCountDic); + +typedef void (^DisposeAM5SetCurrentTime)(BOOL result); + +typedef void (^DisposeAM5SetAlarm)(BOOL result); + +typedef void (^DisposeAM5SetUserTarget)(BOOL result); + +typedef void (^DisposeAM5SetUserInfo)(BOOL result); + +typedef void (^DisposeAM5SetUnit)(BOOL result); + +typedef void (^DisposeAM5SetLongSit)(BOOL result); + +typedef void (^DisposeAM5SetLeftRightHand)(BOOL result); + +typedef void (^DisposeAM5SetHrInterval)(BOOL result); + +typedef void (^DisposeAM5SetHrMode)(BOOL result); + +typedef void (^DisposeAM5SetNoDisturbMode)(BOOL result); + +typedef void (^DisposeAM5SetSportModeSelect)(BOOL result); + +typedef void (^DisposeAM5SetSwitchNotice)(BOOL result); + +typedef void (^DisposeGetAM5SyncConfigComplete)(BOOL result); + +typedef void (^DisposeGetAM5SyncHeartRateData)(NSDictionary * syncDataDic); + +typedef void (^DisposeGetAM5SyncSleepData)(NSDictionary * syncDataDic); + +typedef void (^DisposeGetAM5SyncActivityData)(NSDictionary * syncDataDic); + +typedef void (^DisposeAM5SyncDataProgress)(NSNumber * syncDataProgress); + +typedef void (^DisposeAM5SyncDataSuccess)(void); + +typedef void (^DisposeAM5SetAppReboot)(BOOL result); + +typedef void (^DisposeAM5SetHandUp)(BOOL result); + +#endif + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1.h new file mode 100644 index 0000000..5cd9537 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1.h @@ -0,0 +1,53 @@ +// +// BG1.h +// iHealthSDKStatic +// +// Created by soso on 2017/8/25. +// Copyright © 2017年 ihealth. All rights reserved. +// + +#import +#import "BGMacroFile.h" + +/** + BG1 + */ +@interface BG1 : NSObject +@property (strong, nonatomic) NSString *mac; +@property (strong, nonatomic) NSString *firmwareVersion; + + +/** + * Start connect BG1 and get the connection status. + * @param BG1Model the BG1 type. + * @param discover This block returns means blood glucose meter plugged in. + * @param IDPSInfo This block returns the IDPS of the meter, this will be operated for the first time when the app talks to the meter. + * @param connect This block returns the connection status, the connection of the BG meter is regular , the measurement could be processed. + * @param error block returns error codes,please refer to error codes list in BGMacroFile. + * @Notice Notice: Using this method should be placed kNotificationNameNeedAudioPermission callback + */ +- (void)commandBG1DeviceModel:(NSNumber *)BG1Model withDiscoverBlock:(DisposeBG1DiscoverBlock)discover withDiscoverBlock:(DisposeBG1IDPSBlock)IDPSInfo withConnectBlock:(DisposeBG1ConnectBlock)connect withErrorBlock:(DisposeBG1ErrorBlock)error; + + +/** + * Establish connection and start BG measurement.(New) + * @param measureMode Set the measure test type,BGMeasureMode_Blood is Blood Test,BGMeasureMode_NoBlood is CTL Test. + * @param codeMode Set the code type,BGCodeMode_GOD is GOD,BGCodeMode_GDH is GDH. + * @param codeString The code String gets by scanning the QR code. + * @param sendCodeResult If the QR code is accepted, yes means accepted, no means deny. + * @param stripIn The strips slide into the BG meter. + * @param blood The blood drop has beed sensed from the strip. + * @param measureResult Returns the measurement by the unit of mg/dL, range from 20-600. + * @param stripOut The strip has been pulled out. + * @param error This block returns error codes,please refer to error codes list in BGMacroFile. + */ +- (void)commandBG1MeasureMode:(BGMeasureMode)measureMode withCodeMode:(BGCodeMode)codeMode withCodeString:(NSString *)codeString withSendCodeResultBlock:(DisposeBG1SendCodeResultBlock)sendCodeResult withStripInBlock:(DisposeBGStripInBlock)stripIn withBloodBlock:(DisposeBGBloodBlock)blood withResultBlock:(DisposeBGResultBlock)measureResult withStripOutBlock:(DisposeBGStripOutBlock)stripOut withErrorBlock:(DisposeBG1ErrorBlock)error; + +/** + Analyze code include bottleID,DueDate and the number of strips. Only Available for GOD Code + + @param encodeString The code String gets by scanning the QR code. + @return return a dictionary contains keys such as @"BottleID",@"StripNum",@"DueDate"; return nil if input parameter is GDH code or code is invalid. + */ +-(NSDictionary *)codeStripStrAnalysis:(NSString *)encodeString; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1Controller.h new file mode 100644 index 0000000..fe0860b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1Controller.h @@ -0,0 +1,46 @@ +// +// BG1Controller.h +// iHealthBG +// +// Created by xujianbo on 14-10-08. +// Copyright (c) 2014年 andon. All rights reserved. +// + +#import +@class BG1; + +/** + BG1Controller + */ +@interface BG1Controller : NSObject + + +/** + * Initialization for BG1Controller Instance. + */ ++(BG1Controller *)shareBG1Controller; + +/** + * Initialization for BG1 (connected BG via sound jack) + * When the application detects a headphone device, it sends a notification named kNotificationNameAudioDeviceInsert. When you receive kNotificationNameAudioDeviceInsert notification, you need to adjust the system volume to its maximum. After the device is disconnected, you receive a notification with the name kNotificationNameBG1DidDisConnect. + */ +-(void)initBGAudioModule; + +/** + * Get current BG1 Instance + * The methold needs to be called when the BG1 has been triggered. + */ +-(BG1 *)getCurrentBG1Instance; + + +/** + * Stop audio module for BG1 (connected BG via sound jack) + * Call this method When the app need stop BG1 communication. + After call this method ,the app should set BG1 Disconnected status. + */ +-(void)stopBGAudioModule; + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1S.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1S.h new file mode 100644 index 0000000..c6367c2 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1S.h @@ -0,0 +1,64 @@ +// +// BG1S.h +// iHealthSDKStatic +// +// Created by jing on 2019/5/8. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import +#import "BGMacroFile.h" +NS_ASSUME_NONNULL_BEGIN + +@interface BG1S : NSObject +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *currentUUID; + +/** + * Get device battary + * @param function A block to return the function and states that the device supports. + * @param disposeBGErrorBlock A block to refer ‘error’ in ‘Establish measurement connection’ in BG1S. + */ +-(void)commandFunction:(BlockBG1SDeviceFunction)function DisposeBGErrorBlock:(BlockBG1SError)disposeBGErrorBlock; + +/** + * Button-pressing booting mode + * @param testMode Set the measurement mode,must be the same as the testType in send code method, BGMeasureMode_Blood means blood measurement mode, BGMeasureMode_NoBlood means control solution measurement mode. + * @param disposeBGStripInBlock This block returns yes means strip slides in. + * @param disposeBGBloodBlock This block returns yes means the blood drop has beed sensed from the strip. + * @param disposeBGResultBlock This block returns the measurement by the unit of mg/dL, range from 20-600. + * @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandCreateBG1STestModel:(BGMeasureMode)testMode + DisposeBGStripInBlock:(DisposeBG1SStripInBlock)disposeBGStripInBlock + DisposeBGBloodBlock:(DisposeBGBloodBlock)disposeBGBloodBlock + DisposeBGResultBlock:(DisposeBGResultBlock)disposeBGResultBlock + DisposeBGErrorBlock:(BlockBG1SError)disposeBGErrorBlock; + +/** +* Read the information of the strip from the BG meter +* @param disposeBGCodeDic This block returns the information of the strip, Strips means the number of strips which has been used, Date means expired date. +* @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. +*/ +-(void)commandReadBGCodeDic:(DisposeBGCodeDic)disposeBGCodeDic + DisposeBGErrorBlock:(BlockBG1SError)disposeBGErrorBlock; + +/** + * Send code + + * @param encodeString The code String gets by scanning the QR code. Only used when codetype is GOD + + * @param disposeBGSendCodeBlock YES means success, NO means fail. + + * @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandSendBGCodeWithCodeString:(NSString*)encodeString DisposeBGSendCodeBlock:(DisposeBGSendCodeBlock)disposeBGSendCodeBlock DisposeBGErrorBlock:(BlockBG1SError)disposeBGErrorBlock; +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1SController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1SController.h new file mode 100644 index 0000000..1d013b5 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG1SController.h @@ -0,0 +1,25 @@ +// +// BG1SController.h +// iHealthSDKStatic +// +// Created by jing on 2019/5/8. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BG1SController : NSObject +/** + * Initialize BG1S controller class + */ ++(BG1SController *)shareIHBG1SController; + +/** + * Get all BG1S instance,use hsInstance to call BG related communication methods. + */ +-(NSArray *)getAllCurrentBG1SInstace; +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3.h new file mode 100644 index 0000000..6c44904 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3.h @@ -0,0 +1,83 @@ +// +// BG3.h +// iHealthBG +// +// Created by daiqingquan on 14-2-20. +// Copyright (c) 2014年 andon. All rights reserved. +// + +#import +#import "BGMacroFile.h" + + +/** + DisposeAuthenticationBlock + + @param result UserAuthenResult + */ +typedef void (^DisposeAuthenticationBlock)(UserAuthenResult result);//the result of userID verification + + +/** + BG3 + */ +@interface BG3 : NSObject{ + + uint8_t allCodeBuf[170]; + uint8_t allCTLCodeBuf[170]; + + DisposeBGErrorBlock _disposeBGErrorBlock; + DisposeBGStripInBlock _disposeBGStripInBlock; + DisposeBGStripOutBlock _disposeBGStripOutBlock; + DisposeBGBloodBlock _disposeBGBloodBlock; + DisposeBGResultBlock _disposeBGResultBlock; + DisposeBGSendCodeBlock _disposeBGSendCodeBlock; + DisposeAuthenticationBlock _disposeAuthenticationBlock; + + NSString *thirdUserID; + + NSString *clientSDKUserName; + NSString *clientSDKID; + NSString *clientSDKSecret; + + BGMeasureMode clientTestMode; +} + +@property (strong, nonatomic) NSString *currentUUID; +///‘serialNumber’ is for separating different device when multiple device have been connected. +@property (strong, nonatomic) NSString *serialNumber; + + +/** + * Start measure + * @param testMode The 'testMode' send measurement mode, BGMeasureMode_Blood means blood measurement mode, BGMeasureMode_NoBlood means control solution measurement mode. + * @param encodeString Get the code information by scanning the QR code. + * @param userID The only user label, is indicated by form of email address. + * @param clientID 'clientID' and 'clientSecret' are the only user label, will be achieved after the register of SDK application. Please contact louie@ihealthlabs.com for the registration. + * @param clientSecret 'clientID' and 'clientSecret' are the only user label, will be achieved after the register of SDK application. Please contact louie@ihealthlabs.com for the registration. + * @param disposeAuthenticationBlock This block returns results after the verification of userID,clientID,clientSecret. + * Results: + * a) UserAuthen_RegisterSuccess, new register successes. + * b) UserAuthen_LoginSuccess, user logs in successfully. + * c) UserAuthen_CombinedSuccess, user has been recognised as iHealth user, the measurement via SDK could be activated, the result data belongs to the user. + * d) UserAuthen_TrySuccess, network error, the measurement is only for testing, SDK is not fully functional. + * e) UserAuthen_InvalidateUserInfo, the verification of userID/clientID/clientSecret failed. + * f) UserAuthen_SDKInvalidateRight, the application has not been authorised. + * g) UserAuthen_UserInvalidateRight, the user has not been authorised. + * h) UserAuthen_InternetError, network error, verification failed. + * -- PS: + * 1. the measurement via SDK is functional in the case from a) to d). + * 2. the measurement via SDK will be determined in the case from e) to h), please contact iHealth support team, louie@ihealthlabs.com + * 3. “iHealth Disclaimer” will pop up and need to be proved by the user when SDK is activated for the first time. + * 4. if iHealth SDK has been using without internet, there is only 10-day try out because the SDK can not be certified. + * @param disposeBGSendCodeBlock disposeBGSendCodeBlock + * @param disposeBGStripInBlock The block returns yes means strip slides in. + * @param disposeBGBloodBlock The block returns yes means the blood drop has beed sensed from the strip + * @param disposeBGResultBlock block returns the measurement by the unit of mg/dL, range from 20-600. + * @param disposeBGErrorBlock A block to return error codes. + */ +-(void)commandCreateBG3TestModel:(BGMeasureMode)testMode CodeString:(NSString *)encodeString UserID:(NSString*)userID clientID:(NSString *)clientID clientSecret:(NSString *)clientSecret Authentication:(DisposeAuthenticationBlock)disposeAuthenticationBlock DisposeBGSendCodeBlock:(DisposeBGSendCodeBlock)disposeBGSendCodeBlock DisposeBGStripInBlock:(DisposeBGStripInBlock)disposeBGStripInBlock DisposeBGBloodBlock:(DisposeBGBloodBlock)disposeBGBloodBlock DisposeBGResultBlock:(DisposeBGResultBlock)disposeBGResultBlock DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3Controller.h new file mode 100644 index 0000000..7d048e3 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG3Controller.h @@ -0,0 +1,28 @@ +// +// BG3Controller.h +// iHealthBG +// +// Created by daiqingquan on 14-2-20. +// Copyright (c) 2014年 andon. All rights reserved. +// + +#import +#import "BG3.h" + +/** + BG3Controller + */ +@interface BG3Controller : NSObject + +/** + *Initialization for BG3 (wireless BG via Bluetooth) + */ ++(BG3Controller *)shareIHBg3Controller; + +/** + * Get all BG3 Instance + * The methold needs to be called when the BG3 has been triggered. When the app detected the glucose meter, the notification with the name of DeviceAuthenSuccess will be sent. After the device disconnected, the notification with the name of DeviceAuthenSuccess will be received. + */ +-(BG3 *)getCurrentBG3Instace; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5.h new file mode 100644 index 0000000..79d6a58 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5.h @@ -0,0 +1,158 @@ +// +// BG5.h +// testShareCommunication +// +// Created by daiqingquan on 14-1-16. +// Copyright (c) 2014年 my. All rights reserved. +// + +#import +#import "BGMacroFile.h" + + +/** + BG5 + */ +@interface BG5 : BGDevice + +/** + Set Time + @param disposeBGSetTime The block return YES means set success, NO means set fail. + @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + @note Time is local time + */ +-(void)commandBGSetTime:(DisposeBGSetTime)disposeBGSetTime + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + * Set Unit displayed in BG5's screen + * @param unitState The block return YES means set success, NO means set fail. + * @param disposeBGSetUnitResult YES:success NO:fail + * @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandBGSetUnit:(BGUnit )unitState + DisposeSetUnitResult:(DisposeBGSetUnit)disposeBGSetUnitResult + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + * Query battery remaining energy + * @param disposeBatteryBlock A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. 255 means device in charging. + * @param disposeErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandQueryBattery:(DisposeBGBatteryBlock)disposeBatteryBlock + DisposeErrorBlock:(DisposeBGErrorBlock)disposeErrorBlock; + +/** + Tranfer offline history records. + For BG5 V3.0, after calling this method, you should call commandDeleteMemorryData: method. Otherwise, the measure date may be wrong. + + @param disposeBGDataCount The number of the records in the meter memory. + @param disposeBGHistoryData The offline history records detail, result means result, date means the measurement time. + @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandTransferMemorryData:(DisposeBGDataCount)disposeBGDataCount + DisposeBGHistoryData:(DisposeBGHistoryData)disposeBGHistoryData + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + Delete offline history records + + @param DisposeBGDeleteData deleteOk YES or NO + @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandDeleteMemorryData:(DisposeBGDeleteData)DisposeBGDeleteData + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + * Send code with type (Note: After you got the CTL test results, you need to send the blood Code again.) + * @param testType Set the measure test type,@1 is Blood Test,@2 is CTL Test. + * @param codeType Set the code type,@1 is GOD,@2 is GDH. + * @param encodeString The code String gets by scanning the QR code. Only used when codetype is GOD + * @param date The strip expired date. support Jan 1,2000 to Dec 31, 2099. If other value, return BG5Error_InputParametersError. + * @param num the number of remaining strips,ranging from 1-255. + * @param disposeBGSendCodeBlock YES means success, NO means fail. + * @param disposeBGStartModel The boot mode of the BG meter, BGOpenMode_Strip means booting the meter by sliding the strip, BGOpenMode_Hand means booting the meter by pressing the on/off button. commandCreateBGtestStripInBlock should be called after recieving BGOpenMode_Strip, commandCreateBGtestModel should be called after recieving BGOpenMode_Hand. + * @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandSendBGCodeWithMeasureType:(BGMeasureMode)testType + CodeType:(BGCodeMode)codeType + CodeString:(NSString*)encodeString + validDate:(NSDate*)date + remainNum:(NSNumber*)num + DisposeBGSendCodeBlock:(DisposeBGSendCodeBlock)disposeBGSendCodeBlock + DisposeBGStartModel:(DisposeBGStartModel)disposeBGStartModel + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + * Read the information of the strip from the BG meter + * @param disposeBGCodeDic This block returns the information of the strip, Strips means the number of strips which has been used, Date means expired date. + * @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandReadBGCodeDic:(DisposeBGCodeDic)disposeBGCodeDic + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + *Send BottleID to the BG meter + *@param bottleID bottleID, 4 bytes,0x00000000-0xFFFFFFFF + *@param disposeBGSendBottleIDBlock The block return YES means set success, NO means set fail. + *@param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandSendBottleID:(long long)bottleID +DisposeBGSendBottleIDBlock:(DisposeBGSendBottleIDBlock)disposeBGSendBottleIDBlock + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + * Get the bottleID stored in the BG meter + * @param disposeBGBottleID This block returns the ID which is stored in the BG meter, to verify if the strip that has been used is from the same bottle of the registered one. if not match, the app will notify the user need scan the new bottle; If match, the app can get the number of used strips and expire date. + * @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ + +-(void)commandBGGetBottleID:(DisposeBGBottleID)disposeBGBottleID + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + Strip-Sliding booting mode + + @param disposeBGStripInBlock This block returns yes means strip slides in. + @param disposeBGBloodBlock This block returns yes means the blood drop has beed sensed from the strip. + @param disposeBGResultBlock This block returns the measurement by the unit of mg/dL, range from 20-600. + @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + + */ +-(void)commandCreateBGtestStripInBlock:(DisposeBGStripInBlock)disposeBGStripInBlock + DisposeBGBloodBlock:(DisposeBGBloodBlock)disposeBGBloodBlock + DisposeBGResultBlock:(DisposeBGResultBlock)disposeBGResultBlock + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + + +/** + * Button-pressing booting mode + * @param testMode Set the measurement mode,must be the same as the testType in send code method, BGMeasureMode_Blood means blood measurement mode, BGMeasureMode_NoBlood means control solution measurement mode. + * @param disposeBGStripInBlock This block returns yes means strip slides in. + * @param disposeBGBloodBlock This block returns yes means the blood drop has beed sensed from the strip. + * @param disposeBGResultBlock This block returns the measurement by the unit of mg/dL, range from 20-600. + * @param disposeBGErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandCreateBGtestModel:(BGMeasureMode)testMode + DisposeBGStripInBlock:(DisposeBGStripInBlock)disposeBGStripInBlock + DisposeBGBloodBlock:(DisposeBGBloodBlock)disposeBGBloodBlock + DisposeBGResultBlock:(DisposeBGResultBlock)disposeBGResultBlock + DisposeBGErrorBlock:(DisposeBGErrorBlock)disposeBGErrorBlock; + +/** + * Keep the connection to enable enough time for operation such as scan code, insert strip and drop blood. + * @param disposeBG5KeepConnectBlock A block returns the result of the keeping connection order,'YES' means setting success,'NO' means fail. + * @param disposeErrorBlock This block returns error codes,please refer to error codes list in BGMacroFile. + */ +-(void)commandKeepConnect:(DisposeBG5KeepConnectBlock)disposeBG5KeepConnectBlock + DisposeErrorBlock:(DisposeBGErrorBlock)disposeErrorBlock; + +/** + Analyze code include bottleID,DueDate and the number of strips. Only Available for GOD Code + + @param encodeString The code String gets by scanning the QR code. + @return return a dictionary contains keys such as @"BottleID",@"StripNum",@"DueDate"; return nil if input parameter is GDH code or code is invalid. + */ +-(NSDictionary *)codeStripStrAnalysis:(NSString *)encodeString; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5Controller.h new file mode 100644 index 0000000..32f8935 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5Controller.h @@ -0,0 +1,28 @@ +// +// BG5Controller.h +// testShareCommunication +// +// Created by daiqingquan on 14-1-16. +// Copyright (c) 2014年 my. All rights reserved. +// + +#import +#import "BGMacroFile.h" + +/** + BG5Controller + */ +@interface BG5Controller : BGController + +/** + *Initialization for BG5 (wireless BG via Bluetooth) + */ ++(BG5Controller *)shareIHBg5Controller; + +/** + * Get all BG5 Instance + * The methold needs to be called when the BG5 has been triggered. When the app detected the glucose meter, the notification with the name of BG5ConnectNoti will be sent. After the device disconnected, the notification with the name of BG5DisConnectNoti will be received. + */ +-(NSArray *)getAllCurrentBG5Instace; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h new file mode 100644 index 0000000..08cca13 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5S.h @@ -0,0 +1,294 @@ +// +// BG5S.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/6/30. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +#import "BGMacroFile.h" + +// --------------- DELEGATE --------------- +@class BG5S; + +/** + BG5SDelegate + */ +@protocol BG5SDelegate +@required + +/** + Device sends an error + + @param device active device + @param error error number + @param errorDescription error message + */ +- (void)device:(BG5S *)device occurError:(BG5SError)error errorDescription:(NSString *)errorDescription; + +/** + Device sends strip state message + @note Only after startMeasure: method is called, does the device send strip state message. + If you insert strip before calling startMeasure: method, the device doesn't send strip state(Insert or Pull off) until startMeasure: method is called. + @param device active device + @param state BG5SStripState enum + */ +- (void)device:(BG5S *)device stripStateDidUpdate:(BG5SStripState)state; + +/** + Device sends drop blood or ctl message + @note After reciving this message, you should not call any method until you recive result. If called, the method may be timeout. + @param device active device + */ +- (void)deviceDropBlood:(BG5S *)device; + +/** + Device sends result + + @param device active device + @param dataID data identifier (Only for SDK users) + @param result blood glucose value with mg/dL unit + */ +- (void)device:(BG5S *)device dataID:(NSString *)dataID measureReult:(NSInteger)result; + +/** + Device sends charging state + @note Only state changes, is the message sent. + @param device active device + @param state BG5SChargeState object + */ +- (void)device:(BG5S *)device chargeStateDidUpdate:(BG5SChargeState)state; +@end + +/** + state information of BG5S when call "queryStateInfoWithSuccess:" + */ +@interface BG5SStateInfo : NSObject + +/** + 0-100 means battery percent, 255 means charging + */ +@property (assign, nonatomic, readonly) NSInteger batteryValue; + +/** + device date (UTC) + */ +@property (copy, nonatomic, readonly) NSDate *deviceDate; + +/** + device timezon -12.00 to 14.00. Without setting, default timezone is 0.00 + */ +@property (assign, nonatomic, readonly) float deviceTimeZone; + +/** + quantity of strip used in measurement.range:[0,65535]. If value is 65535, there may be something wrong with BG5S. Because 65535 is very large number for true user. + */ +@property (assign, nonatomic, readonly) NSInteger stripUsedValue; + +/** + quantity of record measuring without connecting to APP.range:[0,500]. If value is 65535, there may be something wrong with BG5S. + */ +@property (assign, nonatomic, readonly) NSInteger offlineDataQuantity; + +/** + blood code version (0-255) + */ +@property (assign, nonatomic, readonly) NSInteger bloodCodeVersion; + +/** + ctl code version (0-255) + */ +@property (assign, nonatomic, readonly) NSInteger ctlCodeVersion; + +/** + measure unit (BGUnit_Unknown means that BG5S has never been set unit from App,BGUnit_mmolPL stands for mmol/L,BGUnit_mgPmL stands for mg/dL) + */ +@property (assign, nonatomic, readonly) BGUnit unit; + +@end + +/** + Offline data model of BG5S + */ +@interface BG5SRecordModel : NSObject + +/** + Data ID (Only for SDK users) + */ +@property (copy, nonatomic, readonly) NSString *dataID; + +/** + Measure Date (UTC) + */ +@property (copy, nonatomic, readonly) NSDate *measureDate; + +/** + Time zone + */ +@property (assign, nonatomic, readonly) float timeZone; + +/** + BG Value with mg/dL unit + */ +@property (assign, nonatomic, readonly) NSInteger value; + +/** + Correct Flag, YES:can be corrected, NO:cannot be corrected + */ +@property (assign, nonatomic, readonly) BOOL canCorrect; + +@end + +/** + Modified offline data model of BG5S + */ +@interface BG5SRecordModifiedModel : NSObject + +/** + Data ID (Only for SDK users) + */ +@property (copy, nonatomic) NSString *dataID; + +/** + Measure Date (UTC) + */ +@property (copy, nonatomic) NSDate *measureDate; + +/** + Time zone + */ +@property (assign, nonatomic,) float timeZone; + +/** + BG Value with mg/dL unit + */ +@property (assign, nonatomic) NSInteger value; + +@end + +/** + BG5S + */ +@interface BG5S : BGDevice + +@property (weak, nonatomic) id delegate; + +/** + Query BG5S state information including battery value,device date, device timezone, strip used, quantity of offline data, blood code version, CTL code version, unit. + + @param stateInfoBlock BG5SStateInfo object + @param errorBlock the block means fail. You can get error from this block + @note If analysis occurs error, BG5SStateInfo object maybe nil or some of its property are nil. + */ +- (void)queryStateInfoWithSuccess:(BG5SStateInfoBlock)stateInfoBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +/** + Set time + + @param date the date you want to set should be an UTC time. valid range:Jan. 1,2000 - Dec. 31,2099. If date is nil, use [NSdate date] and system time zone + @param timezone the timezone you want to set should be from -12.00 to 14.00; step length = 0.25 + @param successBlock the block means success + @param errorBlock the block means fail. You can get error from this block + @note If date is out of reange, BG5SError_InputParametersError will be returned by block. + If date and timezone are invalid , use input parameters; otherwise use [NSdate date] and system time zone; + */ +- (void)setTimeWithDate:(NSDate *)date + timezone:(float)timezone + successBlock:(BG5SSuccessBlock)successBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +/** + Set unit + + @param unit the unit you want to set (BGUnit_mmolPL stands for mmol/L,BGUnit_mgPmL stands for mg/dL) + @param successBlock the block means success + @param errorBlock the block means fail. You can get error from this block + */ +- (void)setUnit:(BGUnit)unit + successBlock:(BG5SSuccessBlock)successBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +/** + Delete strip used info (the quantity of strip used is set to 0) + + @param successBlock the block means success + @param errorBlock the block means fail. You can get error from this block + */ +- (void)deleteStripUsedInfoWithSuccessBlock:(BG5SSuccessBlock)successBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +/** + Query record data stored in BG5S + + @param successBlock the block means success; if has record, return non-empty array (BG5SRecordModel object); if no record, return empty array + @param errorBlock the block means fail. You can get error from this block + */ +- (void)queryRecordWithSuccessBlock:(BG5SRecordBlock)successBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + + +/** + Delete record data stored in BG5S + + @param successBlock the block means success + @param errorBlock the block means fail. You can get error from this block + */ +- (void)deleteRecordWithSuccessBlock:(BG5SSuccessBlock)successBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +/** + Start online measurement with specific measure mode. + + @note If you don't call this method, BG5S use blood mode by default. + + If CTL mode is sent, BG5S use CTL mode and BG5S can't be set to use blood mode until next connection. + @param measureMode Blood or CTL + @param successBlock the block means success + @param errorBlock the block means fail. You can get error from this block + */ +- (void)startMeasure:(BGMeasureMode)measureMode + withSuccessBlock:(BG5SSuccessBlock)successBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +/** + Disconnect device + */ +- (void)disconnectDevice; + +/** + Correct Measure Date if canCorrect is YES in BG5SRecordModel + + @param array BG5SRecordModel objects + @param deviceDate This date should be read before set time method called. + @return BG5SRecordModifiedModel objects; return empty array means input parameters is wrong. + */ +- (NSArray *)processData:(NSArray *)array deviceDate:(NSDate *)deviceDate; + + +/** + + Is offline measurement allowed + + @param isOffline Is offline measurement allowed 0:allowed 1:Offline measurement is not allowed + @param successBlock the block means success + @param errorBlock the block means fail. You can get error from this block + */ +- (void)setIsOfflineMeasurementAllowed:(BOOL)isOffline +successBlock:(BG5SSuccessBlock)successBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + + +- (void)setCodeWithMeasureMode:(BGMeasureMode)mode + resultBlock:(BG5SSetCodeResultBlock)resultBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +- (void)readDeviceInfoWithSuccessBlock:(BG5SDeviceInfoBlock)deviceInfoBlock + errorBlock:(BG5SSDKErrorBlock)errorBlock; + +- (void)commandCloseDeviceBLEWithSuccessBlock:(BG5SSuccessBlock)successBlock errorBlock:(BG5SSDKErrorBlock)errorBlock; + +- (void)commandSetDeviceDisplay:(BOOL)isDisplay successBlock:(BG5SSuccessBlock)successBlock errorBlock:(BG5SSDKErrorBlock)errorBlock; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5SController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5SController.h new file mode 100644 index 0000000..7e83e95 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BG5SController.h @@ -0,0 +1,29 @@ +// +// BG5SController.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/6/30. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +#import "BGMacroFile.h" + +/** + BG5SController + */ +@interface BG5SController : BGController +/** + Initialization method + + @return BG5SController singleton + */ ++(BG5SController *)sharedController; +/** + Get all BG5S Instance + @note The method should be called when the BG5S has been connected. + @return BG5S object array + */ +-(NSArray *)getAllCurrentInstace; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGController.h new file mode 100644 index 0000000..9675047 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGController.h @@ -0,0 +1,32 @@ +// +// BGController.h +// iHealthDemoCode +// +// Created by Realank on 2017/1/4. +// Copyright © 2017年 zhiwei jing. All rights reserved. +// + +#import + +/** + Base class of BG controller + */ +@interface BGController : NSObject{ + //区分设备 + NSString* deviceName; + NSNumber* bluetoothType; + //发送通知 + NSString* deviceConnectNotiName; + NSString* deviceDisconnectNotiName; + //创建实例 + Class DeviceClass; +} + +-(instancetype) initUniqueInstance; + +/** + * Get all BG3 instance,Access control class instance after receiving kNotificationNameBG3ConnectSuccess, then use instance to call BG3 related communication methods. + */ +-(NSArray *)allConnectedInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGDevice.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGDevice.h new file mode 100644 index 0000000..125f762 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGDevice.h @@ -0,0 +1,42 @@ +// +// BGDevice.h +// iHealthDemoCode +// +// Created by Realank on 2017/1/4. +// Copyright © 2017年 zhiwei jing. All rights reserved. +// + +#import + +/** + Base class of BG + */ +@interface BGDevice : NSObject + +/** + UUID + */ +@property (copy, nonatomic) NSString *currentUUID; +/** + serial number or mac + */ +@property (copy, nonatomic) NSString *serialNumber; +/** + firmware version + */ +@property (copy, nonatomic) NSString *firmwareVersion; +/** + hardware version + */ +@property (copy, nonatomic) NSString *hardwareVersion; +/** + model number + */ +@property (copy, nonatomic) NSString *modelNumber; + +/** + device type0:old device 1:new device + */ +@property (copy, nonatomic) NSNumber *deviceType; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGHeader.h new file mode 100644 index 0000000..20eac92 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGHeader.h @@ -0,0 +1,23 @@ +// +// BGHeader.h +// BGDemoCode +// +// Created by zhiwei jing on 14-6-30. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#ifndef BGDemoCode_BGHeader_h +#define BGDemoCode_BGHeader_h + +#import "BG1.h" +#import "BG1Controller.h" +#import "BGMacroFile.h" +#import "BG3.h" +#import "BG3Controller.h" +#import "BG5.h" +#import "BG5Controller.h" +#import "BG5S.h" +#import "BG5SController.h" +#import "BG1S.h" +#import "BG1SController.h" +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h new file mode 100644 index 0000000..7e03f2c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BGMacroFile.h @@ -0,0 +1,507 @@ +// +// BGMacroFile.h +// BGDemoCode +// +// Created by zhiwei jing on 14-6-29. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#import "HealthUser.h" +#import "BGDevice.h" +#import "BGController.h" +@class BG5SStateInfo; +@class BG5SRecordModel; + +#ifndef BGDemoCode_BGMacroFile_h +#define BGDemoCode_BGMacroFile_h + +/** + BG5 open mode + */ +typedef NS_ENUM(NSUInteger, BGOpenMode) { + /// BGOpenMode_Strip means booting the meter by insert the strip + BGOpenMode_Strip = 1, + /// BGOpenMode_Hand means booting the meter by pressing the on/off button. + BGOpenMode_Hand = 2, +}; + +/** + BG5\BG5S measure mode + */ +typedef NS_ENUM(NSUInteger, BGMeasureMode) { + /// BGMeasureMode_Blood means blood measurement mode + BGMeasureMode_Blood = 1, + /// BGMeasureMode_NoBlood means control solution measurement mode. + BGMeasureMode_NoBlood = 2, + +}; + +/** + BG code mode + */ +typedef NS_ENUM(NSUInteger, BGCodeMode) { + /// BGCodeMode_GOD means GOD blood test strip. + BGCodeMode_GOD = 1, + /// BGCodeMode_GDH means GDH Blood test strip. + BGCodeMode_GDH = 2, +}; + +/** + BG unit + */ +typedef NS_ENUM(NSUInteger, BGUnit) { + /// Unknown + BGUnit_Unknown = 0, + /// mmol/L + BGUnit_mmolPL = 1, + /// mg/dL + BGUnit_mgPmL = 2, +}; + +/** + BG1 error code + */ +typedef NS_ENUM(NSInteger,BG1Error){ + /// Battery is low. + BG1Error_LowBattery = 0, + /// Glucose test result is out of the measurement range. + BG1Error_ResultOutOfMeasurementRage = 1, + /// 2.5V reference voltage error, not normal measurement, please repeat the test. + BG1Error_UnvalidReferenceVoltage = 2, + /// Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip. + BG1Error_StripUsed = 3, + /// CODE value check error. This error need let user scan code and call the send code function again,no alert need to show. + BG1Error_CodeError = 4, + /// The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test. + BG1Error_RoomTemperatureOutOfRange1 = 5, + /// The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test. + BG1Error_RoomTemperatureOutOfRange2 = 6, + /// Authentication failed more than 10 times. + BG1Error_AuthenticationFailed = 7, + /// Packet loss in the process of sending CODE. + BG1Error_CodeSendLost = 8, + /// Tooling inspection process is not completed. + BG1Error_ToolingTestFailed = 9, + /// Encryption burn write bit is empty. + BG1Error_EncryptionFailed = 10, + /// Compulsory Authentication is not passed. + BG1Error_CompulsoryAuthenticationFaild = 11, + /// Glucose test result is low. + BG1Error_ResultLow = 12, + /// Glucose test result is high. + BG1Error_ResultHigh = 13, + /// BG unknown. + BG1Error_Unknown = 300, + /// BG time out. + BG1Error_TimeOut = 301, + /// BG disConnented. + BG1Error_DisConnented = 303, + /// BG sleeping mode. + BG1Error_SleepingMode =330, + /// Hand shake failed. + BG1Error_HandShakeFailed = 331, + /// Parameter input error. + BG1Error_ParameterError = 400, +}; + + +//UI +#define kNotificationNameNeedAudioPermission @"LetkNotificationNameNeedAudioPermission" +#define kNotificationNameAudioDeviceInsert @"kNotificationNameAudioDeviceInsert" +#define kNotificationNameBG1DidDisConnect @"kNotificationNameBG1DidDisConnect" + + +/** + Discover BG1 + */ +typedef void (^DisposeBG1DiscoverBlock)(void); + +/** + BG1 IDPS + + @param idpsDic IDPS dictionary + */ +typedef void (^DisposeBG1IDPSBlock)(NSDictionary* idpsDic); + +/** + Connect BG1 successfully + */ +typedef void (^DisposeBG1ConnectBlock)(void); + +/** + BG1 error block + + @param errorID BG1Error enum + */ +typedef void (^DisposeBG1ErrorBlock)(BG1Error errorID); + +/** + BG1 send code result + */ +typedef void (^DisposeBG1SendCodeResultBlock)(void); + +/** + Strip is insered + */ +typedef void (^DisposeBGStripInBlock)(void); +// +/** + Strip is pulled off + */ +typedef void (^DisposeBGStripOutBlock)(void); + +/** + Blood is droped + */ +typedef void (^DisposeBGBloodBlock)(void); + +/** + Measurement result block + + @param result dictionary + */ +typedef void (^DisposeBGResultBlock)(NSDictionary* result); + +/** + BG send code result block + + @param sendOk YES: success NO:fail + */ +typedef void (^DisposeBGSendCodeBlock)(BOOL sendOk); + +/** + BG error block + + @param errorID BG error code + */ +typedef void (^DisposeBGErrorBlock)(NSNumber* errorID); + +/** + BG5 keep connection result + + @param sendOk YES:success NO:fail + */ +typedef void (^DisposeBG5KeepConnectBlock)(BOOL sendOk); + +/** + BG5 set time result + + @param setResult YES:success NO:fail + */ +typedef void (^DisposeBGSetTime)(BOOL setResult); + +/** + BG5 set unit result + + @param setResult YES:success NO:fail + */ +typedef void (^DisposeBGSetUnit)(BOOL setResult); + +/** + BG5 get bottleID result + + @param bottleID bottleID + */ +typedef void (^DisposeBGBottleID)(NSNumber *bottleID); + +/** + BG5 offline measurement data quantity block + + @param dataCount quantity + */ +typedef void (^DisposeBGDataCount)(NSNumber* dataCount); + +/** + BG5 offline measurement data block + + @param historyDataDic data + */ +typedef void (^DisposeBGHistoryData)(NSDictionary *historyDataDic); + +/** + BG5 delete offline measurement data result block + + @param deleteOk YES:success NO:fail + */ +typedef void (^DisposeBGDeleteData)(BOOL deleteOk); + +/** + BG5 send bottle ID result block + + @param sendOk YES:success NO:fail + */ +typedef void(^DisposeBGSendBottleIDBlock)(BOOL sendOk); + +/** + BG5 get code information + + @param codeDic dictionary + */ +typedef void (^DisposeBGCodeDic)(NSDictionary *codeDic); + +/** + BG5 send code result block + + @param sendOk YES:success NO:fail + */ +typedef void (^DisposeBGSendCodeBlock)(BOOL sendOk); + +/** + BG5 open mode block + + @param mode BGOpenMode enum + */ +typedef void (^DisposeBGStartModel)(BGOpenMode mode); + +/** + BG device battery block + + @param energy normal range:0-100;255 means in charging + */ +typedef void (^DisposeBGBatteryBlock)(NSNumber* energy); + + +#define kNotificationNameBG3ConnectSuccess @"kNotificationNameBG3ConnectSuccess" +#define kNotificationNameBG3DidDisConnect @"kNotificationNameBG3DidDisConnect" + + +// ------ BG5 Baolei ------ +#define BG5ConnectNoti @"BG5ConnectNoti" +#define BG5DisConnectNoti @"BG5DisConnectNoti" + +/** + BG5 error code + */ +typedef NS_ENUM(NSInteger, BG5Error) { + /// BG5Error_Unknown: Unknown error + BG5Error_Unknown = -1, + /// BG5Error_LowBattery: Battery is low. + BG5Error_LowBattery = 0, + /// BG5Error_ResultOutOfMeasurementRage: Glucose test result is out of the measurement range. + BG5Error_ResultOutOfMeasurementRage = 1, + /// BG5Error_UnvalidReferenceVoltage: Reference voltage error, not normal measurement, please repeat the + BG5Error_UnvalidReferenceVoltage = 2, + /// BG5Error_StripUsed: Strip is used or unknown moisture detected, discard the test strip and repeat the + BG5Error_StripUsed = 3, + /// BG5Error_ErrorOccurInEEPROM: Reading transmission error. Repeat the test with a new test strip. If the + BG5Error_ErrorOccurInEEPROM = 4, + /// BG5Error_RoomTemperatureOutOfRange1: The environmental temperature is beyond normal range, place the + BG5Error_RoomTemperatureOutOfRange1 = 5, + /// BG5Error_RoomTemperatureOutOfRange2: The environmental temperature is beyond normal range, place the + BG5Error_RoomTemperatureOutOfRange2 = 6, + /// BG5Error_TestStripCodingError1: Test strip coding error. + BG5Error_TestStripCodingError1 = 7, + /// BG5Error_TestStripCodingError2: Test strip coding error. + BG5Error_TestStripCodingError2 = 8, + /// BG5Error_PullOffStripWhenMeasuring: Strip removed in the middle of reading, repeat the test with a new + BG5Error_PullOffStripWhenMeasuring = 9, + /// BG5Error_ShouldPullOffStripAfterReadingResult: Pull off strips after measuring + BG5Error_ShouldPullOffStripAfterReadingResult = 10, + /// BG5Error_CannotWriteSNOrKey: SN or KEY write error + BG5Error_CannotWriteSNOrKey = 11, + /// BG5Error_NeedSetTime: Please set time. + BG5Error_NeedSetTime = 12, + /// BG5Error_StripNumberIsZero: 0 test strips remaining. + BG5Error_StripNumberIsZero = 13, + /// BG5Error_StripExpired: Test strip expired. + BG5Error_StripExpired = 14, + /// BG5Error_CannotMeasureWhenCharging: Unplug the charging cable before testing. + BG5Error_CannotMeasureWhenCharging = 15, + /// BG5Error_InputParametersError: Parameter input error. + BG5Error_InputParametersError = 400, + /// BG5Error_FunctionCallOrderError: Fucntion call order error + BG5Error_FunctionCallOrderError = 402, + /// BG5Error_MeasureModeNotMatch: Measure mode is not match. + BG5Error_MeasureModeNotMatch = 403, + /// BG5Error_CommandTimeout: Command timeout + BG5Error_CommandTimeout = 500, + /// BG5Error_CommandNotSupport: Command is not supported for current device. + BG5Error_CommandNotSupport = 501, +}; + +#define kNotificationNameBG5SDidDiscover @"BG5SDiscover" +#define kNotificationNameBG5SConnectFail @"BG5SConnectFailed" +#define kNotificationNameBG5SConnectSuccess @"BG5SConnectNoti" +#define kNotificationNameBG5SDidDisConnect @"BG5SDisConnectNoti" + +/** + BG5SCommandAction Enum + */ +typedef NS_ENUM(NSInteger, BG5SCommandAction) { + /// placeholder + BG5SCommandAction_Unknown = -1, + /// Query device state information + BG5SCommandAction_QueryBG5SStateInfo, + /// Set device time + BG5SCommandAction_SetBG5STime, + /// Set device unit + BG5SCommandAction_SetBG5SUnit, + /// Send code + BG5SCommandAction_SendBG5SCode, + /// Delete Strip used information + BG5SCommandAction_DeleteBG5SStripUsedInfo, + /// Query device offline measurement data + BG5SCommandAction_QueryBG5SRecord, + /// Delete device offline measurement data + BG5SCommandAction_DeleteBG5SRecord, + /// Set measure mode + BG5SCommandAction_StartBG5SMeasure, + /// Device send error code + BG5SCommandAction_ErrorCode, + /// Strip is inserted + BG5SCommandAction_StripInsert, + /// Strip is pulled off + BG5SCommandAction_StripPullOff, + /// Blood is dropped + BG5SCommandAction_DropBlood, + /// Device send result + BG5SCommandAction_Result, + /// Device enters charging state + BG5SCommandAction_EnterChagre, + /// Device exits charging state + BG5SCommandAction_ExitCharge, + +}; + +/** + BG5S error code + */ +typedef NS_ENUM(NSInteger, BG5SError) { + /// Unknown error + BG5SError_Unknown = -1, + /// Only showed in BG5S's screen and need charging + BG5SError_LowBattery = 0, + /// Strip removed in the middle of reading, repeat the test with a new strip. + BG5SError_PullOffStripWhenMeasuring = 1, + /// Reference voltage error, not normal measurement, please repeat the test. + BG5SError_UnvalidReferenceVoltage = 2, + /// Strip is used or unknown moisture detected, discard the test strip and repeat the test with a new strip. + BG5SError_StripUsed = 3, + /// Reading transmission error. Repeat the test with a new test strip. If the problem persists, contact iHealth customer service for assistance. + BG5SError_ErrorOccurInEEPROM = 4, + /// The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test. + BG5SError_LowTemperature = 5, + /// The environmental temperature is beyond normal range, place the meter at room temperature for at least 30 minutes, then repeat the test. + BG5SError_HighTemperature = 6, + /// Only showed in BG5S's screen. + BG5SError_BluetoothError = 7, + /// Glucose test result is low. + BG5SError_ResultLow = 8, + /// Glucose test result is high. + BG5SError_ResultHigh = 9, + /// Reset and if the problem persists, contact iHealth customer service for assistance. + BG5SError_FactoryError = 10, + /// Parameter input error. + BG5SError_InputParametersError = 400, + /// Quantity not match + BG5SError_RecordTotalNumberNotMatchTransferTotalNumber = 401, + /// Single packet is not full. + BG5SError_RecordPacketNotMatch = 402, + /// Packet index not match. + BG5SError_RecordPackerIndexNotMatch = 403, + /// Command timeout + BG5SError_CommandTimeout = 500, + /// Command is not supported for current device. + BG5SError_CommandNotSupport = 501, + BG5SError_Disconnect = 502, +}; + + +/** + BG5S strip state + */ +typedef NS_ENUM(NSInteger, BG5SStripState) { + /// Unknown state + BG5SStripState_Unknown = -1, + /// Insert + BG5SStripState_Insert, + /// Pull off + BG5SStripState_PullOff, +}; +/** + BG5S charging state + */ +typedef NS_ENUM(NSInteger, BG5SChargeState) { + /// Unknown state + BG5SChargeState_Unknown = -1, + /// In charging + BG5SChargeState_Charging, + /// Not in charging + BG5SChargeState_ExitCharge, +}; + +/** + BG5SStateInfoBlock + + @param stateInfo BG5SStateInfo object + */ +typedef void(^BG5SStateInfoBlock)(BG5SStateInfo *stateInfo); + +/** + BG5SRecordBlock + + @param array offline measurement data array + */ +typedef void(^BG5SRecordBlock)(NSArray *array); +/** + Block without return parameters + */ +typedef void(^BG5SSuccessBlock)(void); + +/** + Block show the result of setting code + + @param success YES:success NO:fail + */ +typedef void(^BG5SSetCodeResultBlock)(BOOL success); + + +typedef void(^BG5SDeviceInfoBlock)(NSDictionary* deviceInfoDic); + + +//typedef void(^BG5SRecordBlock)(NSArray *array); + +/** + Error block with error type + + @param error error type + */ +typedef void(^BG5SSDKErrorBlock)(BG5SError error,NSString *detailInfo); + + +/* + BG1S code + */ + +#define BG1SDiscover @"BG1SDiscover" +#define BG1SConnectFailed @"BG1SConnectFailed" +#define BG1SConnectNoti @"BG1SConnectNoti" +#define BG1SDisConnectNoti @"BG1SDisConnectNoti" + +typedef NS_ENUM(NSUInteger, BG1SDeviceError) { + + BG1SDeviceError0=0, + 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, + BG1SError_ResultHigh, + BG1SError_ResultLow, + BG1SError_Disconnect, + +}; + +typedef void(^BlockBG1SDeviceFunction)(NSDictionary *functionDict); + +typedef void(^BlockBG1SError)(BG1SDeviceError error); + +/** + Strip is insered + */ +typedef void (^DisposeBG1SStripInBlock)(BOOL inORout); + +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3.h new file mode 100644 index 0000000..d7c7342 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3.h @@ -0,0 +1,77 @@ +// +// BP3.h +// testShareCommunication +// +// Created by zhiwei jing on 13-10-22. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPDevice.h" +#import + + +/** + BP3 device class + */ +@interface BP3 : BPDevice + +/** + * Query battery remaining energy + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error A block to return the error in ‘Establish measurement connection’. + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + +/** + * Establish measurement connection and start BP measurement + * @Notice By the first time of new user register via SDK, ‘iHealth disclaimer’ will pop up automatically, and require the user agrees to continue. SDK application requires Internet connection; there is 10-day tryout if SDK cannot connect Internet, SDK is fully functional during tryout period, but will be terminated without verification through Internet after 10 days. + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set with heart beat. + * @param blockWaveletWithoutHeartbeat Wavelet data set without heart beat. + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular + * @param error error codes. + * Specification: + * 1. BPError0 = 0: Unable to take measurements due to arm/wrist movements. + * 2. BPError1: Failed to detect systolic pressure. + * 3. BPError2: Failed to detect diastolic pressure. + * 4. BPError3: Pneumatic system blocked or cuff is too tight during inflation. + * 5. BPError4: Pneumatic system leakage or cuff is too loose during inflation. + * 6. BPError5: Cuff pressure reached over 300mmHg. + * 7. BPError6: Cuff pressure reached over 15 mmHg for more than 160 seconds. + * 8. BPError7: Data retrieving error. + * 9. BPError8: Data retrieving error. + * 10. BPError9: Data retrieving error. + * 11. BPError10: Data retrieving error. + * 12. BPError11: Communication Error. + * 13. BPError12: Communication Error. + * 14. BPError13: Low battery. + * 15. BPError14: Device bluetooth set failed. + * 16. BPError15: Systolic exceeds 260mmHg or diastolic exceeds 199mmHg. + * 17. BPError16: Systolic below 60mmHg or diastolic below 40mmHg. + * 18. BPError17: Arm/wrist movement beyond range. + * 19. BPNormalError=30: device error, error message displayed automatically. + * 20. BPOverTimeError: Abnormal communication. + * 21. BPNoRespondError: Abnormal communication. + * 22. BPBeyondRangeError: device is out of communication range. + * 23. BPDidDisconnect: device is disconnected. + * 24. BPAskToStopMeasure: measurement has been stopped. + * 25. BPInputParameterError=400: Parameter input error. + */ +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + +/** + * Measurement termination and stop upper-arm BPM measurement + * @param result The block return ‘YES’ means measurement has been terminated, return ‘NO’ means termination failed. + * @param error A block to return the error in ‘Establish measurement connection' in BP3. + */ +-(void)stopBPMeassure:(BlockResult)result ErrorBlock:(BlockError)error; +/** + * Disconnect BP3 and delete the measurement port + */ +-(void)deleteMeasurePort; + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3Controller.h new file mode 100644 index 0000000..67b0f0b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3Controller.h @@ -0,0 +1,27 @@ +// +// BP3Controller.h +// testShareCommunication +// +// Created by zhiwei jing on 13-10-22. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPMacroFile.h" + + +/** + BP3 controller class + */ +@interface BP3Controller : NSObject +/** + * Initialize BP3 controller class + */ ++(BP3Controller *)shareBP3Controller; + +/** + * Get all BP3 instance,Access control class instance after receiving BP3ConnectNoti, then use instance to call BP3 related communication methods. + */ +-(NSArray *)getAllCurrentBP3Instace; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3L.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3L.h new file mode 100644 index 0000000..0478149 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3L.h @@ -0,0 +1,58 @@ +// +// BP3L.h +// testShareCommunication +// +// Created by my on 14/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import +#import "BPV24Device.h" + + +/** + BP3L device class + */ +@interface BP3L : BPV24Device + + + +/** + * Establish measurement connection and start BP measurement. + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set with heart beat. + * @param blockWaveletWithoutHeartbeat Wavelet data set without heart beat. + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular. irregular will be 0 or 1. + * @param error Return error codes. + */ +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + +/** + * Measurement termination and stop BP3L measurement + * @param success The block return means measurement has been terminated. + * @param error A block to return the error in ‘Establish measurement connection’ in BP3L. + */ +-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + +/** + * Synchronize time and judge if the device supports BT auto-connection, offline detection, and if the function on or off, corresponding KEYs are haveBlue, haveOffline, blueOpen, offlineOpen. ‘True’ means yes or on, ‘False’ means no or off + * @param function A block to return the function and states that the device supports. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in BP3L. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Query battery remaining energy + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error A block to return the error in ‘Establish measurement connection’. + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3LController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3LController.h new file mode 100644 index 0000000..f4c0e75 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP3LController.h @@ -0,0 +1,30 @@ +// +// BP3LViewController.h +// testShareCommunication +// +// Created by my on 14/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPMacroFile.h" + + + +/** + BP3L controller class + */ +@interface BP3LController : BPController + +/** + * Initialize BP3L controller class + */ ++(BP3LController *)shareBP3LController; + +/** + * Get all BP3L instance,Access control class instance after receiving BP3LConnectNoti then use instance to call BP3L related communication methods. + */ +-(NSArray *)getAllCurrentBP3LInstace; + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5.h new file mode 100644 index 0000000..43fbe42 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5.h @@ -0,0 +1,32 @@ +// +// BP5.h +// testShareCommunication +// +// Created by my on 14/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import "BP7.h" + + +/** + BP5 device class + */ +@interface BP5 : BP7 + +/** + * Establish measurement connection and start BP measurement(Only for BP5). + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set with heart beat. + * @param blockWaveletWithoutHeartbeat Wavelet data set without heart beat. + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular. irregular will be 0 or 1. + * @param error Return error codes. + */ + +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5C.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5C.h new file mode 100644 index 0000000..f2c7a14 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5C.h @@ -0,0 +1,131 @@ +// +// BP5C.h +// iHealthSDKStatic +// +// Created by Realank on 2017/9/26. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPBV10Device.h" +@interface BP5C : BPBV10Device + + +/** + * Synchronize time and return functions this device supports. + * @param function A block to return the functions and states that the device supports. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Get battery remaining energy by percent + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + +/** + * Set units for the Device + * @param UnitName The unit name of the result, must be @"mmHg" or @"kPa". + * @param setResult This block return means set success. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandSetUnit:(NSString *)UnitName disposeSetReslut:(BlockSuccess)setResult errorBlock:(BlockError)error; + + +/** + Set auto loop measure scheme + + @param scheme scheme content + @param successBlock A block refer to success. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandSetLoopMeasureScheme:(BPLoopMeasureSettingModel*)scheme successBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; + +/** + Get auto loop measure scheme + + @param loopMeasureSchemeBlock return auto loop measure scheme content + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandAskLoopMeasureScheme:(BlockAskLoopMeasureScheme)loopMeasureSchemeBlock errorBlock:(BlockError)errorBlock; + +/** + * Start BP measurement. + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set including pulse rate + * @param blockWaveletWithoutHeartbeat Wavelet data set without pulse rate + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant keys: time, sys, dia, heartRate, irregular. irregular will be 0 or 1. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + +/** + * Stop measurement + * @param success The block return means measurement has been terminated. + * @param error Operation failed, and returns the error codes. + */ +-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + + +/** + * Upload history data. + * @param totalCount history data total Count. + * @param progress upload completion ratio , from 0.0 to 1.0. + * @param uploadDataArray offline data set, including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment,scheme ID,body movement flag. corresponding KEYs are time, sys, dia, heartRate, irregular,schemeID,bodyMovementFlg. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +-(void)commandTransferMemoryDataAndRawPressureWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +/** + * Upload history data total Count. + * @param totalCount item quantity of total data. + * @param error Operation failed, and returns the error codes. + */ +-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error; + + +/** + Delete all the history memory stored in device + + @param successBlock A block refer to delete complete. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandDeleteAllMemoryWithSuccessBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; + + +/** + Set ID String (eg.patientID, schemeID), length 100 max + + @param idString the content of id + @param successBlock A block refer to success. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandSetIDString:(NSString*)idString successBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; + + +/** + Ask ID String + + @param idStringResultBlock return ID String + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandAskIDStringWithResult:(BlockAskIDString)idStringResultBlock errorBlock:(BlockError)errorBlock; + +/** + Change loop measure scheme status + + @param start YES to start, NO to pause + @param successBlock A block refer to success. + @param errorBlock Operation failed, and returns the error codes. + */ +- (void)commandChangeLoopMeasureStatusToStart:(BOOL)start successBlock:(BlockSuccess)successBlock errorBlock:(BlockError)errorBlock; + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5CController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5CController.h new file mode 100644 index 0000000..30c8069 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5CController.h @@ -0,0 +1,25 @@ +// +// ABPMController.h +// iHealthSDKStatic +// +// Created by Realank on 2017/9/26. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPController.h" + +/** + BP5C controller class + */ +@interface BP5CController : BPController +/** + * Initialize BP5C controller class + */ ++ (BP5CController *)sharedController; + +/** + * Get all BP5C instance,Access control class instance after receiving BP3LConnectNoti then use instance to call BP5C related communication methods. + */ +- (NSArray *)allConnectedInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5Controller.h new file mode 100644 index 0000000..e9609ae --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5Controller.h @@ -0,0 +1,25 @@ +// +// BP5ViewController.h +// testShareCommunication +// +// Created by my on 14/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPMacroFile.h" + +/** + BP5 controller class + */ +@interface BP5Controller : BPController +/** + * Initialize BP5 controller class + */ ++(BP5Controller *)shareBP5Controller; + +/** + * Get all BP5 instance,Access control class instance after receiving BP5ConnectNoti, then use instance to call BP5 related communication methods. + */ +-(NSArray *)getAllCurrentBP5Instace; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5S.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5S.h new file mode 100644 index 0000000..bb1db70 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5S.h @@ -0,0 +1,97 @@ +// +// BP5S.h +// iHealthSDKStatic +// +// Created by Realank on 2017/7/14. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import "BPV25Device.h" + + +/** + BP5S device class + */ +@interface BP5S : BPV25Device + + +/** + * Upload offline data. + * @Notice By the first time of new user register via SDK, ‘iHealth disclaimer’ will pop up automatically, and require the user agrees to continue. SDK application requires Internet connection; there is 10-day tryout if SDK cannot connect Internet, SDK is fully functional during tryout period, but will be terminated without verification through Internet after 10 days. + * @param totalCount item quantity of total data + * @param progress upload completion ratio , from 0.0 to 1.0 or 0%~100%, 100% means upload completed. + * @param uploadDataArray offline data set, including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment,scheme ID,body movement flag. corresponding KEY as time, sys, dia, heartRate, irregular,schemeID,bodyMovementFlg. + * @param error error codes. + */ +-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + + +/** + * Upload offline data total Count. + * @param totalCount item quantity of total data. + * @param error A block to return the error. + */ +-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error; + + +/** + * * Synchronize time and return the function and states that the device supports + * @param function A block to return the function and states that the device supports,judge if the device supports the function of up Air Measurement, arm Measurement,the last operation status,the max memory capacity, HSD, Offline Memory, mutable Groups Upload, Self Upgrade. ‘True’ means yes or on, ‘False’ means no or off. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in BP5S. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Query battery remaining energy + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param energyState 1:Not charging 2:charging 3:charging finish + * @param error A block to return the error in ‘Establish measurement connection’. + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue energyState:(BlockEnergyState)energyState errorBlock:(BlockError)error; + +/** + * Establish measurement connection and start BP measurement. + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set with heart beat. + * @param blockWaveletWithoutHeartbeat Wavelet data set without heart beat. + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular. irregular will be 0 or 1. + * @param error Return error codes. + */ +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + +/** + * Measurement termination and stop BP measurement + * @param success The block return means measurement has been terminated. + * @param error A block to return the error in ‘Establish measurement connection’ in BP. + */ +-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + +/** + * Delete all offline data + * @param success The block return means delete has been terminated. + * @param error A block to return the error in ‘Establish measurement connection’ in BP. + */ +-(void)commandDeleteDataSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + +/** + * set up offline detection + * @param open True means on; False means off. + * @param successBlock A block to refer ‘set success’. + * @param errorBlock A block to refer ‘set failed’. + */ +-(void)commandSetOffline:(BOOL)open success:(BlockSuccess)successBlock error:(BlockError)errorBlock; + +/** + * set unit display + * @param UnitName mmHg, kPa + * @param setResult A block to refer ‘set success’. + * @param error A block to refer ‘set failed’. + */ +-(void)commandSetUnit:(NSString *)UnitName disposeSetReslut:(BlockSuccess)setResult errorBlock:(BlockError)error; +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SController.h new file mode 100644 index 0000000..7018b8f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SController.h @@ -0,0 +1,27 @@ +// +// BP5SController.h +// iHealthSDKStatic +// +// Created by Realank on 2017/7/7. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +#import "BPMacroFile.h" + +/** + BP5S controller class + */ +@interface BP5SController : BPController + +/** + * Initialize controller class + */ ++(instancetype)sharedController; + +/** + * Get all BP5S instance,Access control class instance after receiving BP3LConnectNoti then use instance to call BP5S related communication methods. + */ +-(NSArray *)getAllCurrentInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRW.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRW.h new file mode 100644 index 0000000..e2e8d77 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRW.h @@ -0,0 +1,101 @@ +// +// BP5SRW.h +// testShareCommunication +// +// Created by my on 14/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPDevice.h" +#import + + +/** + BP5SRW device class + */ +@interface BP5SRW : BPDevice + + + +/** + * Establish measurement connection and start BP measurement. + * @Notice By the first time of new user register via SDK, ‘iHealth disclaimer’ will pop up automatically, and require the user agrees to continue. SDK application requires Internet connection; there is 10-day tryout if SDK cannot connect Internet, SDK is fully functional during tryout period, but will be terminated without verification through Internet after 10 days. + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set with heart beat. + * @param blockWaveletWithoutHeartbeat Wavelet data set without heart beat. + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular. + * @param redWave A block to return wave information,include the packets order number(0~255),the current measure status(@1 means measuring,@2 means constant Pressure measuring,@3 means completed),the pressure data type(@1 means pressure data ,@2 means wave data) ,the pressure or wave count ,the pressure or wave data array.The corresponding keys are @"packetOrderID",@"measureStatusID",@"pressureDataType",@"pressureCount",@"pressureArray". + * @param error Return error codes. + * Specification: + * 1. BPError0 = 0: Unable to take measurements due to arm/wrist movements. + * 2. BPError1: Failed to detect systolic pressure. + * 3. BPError2: Failed to detect diastolic pressure. + * 4. BPError3: Pneumatic system blocked or cuff is too tight during inflation. + * 5. BPError4: Pneumatic system leakage or cuff is too loose during inflation. + * 6. BPError5: Cuff pressure reached over 300mmHg. + * 7. BPError6: Cuff pressure reached over 15 mmHg for more than 160 seconds. + * 8. BPError7: Data retrieving error. + * 9. BPError8: Data retrieving error. + * 10. BPError9: Data retrieving error. + * 11. BPError10: Data retrieving error. + * 12. BPError11: Communication Error. + * 13. BPError12: Communication Error. + * 14. BPError13: Low battery. + * 15. BPError14: Device bluetooth set failed. + * 16. BPError15: Systolic exceeds 260mmHg or diastolic exceeds 199mmHg. + * 17. BPError16: Systolic below 60mmHg or diastolic below 40mmHg. + * 18. BPError17: Arm/wrist movement beyond range. + * 19. BPError18: Bleed to specified pressure over time + * 20. BPError19: Constant pressure acquisition process changes over the specified range of pressure. + * 21. BPNormalError=30: device error, error message displayed automatically. + * 22. BPOverTimeError: Abnormal communication. + * 23. BPNoRespondError: Abnormal communication. + * 24. BPBeyondRangeError: device is out of communication range. + * 25. BPDidDisconnect: device is disconnected. + * 26. BPAskToStopMeasure: measurement has been stopped. + * 27. BPInputParameterError=400: Parameter input error. + */ + +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result redWave:(BlockRedWaveDic)redWave errorBlock:(BlockError)error; + +/** + * Measurement termination and stop BP5SRW measurement + * @param success The block return means measurement has been terminated. + * @param error A block to return the error in ‘Establish measurement connection’ in BP5SRW. + */ +-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + +/** + * Synchronize time and judge if the device supports BT auto-connection, offline detection, and if the function on or off, corresponding KEY as haveBlue, haveOffline, blueOpen, offlineOpen. ‘True’ means yes or on, ‘False’ means no or off + * @param function A block to return the function and states that the device supports. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in BP5SRW. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Query battery remaining energy + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error A block to return the error in ‘Establish measurement connection’. + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + + +/** + Set the target measure configure + + @param targetPressure Set the target constant pressure in measuring. + @param fluctuationPressure Set the allowed range of pressure fluctuations. + @param sampleTime Set the pressure sample time. + @param setResult Success callback + @param error A block to return the error in ‘Establish measurement connection’. + */ +-(void)CommandSetPressureSamplewithTargetPressure:(NSNumber *)targetPressure fluctuationRange:(NSNumber *)fluctuationPressure sampleTime:(NSNumber *)sampleTime disposeSetPresureTargetSuccess:(BlockSuccess)setResult errorBlock:(BlockError)error; + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRWController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRWController.h new file mode 100644 index 0000000..5026a2c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP5SRWController.h @@ -0,0 +1,26 @@ +// +// BP5SRWController.h +// testShareCommunication +// +// Created by my on 14/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPMacroFile.h" + +/** + BP5SRW contoller class + */ +@interface BP5SRWController : BPController +/** + * Initialize BP5SRW controller class + */ ++(BP5SRWController *)shareBP5SRWController; + +/** + * Get all BP5SRW instance,Access control class instance after receiving BP5SRWConnectNoti then use instance to call BP5SRW related communication methods. + */ +-(NSArray *)getAllCurrentBP5SRWInstace; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7.h new file mode 100644 index 0000000..fa9b478 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7.h @@ -0,0 +1,141 @@ +// +// BP7.h +// testShareCommunication +// +// Created by my on 8/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPDevice.h" +#import + + +/** + BP7 device class + */ +@interface BP7 : BPDevice +/** + * Synchronize time and judge if the device supports BT auto-connection, offline detection, and if the function on or off, corresponding KEYs are haveBlue, haveOffline, blueOpen, offlineOpen. ‘True’ means yes or on, ‘False’ means no or off + * @param function A block to return the function and states that the device supports. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in BP. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + *set up BT auto-connection + * @param open True means on; False means off. + * @param blockBuleSet The device current statues, True means on, False means off. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in BP. + */ +-(void)commandSetBlueConnect:(BOOL)open respond:(BlockBlueSet)blockBuleSet errorBlock:(BlockError)error; + +/** + * set up offline detection + * @param open True means on; False means off. + * @param successBlock A block to refer ‘set success’. + * @param errorBlock A block to refer ‘set failed’. + */ +-(void)commandSetOffline:(BOOL)open success:(BlockSuccess)successBlock error:(BlockError)errorBlock; +/** + * set up offline detection (Deprecated) + * @param open True means on; False means off. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in BP. + */ +-(void)commandSetOffline:(BOOL)open errorBlock:(BlockError)error; + + +/** + * Query battery remaining energy + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error A block to return the error in ‘Establish measurement connection’ + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + + +/** + * Get current angle(only for BP7,This function needs to be called before the call of the start measure function) + * @param angleInfo Angle information, including angle、isLeftHand. ‘angle’ stands for the inclination angle of the device, from 0 to 90; ‘isLeftHand’ stands for the judgment if the device is on the left hand, ‘true’ means left hand, otherwise is right hand. + * @param error error codes. + * Specification: + * 1. BPError0 = 0: Unable to take measurements due to arm/wrist movements. + * 2. BPError1: Failed to detect systolic pressure. + * 3. BPError2: Failed to detect diastolic pressure. + * 4. BPError3: Pneumatic system blocked or cuff is too tight during inflation. + * 5. BPError4: Pneumatic system leakage or cuff is too loose during inflation. + * 6. BPError5: Cuff pressure reached over 300mmHg. + * 7. BPError6: Cuff pressure reached over 15 mmHg for more than 160 seconds. + * 8. BPError7: Data retrieving error. + * 9. BPError8: Data retrieving error. + * 10. BPError9: Data retrieving error. + * 11. BPError10: Data retrieving error. + * 12. BPError11: Communication Error. + * 13. BPError12: Communication Error. + * 14. BPError13: Low battery. + * 15. BPError14: Device bluetooth set failed. + * 16. BPError15: Systolic exceeds 260mmHg or diastolic exceeds 199mmHg. + * 17. BPError16: Systolic below 60mmHg or diastolic below 40mmHg. + * 18. BPError17: Arm/wrist movement beyond range. + * 19. BPNormalError=30: device error, error message displayed automatically. + * 20. BPOverTimeError: Abnormal communication. + * 21. BPNoRespondError: Abnormal communication. + * 22. BPBeyondRangeError: device is out of communication range. + * 23. BPDidDisconnect: device is disconnected. + * 24. BPAskToStopMeasure: measurement has been stopped. + * 25. BPInputParameterError=400: Parameter input error. + */ +-(void)commandStartGetAngle:(BlockAngle)angleInfo errorBlock:(BlockError)error; + +/* + * Measurement start(only for BP7). When ‘angle’ is between 10-30, measurement starts + * @param blockZeroState Zeroing state + * @param Pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set with heart beat. + * @param blockWaveletWithoutHeartbeat Wavelet data set without heart beat. + * @param Result result including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular. irregular will be 0 or 1. + * @param error error codes. + * Specification: + * 1. BPNormalError: device error, error message displayed automatically. + * 2. BPOverTimeError: communication over time error. + * 3. BPNoRespondError: abnormal communication. + * 4. BPBeyondRangeError: device is out of communication range. + * 5. BPDidDisconnect: device is disconnected. + * 6. BPAskToStopMeasure: measurement has been stopped. + */ + +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + +/** + * upload offline data (Deprecated) + * @param totalCount item quantity of total data. + * @param progress upload completion ratio , from 0.0 to 1.0 or 0%~100%, 100% means upload completed. + * @param uploadDataArray offline data set, including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment. corresponding KEYs are time, sys, dia, heartRate, irregular. + * @param error refer ‘error’ in ‘Establish measurement connection’ in BP. + */ +-(void)commandBatchUpload:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +/** + * Upload offline data total Count. + * @param totalCount item quantity of total data. + * @param error A block to return the error. + */ +-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error; + +/** + * Upload offline data. + * @Notice By the first time of new user register via SDK, ‘iHealth disclaimer’ will pop up automatically, and require the user agrees to continue. SDK application requires Internet connection; there is 10-day tryout if SDK cannot connect Internet, SDK is fully functional during tryout period, but will be terminated without verification through Internet after 10 days. + * @param totalCount item quantity of total data + * @param progress upload completion ratio , from 0.0 to 1.0 or 0%~100%, 100% means upload completed. + * @param uploadDataArray offline data set, including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment,scheme ID,body movement flag. corresponding KEYs are time, sys, dia, heartRate, irregular,schemeID,bodyMovementFlg. + * @param error A block to return the error. + */ +-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +/** + * Measurement termination and stop BP measurement + * @param success The block return means measurement has been terminated. + * @param error A block to return the error in ‘Establish measurement connection’ in BP. + */ +-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7Controller.h new file mode 100644 index 0000000..2c0151e --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7Controller.h @@ -0,0 +1,25 @@ +// +// BP7Controller.h +// testShareCommunication +// +// Created by my on 8/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPMacroFile.h" + +/** + BP7 controller class + */ +@interface BP7Controller : BPController +/** + * Initialize BP7 controller class + */ ++(BP7Controller *)shareBP7Controller; + +/** + * Get all BP7 instance,Access control class instance after receiving BP7ConnectNoti, then use instance to call BP7 related communication methods. + */ +-(NSArray *)getAllCurrentBP7Instace; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7S.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7S.h new file mode 100644 index 0000000..bc06c5a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7S.h @@ -0,0 +1,106 @@ +// +// BP7S.h +// testShareCommunication +// +// Created by my on 8/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPDevice.h" +#import + + +/** + BP7S device class + */ +@interface BP7S : BPDevice + +#pragma mark - Hypogenous query + +/** + * Synchronize time and return the function and states that the device supports + * @param function A block to return the function and states that the device supports,judge if the device supports the function of up Air Measurement, arm Measurement, Angle Sensor, Angle Setting, HSD, Offline Memory, mutable Groups Upload, Self Upgrade. ‘True’ means yes or on, ‘False’ means no or off. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in BP7S. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Query battery remaining energy. + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error A block to return the error in ‘Establish measurement connection’ + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + + +/** + * Upload offline data total Count. + * @param totalCount item quantity of total data. + * @param error A block to return the error. + */ +-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error; + +/** + * Upload offline data. + * @param totalCount item quantity of total data + * @param progress upload completion ratio , from 0.0 to 1.0 or 0%~100%, 100% means upload completed. + * @param uploadDataArray offline data set, including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment. corresponding KEYs are time, sys, dia, heartRate, irregular. + * @param error error codes. + * Specification: + * 1. BPError0 = 0: Unable to take measurements due to arm/wrist movements. + * 2. BPError1: Failed to detect systolic pressure. + * 3. BPError2: Failed to detect diastolic pressure. + * 4. BPError3: Pneumatic system blocked or cuff is too tight during inflation. + * 5. BPError4: Pneumatic system leakage or cuff is too loose during inflation. + * 6. BPError5: Cuff pressure reached over 300mmHg. + * 7. BPError6: Cuff pressure reached over 15 mmHg for more than 160 seconds. + * 8. BPError7: Data retrieving error. + * 9. BPError8: Data retrieving error. + * 10. BPError9: Data retrieving error. + * 11. BPError10: Data retrieving error. + * 12. BPError11: Communication Error. + * 13. BPError12: Communication Error. + * 14. BPError13: Low battery. + * 15. BPError14: Device bluetooth set failed. + * 16. BPError15: Systolic exceeds 260mmHg or diastolic exceeds 199mmHg. + * 17. BPError16: Systolic below 60mmHg or diastolic below 40mmHg. + * 18. BPError17: Arm/wrist movement beyond range. + * 19. BPNormalError=30: device error, error message displayed automatically. + * 20. BPOverTimeError: Abnormal communication. + * 21. BPNoRespondError: Abnormal communication. + * 22. BPBeyondRangeError: device is out of communication range. + * 23. BPDidDisconnect: device is disconnected. + * 24. BPAskToStopMeasure: measurement has been stopped. + * 25. BPInputParameterError=400: Parameter input error. + */ +-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +/** + * Set units for the Device + * @param UnitName The unit name string that BP7S show result should use, must be @"mmHg" or @"kPa". + * @param setResult This block return means set success. + * @param error A block to return the error in set Unit communication. + */ +-(void)commandSetUnit:(NSString *)UnitName disposeSetReslut:(BlockSuccess)setResult errorBlock:(BlockError)error; + + +/** + Set the effective angle range for left hand measurement and right hand measurement to the Device + + @param angleInfo A dictionary set the max and mini effective angles for left hand measurement and right hand measurement,the angle values type is NSNumber, ranging from 0~90 + with the four keys are: + @"highAngleForLeft", @"lowAngleForLeft", @"highAngleForRight", @"lowAngleForRight". + @param setResult This block return means set success. + @param error A block to return the error in set angles communication. + */ +-(void)commandSetAngle:(NSDictionary *)angleInfo disposeSetReslut:(BlockSuccess)setResult errorBlock:(BlockError)error; + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7SController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7SController.h new file mode 100644 index 0000000..4ef86a1 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BP7SController.h @@ -0,0 +1,32 @@ +// +// BP7SController.h +// testShareCommunication +// +// Created by my on 8/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPController.h" + +/** + BP7S device controller class + */ +@interface BP7SController : BPController{ + NSMutableArray *BP7SDeviceArray; +} + +/** + * Initialize BP7S controller class + */ ++(BP7SController *)shareBP7SController; + +/** + * Get all BP7S instance,Access control class instance after receiving BP7SConnectNoti, then use instance to call BP7S related communication methods. + */ +-(NSArray *)getAllCurrentBP7SInstace; + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPAV10Device.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPAV10Device.h new file mode 100644 index 0000000..7974ba0 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPAV10Device.h @@ -0,0 +1,15 @@ +// +// BPAV10Device.h +// iHealthSDKStatic +// +// Created by Realank on 2017/7/24. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPBTLEDevice.h" +/** + a subclass of BPBTLEDevice, which represent BP BTLE devices using BPAV10 protocol + */ +@interface BPAV10Device : BPBTLEDevice + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBTLEDevice.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBTLEDevice.h new file mode 100644 index 0000000..01546d8 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBTLEDevice.h @@ -0,0 +1,17 @@ +// +// BPBTLEDevice.h +// iHealthSDKStatic +// +// Created by Realank on 2017/9/22. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPDevice.h" + + +/** + a subclass of BP device, which represent BP BTLE devices + */ +@interface BPBTLEDevice : BPDevice + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBV10Device.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBV10Device.h new file mode 100644 index 0000000..77b512f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPBV10Device.h @@ -0,0 +1,20 @@ +// +// BPBV10Device.h +// iHealthSDKStatic +// +// Created by Realank on 2017/9/26. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPV24Device.h" +#import "BPLoopMeasureSettingModel.h" + +typedef void(^BlockAskIDString)(NSString* IDString); +typedef void(^BlockAskLoopMeasureScheme)(BPLoopMeasureSettingResultModel* scheme); + +/** + a subclass of BPBTLEDevice, which represent BP BTLE devices using BPBV10 protocol + */ +@interface BPBV10Device : BPV24Device + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinua.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinua.h new file mode 100644 index 0000000..3949cae --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinua.h @@ -0,0 +1,56 @@ +// +// BPContinua.h +// testShareCommunication +// +// Created by zhiwei jing on 13-10-22. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "UIKit/UIKit.h" +#import "BPDevice.h" + + /** + + BPContinua device class + + */ +@interface BPContinua : BPDevice + + +/** + * Upload offline data. + * @param uploadDataArray offline data set, including MAP, dataID, dia, heartRate, irregular, measureState, sys, time, unit, userId. + * @param completeBlock transfer memory complete + * @param error error codes. + * Specification: + */ +-(void)commandTransferMemoryDataWithDataArray:(BlockBachArray)uploadDataArray complete:(BlockSuccess)completeBlock errorBlock:(BlockError)error; + + +/** + * Set the userID of memery data that need to upload + * @param userID The userID of memery data that want to upload.The userID is @1 or @2. + * @param setResult The result of setting userID,'YES'means success. + * @param error Error codes. + */ +-(void)commandSetUploadUserID:(NSNumber *)userID setUserIDBlock:(BlockSetUserID)setResult errorBlock:(BlockError)error; + +/** + * Synchronize time + */ +-(void)commandSynchronizeTime; + +/** + * Get Battery + * @param energyValue 0-100 + * @param error Error codes. + */ +-(void)commandGetBattery:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinuaController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinuaController.h new file mode 100644 index 0000000..2511f32 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPContinuaController.h @@ -0,0 +1,30 @@ +// +// BPContinuaController.h +// testShareCommunication +// +// Created by zhiwei jing on 13-10-22. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPContinua.h" +#import "BPController.h" + +/** + BPContinua controller class + */ +@interface BPContinuaController : BPController{ + +} + +/** + * Initialize contina BP controller class + */ ++(BPContinuaController *)sharedController; + +/** + * Get all ContinuaBP instance,Access control class instance after receiving ContinuaBPConnectNoti, then use instance to call ContinuaBP related communication methods. + */ +- (NSArray *)allConnectedInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPController.h new file mode 100644 index 0000000..d706d39 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPController.h @@ -0,0 +1,40 @@ +// +// BPController.h +// iHealthDemoCode +// +// Created by Realank on 2017/1/4. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import + +/** + BP Base Controller + */ +@interface BPController : NSObject{ + //区分设备 + NSString* deviceName; + NSString* deviceProtocol; + //发送通知 + NSString* deviceConnectNotiName; + NSString* deviceDisconnectNotiName; + //创建实例 + Class DeviceClass; +} + + +/** + Get BPController singleton instance + + @return unique BPController instance + */ +-(instancetype) initUniqueInstance; + +/** + Get all BP instances,you can choose one instance to call BP related communication methods. + + @return all connected BP instance + */ +-(NSArray *)allConnectedInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPDevice.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPDevice.h new file mode 100644 index 0000000..8f7a96b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPDevice.h @@ -0,0 +1,131 @@ +// +// BPDevice.h +// iHealthDemoCode +// +// Created by Realank on 2017/1/4. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import +#import "BPMacroFile.h" + + +/** + a BP protocol related to realtime measure + */ +@protocol BPRealtimeMeasureProtocol + +/** + * Establish measurement connection and start BP measurement. + * @param blockZeroState Zeroing state + * @param pressure Pressure value in the process of measurement, the unit is ‘mmHg’. + * @param blockWaveletWithHeartbeat Wavelet data set including pulse rate + * @param blockWaveletWithoutHeartbeat Wavelet data set without pulse rate + * @param result result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular. irregular will be 0 or 1. + * @param error Return error codes. + */ +-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat result:(BlockMeasureResult)result errorBlock:(BlockError)error; + +/** + * stop measuring state of BP + * @param success The block return means measurement has been successfully stoped. + * @param error Return error codes. + */ +-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + +@end + + +/** + a BP protocol related to offline data transfer + */ +@protocol BPOfflineDataTransferProtocol + +/** + * Upload offline data. + * @param totalCount quantity of total history data + * @param progress upload completion ratio , from 0.0 to 1.0, 1.0 means upload completed. + * @param uploadDataArray offline data set, may including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment,scheme ID, body movement flag. corresponding KEYs are time, sys, dia, heartRate, irregular,schemeID,bodyMovementFlg. + * @param error Return error codes. + */ +-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + + +/** + * Upload offline data total Count. + * @param totalCount quantity of total history data. + * @param error Return error codes. + */ +-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error; + +-(void)commandDeleteDataSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error; + +@end + + +/** + a BP protocol related to basic function, such as get function, get energy + */ +@protocol BPBasicProtocol + +/** + * Synchronize time and judge if the device supports BT auto-connection, offline detection, and if the function on or off, corresponding KEY are haveBlue, haveOffline, blueOpen, offlineOpen. ‘True’ means yes or on, ‘False’ means no or off + * @param function A block to return the function and states that the device supports. + * @param error Return error codes. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Get battery remaining energy by percent + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error Return error codes. + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + +@end + + +/** + a BP protocol related to basic function and disconnect + */ +@protocol BPBasicBTLEProtocol + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + +@end + + +/** + a BP protocol related to enable offline + */ +@protocol BPEnableOfflineProtocol + +/** + * set up offline detection + * @param open True means on; False means off. + * @param successBlock A block to refer ‘set success’. + * @param errorBlock A block to refer ‘set failed’. + */ +-(void)commandSetOffline:(BOOL)open success:(BlockSuccess)successBlock error:(BlockError)errorBlock; + +@end + + +/** + BP device basic class + */ +@interface BPDevice : NSObject + +@property (copy, nonatomic) NSString *currentUUID; +///‘serialNumber’ is for separating different device when multiple device have been connected. +@property (copy, nonatomic) NSString *serialNumber; +@property (copy, nonatomic) NSString *firmwareVersion; +@property (copy, nonatomic) NSString *hardwareVersion; +@property (copy, nonatomic) NSString *deviceName; +@property (copy, nonatomic) NSString *protocolString; +@property (copy, nonatomic) NSString *modelNumber; +@property (copy, nonatomic) NSNumber *isNew550BT; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPHeader.h new file mode 100644 index 0000000..df61d1f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPHeader.h @@ -0,0 +1,54 @@ +// +// BPHeader.h +// BP_SDKDemo +// +// Created by zhiwei jing on 14-2-28. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#ifndef BP_SDKDemo_BPHeader_h +#define BP_SDKDemo_BPHeader_h + +#import "BPController.h" +#import "BPDevice.h" + +#import "BP5Controller.h" +#import "BP5.h" + +#import "BP3.h" +#import "BP3Controller.h" + +#import "BP3L.h" +#import "BP3LController.h" + +#import "BP7Controller.h" +#import "BP7.h" + +#import "BP7SController.h" +#import "BP7S.h" + +#import "KN550BT.h" +#import "KN550BTController.h" + +#import "BPMacroFile.h" +#import "HealthUser.h" + +#import "ABI.h" +#import "ABIController.h" + +#import "ABPM.h" +#import "ABPMController.h" + +#import "BPContinua.h" +#import "BPContinuaController.h" + +#import "BP5S.h" +#import "BP5SController.h" + +#import "BP5SRW.h" +#import "BP5SRWController.h" + +#import "BP5C.h" +#import "BP5CController.h" + +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPLoopMeasureSettingModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPLoopMeasureSettingModel.h new file mode 100644 index 0000000..ea0e177 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPLoopMeasureSettingModel.h @@ -0,0 +1,120 @@ +// +// BPLoopMeasureSettingModel.h +// iHealthSDKStatic +// +// Created by Realank on 2017/9/27. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import + + +/** + ABPM loop remeasure method + + - BPLoopRemeasureNO: don't remeasure + - BPLoopRemeasure90Sec: 90 seconds remeasure + - BPLoopRemeasure90Sec10Min: 90 seconds and 10 minutes remeasure + */ +typedef NS_ENUM(NSUInteger, BPLoopRemeasureMethod) { + BPLoopRemeasureNO = 0x00, + BPLoopRemeasure90Sec = 0x01, + BPLoopRemeasure90Sec10Min = 0x03, +}; + + +/** + ABPM loop measure time setting model + */ +@interface BPLoopMeasureTimeSetting : NSObject +@property (nonatomic, assign) NSUInteger hour; +@property (nonatomic, assign) NSUInteger min; +@property (nonatomic, assign) NSUInteger measureIntervalInMin; +@property (nonatomic, assign) BOOL before5MinViberateAlert; +@property (nonatomic, assign) BOOL before5MinSoundAlert; +@property (nonatomic, assign) BOOL before30SecViberateAlert; +@property (nonatomic, assign) BOOL before30SecSoundAlert; +@property (nonatomic, assign) BPLoopRemeasureMethod remeasureMethods; + ++ (instancetype) modelWithHour:(NSUInteger)hour + min:(NSUInteger)min + measureIntervalInMin:(NSUInteger)measureIntervalInMin + before5MinViberateAlert:(BOOL)before5MinViberateAlert + before5MinSoundAlert:(BOOL)before5MinSoundAlert + before30SecViberateAlert:(BOOL)before30SecViberateAlert + before30SecSoundAlert:(BOOL)before30SecSoundAlert + remeasureMethod:(BPLoopRemeasureMethod)remeasureMethod; + ++(instancetype) alloc __attribute__((unavailable("alloc not available, call sharedInstance instead"))); +-(instancetype) init __attribute__((unavailable("init not available, call sharedInstance instead"))); ++(instancetype) new __attribute__((unavailable("new not available, call sharedInstance instead"))); + +@end + + +/** + ABPM loop measure setting model + */ +@interface BPLoopMeasureSettingModel : NSObject + +@property (nonatomic, assign) BOOL isTakeMedicine; +@property (nonatomic, assign) uint8_t measureHours; +@property (nonatomic, strong) BPLoopMeasureTimeSetting* morningTimeSetting; +@property (nonatomic, strong) BPLoopMeasureTimeSetting* nightTimeSetting; +@property (nonatomic, strong) BPLoopMeasureTimeSetting* noonSleepTimeSetting; +@property (nonatomic, strong) BPLoopMeasureTimeSetting* noonWakeupTimeSetting; + ++ (instancetype)modelWithTakeMedicine:(BOOL)isTakeMedicine + measureHours:(uint8_t)measureHours + morningTimeSetting:(BPLoopMeasureTimeSetting*)morningTimeSetting + nightTimeSetting:(BPLoopMeasureTimeSetting*)nightTimeSetting + noonSleepTimeSetting:(BPLoopMeasureTimeSetting*)noonSleepTimeSetting + noonWakeupTimeSetting:(BPLoopMeasureTimeSetting*)noonWakeupTimeSetting; + ++(instancetype) alloc __attribute__((unavailable("alloc not available, call sharedInstance instead"))); +-(instancetype) init __attribute__((unavailable("init not available, call sharedInstance instead"))); ++(instancetype) new __attribute__((unavailable("new not available, call sharedInstance instead"))); + + +@end + + +/** + ABPM loop measure status + + - BPLoopMeasureStateNoScheme: don't have scheme + - BPLoopMeasureStateSchemeUncompleted: scheme not completed + - BPLoopMeasureStateSchemeCompleted: scheme has been completed + */ +typedef NS_ENUM(NSUInteger, BPLoopMeasureStatus) { + BPLoopMeasureStateNoScheme, + BPLoopMeasureStateSchemeUncompleted, + BPLoopMeasureStateSchemeCompleted, +}; + + + +/** + ABPM loop measure setting result model + */ +@interface BPLoopMeasureSettingResultModel : BPLoopMeasureSettingModel + +@property (nonatomic, assign) BPLoopMeasureStatus loopMeasureStatus; +@property (nonatomic, strong) NSDate* realStartDate; +@property (nonatomic, assign) NSInteger realStartDateTimeZoneInMin; + ++ (instancetype)modelWithLoopMeasureStatus:(BPLoopMeasureStatus)loopMeasureStatus + TakeMedicine:(BOOL)isTakeMedicine + measureHours:(uint8_t)measureHours + realStartDate:(NSDate*)realStartDate + realStartDateTimeZoneInMin:(NSInteger)realStartDateTimeZoneInMin + morningTimeSetting:(BPLoopMeasureTimeSetting*)morningTimeSetting + nightTimeSetting:(BPLoopMeasureTimeSetting*)nightTimeSetting + noonSleepTimeSetting:(BPLoopMeasureTimeSetting*)noonSleepTimeSetting + noonWakeupTimeSetting:(BPLoopMeasureTimeSetting*)noonWakeupTimeSetting; + ++(instancetype) alloc __attribute__((unavailable("alloc not available, call sharedInstance instead"))); +-(instancetype) init __attribute__((unavailable("init not available, call sharedInstance instead"))); ++(instancetype) new __attribute__((unavailable("new not available, call sharedInstance instead"))); + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPM1AE.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPM1AE.h new file mode 100644 index 0000000..4027742 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPM1AE.h @@ -0,0 +1,80 @@ +// +// BPM1AE.h +// iHealthDemoCode +// +// Created by XuJianbo on 16/8/18. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, WifiSetWifiError) { + WifiDidDisconnect=0,//下位机断开 + WifiOverTimeError,//超时 + WifiParameterInputWrong=400,//输入参数错误 +}; + + +typedef void(^BlockWifiError)(WifiSetWifiError error); +typedef void(^BlockWifiSetSuccess)(NSNumber *waitFlg); +typedef void(^BlockWifiConnectState)(void); +typedef void(^BlockWifiInfoDictionary) (NSDictionary *dict); + + +#define Wifi_SSID @"Wifi_SSID" +#define Wifi_Channel @"Wifi_Channel" +#define Wifi_Security @"Wifi_Security" +#define Wifi_RSSI @"Wifi_RSSI" + + + +/** + BPM1AE device class + */ +@interface BPM1AE : NSObject + + +/** + *Start search the UDP access point device. + * @param wifiIDPSDic A block return the IDPS of the connected wifi Device. + * @param error This block will be invoked when error occurs. + * Specification: + * 1. WifiDidDisconnect: Socket connection disconnected. + * 2. WifiOverTimeError: Command time out. + * 3. WifiParameterInputWrong: Input wrong parameter(s). + */ +-(void)commandStartSearchDeviceGetIDPS:(BlockWifiInfoDictionary)wifiIDPSDic blockError:(BlockWifiError)error; +/** + *Start search the UDP access point device. + * @param blockWifiArrayDic The block return a dictionary which contains the wifi list and the wifi count that the device scan. + * @param error This block will be invoked when error occurs. + * Specification: + * 1. WifiDidDisconnect: Socket connection disconnected. + * 2. WifiOverTimeError: Command time out. + * 3. WifiParameterInputWrong: Input wrong parameter(s). + */ +-(void)commandGetWifiArrayDictionary:(BlockWifiInfoDictionary)blockWifiArrayDic blockError:(BlockWifiError)error; + +/** + *Send wifi name and password to the device and return the connect status of the device. + * @param wifiName wifiname + * @param password wifiName,password are the information of the wifi that selected to connect. + * @param phoneIDStr The unique device ID of the current iPhone,iTouch or iPad. + * @param urlStr a service URL, to where the AP device send the wifi connect status. + * @param setResult The block return means set success, containing a flg to show whether need to wait the 'stepAndStateDic', @1 means need,@0 means not. + * @param stepAndStateDic The block return a dictionary which contains the connection step and the connection status. + * @param error This block will be invoked when error occurs. + * Specification: + * 1. WifiDidDisconnect: Socket connection disconnected. + * 2. WifiOverTimeError: Command time out. + * 3. WifiParameterInputWrong: Input wrong parameter(s). + */ +-(void)commandSendWifiName:(NSString*)wifiName password:(NSString *) password phoneID:(NSString *)phoneIDStr withURL:(NSString *)urlStr setResult:(BlockWifiSetSuccess)setResult blockConnectState:(BlockWifiInfoDictionary)stepAndStateDic blockError:(BlockWifiError)error; + + +/** + Disconnect current socket + */ +- (void)disconnect; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPMacroFile.h new file mode 100644 index 0000000..aea3dcd --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPMacroFile.h @@ -0,0 +1,247 @@ +// +// BPMacroFile.h +// BP_SDKDemo +// +// Created by zhiwei jing on 14-2-25. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + + + +#ifndef BP_SDKDemo_BPMacroFile_h +#define BP_SDKDemo_BPMacroFile_h + +#import "HealthUser.h" +#import "BPController.h" + +/** + BP error code + */ +typedef NS_ENUM(NSUInteger, BPDeviceError) { + /// Unable to take measurements due to arm/wrist movements. + BPError0 = 0, + /// Failed to detect systolic pressure + BPError1, + /// Failed to detect diastolic pressure + BPError2, + /// Pneumatic system blocked or cuff is too tight during inflation + BPError3, + /// Pneumatic system leakage or cuff is too loose during inflation + BPError4, + /// Cuff pressure reached over 300mmHg + BPError5, + /// Cuff pressure reached over 15 mmHg for more than 160 seconds + BPError6, + /// Data retrieving error + BPError7, + /// Data retrieving error + BPError8, + /// Data retrieving error + BPError9, + /// Data retrieving error + BPError10, + /// Communication Error + BPError11, + /// Communication Error + BPError12, + /// Low battery + BPError13, + /// Device bluetooth set failed + BPError14, + /// Systolic exceeds 260mmHg or diastolic exceeds 199mmHg + BPError15, + /// Systolic below 60mmHg or diastolic below 40mmHg + BPError16, + /// Arm/wrist movement beyond range + BPError17, + /// Heart rate in measure result exceeds max limit + BPError18, + /// Heart rate in measure result exceeds min limit + BPError19, + /// PP(Average BP) exceeds limit + BPError20, + /// User stop measure(for ABPM history measurement only) + BPErrorUserStopMeasure, + /// device error, error message displayed automatically + BPNormalError = 30, + /// Abnormal communication + BPOverTimeError, + /// Abnormal communication + BPNoRespondError, + /// device is out of communication range. + BPBeyondRangeError, + /// device is disconnected. + BPDidDisconnect, + /// measurement has been stopped. + BPAskToStopMeasure, + /// 36 device is busy doing other things + BPDeviceBusy, + /// Parameter input error. + BPInputParameterError = 400, + /// Parameter input error. + BPInvalidOperation = 402, +}; + + +typedef void(^BlockEnergyDetailValue)(NSNumber *energyValue,NSNumber *mVolt, NSNumber* measureTimesLeft); +typedef void(^BlockEnergyValue)(NSNumber *energyValue); +typedef void(^BlockEnergyState)(NSNumber *energyState); +typedef void(^BlockError)(BPDeviceError error); +typedef void(^BlockDeviceFunction)(NSDictionary *functionDict); +typedef void(^BlockBlueSet)(BOOL isOpen); +typedef void(^BlockAngle)(NSDictionary *angleDict); +typedef void(^BlockPressure)(NSArray *pressureArr); +typedef void(^BlockWavelet)(NSArray *waveletArr); +typedef void(^BlockZero)(BOOL isComplete); +typedef void(^BlockMeasureResult)(NSDictionary *resultDict); + +typedef void(^BlockBachCount)(NSNumber *count); +typedef void(^BlockBachProgress)(NSNumber *progressValue); +typedef void(^BlockBachArray)(NSArray *bachArray); +typedef void(^BlockBachFinished)(BOOL finishFlag); + +typedef void(^BlockAskMeasureTime)(NSDictionary *measureTimeDict);//Deprecated +typedef void(^BlockSetMeasureTime)(NSDictionary *setResult);//Deprecated + +typedef void(^BlockSuccess)(void); + +typedef void(^BlockUserAuthentication)(UserAuthenResult result);//the result of userID verification +typedef void(^BlockSetUserID)(BOOL finishFlag); + +typedef void(^BlockResult)(BOOL result); + +typedef void(^BlockRedWaveDic)(NSDictionary *redWaveDict); + +typedef void(^BlockMeasureStatus)(NSDictionary *statusDict); + +typedef void(^BlockDisplayStatus)(NSDictionary *statusDict); + + +#define BP3ConnectNoti @"BP3ConnectNoti" +#define BP3DisConnectNoti @"BP3DisConnectNoti" +#define BP5ConnectNoti @"BP5ConnectNoti" +#define BP5DisConnectNoti @"BP5DisConnectNoti" +#define BP7ConnectNoti @"BP7ConnectNoti" +#define BP7DisConnectNoti @"BP7DisConnectNoti" + +#define BP3LDiscover @"BP3LDiscover" +#define BP3LConnectFailed @"BP3LConnectFailed" +#define BP3LConnectNoti @"BP3LConnectNoti" +#define BP3LDisConnectNoti @"BP3LDisConnectNoti" + +#define BP5SDiscover @"BP5SDiscover" +#define BP5SConnectFailed @"BP5SConnectFailed" +#define BP5SConnectNoti @"BP5SConnectNoti" +#define BP5SDisConnectNoti @"BP5SDisConnectNoti" + +#define BP5SRWDiscover @"BP5SRWDiscover" +#define BP5SRWConnectFailed @"BP5SRWConnectFailed" +#define BP5SRWConnectNoti @"BP5SRWConnectNoti" +#define BP5SRWDisConnectNoti @"BP5SRWDisConnectNoti" + +#define BP7SDiscover @"BP7SDiscover" +#define BP7SConnectFailed @"BP7SConnectFailed" +#define BP7SConnectNoti @"BP7SConnectNoti" +#define BP7SDisConnectNoti @"BP7SDisConnectNoti" + +#define KN550BTDiscover @"KN550BTDiscover" +#define KN550BTConnectFailed @"KN550BTConnectFailed" +#define KN550BTConnectNoti @"KN550BTConnectNoti" +#define KN550BTDisConnectNoti @"KN550BTDisConnectNoti" + +#define KD926Discover @"KD926Discover" +#define KD926ConnectFailed @"KD926ConnectFailed" +#define KD926ConnectNoti @"KD926ConnectNoti" +#define KD926DisConnectNoti @"KD926DisConnectNoti" + +#define KD723Discover @"KD723Discover" +#define KD723ConnectFailed @"KD723ConnectFailed" +#define KD723ConnectNoti @"KD723ConnectNoti" +#define KD723DisConnectNoti @"KD723DisConnectNoti" + +#define ABPMDiscover @"ABPMDiscover" +#define ABPMConnectFailed @"ABPMConnectFailed" +#define ABPMConnectNoti @"ABPMConnectNoti" +#define ABPMDisConnectNoti @"ABPMDisConnectNoti" + +#define BP5CDiscover @"BP5CDiscover" +#define BP5CConnectFailed @"BP5CConnectFailed" +#define BP5CConnectNoti @"BP5CConnectNoti" +#define BP5CDisConnectNoti @"BP5CDisConnectNoti" + +#define ContinuaBPDiscover @"ContinuaBPDiscover" +#define ContinuaBPConnectFailed @"ContinuaBPConnectFailed" +#define ContinuaBPConnectNoti @"ContinuaBPConnectNoti" +#define ContinuaBPDisConnectNoti @"ContinuaBPDisConnectNoti" + +#define ABIConnectNoti @"ABIConnectNoti" +#define ABIDisConnectNoti @"ABIDisConnectNoti" +#define ArmKey @"ABI-ARM" +#define LegKey @"ABI-Leg" +#define ArmConnectNoti @"ArmConnectNoti" +#define ArmDisConnectNoti @"ArmDisConnectNoti" + +//#define BPDeviceID @"ID" +//#define BPSDKRightApi @"OpenApiBP" + +//result +#define kResultBPSYS @"sys" +#define kResultBPDIA @"dia" +#define kResultBPPulse @"heartRate" +#define kResultBPIHB @"irregular" +#define kResultBPHSD @"hsdValue" +#define kResultBPChooseHand @"chooseHand" +#define kResultBPBodyMove @"bodyMovement" +#define kResultBPStartAngle @"startAngle" +#define kResultBPAngleChange @"measureAngleChange" +#define kResultBPDataID @"dataID" +#define kResultBPMeasureDate @"time" +#define kResultBPMeasureDateTimeZoneInMin @"timeZoneInMin" +#define kResultBPSchemeID @"schemeID" +#define kResultBPHistoryIndex @"historyIndex" +#define kResultBPUnit @"unit" + +#define kResultBPIsAutoMeasure @"isAutoMeasure" +#define kResultBPRemeasureMode @"remeasureMode" +#define kResultBPHasRawPressure @"hasRawPressure" +#define kResultBPStartMeasureAngle @"startMeasureAngle" +#define kResultBPMeasureAngleDelta @"measureAngleDelta" +#define kResultBPIsMeasureResultFailed @"isMeasureResultFailed" +#define kResultBPMeasureResultErrorCode @"measureResultErrorCode" +#define kResultBPMeasureResultRawPressure @"measureResultRawPressure" +#define kResultBPActivityStrengthList @"activityStrengthList" +#define kResultBPActivityStrengthLevel @"level" +#define kResultBPActivityStrengthAngle @"angle" +#define kResultBPActivityStrengthIsSleeping @"isSleeping" + +//function +#define kFunctionBPUpAirMeasure @"upAirMeasureFlg" +#define kFunctionBPArmMeasure @"armMeasureFlg" +#define kFunctionBPHaveAngleSensor @"haveAngleSensor" +#define kFunctionBPSupportPowerOff @"havePowerOff" +#define kFunctionBPSupportOffline @"haveOffline" +#define kFunctionBPSupportClearMemory @"haveClearMemory" +#define kFunctionBPSupportBTConnectBack @"haveBlue" +#define kFunctionBPBTConnectBackOpen @"blueOpen" +#define kFunctionBPOfflineOpen @"offlineOpen" +#define kFunctionBPHaveHSD @"haveHSD" +#define kFunctionBPHaveAngleSet @"haveAngleSet" +#define kFunctionBPAutoLoopMeasureModel @"autoLoopMeasureModel" +#define kFunctionBPAutoConnect @"autoConnect" +#define kFunctionBPReConnectSwitch @"reConnectSwitch" +#define kFunctionBPhasOfflineSetingFlg @"offlineSetingFlg" +#define kFunctionBPofflineMeasureFlg @"offlineMeasureFlg" +#define kFunctionBPbtfunctionFlg @"btfunctionFlg" + +#define kFunctionBPSupportUnitSetting @"hasUnitSetting" +#define kFunctionBPCurrentUnitIsKPa @"unitKPa" +#define kFunctionBPMutableUpload @"mutableUpload" +#define kFunctionBPDFU @"selfUpdate" +#define kFunctionBPSupportMoveDetect @"hasMoveDetect" +#define kFunctionBPSupportAlertSetting @"hasAlertSetting" +#define kFunctionBPSupportRawPressure @"hasRawPressure" +#define kFunctionBPRawPressureFormat @"rowPressureFormat" +#define kFunctionBPBackLightControl @"haveBackLightSetting" +#define kFunctionBPClockDisplayControl @"haveClockShowSetting" +#define kFunctionBPMaxHistoryCount @"maxHistoryCount" +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV24Device.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV24Device.h new file mode 100644 index 0000000..1b79f16 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV24Device.h @@ -0,0 +1,16 @@ +// +// BPV2xDevice.h +// iHealthSDKStatic +// +// Created by Realank on 2017/7/14. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import "BPBTLEDevice.h" + +/** + a subclass of BPBTLEDevice, which represent BP BTLE devices using BPV24 protocol + */ +@interface BPV24Device : BPBTLEDevice + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV25Device.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV25Device.h new file mode 100644 index 0000000..df34ce7 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPV25Device.h @@ -0,0 +1,17 @@ +// +// BPV25Device.h +// iHealthSDKStatic +// +// Created by jing on 2018/7/18. +// Copyright © 2018年 ihealthSDK. All rights reserved. +// + +#import "BPBTLEDevice.h" + +/** + a subclass of BPBTLEDevice, which represent BP BTLE devices using BPV25 protocol + */ + +@interface BPV25Device : BPBTLEDevice + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ConnectDeviceController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ConnectDeviceController.h new file mode 100644 index 0000000..d29e9cc --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ConnectDeviceController.h @@ -0,0 +1,27 @@ +// +// ConnectDeviceController.h +// iHealthDemoCode +// +// Created by zhiwei jing on 1/24/16. +// Copyright © 2016 zhiwei jing. All rights reserved. +// + +#import +#import "HealthHeader.h" + +/** + ConnectDeviceController + */ +@interface ConnectDeviceController : NSObject + ++(ConnectDeviceController *)commandGetInstance; + + +/** + * Connect iHealth device with bluretooth low energy + * @param tempDeviceType iHealth DeviceType + * @param tempSerialNub iHealth device serialNub or deviceID, you can get it from [ScanDeviceController commandScanDeviceType]. + */ +-(int)commandContectDeviceWithDeviceType:(HealthDeviceType)tempDeviceType andSerialNub:(NSString *)tempSerialNub; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h new file mode 100644 index 0000000..57dace4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUController.h @@ -0,0 +1,160 @@ +// +// DFUController.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/7/17. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +#import "DFUMacro.h" +/** + DFU Controller + */ +@interface DFUController : NSObject + +/** + Get instance + + @return DFUController object + */ ++ (instancetype)shareInstance; + +/** + Query device firmware information in Flash + + @param deviceType DFUDeviceType enum + @param uuid device UUID + @param successBlock success block + @param errorBlock DFUError enum(DFUError_InUpgradeCannotExecuteCommand,DFUError_UnsupportedDeviceType,DFUError_InvalidUUID,DFUError_NoConnectedDevice,DFUError_CommandTimeOut,DFUError_DeviceDisconnect) + @note The method should be called when device is connected. + */ +- (void)queryDeviceFirmwareInfoWithDeviceType:(DFUDeviceType)deviceType + uuid:(NSString *)uuid + successBlock:(QueryDeviceFirmwareInfoSuccessBlock)successBlock + errorBlock:(DFUErrorBlock)errorBlock; + +/** + Query the latest firmware information from server + + @param deviceType DFUDeviceType enum + @param productModel Model Number(you can get from IDPS or device object's property) + @param currentFirmwareVersion current firmware version (you can get from IDPS or device object's property) + @param hardwareVersion hardware version (you can get from IDPS or device object's property) + @param successBlock success block + @param errorBlock DFUError enum(DFUError_UnsupportedDeviceType,DFUError_InvalidFirmwareVersion,DFUError_InvalidHardwareVersion,DFUError_NetworkError,DFUError_ServerError) + @note No need to connect but IDPS should be known. + */ +- (void)queryServerFirmwareInfoWithDeviceType:(DFUDeviceType)deviceType + productModel:(NSString *)productModel + currentFirmwareVersion:(NSString *)currentFirmwareVersion + hardwareVersion:(NSString *)hardwareVersion + successBlock:(QueryServerFirmwareInfoSuccessBlock)successBlock + errorBlock:(DFUErrorBlock)errorBlock; + + +/** + Download firmware file + + @param deviceType DFUDeviceType enum + @param productModel Model Number(you can get from IDPS or device object's property) + @param firmwareVersion firmware version you want to download (the latest version you can get from "queryServerFirmwareInfoWithDeviceType:") + @param hardwareVersion hardware version (you can get from IDPS or device object's property) + @param startBlock download start block + @param downloadFirmwareProgressBlock download progress block [0-100] + @param successBlock success block (firmwareIdentifier is used to in "startUpgradeWithDeviceType:") + @param errorBlock DFUError enum(DFUError_UnsupportedDeviceType,DFUError_InvalidFirmwareVersion,DFUError_InvalidHardwareVersion,DFUError_FileSaveError,DFUError_NetworkError,DFUError_ServerError,DFUError_RequestedFileNotExist,DFUError_InfoFileCheckNotPass,DFUError_firmwareFileCheckNotPass) + */ +- (void)downloadFirmwareWithDeviceType:(DFUDeviceType)deviceType + productModel:(NSString *)productModel + firmwareVersion:(NSString *)firmwareVersion + hardwareVersion:(NSString *)hardwareVersion + downloadStartBlock:(DownloadFirmwareStartBlock)startBlock + downloadFirmwareProgressBlock:(DownloadFirmwareProgressBlock)downloadFirmwareProgressBlock + successblock:(DownloadFirmwareSuccessBlock)successBlock + errorBlock:(DFUErrorBlock)errorBlock; + + +/** + Cancel downloading firmware file + + @param deviceType DFUDeviceType enum + @param successBlock success block + + */ +- (void)cancelDownloadFirmwareWithDeviceType:(DFUDeviceType)deviceType + successBlock:(CancelDownloadFirmwareSuccessBlock)successBlock; + +/** + Start update + + @param deviceType DFUDeviceType enum + @param productModel Model Number(you can get from IDPS or device object's property) + @param uuid device UUID + @param firmwareIdentifier firmware identifier + @param firmwareVersion destination firmware version + @param hardwareVersion hardware version (you can get from IDPS or device object's property) + @param deviceReplyCannotUpgradeBlock cannot upgrade and return reason + @param transferBeginBlock transfer begin + @param transferProgressBlock transfer progress block [0-100] + @param transferSuccessBlock transfer success block (return write MCU speed, unit:Byte/s, only support AM3S,AM4,PO3,HS2,HS4,ECG) + @param transferResultBlock transfer result block (return result type, pasue reason, pause length,only support BG5S,BP5S,ABPM) + @param upgradeSuccessBlock upgrade success block(only support AM3) + @param upgradeFailBlock upgrade fail block + @param upgradeErrorBlock upgrade error blcok (DFUError enum(DFUError_InUpgradeCannotExecuteCommand,DFUError_UnsupportedDeviceType,DFUError_InvalidUUID,DFUError_NoConnectedDevice,DFUError_NoFirmwareFile,DFUError_InvalidFirmwareInfoFile,DFUError_CommandTimeOut,DFUError_DeviceDisconnect)) + */ +- (void)startUpgradeWithDeviceType:(DFUDeviceType)deviceType + productModel:(NSString *)productModel + uuid:(NSString *)uuid + firmwareVersion:(NSString *)firmwareVersion + hardwareVersion:(NSString *)hardwareVersion + firmwareIdentifier:(NSString *)firmwareIdentifier + deviceReplyCannotUpgradeBlock:(DeviceReplyCannotUpgradeBlock)deviceReplyCannotUpgradeBlock + transferBeginBlock:(TransferBeginBlock)transferBeginBlock + transferProgressBlock:(TransferProgressBlock)transferProgressBlock + transferSuccessBlock:(TransferSuccessBlock)transferSuccessBlock + transferResultBlock:(TransferResultBlock)transferResultBlock + upgradeSuccessBlock:(UpgradeSuccessBlock)upgradeSuccessBlock + upgradeFailBlock:(UpgradeFailBlock)upgradeFailBlock + upgradeErrorBlock:(DFUErrorBlock)upgradeErrorBlock; + +/** + Stop update + + @param deviceType DFUDeviceType enum + @param uuid device UUID + @param successBlock success block + @param failBlock fail block, DFUError enum:(DFUError_UnsupportedDeviceType,DFUError_InvalidUUID,DFUError_CommandTimeOut) + */ +- (void)stopUpgradeWithDeviceType:(DFUDeviceType)deviceType + uuid:(NSString *)uuid + successBlock:(StopUpgradeSuccessBlock)successBlock + failBlock:(DFUErrorBlock)failBlock; + +/** + Delete firmware file + + @param firmwareIdentifier firmware identifier + @param successBlock success block + @param errorBlock error block DFUError enum:DFUError_DeleteError + */ +- (void)deleteFirmwareWithIdentifier:(NSString *)firmwareIdentifier + successBlock:(DeleteFirmwareSuccessBlock)successBlock + errorBlock:(DFUErrorBlock)errorBlock; + +/** + Query DFU state + + @return Busy or Free + */ +- (DFUState)queryDFUState; + +/** + Query Device UUID in updating + + @return Device UUID + */ +- (NSString *)UUIDInDFU; + +- (void)openSesame:(NSInteger)number; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUDeviceFirmwareInfo.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUDeviceFirmwareInfo.h new file mode 100644 index 0000000..a33e67e --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUDeviceFirmwareInfo.h @@ -0,0 +1,56 @@ +// +// DFUDeviceFirmwareInfo.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/7/17. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +#import "DFUMacro.h" +/** + Firmware information from device flash + */ +@interface DFUDeviceFirmwareInfo : NSObject +/** + Device UUID + */ +@property (copy, nonatomic, readonly) NSString *UUID; +/** + DFUDeviceType + */ +@property (assign, nonatomic, readonly) DFUDeviceType deviceType; + +/** + Model Number + */ +@property (copy, nonatomic, readonly) NSString *deviceModel; + +/** + Hardware version + */ +@property (copy, nonatomic, readonly) NSString *hardwareVersion; + +/** + Firmware version in Flash + */ +@property (copy, nonatomic, readonly) NSString *firmwareVersion; + +/** + YES:allow;NO:not allow + */ +@property (assign, nonatomic, readonly) BOOL canUpgrade; + +/** + Continue to transfer or not + */ +@property (assign, nonatomic, readonly) BOOL isContinue; + +/** + 1:update no need to disconnect 2:update need to disconnect + */ +@property (assign, nonatomic, readonly) NSInteger upgradeMethod; + ++ (instancetype)infoWithData:(uint8_t [])buf deviceType:(DFUDeviceType)deviceType deviceUUID:(NSString *)uuid; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUHeader.h new file mode 100644 index 0000000..7ac9450 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUHeader.h @@ -0,0 +1,19 @@ +// +// DFUHeader.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/7/17. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#ifndef DFUHeader_h +#define DFUHeader_h + +#import "DFUController.h" +#import "DFUDeviceFirmwareInfo.h" +#import "DFUServerFirmwareInfo.h" + + + + +#endif /* DFUHeader_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h new file mode 100644 index 0000000..4848ad9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUMacro.h @@ -0,0 +1,264 @@ +// +// DFUMacro.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/7/18. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#ifndef DFUMacro_h +#define DFUMacro_h + +@class DFUDeviceFirmwareInfo; +@class DFUServerFirmwareInfo; + +/** + DFU error code + */ +typedef NS_ENUM(NSInteger, DFUError) { + /// Device type does not support. + DFUError_UnsupportedDeviceType = 100, + /// UUID is invalid. + DFUError_InvalidUUID = 101, + /// Command timeout. + DFUError_CommandTimeOut = 102, + /// Device is not connected. + DFUError_NoConnectedDevice = 104, + /// During DFU, other commands cannot be executed. + DFUError_InUpgradeCannotExecuteCommand = 105, + /// Firmware version is invalid. + DFUError_InvalidFirmwareVersion = 106, + /// Hardware version is invalid. + DFUError_InvalidHardwareVersion = 107, + /// The firmware info file is wrong. + DFUError_InvalidFirmwareInfoFile = 108, + /// The firmware file is wrong. + DFUError_InvalidFirmwareFile = 109, + /// It indicates network error. + DFUError_NetworkError = 200, + /// Server error + DFUError_ServerError = 202, + /// Requested file does not exist. + DFUError_RequestedFileNotExist = 203, + /// File save error + DFUError_FileSaveError = 204, + /// Info file does not pass check. + DFUError_InfoFileCheckNotPass = 205, + /// Firmware file does not pass check. + DFUError_firmwareFileCheckNotPass = 206, + /// Device disconnects before command finish. + DFUError_DeviceDisconnect = 300, + /// Device stops update. + DFUError_DeviceStopUpdate = 301, + /// The firmware file does not exist. + DFUError_NoFirmwareFile = 402, + /// Delete error + DFUError_DeleteError = 407, + /// Delete file , but file does not exist + DFUError_DeleteWhileFileNotExist = 408, + /// Device flash error (only support in ECG3 DFU) + DFUError_DeviceFlashError = 408, + +}; + +/** + DFU device type + */ +typedef NS_ENUM(NSInteger, DFUDeviceType) { + /// Unknown + DFUDeviceType_Unknown = -1, + /// AM3 + DFUDeviceType_AM3, + /// AM3S + DFUDeviceType_AM3S, + /// AM4 + DFUDeviceType_AM4, + /// PO3 + DFUDeviceType_PO3, + /// HS2 + DFUDeviceType_HS2, + /// HS4 + DFUDeviceType_HS4, + /// ECG + DFUDeviceType_ECG, + /// BP5S + DFUDeviceType_BP5S, + /// ABPM + DFUDeviceType_ABPM, + /// BG5S + DFUDeviceType_BG5S, + /// HS2S + DFUDeviceType_HS2S, + /// placeholder + DFUDeviceType_MAX, +}; + +/** + Cannot upgrade reason + */ +typedef NS_ENUM(NSInteger, DFUDeviceReplyCannotUpgradeReason){ + /// Unknown + DFUDeviceReplyCannotUpgradeReason_Unknown = 1, + /// battery is low + DFUDeviceReplyCannotUpgradeReason_Battery, + /// cannot upgrade when measuring + DFUDeviceReplyCannotUpgradeReason_InMeasuring, +}; + +/** + Upgrade fail reason + */ +typedef NS_ENUM(NSInteger, DFUUpgradeFailReason) { + /// Unknown + DFUUpgradeFailReason_Unknown = -1, + /// Device recieve wrong data or no data + DFUUpgradeFailReason_DeviceRecieveWrongDataOrNotRecieve, + /// Write MCU error + DFUUpgradeFailReason_WriteMCUError, + /// Device stop upgrade + DFUUpgradeFailReason_DeviceStopUpgrade, + /// Delete firmware error (only support in ECG3 DFU) + DFUUpgradeFailReason_DeleteFirmwareError, + /// Device flash error (only support in ECG3 DFU) + DFUUpgradeFailReason_DeviceFlashError, +}; + +/** + Transmission result type + */ +typedef NS_ENUM(NSInteger, DFUTransmissionResultType) { + /// Unknown + DFUTransmissionResultType_Unknown = -1, + /// All firmware transfer finish + DFUTransmissionResultType_Finish, + /// Pasuse because device needs write MCU + DFUTransmissionResultType_Pause, +}; + +/** + Pause reason + */ +typedef NS_ENUM(NSInteger, DFUPauseReason) { + /// Unkonw reason + DFUPauseReason_Unknown = 0, + /// Need write MCU, if finished, device can be connected. + DFUPauseReason_RebootAndNeedReconnect, +}; + + +/** + DFU state + */ +typedef NS_ENUM(NSInteger, DFUState) { + /// Unknown + DFUState_Unknown = -1, + /// Busy + DFUState_Busy, + /// Free + DFUState_Free, +}; + + +/** + DFU error block + + @param error DFUError enum + */ +typedef void (^DFUErrorBlock)(DFUError error); + +/** + Device firmware information block + + @param deviceFirmwareInfo DFUDeviceFirmwareInfo object + */ +typedef void (^QueryDeviceFirmwareInfoSuccessBlock)(DFUDeviceFirmwareInfo *deviceFirmwareInfo); + +/** + Server firmware information block + + @param serverFirmwareInfo DFUServerFirmwareInfo object + */ +typedef void (^QueryServerFirmwareInfoSuccessBlock)(DFUServerFirmwareInfo *serverFirmwareInfo); + +/** + Download firmware file success block + + @param firmwareIdentifier firmware ID + */ +typedef void (^DownloadFirmwareSuccessBlock)(NSString *firmwareIdentifier); + +/** + Download firmware file start block + */ +typedef void (^DownloadFirmwareStartBlock)(void); + +/** + Download firmware file progress block + + @param progress 0-100 + */ +typedef void (^DownloadFirmwareProgressBlock)(NSInteger progress); + +/** + CancelDownloadFirmwareSuccessBlock + */ +typedef void (^CancelDownloadFirmwareSuccessBlock)(void); + +/** + DeviceReplyCannotUpgradeBlock + + @param reason DFUDeviceReplyCannotUpgradeReason enum + */ +typedef void(^DeviceReplyCannotUpgradeBlock)(DFUDeviceReplyCannotUpgradeReason reason); + +/** + TransferBeginBlock + */ +typedef void(^TransferBeginBlock)(void); + +/** + TransferProgressBlock + + @param progress 0-100 + */ +typedef void(^TransferProgressBlock)(NSInteger progress); + +/** + TransferSuccessBlock + + @param writeMCUSpeed unit:bytes/second + */ +typedef void(^TransferSuccessBlock)(NSUInteger writeMCUSpeed); + +/** + TransferResultBlock + + @param type DFUTransmissionResultType enum + @param reason DFUPauseReason enum, -1 if type is DFUTransmissionResultType_Finish; + @param pauseLength 0-255s,-1 if type is DFUTransmissionResultType_Finish; + */ +typedef void(^TransferResultBlock)(DFUTransmissionResultType type,DFUPauseReason reason,NSInteger pauseLength); + +/** + UpgradeSuccessBlock + */ +typedef void(^UpgradeSuccessBlock)(void); + +/** + UpgradeFailBlock + + @param reason DFUUpgradeFailReason enum + */ +typedef void(^UpgradeFailBlock)(DFUUpgradeFailReason reason); + +/** + StopUpgradeSuccessBlock + */ +typedef void(^StopUpgradeSuccessBlock)(void); + +/** + DeleteFirmwareSuccessBlock + */ +typedef void(^DeleteFirmwareSuccessBlock)(void); + +#endif /* DFUMacro_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUServerFirmwareInfo.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUServerFirmwareInfo.h new file mode 100644 index 0000000..c3fa2af --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/DFUServerFirmwareInfo.h @@ -0,0 +1,48 @@ +// +// DFUServerFirmwareInfo.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/7/17. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +#import "DFUMacro.h" + +/** + Firmware information from server + */ +@interface DFUServerFirmwareInfo : NSObject + +/** + DFUDeviceType + */ +@property (assign, nonatomic, readonly) DFUDeviceType deviceType; + +/** + The latest firmware version (0.0.0 or 0.0.0.0 means no firmware in server, you should check your query input parameters) + */ +@property (copy, nonatomic, readonly) NSString *latestFirmwareVersion; + +/** + YES means mandtory + */ +@property (assign, nonatomic, readonly) BOOL isMandtoryUpgrade; + +/** + Description + */ +@property (copy, nonatomic, readonly) NSString *updateDescription; + +/** + Images before updating + */ +@property (copy, nonatomic, readonly) NSArray *beforeImages; + +/** + Image after updating + */ +@property (copy, nonatomic, readonly) NSArray *afterImages; + ++ (instancetype)infoWithDeviceType:(DFUDeviceType)deviceType dic:(NSDictionary *)dic; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3.h new file mode 100644 index 0000000..d8d8736 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3.h @@ -0,0 +1,94 @@ +// +// ECG3.h +// iHealthDemoCode +// +// Created by zhiwei jing on 16/7/12. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import +#import "ECGMacroFile.h" + +/** + Sync Time Successfully + */ +typedef void (^DisposeECG3SyncTimeSuccessBlock)(void); + +/** + Error block + + @param errorId see ECG3ErrorID enum + */ +typedef void(^DisposeECG3ErrorBlock)(ECG3ErrorID errorId); +/** + Start Measure + */ +typedef void (^DisposeECG3StartMeasureBlock)(void); +/** + Finish Measure + */ +typedef void (^DisposeECG3FinishMeasureSuccessBlock)(void); + + /** + ECG3 Wave Data + */ +typedef void (^DisposeECG3WaveDataBlock)(NSArray* waveDataArray); + +/** + ECG3 HR Data + */ +typedef void (^DisposeECG3PluseResultBlock)(BOOL hasHR,NSUInteger HR); +/** + get Battery + */ +typedef void (^DisposeECG3GetBatteryBlock)(NSNumber *battery); +/** + ECG3 + */ +@interface ECG3 : NSObject + +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *firmwareVersion; + +/** + * Sync time + * @param syncTimeBlock Sync time successfully + * @param errorBlock Communication error codes, see ECG3 error descriptions. + */ +-(void)commandECG3SyncTime:(DisposeECG3SyncTimeSuccessBlock)syncTimeBlock withErrorBlock:(DisposeECG3ErrorBlock)errorBlock; + + +/** + * Start Measure + * @param startMeasureBlock True: Success, False: Failed. + * @param waveDataBlock waveData:ECGWaveData use for draw wave + * @param pluseResultBlock hasHR: whether have heart; HR: heart rate (unit: bpm) only valid when isHaveHeart is true + * @param errorBlock Communication error codes, see ECG3 error descriptions. + */ +-(void)commandECG3StartMeasure:(DisposeECG3StartMeasureBlock)startMeasureBlock withWaveData:(DisposeECG3WaveDataBlock)waveDataBlock withPulseResult:(DisposeECG3PluseResultBlock)pluseResultBlock withErrorBlock:(DisposeECG3ErrorBlock)errorBlock; + + + +/** + * Finish Measure + * @param finishMeasureBlock finish successfully + * @param errorBlock Communication error codes, see ECG3 error descriptions. + */ +-(void)commandECG3FinishMeasure:(DisposeECG3FinishMeasureSuccessBlock)finishMeasureBlock withErrorBlock:(DisposeECG3ErrorBlock)errorBlock; + + + + +/** + * Get Battery + * @param batteryBlock from 0~100. + * @param errorBlock Communication error codes, see ECG3 error descriptions. + */ +-(void)commandECG3GetBatteryInfo:(DisposeECG3GetBatteryBlock)batteryBlock withErrorBlock:(DisposeECG3ErrorBlock)errorBlock; + +/** + Disconnect device + */ +- (void)disconnectDevice; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3Controller.h new file mode 100644 index 0000000..548ea75 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3Controller.h @@ -0,0 +1,30 @@ +// +// ECG3Controller.h +// CES2014ECG +// +// Created by 小翼 on 15/8/27. +// Copyright (c) 2015年 leed. All rights reserved. +// + +#import + +/** + ECG3Controller + */ +@interface ECG3Controller : NSObject + + + +/** + * Initialize ECG3 controller class + */ ++(ECG3Controller *)shareECG3Controller; + +/** + * Access control class instance after receiving ECG3ConnectNoti, then use instance to call ECG3 related communication methods + */ +-(NSArray *)getAllCurrentECG3Instace; + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USB.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USB.h new file mode 100755 index 0000000..5882028 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USB.h @@ -0,0 +1,145 @@ +// +// ECG3.h +// iHealthDemoCode +// +// Created by daiqingquan on 15/9/15. +// Copyright (c) 2015年 zhiwei jing. All rights reserved. +// + +#import +#import "ECGMacroFile.h" + +/** + Sync Start + */ +typedef void (^ECG3USBSyncStartBlock)(void); + +/** + Sync Progress + + @param progress 0-100 + */ +typedef void (^ECG3USBSyncProgressBlock)(NSUInteger progress); + +/** + @brief Sync Result + + @param resultArray An array contains Dictionary + @code Dictionary format: { + @"SampleRate":@(sampleRate), + @"StartTime":startTimeString, + @"EndTime":endTimeString, + @"FileName":fileName, + @"FilePath":path + }); + @endcode + @param finish YES means all data has been uploaded, NO means not all data has been uploaded because of some reasons sucn as device disconnect\communication error\iOS device's memory issue\raw data error. The reason you can get from ECG3USBErrorBlock. + */ +typedef void (^ECG3USBSyncResultBlock)(NSArray *resultArray,BOOL finish); + +/** + Sync Error + + @param errorID error ID + */ +typedef void (^ECG3USBErrorBlock)(ECG3USBError errorID); + + +/** + Format SD Card Success + */ +typedef void (^ECG3FormatSDCardSuccessBlock)(void); + +/** + Format SD Card Fail + */ +typedef void (^ECG3FormatSDCardFailBlock)(ECG3USBError error); +/** + Format Progress + + @param progress 0-100 + */ +typedef void (^ECG3USBFormatProgressBlock)(NSUInteger progress); +/** + ECG3USB + */ +@interface ECG3USB : NSObject +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *firmwareVersion; + +/** + Sync Data + + @param startBlock means start + @param progressBlock 0-100 + @param resultBlock You can get filtered data from the NSDocumentDirectory path. + + Abnormal Point Marked by User: OBData_FileName.xml + Filtered ECG Data: ECGAnalyseResult_FileName.dat + Lead Off Begin Point: ECGLeadOffBegin_FileName.xml + Lead Off End Point: ECGLeadOffEnd_FileName.xml + ECG HR Information EveryHour: ECGHREveryHour_FileName.xml + Abnormal Point Filtered by Algorithm: ECGOBbyFilter_FileName.xml + ECG HR Information for Day: ECGDetail_FileName.xml + @param errorBlock error + + */ +- (void)syncDataWithStartBlock:(ECG3USBSyncStartBlock)startBlock + progressBlock:(ECG3USBSyncProgressBlock)progressBlock + resultBlock:(ECG3USBSyncResultBlock)resultBlock + errorBlock:(ECG3USBErrorBlock)errorBlock; + +/** + Format SD Card + + @param successBlock Success + @param progressBlock 0-100 + @param failBlock Fail + */ +-(void)formatSDCard:(ECG3FormatSDCardSuccessBlock)successBlock + progressBlock:(ECG3USBFormatProgressBlock)progressBlock + errorBlock:(ECG3FormatSDCardFailBlock)failBlock; + +/** + Splice data + + @param fileNames An Array with FileName value from ECG3USBSyncResultBlock + @param successBlock a block contains a dictionary with keys: success(@{@"DataFileName":dataFileName,@"MarkFileName":markFileName,@"StartTime":yyyyMMddHHmmss,@"EndTime":yyyyMMddHHmmss,@"FilePath":directory}); + @param errorBlock a block contains error message + */ ++ (void)spliceWithFileNames:(NSArray*)fileNames + successBlock:(void(^)(NSDictionary *dic))successBlock + errorBlock:(void(^)(ECG3USBError error,NSString *message))errorBlock; + + +/** + Get data cache + + @param block An array contains Dictionary object + { + @"SampleRate":@(sampleRate), + @"StartTime":startTimeString, + @"EndTime":endTimeString, + @"FileName":fileName, + @"FilePath":path + }); + */ +- (void)getCacheDataWithBlock:(void(^)(NSArray *array))block; + +/** + + + @param dic the dictionary from the success block of method ’synthesisWithFileNames:success:error:‘ + */ + +/** + Filter + + @param dic the dictionary from the success block of method ’synthesisWithFileNames:success:error:‘ + @param success see ECG3USBSyncResultBlock comments + @param error a block contains error message (If the files don't exist, no error block retrun but print error message in the console) + */ +- (void)getFilterDataWithDic:(NSDictionary *)dic success:(ECG3USBSyncResultBlock)success error:(void(^)(NSString *message))error; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USBController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USBController.h new file mode 100755 index 0000000..df2c6d2 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USBController.h @@ -0,0 +1,31 @@ +// +// ECG3Controller.h +// iHealthDemoCode +// +// Created by daiqingquan on 15/9/15. +// Copyright (c) 2015年 zhiwei jing. All rights reserved. +// + +#import + +@class ECG3USB; + +/** + ECG3USBController + */ +@interface ECG3USBController : NSObject + +/** + share ECG3 Controller + + @return ECG3USBController + */ ++(ECG3USBController *)shareECG3USBController; + +/** + get ECG3 + + @return ECG3USB + */ +-(ECG3USB *)getCurrentECG3USBInstace; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGHeader.h new file mode 100644 index 0000000..006c5f2 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGHeader.h @@ -0,0 +1,20 @@ +// +// ECGHeader.h +// iHealthDemoCode +// +// Created by zhiwei jing on 16/7/12. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#ifndef ECGHeader_h +#define ECGHeader_h + + +#import "ECG3.h" +#import "ECG3Controller.h" +#import "ECGMacroFile.h" +#import "HealthUser.h" +#import "ECG3USB.h" +#import "ECG3USBController.h" + +#endif /* ECGHeader_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGMacroFile.h new file mode 100644 index 0000000..45a749c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECGMacroFile.h @@ -0,0 +1,84 @@ +// +// ECGMacroFile.h +// iHealthDemoCode +// +// Created by zhiwei jing on 16/7/12. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import "HealthUser.h" + +#ifndef ECGMacroFile_h +#define ECGMacroFile_h + + +#define ECGUSBConnectNoti @"ECGUSBConnect" +#define ECGUSBDisConnectNoti @"ECGUSBDisConnectNoti" + +#define ECG3Discover @"ECG3Discover" +#define ECG3ConnectFailed @"ECG3ConnectFailed" +#define ECG3ConnectNoti @"ECG3ConnectNoti" +#define ECG3DisConnectNoti @"ECG3DisConnectNoti" +#define ECG3DeviceID @"ID" + +/** + ECG3ErrorID + */ +typedef NS_ENUM(NSUInteger, ECG3ErrorID) { + /// Electrode Loss + ECG3Error_ElectrodeLoss = 1, + /// Electrode Loss Recovery + ECG3Error_ElectrodeLossRecovery, + /// Electrode Loss Timeout + ECG3Error_ElectrodeLossTimeout, + /// SDCard Communication Error + ECG3Error_SDCardCommunicationError, + /// Sample Module Error + ECG3Error_SampleModuleError, + /// Low Power + ECG3Error_LowPower, + /// Device Memory Full + ECG3Error_DeviceMemoryFull, + /// Disconnect + ECG3Error_Disconnect, + /// Parameter Error + ECG3Error_ParameterError = 400, + /// Command timeout + ECG3Error_CommandTimeout = 500, +}; + +typedef NS_ENUM(NSUInteger, ECG3USBError) { + /// Query command timeout + ECG3USBError_QuerySDCardInfoTimeout, + /// Received SD card info is wrong. + ECG3USBError_SDCardInfoError, + /// Receive devce's error log: SD card error. + ECG3USBError_SDCardError, + /// There is not enough space for ECG's offline data. + ECG3USBError_iOSDeviceFlashNotEnough, + /// Receive wrong data + ECG3USBError_AFilePackageIndexNotMatch, + /// Receive wrong data + ECG3USBError_BFilePackageIndexNotMatch, + /// Receive data timeout + ECG3USBError_ReceiveDataTimeout, + /// Save file error + ECG3USBError_SaveFileError, + /// Device is disconnected. + ECG3USBError_DeviceDisconnect, + /// Format fail. + ECG3USBError_DeviceReplyFormatFail, + /// Splice fail. + ECG3USBError_SpliceFail, + /// Get data cache fail. + ECG3USBError_GetDataCacheFail, + /// Filter fail. + ECG3USBError_FilterFail, + /// Format command timeout. + ECG3USBError_DeviceFormatTimeout, + /// Command timeout + ECG3USBError_CommandTimeout = 500, + +}; + +#endif /* ECGMacroFile_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLink.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLink.h new file mode 100644 index 0000000..236e6d4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLink.h @@ -0,0 +1,88 @@ +// +// HFSmartLink.h +// SmartlinkLib +// +// Created by wangmeng on 15/3/16. +// Copyright (c) 2015年 HF. All rights reserved. +// + +#import +#import "HFSmartLinkDeviceInfo.h" + +typedef void(^SmartLinkProcessBlock)(NSInteger process); +/** + * 设置成功以后的Block + * + * + */ +typedef void(^SmartLinkSuccessBlock)(HFSmartLinkDeviceInfo *dev); +/** + * 设置失败的信息 + * + * @param failmsg 失败信息 + */ +typedef void(^SmartLinkFailBlock)(NSString * failmsg); +/** + * 用户手动停掉的block + * + * @param stopMsg 停止的信息 + * @param isOk 是否停止成功 + */ +typedef void(^SmartLinkStopBlock)(NSString *stopMsg,BOOL isOk); +/** + * 关闭服务的Block + * + * @param closeMsg 关闭的信息 + * @param isOK 是否关闭成功 + */ +typedef void(^SmartLinkCloseBlock)(NSString * closeMsg,BOOL isOK); +/** + * 发现设备的block + * + * @param deviceDic 发现的设备 + */ +typedef void(^SmartLinkEndblock)(NSDictionary * deviceDic); + +@interface HFSmartLink : NSObject +/** + * 是否配置单个设备,或者多个设备 默认false + */ +@property (nonatomic) BOOL isConfigOneDevice; +/** + * 配置信息发送完成以后,等待搜索设备的时间 second 默认15 + */ +@property (nonatomic) NSInteger waitTimers; + +/** + * 获取smartlink 的单例 + * + * @return 返回smartlink的单例 + */ ++(instancetype)shareInstence; +/** + * 开始配置 block不能为nil + * + * @param key 路由器密码 + * @param pblock 进度block + * @param sblock 成功block + * @param fblock 失败block + * @param eblock 结束block + */ +//-(void)startWithKey:(NSString*)key processblock:(SmartLinkProcessBlock)pblock successBlock:(SmartLinkSuccessBlock)sblock failBlock:(SmartLinkFailBlock)fblock endBlock:(SmartLinkEndblock)eblock; + +-(void)startWithSSID:(NSString*)ssid Key:(NSString*)key withV3x:(BOOL)v3x processblock:(SmartLinkProcessBlock)pblock successBlock:(SmartLinkSuccessBlock)sblock failBlock:(SmartLinkFailBlock)fblock endBlock:(SmartLinkEndblock)eblock; +// for smartlink V7.0 +//-(void)startWithContent:(char *)content lenght:(int)len key:(NSString *)key withV3x:(BOOL)v3x processblock:(SmartLinkProcessBlock)pblock successBlock:(SmartLinkSuccessBlock)sblock failBlock:(SmartLinkFailBlock)fblock endBlock:(SmartLinkEndblock)eblock; +/** + * 停止配置 + * + * @param block 停止配置的block + */ +-(void)stopWithBlock:(SmartLinkStopBlock)block; +/** + * 关闭整个Smartlink服务,再次调用的时候必须 从头开始 初始化。 + * + * @param block 关闭服务block + */ +-(void)closeWithBlock:(SmartLinkCloseBlock)block; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLinkDeviceInfo.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLinkDeviceInfo.h new file mode 100644 index 0000000..2abf066 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HFSmartLinkDeviceInfo.h @@ -0,0 +1,14 @@ +// +// HFSmartLinkDeviceInfo.h +// SmartlinkLib +// +// Created by wangmeng on 15/3/17. +// Copyright (c) 2015年 HF. All rights reserved. +// + +#import + +@interface HFSmartLinkDeviceInfo : NSObject +@property (nonatomic,strong) NSString * ip; +@property (nonatomic,strong) NSString * mac; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2.h new file mode 100644 index 0000000..347b7a9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2.h @@ -0,0 +1,64 @@ +// +// HS2.h +// iHealthSDKStatic +// +// Created by ihealth on 2017/6/6. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +#import "HSMacroFile.h" + +@interface HS2 : NSObject +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *deviceID; +@property (strong, nonatomic) NSNumber *daiModel; +@property (retain, nonatomic) NSString *firmwareVersion; + +/** + + * Establish memory and measurement connection + + * Import parameter: + * @param tempUnit -Unit displayed on HS2: HSUnit_Kg、HSUnit_LB、HSUnit_ST。 + + * Return parameters: + The measurement via SDK will be operated in the case of 1-4, and will be terminated if any of 5-8 occurs. The interface needs to be re-called after analyzing the return parameters. + + * @param unStableWeight - Current weight, (Kg) [Value Range:0~180] + * @param stableWeight - Stable weight, (Kg) [Value Range:0~180] + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2 error instruction. + */ + +-(void)commandHS2MeasureWithUint:(HSUnit)tempUnit Weight:(UnStableWeight)unStableWeight StableWeight:(StableWeight)stableWeight DisposeErrorBlock:(DisposeHS2ErrorBlock)disposeErrorBlock; + +/** + * Upload memory data + + * Return parameters: + * @param startTransmission -Start Memory transmission. + * @param progress -Memory transmission progress,[Range:0.0~1.0]. + * @param memorryData -Record data including weight (kg), measurement time,coordinated key:weight,date.[Range of weight 0~180(kg)] (If it exceeds 180kg, it will display er1 error, but the SDK interface will also return data. More than 180kg of data is not recommended.) + * @param finishTransmission -Finish memory transmission. + * @param disposeErrorBlock -Record the error code in uploading process. + * Error code definition: refer to ”error” : HS2 error instruction. + */ + +-(void)commandHS2TransferMemorryData:(StartHS2Transmission)startTransmission DisposeProgress:(DisposeProgress)progress MemorryData:(MemorryData)memorryData FinishTransmission:(FinishHS2Transmission)finishTransmission DisposeErrorBlock:(DisposeHS2ErrorBlock)disposeErrorBlock; + +/** + *Get HS2 Battery + + * @param HS2battery HS2battery [Range:0~100]% + * @param disposeErrorBlock error code + */ +-(void)commandGetHS2Battery:(DisposeHS2BatteryBlock)HS2battery DiaposeErrorBlock:(DisposeHS2ErrorBlock)disposeErrorBlock; +/** + Disconnect current device + */ + +-(void)commandDisconnectDevice; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2Controller.h new file mode 100644 index 0000000..781e830 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2Controller.h @@ -0,0 +1,25 @@ +// +// HS2Controller.h +// iHealthSDKStatic +// +// Created by ihealth on 2017/6/6. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import + +/** + HS2Controller + */ +@interface HS2Controller : NSObject +/** + * Initialize HS2 controller class + */ ++(HS2Controller *)shareIHHs2Controller; + +/** + * Get all scale instance,use hsInstance to call HS related communication methods. + */ +-(NSArray *)getAllCurrentHS2Instace; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2S.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2S.h new file mode 100644 index 0000000..96b4829 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2S.h @@ -0,0 +1,399 @@ +// +// HS2S.h +// iHealthSDKStatic +// +// Created by jing on 2019/5/8. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import +#import "HSMacroFile.h" +NS_ASSUME_NONNULL_BEGIN + +@interface HS2S : NSObject + +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *currentUUID; +@property (nonatomic,strong) NSNumber *hs2sDeviceFlag; +/** + *Get HS2S DeviceInfo (After the HS2S device is successfully connected, the interface must be called to synchronize the device time. Otherwise, the offline data measurement time error will be caused) + + * @param deviceInfo Contains device IDPS info(FirmwareVersion,HardwareVersion,Manufacture,ModelNumber,ProtocolString,SerialNumber),user count ,HS2S current unit(1:Kg,2:LB,3:ST),battery + * Example: + * { + Battary = 70; + DeviceName = HS2S; + FirmwareVersion = "0.5.4"; + HardwareVersion = "1.0.0"; + Manufacture = iHealth; + ModelNumber = "HS2S 11070"; + ProtocolString = "com.jiuan.BFSV22"; + SerialNumber = 004D320CA04D; + Unit = 1; + UserCount = 1; + * } + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandGetHS2SDeviceInfo:(DisposeHS2SDeviceInfo)deviceInfo DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + + +/** + *Get HS2S battery + + * @param battary HS2Sbattery [Range:0~100]% + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandGetHS2SBattery:(DisposeHS2SBatteryBlock)battary DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + + +/** + + * SetUnit + + * Import parameter: + * @param tempUnit -Unit displayed on HS2S: HSUnit_Kg、HSUnit_LB、HSUnit_ST。 + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ + +-(void)commandSetHS2SUnit:(HSUnit)tempUnit result:(DisposeHS2SResult)result DisposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Get HS2S UserInfo + * Return parameters: + * @param userInfo NSDictionary type,contains: UserCount and UserInfo + * Example: + * { + UserCount = 1; + UserInfo =( + { + "UserInfo_Age" = 20; + "UserInfo_Height" = 100; + "UserInfo_CreatTS" = 1558406503; //User creat time + "UserInfo_ID" = <69486561 6c746831 32333435 36373839>; + "UserInfo_ImpedanceMark" = 1; //0 Don't measure 1 Measure + "UserInfo_SEX" = 1; //0 female 1 male, + "UserInfo_Weight" = "79.5"; + "UserInfo_Fitness" = 1; //0:Don't fitness 1:fitness + } + ); + * } + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandGetHS2SUserInfo:(DisposeHS2SUserInfo)userInfo DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Create or Update HS2S UserInfo (The HS2S device only supports the creation of a maximum of 8 users) + * Import parameter: + * @param user (user information must be entered in accordance with the reference range, otherwise it may be impossible to measure the accurate body fat information) + + * contains: + * hs2SUserID:NSData type,The user ID must be 16 bytes or the user creation fails, + * createTS:NSInteger type,The unit of time is seconds , + * weight:NSNumber type,range:20-150kg, + * age:NSNumber type,range:18-99 years, + * height:NSNumber type,range:90-220cm + * sex:0 female 1 male, + * impedanceMark: 0 Don't measure 1 Measure + * fitnessMark:0 Don't fitness 1:fitness + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandUpdateHS2SUserInfoWithUser:(HealthUser*)user result:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Delete HS2S User + * Import parameter: + * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails, + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandDeleteHS2SUserWithUserID:(NSData*)userID result:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Get HS2S Memory data count + * Import parameter: + * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails, + * Return parameters: + * @param count NSNumber Type,memory count + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandGetHS2SMemoryDataCountWithUserID:(NSData*)userID memoryCount:(DisposeHS2SMemoryCountBlock)count DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Get HS2S Memory data + + Lean mass calculation formula: result = weight * (1 - body fat percentage) + BMI calculation formula: result = weight / (height * height) + BMR calculation formula: + If no fat is measured + { + For men: + P = 13.397* weight + 4.799* height – 5.677* age + 88.362 + For women: + P = 9.247* weight + 3.098* height – 4.330* age + 447.593 + If the user enters the sport level in the app, correct the P: + Sport level=1, P = P*1.0 + Sport level = 2, P = P*1.05 + Sport level = 3, P = P*1.10 + } + When fat is measured: + { + P=370 + 21.6*Lean mass(kg ) + } + * Import parameter: + * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails, + * Return parameters: + * @param memoryData NSArray Type,memory data + * Example: + * ( + + { + DeviceMac = 004D320CA04D; //device mac + HS2SBodyAge = 10; //body age + HS2SBodyWaterPercentAge = "39.3"; //body moisture rate + HS2SBoneMineral = "1.9"; //Bone salt + HS2SFatControl = 0; //Fat Control + HS2SFatWeight = 0; //Fat weight + HS2SFitness = 1; //0:Don't fitness 1:fitness + HS2SImpedance = (); //NSArray type ,Impedance + HS2SIsRightTS = 1; //0:Incorrect, unsynchronized time on measured data 1:Correct, synchronize the measured data after the time + HS2SMeasureTS = "2019-05-18 08:56:38 +0000"; + HS2SMuscle = "13.1"; //Muscle mass + HS2SMuscleControl = 0; //Muscle Control + HS2SProteinPercentAge = "9.8"; //Protein rate + HS2SResultBodyFatPercentAge = "44.2"; //Body fat rate + HS2SBodyWeightFlag = 0; //0:Body fat was not measured 1:Measure body fat + HS2SSkeletalMuscle = 0; //Skeletal Muscle + HS2SStandardWeight = 0; //Standard Weight + HS2SVFR = 29; //Visceral fat grade + HS2SWeightControl = 0; //Weight Control + HS2SWeigthResult = "79.5"; + "UserInfo_Age" = 18; + "UserInfo_Height" = 100; + "UserInfo_SEX" = 1; + } + * ) + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandGetHS2SMemoryDataWithUserID:(NSData*)userID memoryData:(DisposeHS2SMemoryDataBlock)memoryData DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Delete HS2S Memory data + * Import parameter: + * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails, + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandDeleteHS2SMemoryDataWithUserID:(NSData*)userID result:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Get HS2S Anonymous Memory data count + * Return parameters: + * @param count memory count + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandGetHS2SAnonymousMemoryDataCount:(DisposeHS2SAnonymousMemoryCountBlock)count DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Get HS2S Anonymous Memory data + * Return parameters: + * @param memoryData NSArray type,Each result dictionary contains: HS2SIsRightTS(Time correctness identification,0:Incorrect, unsynchronized time on measured data 1:Correct, synchronize the measured data after the time),HS2SMeasureTS(Measure Time,NSdate type),HS2SWeigthResult(Weigth Result) + * Example: + * ( + { + HS2SIsRightTS = 0; //Time correctness identification + HS2SMeasureTS = "2019-05-18 07:18:36 +0000"; + HS2SWeigthResult = "43.7"; + } + * ) + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandGetHS2SAnonymousMemoryData:(DisposeHS2SAnonymousMemoryDataBlock)memoryData DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * Delete HS2S Anonymous Memory data + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandDeleteHS2SAnonymousMemoryData:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + + +/** + * Measure HS2S Data + * Import parameter: + * @param user (user information must be entered in accordance with the reference range, otherwise it may be impossible to measure the accurate body fat information) + + Lean mass calculation formula: result = weight * (1 - body fat percentage) + BMI calculation formula: result = weight / (height * height) + BMR calculation formula: + If no fat is measured + { + For men: + P = 13.397* weight + 4.799* height – 5.677* age + 88.362 + For women: + P = 9.247* weight + 3.098* height – 4.330* age + 447.593 + If the user enters the sport level in the app, correct the P: + Sport level=1, P = P*1.0 + Sport level = 2, P = P*1.05 + Sport level = 3, P = P*1.10 + } + When fat is measured: + { + P=370 + 21.6*Lean mass(kg ) + } + * contains: + * userType : 0 guest 1 normal + * hs2SUserID:NSData type,The user ID must be 16 bytes or the user creation fails, + * createTS:NSInteger type,The unit of time is seconds , + * weight:NSNumber type,range:20-150kg, + * age:NSNumber type,range:18-99 years, + * height:NSNumber type,range:90-220cm + * sex:0 female 1 male, + * impedanceMark: 0 Don't measure 1 Measure + * fitnessMark:0 Don't fitness 1:fitness + * Return parameters: + * @param unStableWeight - Current weight, (Kg) [Value Range:0~180] + * @param stableWeight - Stable weight, (Kg) [Value Range:0~180] + * @param weightAndBodyInfo Weight and body fat information guest user not return weightAndBodyInfo + * Example: + * { + DeviceMac = 004D320CA04D; //device mac + HS2SBodyAge = 10; //body age + HS2SBodyWaterPercentAge = "39.3"; //body moisture rate + HS2SBoneMineral = "1.9"; //Bone salt + HS2SFatControl = 0; //Fat Control + HS2SFatWeight = 0; //Fat weight + HS2SFitness = 1; //0:Don't fitness 1:fitness + HS2SImpedance = (); //NSArray type ,Impedance + HS2SMeasureTS = "2019-05-18 08:56:38 +0000"; + HS2SMuscle = "13.1"; //Muscle mass + HS2SMuscleControl = 0; //Muscle Control + HS2SProteinPercentAge = "9.8"; //Protein rate + HS2SResultBodyFatPercentAge = "44.2"; //Body fat rate + HS2SBodyWeightFlag = 0; //0:Body fat was not measured 1:Measure body fat + HS2SSkeletalMuscle = 0; //Skeletal Muscle + HS2SStandardWeight = 0; //Standard Weight + HS2SVFR = 29; //Visceral fat grade + HS2SWeightControl = 0; //Weight Control + HS2SWeigthResult = "79.5"; + "UserInfo_Age" = 18; + "UserInfo_Height" = 100; + "UserInfo_SEX" = 1; + * } + * @param measureFinish If HS2S is measuring weight, the call to the online measurement interface will fail at the beginning, and the call to the interface will succeed when the return measurement is completed. + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandStartHS2SMeasureWithUser:(HealthUser*)user weight:(DisposeHS2SUnStableWeight)unStableWeight stableWeight:(DisposeHS2SStableWeight)stableWeight weightAndBodyInfo:(DisposeHS2SWeightAndBodyInfo)weightAndBodyInfo disposeHS2SMeasureFinish:(DisposeHS2SMeasureFinish)measureFinish DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + + +/** + * Reset HS2S device + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandResetHS2SDevice:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * HS2S BroadCastType device + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandBroadCastTypeHS2SDevice:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + + +/** + Disconnect current device + */ + +-(void)commandDisconnectDevice; + +/** + * HS2S Light up bluetooth + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandSetHS2SDeviceLightUp:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + + + + +/** + * HS2S Enter heart rate measurement mode + * Return parameters: + * @param result + * heartResultDic:{ + HeartValue = 0; + ResultStatus = 1;(0: success, + 1: failed 1, no real-time data received in 6s + 2: Failure 2, the algorithm judges that the user is weighing down + 3: Failure 3, calculation failed + 4: Failure 4: 30s timeout) + } + + * @param status ( 1: User on the scale + 2: User referred below + 3: The user's heartbeat signal is detected) + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandEnterHS2SHeartRateMeasurementMode:(DisposeHS2SHeartResult)result measurementStatus:(DisposeHS2SMeasurementStatus)status DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + +/** + * HS2S Exit heart rate measurement mode + * Return parameters: + * @param result YES:Success NO:Failed + * @param disposeErrorBlock - error code + * Error code definition: + * refer to “error” : HS2S error instruction. + */ +-(void)commandExitHS2SHeartRateMeasurementMode:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock; + + +@end + + + + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2SController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2SController.h new file mode 100644 index 0000000..8758699 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2SController.h @@ -0,0 +1,27 @@ +// +// HS2SController.h +// iHealthSDKStatic +// +// Created by jing on 2019/4/30. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +/** + HS2SController + */ +@interface HS2SController : NSObject +/** + * Initialize HS2S controller class + */ ++(HS2SController *)shareIHHS2SController; + +/** + * Get all scale instance,use hsInstance to call HS related communication methods. + */ +-(NSArray *)getAllCurrentHS2SInstace; +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3.h new file mode 100644 index 0000000..2d8fb09 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3.h @@ -0,0 +1,63 @@ +// +// HS3.h +// testShareCommunication +// +// Created by daiqingquan on 13-10-10. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "HSMacroFile.h" + + +/** + HS3 + */ +@interface HS3 : NSObject +@property (retain, nonatomic) NSString *currentUUID; +@property (retain, nonatomic) NSString *deviceID; +@property (retain, nonatomic) NSString *modelNumber; +@property (retain, nonatomic) NSDictionary *commInfoDic; +@property (retain, nonatomic) NSString *firmwareVersion; + + + +-(void)commandInitMeasureWeightID:(WeightID)weightID FinishInit:(FinishHS3Init)finishInit DisposeErrorBlock:(DisposeHS3ErrorBlock)disposeHS3ErrorBlock; + + +/** + Establish memory and measurement connection + The measurement via SDK will be operated in the case of 1-4, and will be terminated if any of 5-8 occurs. The interface needs to be re-called after analyzing the return parameters. + + @param startTransmission Start Memory transmission,Success: Yes,Fail: No. + @param hs3UploadDataNum MemoryNumber,Range:0~200. + @param progress Memory transmission progress,Range:0.0~1.0. + @param memorryData Record data including weight(kg)[Range:0.0~150.0], measure time,coordinated key:weight、date. + @param finishTransmission Finish memory transmission. + @param stableWeight weight (Kg) [value range:0.0~150.0] + @param disposeHS3ErrorBlock Error code in measurement process + */ +-(void)commandInitWithUser:(StartHS3Transmission)startTransmission UploadDataNum:(DisposeHS3UploadDataNum)hs3UploadDataNum DisposeProgress:(DisposeHS3Progress)progress MemorryData:(HS3MemorryData)memorryData FinishTransmission:(FinishHS3Transmission)finishTransmission StableWeight:(StableHS3Weight)stableWeight DisposeErrorBlock:(DisposeHS3ErrorBlock)disposeHS3ErrorBlock; + +/** + Turn off Bluetooth Connection + This method can be called only for hsInstance.HS3 with FirmwareVersion>=1.0.2 + Return parameters: + @param disposeResult — ‘YES’ means measurement has been terminated, ‘NO’ means termination failed. + @param disposeHS3ErrorBlock - refer to “error” : HS3 error instruction. +*/ +-(void)commandTurnOffBTConnectAutoResult:(DisposeResult)disposeResult DisposeErrorBlock:(DisposeHS3ErrorBlock)disposeHS3ErrorBlock; + + + +/** + Turn on Bluetooth Connection + This method can be called only for hsInstance.HS3 with FirmwareVersion>=1.0.2 + Return parameters: + @param disposeResult ‘YES’ means measurement has been terminated, ‘NO’ means termination failed. + @param disposeHS3ErrorBlock refer to “error” : HS3 error instruction. + + */ +-(void)commandTurnOnBTConnectAutoResult:(DisposeResult)disposeResult DisposeErrorBlock:(DisposeHS3ErrorBlock)disposeHS3ErrorBlock; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3Controller.h new file mode 100644 index 0000000..9a811ae --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS3Controller.h @@ -0,0 +1,32 @@ +// +// HS3Controller.h +// testShareCommunication +// +// Created by daiqingquan on 13-10-10. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import + + +/** + HS3Controller + */ +@interface HS3Controller : NSObject{ + + NSMutableArray *hs3Array; +} + +/** + * Initialize HS3 controller class + */ + ++(HS3Controller *)shareIHHs3Controller; + +/** + * Get all scale instance,use hsInstance to call HS related communication methods. + */ +-(NSArray *)getAllCurrentHS3Instace; + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4.h new file mode 100644 index 0000000..066b3ed --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4.h @@ -0,0 +1,64 @@ +// +// HS4.h +// testShareCommunication +// +// Created by daiqingquan on 13-12-2. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "HSMacroFile.h" + + +/** + HS4 + */ +@interface HS4 : NSObject +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *deviceID; +@property (strong, nonatomic) NSNumber *daiModel; +@property (retain, nonatomic) NSString *firmwareVersion; + + +/** + Establish memory and measurement connection +Import parameter: + @param tempUnit Unit displayed on HS4: HSUnit_Kg、HSUnit_LB、HSUnit_ST。 + Return parameters: + The measurement via SDK will be operated in the case of 1-4, and will be terminated if any of 5-8 occurs. The interface needs to be re-called after analyzing the return parameters. + @param unStableWeight Current weight, (Kg) [Value Range:0~180] + @param stableWeight Stable weight, (Kg) [Value Range:0~180] + @param disposeErrorBlock error code + */ +-(void)commandMeasureWithUint:(HSUnit)tempUnit Weight:(UnStableWeight)unStableWeight StableWeight:(StableWeight)stableWeight DisposeErrorBlock:(DisposeHS4ErrorBlock)disposeErrorBlock; + + + +/** + Upload memory data + + Return parameters: + @param startTransmission Start Memory transmission. + @param progress Memory transmission progress,[Range:0.0~1.0]. + @param memorryData Record data including weight (kg), measurement time,coordinated key:weight,date.[Range of weight 0.0~180.0(kg)] + @param finishTransmission Finish memory transmission. + @param disposeErrorBlock Record the error code in uploading process. + */ +-(void)commandTransferMemorryData:(StartHS4Transmission)startTransmission DisposeProgress:(DisposeProgress)progress MemorryData:(MemorryData)memorryData FinishTransmission:(FinishHS4Transmission)finishTransmission DisposeErrorBlock:(DisposeHS4ErrorBlock)disposeErrorBlock; + +/** + * End Current Measure Connection + * @param result - the result of end current action + * @param disposeErrorBlock - error code + * Error code definition ---refer to “error” : HS4 error instruction. +*/ + +-(void)commandEndCurrentConnection:(DisposeResult)result DisposeErrorBlock:(DisposeHS4ErrorBlock)disposeErrorBlock; + +/** + Disconnect current device + */ + +-(void)commandDisconnectDevice; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4Controller.h new file mode 100644 index 0000000..57e436c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS4Controller.h @@ -0,0 +1,26 @@ +// +// HS4Controller.h +// testShareCommunication +// +// Created by daiqingquan on 13-12-2. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import + +/** + HS4Controller + */ +@interface HS4Controller : NSObject + +/** + * Initialize HS4 controller class + */ ++(HS4Controller *)shareIHHs4Controller; + +/** + * Get all scale instance,use hsInstance to call HS related communication methods. + */ +-(NSArray *)getAllCurrentHS4Instace; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5.h new file mode 100644 index 0000000..632ca4f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5.h @@ -0,0 +1,141 @@ +// +// HS5.h +// testShareCommunication +// +// Created by zhiwei jing on 13-10-22. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "HealthUser.h" +#import "HSMacroFile.h" + + + +/** + HS5 + */ +@interface HS5 : NSObject + +@property (retain, nonatomic) NSString *currentUUID; +@property (retain, nonatomic) NSString *deviceID; +@property (retain, nonatomic) NSString *firmwareVersion; +@property (retain, nonatomic) NSString *modelNumber; + + + +/** + Establish memory and measurement connection + +Import Parameters: + @param tempUser included properties: userAccount、clientID、clientSecret。 + userAccount: either email or mobile phone number (mobile phone number is not currently supported yet) + height: the height of a user (cm); + clientID & clientSecret: the only identification for users of the SDK, requires registration from iHealth administrator, please email: heguangming@ihealthlabs.com.cn for more information. + + Return Parameters: + The measurement via SDK will be operated in the case of 1-3, and will be terminated if any of 4-8 occurs. The interface needs to be re-called after analyzing the return parameters. + Notice: when a new user registers via SDK, an ‘iHealth disclaimer’ will pop up automatically, and will require the user to agree in order to continue. SDK applications require an Internet connection; UserAuthen_TrySuccess is invalidate for HS5. + @param serialNub The only identification of a user,should be reserved in third party apps,provide to other Apps [Range:0~0xFFFFFFF] + @param MemorryUserListHS5Data Existing user info in HS5,including serialNub、Position of users. Related key: serialNumber、position + @param disposeErrorBlock error codes in transmission process: Errors in HS5 + */ +-(void)commandCreateUserManageConnectWithUser:(HealthUser *)tempUser currentUserSerialNub:(CurrentSerialNub)serialNub deviceUserList:(MemorryUserListHS5Data) MemorryUserListHS5Data Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; + +/** + * Create new user + * Use the function if the SerialNub of current user is not included in user list of HS5 and the user number is less than 20 + * Import parameters: + * @param tempUser - included properties: serialNub、age、birthday、height、isAthlete、sex。 + * serialNub: The only identification for user [Range:0~0x7FFFFFFF] + * age:user's age Range:7~99 + * birthday: User’s birthday, NSDate + * height: User’s height, (cm) Range:81~219 + * isAthlete: If user is an athelete, UserIsAthelete_No: no, UserIsAthelete_Yes: Yes + * sex: User’s sex, UserSex_Female: female, UserSex_Male: male + * @param tempPosition - Position of user, range: 0~19, pick from empty position that has never been occupied + * Return Parameters: + * @param disposeHS5Result - Success:Yes,Fail:No. + * @param disposeErrorBlock - error codes in transmission process: Errors in HS5 +*/ +-(void)commandCreateUser:(HealthUser *)tempUser position:(uint8_t )tempPosition DisposeHS5Result:(DisposeHS5Result)disposeHS5Result Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; + + +/** + * Edit User Info + * If the SerialNub of current user already exists in the user list of HS5, this will be used when user info is changed. + *Import Parameters: + * @param tempUser - included properties: serialNub、birthday、height、isAthlete、sex,instructions refer to “new user Api”. + *Return Parameters: + * @param disposeHS5Result - Success:Yes,Fail:No. + * @param disposeErrorBlock - error codes in transmission process: Errors in HS5 + */ +-(void)commandModifyUser:(HealthUser *)tempUser DisposeHS5Result:(DisposeHS5Result)disposeHS5Result Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; + +/** + * Delete Specified User + * This will be used deleting account in HS5. + *Import Parameters: + * @param tempUser - included properties: serialNub,instructions refer to “new user Api”. + *Return Parameters: + * @param disposeHS5Result - Success:Yes,Fail:No. + * @param disposeErrorBlock - error codes in transmission proces: Errors in HS5 + */ +-(void)commandDelteUser:(HealthUser *)tempUser DisposeHS5Result:(DisposeHS5Result)disposeHS5Result Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; + + + + +/** + Create memory upload connection + Import Parameters: + @param tempUser included properties: serialNub [Range:0~0x7FFFFFFF],instructions refer to “new user Api”. + Return Parameters: + @param disposeHS5Result Success:Yes,Fail:No. + @param startTransmission Finish memory transmission. + @param progress Memory transmission progress,0.0~1.0. + @param memorryData Record data,More details and key refer Measure API. Additionally add time-measure property, related key: date.dataID + @param finishTransmission Finish Memory Transmission + @param disposeErrorBlock error codes in transmission process: Errors in HS5 + */ +-(void)commandCreateMemoryWithUser:(HealthUser *)tempUser uploadConnect: (DisposeHS5Result)disposeHS5Result TransferMemorryData:(StartHS5Transmission)startTransmission DisposeProgress:(DisposeHS5Progress)progress MemorryData:(MemorryHS5Data)memorryData FinishTransmission:(FinishHS5Transmission)finishTransmission Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; + + +/** + * Establish Measurement Connection + * Import Parameters: + * @param tempUser - included properties: serialNub [Range:0~0x7FFFFFFF]、height,instructions refer to “new user Api”. + * Return Parameters: + * @param unStableHS5Weight - Current weight, (kg) [Value Range:0.0~150.0] + * @param stableHS5Weight - Stable weight, (kg) [Value Range:0.0~150.0] + * @param impedanceWeight - Weight by impedence, (kg)[Value Range:0.0~150.0] + * @param bodyCompositionMeasurements - body info, includes weight(kg) Range:0.0~150.0, fat content(%) Rnage:0.0~100.0, water content(%) Range:0.0~100.0, muscle content(%) Rnage:0.0~100.0, bone mass Range:0.0~25.5, visceral fat level Range:0~255, DCI(Kcal) Range:0~65535. keys: weight, weightFatValue, waterValue, muscleValue, skeletonValue, VFatLevelValue, DCIValue, dataID + * @param disposeErrorBlock - error codes in transmission process: Errors in HS5 + */ + +-(void)commandCreateMeasureWithUser:(HealthUser *)tempUser unStableWeight:(UnStableHS5Weight)unStableHS5Weight MeasureWeight:(StableHS5Weight)stableHS5Weight ImpedanceType:(ImpedanceWeight)impedanceWeight BodyCompositionMeasurements:(BodyCompositionMeasurements)bodyCompositionMeasurements Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; + + + + +/** + Stop Current Action and disconnect + Return Parameters: + @param disposeHS5Result Success:Yes,Fail:No. + @param disposeErrorBlock error codes in endCurrentConnect: Errors in HS5 + */ +-(void)commandEndCurrentConnect:(DisposeHS5Result)disposeHS5Result Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; +/** + * Clean HS5 + * Explanation:Delete current Auten Device and then rebuild connection. + * Return Parameters: + * @param disposeHS5Result - Success:Yes,Fail:No. + * @param disposeErrorBlock - error codes in transmission process: Errors in HS5 + */ +-(void)commandcleanDeviceDisposeHS5Result:(DisposeHS5Result)disposeHS5Result Disposehs5ErrorBlock:(DisposeHS5ErrorBlock)disposeErrorBlock; + +/** + * Rebuild UDP connection + */ +-(void)commandRebuildUdpLinker; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5Controller.h new file mode 100644 index 0000000..7ad4965 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS5Controller.h @@ -0,0 +1,38 @@ +// +// HS5Controller.h +// testShareCommunication +// +// Created by zhiwei jing on 13-10-22. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "HSMacroFile.h" + + +/** + HS5Controller + */ +@interface HS5Controller : NSObject + +/** + * Initialize HS5 controller class + */ ++(HS5Controller *)shareIHHs5Controller; + +/** + * Get all scale instance,use hsInstance to call HS related communication methods. + */ +-(NSArray *)getAllCurrentHS5Instace; + +//Acquire HS5 data from cloud +//When connected to the internet, HS5 could upload measurement to cloud to be recorded. Get data in cloud using the below API. +-(void)getDownloadDataFromCloud:(BlockDataFromCloud )dataBlock; + +/*Start search HS5*/ +-(void)commandStartSearchScale; + +/*Stop search HS5*/ +-(void)commandStopSearchScale; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSHeader.h new file mode 100644 index 0000000..f6f7543 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSHeader.h @@ -0,0 +1,25 @@ +// +// HSHeader.h +// HSDemoCode +// +// Created by zhiwei jing on 14-7-28. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#ifndef HSDemoCode_HSHeader_h +#define HSDemoCode_HSHeader_h + +#import "HealthUser.h" +#import "HS3.h" +#import "HS2.h" +#import "HS4.h" +#import "HS5.h" +#import "HS3Controller.h" +#import "HS2Controller.h" +#import "HS4Controller.h" +#import "HS5Controller.h" +#import "HSMacroFile.h" +#import "iHealthHS6.h" +#import "HS2S.h" +#import "HS2SController.h" +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSMacroFile.h new file mode 100644 index 0000000..fc3e117 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HSMacroFile.h @@ -0,0 +1,709 @@ +// +// HSMacroFile.h +// HSDemoCode +// +// Created by zhiwei jing on 14-7-23. +// Copyright (c) 2014年 zhiwei jing. All rights reserved. +// + +#import "HealthUser.h" + +#ifndef HSDemoCode_HSMacroFile_h +#define HSDemoCode_HSMacroFile_h + +#define RecordLength 16 + + + +/** + HS2 Device Error Code + */ +typedef NS_ENUM(NSInteger,HS2DeviceError){ + /// Battery level is low + HS2DeviceLowPower = 1, + /// The Scale failed to initialize + HS2DeviceEr0 = 2, + /// Maximum weight has been exceeded + HS2DeviceEr1 = 3, + /// The Scale can't capture a steady reading + HS2DeviceEr2 = 4, + /// Bluetooth connection error + HS2DeviceEr4 = 5, + /// Movement while measuring + HS2DeviceEr7 = 6, + ///Invalidate + HS2DeviceEr8 = 7, + /// Scale memory access error + HS2DeviceEr9 = 8, + /// No memory 9 + HS2DataZeor = 9, + ///Device disconnect + HS2DeviceDisconnect = 10, + /// Communication error + HS2DeviceSendTimeout = 11, + /// DeviceRecWeightError + HS2DeviceRecWeightError = 12, +}; +/** + HS2S Device Error Code + */ +typedef NS_ENUM(int, HS2SDeviceError) { + HS2SDeviceError_Unknown = -1,// device send wrong error code + HS2SDeviceError_CommunicationTimeout = 0, + HS2SDeviceError_ReceivedCommandError, + HS2SDeviceError_InputParameterError, + HS2SDeviceError_MoreThanMaxNumbersOfUser, + HS2SDeviceError_WriteFlashError, + HS2SDeviceError_UserNotExist, + HS2SDeviceError_StartMeasureError, + HS2SDeviceError_MeasureTimeout, + HS2SDeviceError_MeasureOverweight, + HS2SDeviceError_Disconnect, + HS2SDeviceError_Unsupported, +}; + + +/** + HS3 Device Error Code + */ +typedef NS_ENUM(NSInteger,HS3DeviceError){ + /// Low battery + HS3DeviceLowPower = 1, + /// Weight capacity is exceeded + HS3DeviceEr2 = 2, + /// The Scale calibration error + HS3DeviceEr4 = 3, + /// Movement while measuring + HS3DeviceEr7 = 4, + /// No memory + HS3DataZeor = 5, //No memory + /// Device disconnect + HS3DeviceDisconnect = 6, + /// Communication error + HS3DeviceSendTimeout = 7, +}; + + +/** + HS4 Device Error Code + */ +typedef NS_ENUM(NSInteger,HS4DeviceError){ + /// Battery level is low + HS4DeviceLowPower = 1, // Battery level is low + /// The Scale failed to initialize + HS4DeviceEr0 = 2, + /// Maximum weight has been exceeded + HS4DeviceEr1 = 3, + /// The Scale can't capture a steady reading + HS4DeviceEr2 = 4, + /// Bluetooth connection error + HS4DeviceEr4 = 5, + /// Movement while measuring + HS4DeviceEr7 = 6, + /// Invalidate + HS4DeviceEr8 = 7, + /// Scale memory access error + HS4DeviceEr9 = 8, + /// No memory + HS4DataZeor = 9 , + /// Device disconnect + HS4DeviceDisconnect = 10, + /// Communication error + HS4DeviceSendTimeout = 11, // Communication error + /// Device Recive Weight Error + HS4DeviceRecWeightError = 12, +}; + +/** + HS5 error + */ +typedef NS_ENUM(NSInteger,HS5DeviceError){ + /// Communication error + IHSCOverTimeError = 0, + /// Communication Error + IHSCUserInScale=5, + /// Make sure batteries are installed correctly, if the problem persists, replace with a new set of batteries. + IHSCLowPower=6, + /// Remove the batteries, wait 1 minute and then replace with a new set of batteries. + IHSCScaleEr0=7, + /// The current weight may be beyond the measurement range of 330 lbs/150 kg. + IHSCScaleEr1=8, + /// Stand still on all four electrodes with bare feet. + IHSCScaleEr2=9, + /// Communication Error + IHSCScaleEr7=10, + /// Communication Error + IHSCScaleEr8=11, + /// Communication Error + IHSCScaleEr9=12, + /// Scale is busy + IHScaleBusy=13, + /// No memory + HS5DataZeor=14,// No memory + /// Scale Create User Test Error + IHSCScaleCreateUserTestError = 15, + /// Device disconnect + HS5Disconnect = 16, + /// User verify error + HS5UserInvalidate = 400 +}; + +//HS6 Unit + +/** + HS6 Unit + + */ +typedef NS_ENUM(NSInteger,IHHS6SDKUnitWeight){ + /// kg + IHHS6SDKUnitWeight_kg = 0, + /// lb + IHHS6SDKUnitWeight_lbs, + /// st + IHHS6SDKUnitWeight_oz, +}; + +#pragma mark HS2 Block + +/** + Result + + @param resetSuc reset Success + */ +typedef void (^DisposeHS2Result)(BOOL resetSuc); + +/** + HS4 error + + @param errorID error number + */ +typedef void (^DisposeHS2ErrorBlock)(HS2DeviceError errorID); + + +/** +Start transfer Memory Dictionary(5) + + @param startDataDictionary Memory Data Dictionary + */ +typedef void (^StartHS2Transmission)(NSDictionary *startDataDictionary); + +/** + Memory transmission progress + + @param progress progress 0.0~1.0. + */ +typedef void (^DisposeHS2Progress)(NSNumber *progress); +//data including weight (kg), measurement time,coordinated key:weight,date. + +/** + historyDataArray including weight (kg), measurement time,coordinated key:weight,date. + + @param historyDataArray historyDataArray + */ +typedef void (^HS2MemorryData)(NSArray *historyDataArray); + +/** + Finish memory transmission. + */ +typedef void (^FinishHS2Transmission)(void); +//Current weight, (Kg) + +/** + Current unstable weight, (Kg) + + @param unStableWeight unStableWeight + */ +typedef void (^HS2UnStableWeight)(NSNumber *unStableWeight); +//Stable weight, (Kg) + +/** + StableWeightDictionary including stableweight(kg),time,dataID + + @param StableWeightDic StableWeightDictionary + */ +typedef void (^HS2StableWeight)(NSDictionary *StableWeightDic); + +/** + DisposeSendHS2DataBlock + */ +typedef void (^DisposeSendHS2DataBlock)(void); + +/** + HS2 battery + + @param battary battery + */ +typedef void (^DisposeHS2BatteryBlock)(NSNumber *battary); + + +#pragma mark HS3 Block +/** + deviceID + + @param weightID deviceID + */ +typedef void(^WeightID)(NSString *weightID); +//HS3Error + +/** + HS3 Device Error + + @param errorID errorID + */ +typedef void (^DisposeHS3ErrorBlock)(HS3DeviceError errorID); + +/** + Memory Number,0~200. + + @param uploadDataNum Memory Number + */ +typedef void (^DisposeHS3UploadDataNum)(NSNumber *uploadDataNum); + +/** + Memory transmission progress,0.0~1.0. + + @param progress Transmission progress + */ +typedef void (^DisposeHS3Progress)(float progress); + +/** + historyData including weight(kg), measure time,coordinated key:weight、date. + + @param historyDataDic historyDataDictionary + */ +typedef void (^HS3MemorryData)(NSDictionary *historyDataDic); +//Start transmission + +/** + Start transmission + + @param startTransmission YES or NO + */ +typedef void (^StartHS3Transmission)(BOOL startTransmission); + +/** + Finish memory transmission. + */ +typedef void (^FinishHS3Transmission)(void); + +/** + Stable weight (Kg) + + @param StableWeightDic StableWeightNSDictionary + */ +typedef void (^StableHS3Weight)(NSDictionary *StableWeightDic); + +/** + FinishHS3Init + */ +typedef void (^FinishHS3Init)(void); + +/** + DisposeResult + + @param resetSuc YES or NO + */ +typedef void (^DisposeResult)(BOOL resetSuc); + + +#pragma mark HS4 Block +/** + DisposeResult + + @param resetSuc YES or NO + */ +typedef void (^DisposeResult)(BOOL resetSuc); + +/** + HS4 error + + @param errorID errorID + */ +typedef void (^DisposeHS4ErrorBlock)(HS4DeviceError errorID); + +/** + Start Memory transmission + + @param startDataDictionary startDataDictionary + */ +typedef void (^StartHS4Transmission)(NSDictionary *startDataDictionary); + +/** + Memory transmission progress,0.0~1.0. + + @param progress progress + */ +typedef void (^DisposeProgress)(NSNumber *progress); + +/** + historyDataArray data including weight (kg), measurement time,coordinated key:weight,date. + + @param historyDataArray historyDataArray + */ +typedef void (^MemorryData)(NSArray *historyDataArray); + +/** + Finish memory transmission. + */ +typedef void (^FinishHS4Transmission)(void); + +/** + Current unstableweight, (Kg) + + @param unStableWeight unStableWeight + */ +typedef void (^UnStableWeight)(NSNumber *unStableWeight); + +/** + Stable weight,(Kg) + + @param StableWeightDic StableWeightDictionary + */ +typedef void (^StableWeight)(NSDictionary *StableWeightDic); + +/** + SendHS4DataBlock + */ +typedef void (^DisposeSendHS4DataBlock)(void); + + +#pragma mark HS5 Block + +/** + Existing user info in HS5,including serialNub、Position of users. Related key: serialNumber、position + + @param userListDataArray userListDataArray + */ +typedef void (^MemorryUserListHS5Data)(NSArray *userListDataArray); + +/** + HS5 result + + @param resetSuc reset success + */ +typedef void (^DisposeHS5Result)(BOOL resetSuc); + +/** + HS5 error + + @param errorID errorID + */ +typedef void (^DisposeHS5ErrorBlock)(HS5DeviceError errorID); + +/** + Start memory transmission. + + @param startHS5Transmission startHS5Transmission + */ +typedef void (^StartHS5Transmission)(BOOL startHS5Transmission); + +/** + progress: Memory transmission progress,0.0~1.0. + + @param progress progress + */ +typedef void (^DisposeHS5Progress)(NSNumber *progress); + +/** + Record data,More details and key refer Measure API. Additionally add time-measure property, related key: date. + + @param historyDataDic historyDataDictionary + */ +typedef void (^MemorryHS5Data)(NSDictionary *historyDataDic); + +/** + Finish Memory Transmission + + @param finishHS5Transmission YES or NO + */ +typedef void (^FinishHS5Transmission)(BOOL finishHS5Transmission); + +/** + Current unstableweight, (kg) + + @param unStableWeight unStableWeight + */ +typedef void (^UnStableHS5Weight)(NSNumber *unStableWeight); + +/** + Stable weight, (kg) + + @param StableWeight StableWeight + */ +typedef void (^StableHS5Weight)(NSNumber *StableWeight); + +/** + Weight by impedence, (kg) + + @param ImpedanceWeight ImpedanceWeight + */ +typedef void (^ImpedanceWeight)(NSNumber*ImpedanceWeight); + +/** + body info, includes weight(kg), fat content(%), water content(%), muscle content(%), bone mass, visceral fat level, DCI(Kcal). keys: weight, weightFatValue, waterValue, muscleValue, skeletonValue, VFatLevelValue, DCIValue + + + @param BodyCompositionInforDic BodyCompositionInforDictionary + */ +typedef void (^BodyCompositionMeasurements)(NSDictionary*BodyCompositionInforDic); + +/** + superPassword + + @param superPassword superPassword + */ +typedef void (^GetScaleSuperPassword)(NSString*superPassword); + +/** + CurrentSerialNub + + @param serialNub serialNub + */ +typedef void (^CurrentSerialNub)(NSInteger serialNub); + +/** + SendHS5DataBlock + */ +typedef void (^DisposeSendHS5DataBlock)(void); + + +#pragma mark HS6 Block + +/** + Set HS6 wifi success with device infomation + + @param deviceInfo deviceInfo + */ +typedef void (^DisposeHS6SuccessBlock)(NSDictionary* deviceInfo); + +/** + Set HS6 wifi fail + + @param failmsg fail message + */ +typedef void (^DisposeHS6FailBlock)(NSString* failmsg); + +/** + Set HS6 end + + @param deviceDic deviceDictionary + */ +typedef void (^DisposeHS6EndBlock)(NSDictionary* deviceDic); + +/** + HS6 error + + @param error error number + */ +typedef void (^DisposeHS6ErrorBlock)(NSNumber* error); + +/** + Binding QR Device + + @param resultArray resultArray + */ +typedef void(^BinedQRDeviceBlock)(NSArray *resultArray); +/** + Binding QR Device error + + @param errorCode errorCode + */ +typedef void(^BinedQRDeviceErrorBlock)(NSString *errorCode); + +/** + unbind QRDevice + + @param resultArray resultArray + */ +typedef void(^DisBinedQRDeviceBlock)(NSArray *resultArray); + +/** + unbind QRDevice error + + @param errorCode errorCode + */ +typedef void(^DisBinedQRDeviceErrorBlock)(NSString *errorCode); + +/** + getOpenApi + + @param openAPIInfoDic openAPIInfoDictionary + */ +typedef void (^DisposeHS6GetOpenAPISuccessBlock)(NSDictionary* openAPIInfoDic); + +/** + GetOpenAPIError + + @param errorCode errorCode + */ +typedef void (^DisposeHS6GetOpenAPIErrorBlock)(NSDictionary *errorCode); + +/** + sync Weight Unit + + @param syncWeightUnit syncWeightUnit + */ +typedef void (^DisposeHS6SyncWeightUnitSuccessBlock)(BOOL syncWeightUnit); + +/** + Sync Weight Unit Error + + @param errorCode errorCode + */ +typedef void (^DisposeHS6SyncWeightUnitErrorBlock)(NSString *errorCode); + + +//typedef void (^BlockUserAuthentication)(UserAuthenResult result); + +/** + the result of userID + + @param dataArray dataArray + */ + +typedef void (^BlockDataFromCloud)(NSArray *dataArray); + +typedef void (^BlockHS6DataFromCloud)(NSDictionary *dataDic); + +typedef void (^BlockHS6LastTSFromCloud)(NSNumber *lastTS); + +#pragma mark HS2S Block + + +/** + Result + + @param deviceInfo deviceInfo + */ +typedef void (^DisposeHS2SDeviceInfo)(NSDictionary*deviceInfo); + +/** + HS2S error + + @param errorID error number + */ +typedef void (^DisposeHS2SErrorBlock)(HS2SDeviceError errorID); + +/** + HS2S battery + + @param battary battery + */ +typedef void (^DisposeHS2SBatteryBlock)(NSNumber *battary); + +/** + HS2S UserInfo + + + @param userInfo userInfo + */ +typedef void (^DisposeHS2SUserInfo)(NSDictionary*userInfo); + +/** + Result + + @param result reset Success + */ +typedef void (^DisposeHS2SResult)(BOOL result); + +/** + HS2S memory count + + @param count count + */ +typedef void (^DisposeHS2SMemoryCountBlock)(NSNumber *count); + +/** + HS2S memory data + + @param data data + */ +typedef void (^DisposeHS2SMemoryDataBlock)(NSArray *data); + +/** + HS2S memory count + + @param count count + */ +typedef void (^DisposeHS2SAnonymousMemoryCountBlock)(NSNumber *count); + +/** + HS2S memory data + + @param data data + */ +typedef void (^DisposeHS2SAnonymousMemoryDataBlock)(NSArray *data); +/** + Current unstableweight, (Kg) + + @param unStableWeight unStableWeight + */ +typedef void (^DisposeHS2SUnStableWeight)(NSNumber *unStableWeight); + +/** + Stable weight,(Kg) + + @param stableWeight StableWeight + */ +typedef void (^DisposeHS2SStableWeight)(NSNumber *stableWeight); + +/** + weightAndBodyInfoDic + + @param weightAndBodyInfoDic weightAndBodyInfoDic + */ +typedef void (^DisposeHS2SWeightAndBodyInfo)(NSDictionary *weightAndBodyInfoDic); + + +/** + Heart Result + + @param heartResultDic + */ +typedef void (^DisposeHS2SHeartResult)(NSDictionary *heartResultDic); + + +/** + MeasurementStatus + + @param measurementStatus + */ +typedef void (^DisposeHS2SMeasurementStatus)(NSNumber *measurementStatus); + + + +typedef void (^DisposeHS2SMeasureFinish)(void); + +#define HS3ConnectNoti @"HS3ConnectNoti" +#define HS3DisConnectNoti @"HS3DisConnectNoti" + +#define HS2Discover @"HS2Discover" +#define HS2ConnectFailed @"HS2ConnectFailed" +#define HS2ConnectNoti @"HS2ConnectNoti" +#define HS2DisConnectNoti @"HS2DisConnectNoti" + +#define HS2SDiscover @"HS2SDiscover" +#define HS2SConnectFailed @"HS2SConnectFailed" +#define HS2SConnectNoti @"HS2SConnectNoti" +#define HS2SDisConnectNoti @"HS2SDisConnectNoti" + +#define HS4Discover @"HS4Discover" +#define HS4ConnectFailed @"HS4ConnectFailed" +#define HS4ConnectNoti @"HS4ConnectNoti" +#define HS4DisConnectNoti @"HS4DisConnectNoti" + + +#define HS5ConnectNoti @"HS5ConnectNoti" +#define HS5DisConnectNoti @"HS5DisConnectNoti" + +#define HSDeviceID @"ID" +#define HSSDKRightApi @"OpenApiWeight" + + +#define ContinuaHSDiscover @"ContinuaHSDiscover" +#define ContinuaHSConnectFailed @"ContinuaHSConnectFailed" +#define ContinuaHSConnectNoti @"ContinuaHSConnectNoti" +#define ContinuaHSDisConnectNoti @"ContinuaHSDisConnectNoti" + + +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthHeader.h new file mode 100644 index 0000000..83ca80f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthHeader.h @@ -0,0 +1,67 @@ +// +// HealthHeader.h +// iHealthDemoCode +// +// Created by zhiwei jing on 1/25/16. +// Copyright © 2016 zhiwei jing. All rights reserved. +// + +#ifndef HealthHeader_h +#define HealthHeader_h + +typedef NS_ENUM(NSUInteger, HealthDeviceType) { + //AM + HealthDeviceType_AM3, + HealthDeviceType_AM3S, + HealthDeviceType_AM4, + //BP + HealthDeviceType_BP3L, + HealthDeviceType_BP5SRW, + HealthDeviceType_BP5S, + HealthDeviceType_BP7S, + HealthDeviceType_KN550BT, + HealthDeviceType_KD926, + HealthDeviceType_KD723, + HealthDeviceType_ABPM, + //PO + HealthDeviceType_PO3, + //HS + HealthDeviceType_HS4, + HealthDeviceType_HS2, + //ECG + HealthDeviceType_ECG3, + //BG + HealthDeviceType_BG5S, + //HTS + HealthDeviceType_TS28B, + HealthDeviceType_CONTINUA_BP, + HealthDeviceType_CONTINUA_BG, + HealthDeviceType_CONTINUA_PO, + HealthDeviceType_CONTINUA_HS, + HealthDeviceType_THV3, + //BLE Device + HealthDeviceType_HS3, + HealthDeviceType_HS5, + HealthDeviceType_BP3, + HealthDeviceType_BP5, + HealthDeviceType_BP7, + HealthDeviceType_ABI, + HealthDeviceType_BG1, + HealthDeviceType_BG3, + HealthDeviceType_BG5, + HealthDeviceType_USBECG, + HealthDeviceType_HS6, + HealthDeviceType_AM5, + HealthDeviceType_BP5C, + HealthDeviceType_HS2S, + HealthDeviceType_BG1S, + HealthDeviceType_NT13B, + HealthDeviceType_PT3SBT, + HealthDeviceType_PO1, +}; + +#import "ScanDeviceController.h" +#import "ConnectDeviceController.h" + + +#endif /* HealthHeader_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthUser.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthUser.h new file mode 100644 index 0000000..03fc9f9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HealthUser.h @@ -0,0 +1,126 @@ +// +// HealthUser.h +// iHealthDemoCode +// +// Created by jing on 16/5/13. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + + +typedef enum{ + UserAuthen_RegisterSuccess = 1,//New-user registration succeeded + UserAuthen_LoginSuccess,// User login succeeded + UserAuthen_CombinedSuccess,// The user is iHealth user as well, measurement via SDK has been activated, and the data from the measurement belongs to the user + UserAuthen_TrySuccess,//Testing without Internet connection succeeded + UserAuthen_InvalidateUserInfo,//Userid/clientID/clientSecret verification failed + UserAuthen_SDKInvalidateRight,//SDK has not been authorized + UserAuthen_UserInvalidateRight,//User has not been authorized + UserAuthen_InternetError,//Internet error, verification failed + UserAuthen_AppSecretVerifySuccess, // appsecrect is right + UserAuthen_AppSecretVerifyFailed, //appsecrect error + UserAuthen_InputError, //Input error + UserAuthen_CertificateExpired, //Certificate expired + UserAuthen_InvalidCertificate, //Invalid certificate +}UserAuthenResult; + +//User +typedef enum{ + LengthUnit_Mile = 0, + LengthUnit_Kilometer, +}LengthUnit; + +typedef enum{ + UserSex_Female = 0, + UserSex_Male, +}UserSex; + +typedef enum{ + UserType_Guest = 0, + UserType_Normal, +}HS2SUserType; +typedef enum{ + HS2SImpedanceMark_NO = 0, + HS2SImpedanceMark_YES, +}HS2SImpedanceMark; +typedef enum{ + HS2SFitnessMark_NO = 0, + HS2SFitnessMark_YES, +}HS2SFitnessMark; + +typedef enum{ + HSUnit_Kg = 1, //kg + HSUnit_LB, //lb + HSUnit_ST //st +}HSUnit; + +typedef enum{ + UserIsAthelete_No = 0, //No athelete + UserIsAthelete_Yes //athelete +}UserIsAthelete; + + +typedef enum{ + AppSecretVerifySucess = 1, + AppSecretVerifyFailed +}AppSecretVerifyStatus; + +typedef enum{ + iHealthSDK_BP= 0, + iHealthSDK_BG, + iHealthSDK_HS, + iHealthSDK_PO, + iHealthSDK_AM, + iHealthSDK_ECG, + iHealthSDK_TH, + iHealthSDK_All +}SDKDeviceAccessType; + +typedef void(^DisposeSDKUserDeviceAccess)(NSArray*DeviceAccessArray); + +typedef void(^DisposeSDKUserValidationSuccess)(UserAuthenResult result); + +typedef void(^DisposeSDKUserValidationReturn)(NSString *userID); + +typedef void (^DisposeSDKUserValidationErrorBlock)(UserAuthenResult errorID); + + + +@interface HealthUser : NSObject + + +@property (nonatomic, strong) NSString * clientID; +@property (nonatomic, strong) NSString * clientSecret; +@property (nonatomic, strong) NSString * userID; +@property (nonatomic, strong) NSString * userAccount; +@property (nonatomic, strong) NSString * certificatePath; +@property (nonatomic, strong) NSString * certificateSecret; + +@property (nonatomic, strong) NSNumber * serialNub; +@property (nonatomic, strong) NSDate *birthday; +@property (nonatomic, strong) NSNumber *age; + +//unit:cm +@property (nonatomic, strong) NSNumber * height; +//kg +@property (strong, nonatomic)NSNumber *weight; +//invalidate +@property (strong, nonatomic)NSNumber *bmr; +//activityLevel=1, Sedentary,spend most of day sitting. +//activityLevel=2, Active,spend a good part of day doing some physical activity. +//activityLevel=3, Very Active,spend most of day doing heavy physical activity. +@property (strong, nonatomic)NSNumber *activityLevel; + +@property UserIsAthelete isAthlete; +@property UserSex sex; +@property LengthUnit lengthUnit; + +@property HS2SUserType userType; +@property HS2SImpedanceMark impedanceMark; +@property HS2SFitnessMark fitnessMark; +@property NSInteger newDevice; +@property NSInteger createTS; +@property (nonatomic, strong) NSData * hs2SUserID; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBindEnum.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBindEnum.h new file mode 100755 index 0000000..f73c91a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBindEnum.h @@ -0,0 +1,49 @@ +// +// IDOBindEnum.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/3. +// Copyright © 2019 何东阳. All rights reserved. +// + +#ifndef IDOBindEnum_h +#define IDOBindEnum_h + +/** + * 绑定状态枚举 + * Binding status enumeration + */ +typedef NS_ENUM(NSInteger, IDO_BIND_STATUS) { + /** + * 绑定失败 + * Binding failed + */ + IDO_BLUETOOTH_BIND_FAILED = 0, + + /** + * 绑定成功 + * Binding succeeded + */ + IDO_BLUETOOTH_BIND_SUCCESS, + + /** + * 已经绑定 + * Already bound + */ + IDO_BLUETOOTH_BINDED, + + /** + * 需要授权绑定 + * Need authorization binding + */ + IDO_BLUETOOTH_NEED_AUTH, + + /** + * 拒绝绑定 + * Rejected binding + */ + IDO_BLUETOOTH_REFUSED_BINDED, + +}; + +#endif /* IDOBindEnum_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueDataResponse.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueDataResponse.h new file mode 100755 index 0000000..d316b52 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueDataResponse.h @@ -0,0 +1,66 @@ +// +// IDOBlueDataResponse.h +// IDOBlueProtocol +// +// Created by 何东阳 on 2019/5/8. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface IDOBlueDataResponse : NSObject + +/** + * 获取扫描的服务 + * [manager scanForPeripheralsWithServices:services options:@{CBCentralManagerScanOptionAllowDuplicatesKey:@YES}]; + * get the scan service + */ ++ (NSArray *)getScanServices; + +/** + * 判断当前外围设备是否为OTA模式 + * whether the current peripheral is in OTA mode + */ ++ (BOOL)isOtaModeWithPeripheral:(CBPeripheral *)peripheral; + +/** + * manager :当前蓝牙管理中心 + * peripheral : 当前外接设备 + * serviceIndex : 当前发现服务的索引 默认传0不作服务索引判断 + * current bluetooth management center + * current bluetooth peripheral + * serviceIndex : the index of the current discovered service is set to 0 by default without service index judgment + */ ++ (void)blueManager:(CBCentralManager *)manager + peripheral:(CBPeripheral *)peripheral + serviceIndex:(NSInteger)serviceIndex + didConnected:(void(^)(BOOL isOta))callback; + +/** + * 连接外围设备成功后发现外围设备特征 + * - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error + * after successfully connecting the peripheral device, peripheral device characteristics are found. + */ ++ (void)findCharac:(CBPeripheral *)peripheral + service:(CBService *)service; + +/** + * 蓝牙接收到手环返回的数据 + * - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error + * bluetooth receives data from the ring + */ ++ (void)didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic; + +/** + * 蓝牙写完数据的回调 + * - (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(nullable NSError *)error + * bluetooth writes a callback to the data + */ ++ (void)didWriteValueForCharacteristic:(CBCharacteristic *)characteristic + error:(NSError *)error; +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueEnum.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueEnum.h new file mode 100755 index 0000000..2303091 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBlueEnum.h @@ -0,0 +1,213 @@ +// +// IDOBlueEnum.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/3. +// Copyright © 2019 何东阳. All rights reserved. +// + +#ifndef IDOBlueEnum_h +#define IDOBlueEnum_h + +/** + * 蓝牙扫描设备模式枚举 + * Bluetooth scanning device mode enumeration + */ +typedef NS_ENUM(NSInteger, IDO_SCAN_DEVICE_MODE) { + /** + * 手机蓝牙关闭或不支持蓝牙功能将不能扫描设备 + * Mobile phone Bluetooth off or not supporting Bluetooth will not scan the device + */ + IDO_DO_NOT_SCAN_MODE = 0, + + /** + * 手动扫描连接模式 + * Manual scan connection mode + */ + IDO_MANUAL_SCAN_CONNECT_MODE, + + /** + * 系统蓝牙列表扫描连接模式 + * System bluetooth list scan connection mode + */ + IDO_SYSTEM_LIST_SCAN_CONNECT_MODE, + + /** + * 自动扫描连接模式 + * MAutomatic scan connection mode + */ + IDO_AUTO_SCAN_CONNECT_MODE, + +}; + +/** + * 蓝牙管理状态枚举 + * Bluetooth management status enumeration + */ +typedef NS_ENUM(NSInteger, IDO_BLUETOOTH_MANAGER_STATE) { + /** + * 蓝牙关闭 + * Bluetooth off + */ + IDO_MANAGER_STATE_POWEREDOFF = 1, + + /** + * 蓝牙打开 + * Bluetooth open + */ + IDO_MANAGER_STATE_POWEREDON, + + /** + * 蓝牙自动扫描中 + * Bluetooth automatic scanning + */ + IDO_MANAGER_STATE_AUTO_SCANING, + + /** + * 在ota模式自动连接 + * Automatically connect in ota mode + */ + IDO_MANAGER_STATE_AUTO_OTA_CONNECT, + + /** + * 普通模式自动连接 + * Normal mode automatic connection + */ + IDO_MANAGER_STATE_AUTO_CONNECT, + + /** + * 蓝牙扫描停止 + * Bluetooth scan stop + */ + IDO_MANAGER_STATE_SCAN_STOP, + + /** + * 蓝牙手动扫描中 + * Bluetooth manual scanning + */ + IDO_MANAGER_STATE_MANUAL_SCANING, + + /** + * 在ota模式手动连接 + * Manually connect in ota mode + */ + IDO_MANAGER_STATE_MANUAL_OTA_CONNECT, + + /** + * 普通模式手动连接 + * Normal mode manual connection + */ + IDO_MANAGER_STATE_MANUAL_CONNECT, + + /** + * 手环连接成功 + * The bracelet is connected successfully + */ + IDO_MANAGER_STATE_DID_CONNECT, + + /** + * 手环连接失败 + * Bracelet connection failed + */ + IDO_MANAGER_STATE_CONNECT_FAILED, + + /** + * 手环断开连接 + * Bracelet dis connect + */ + IDO_MANAGER_STATE_DIS_CONNECT +}; + + +/** + * 蓝牙连接错误类型枚举 + * Bluetooth connection error type enumeration + */ +typedef NS_ENUM(NSInteger, IDO_BLUETOOTH_CONNECT_ERROR_TYPE) { + /** + * UUID 为空蓝牙不能自动连接 + * UUID is Empty, Bluetooth cannot be automatically connected + */ + IDO_BLUETOOTH_UUID_EMPTY_TYPE = 1, + + /** + * MAC地址为空ota模式蓝牙不能自动连接 + * The MAC address is empty. ota mode Bluetooth cannot be automatically connected. + */ + IDO_BLUETOOTH_MAC_ADDR_EMPTY_TYPE, + + /** + * 未绑定设备蓝牙不能自动连接 + * Unbound device Bluetooth cannot be automatically connected. + */ + IDO_BLUETOOTH_UNBOUND_TYPE, + + /** + * 蓝牙关闭不能自动连接 + * Bluetooth off does not automatically connect. + */ + IDO_BLUETOOTH_POWERED_OFF_TYPE, + + /** + * 外围设备不存在 + * Peripheral device does not exist + */ + IDO_BLUETOOTH_PERIPHERAL_DON_EXIST, + + /** + * 蓝牙自动模式断开连接 + * Bluetooth auto mode disconnect + */ + IDO_BLUETOOTH_AUTO_DIS_CONNECT_TYPE, + + /** + * 蓝牙手动模式断开连接 + * Bluetooth manual mode disconnect + */ + IDO_BLUETOOTH_MANUAL_DIS_CONNECT_TYPE, + + /** + * 蓝牙连接失败 + * Bluetooth connection failed + */ + IDO_BLUETOOTH_CONNECT_FAIL_TYPE, + + /** + * 蓝牙连接超时 + * Bluetooth connection timeout + */ + IDO_BLUETOOTH_CONNECT_TIME_OUT_TYPE, + + /** + * 蓝牙扫描连接超时 + * Bluetooth scan connection timed out + */ + IDO_BLUETOOTH_SCAN_CONNECT_TIME_OUT_TYPE, + + /** + * 蓝牙发现外围设备服务失败 + * Bluetooth discovery peripheral service failed + */ + IDO_BLUETOOTH_DISCOVER_SERVICE_FAIL_TYPE, + + /** + * 蓝牙发现外围设备服务不存在 + * Bluetooth discovery peripheral service does not exist + */ + IDO_BLUETOOTH_DISCOVER_SERVICE_NO_EXIST_TYPE, + + /** + * 蓝牙发现外围设备特征失败 + * Bluetooth discovery peripheral feature failed + */ + IDO_BLUETOOTH_DISCOVER_CHARACTERISTICS_TYPE, + + /** + * 蓝牙数据交换错误 + * Bluetooth data exchange error + */ + IDO_BLUETOOTH_DATA_EXCHANGE_ERROR_TYPE + +}; + +#endif /* IDOBlueEnum_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothBaseModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothBaseModel.h new file mode 100755 index 0000000..4d9ffbe --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothBaseModel.h @@ -0,0 +1,112 @@ +// +// IDOBluetoothInfo.h +// VeryfitSDK +// +// Created by hedongyang on 2018/6/13. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#import + +@interface IDOBluetoothBaseModel : NSObject + +@property (copy,readonly,nonatomic,nullable) NSArray * originColumnNames; +@property (copy,readonly,nonatomic,nullable) NSArray * columnNames; +@property (copy,readonly,nonatomic,nullable) NSArray * columnTypes; + +@property (nonatomic,assign) NSInteger pk; + +@property (nonatomic,copy,nullable) NSString * macAddr; +@property (nonatomic,copy,nullable) NSString * uuidStr; +@property (nonatomic,copy,nullable) NSString * deviceId; +@property (nonatomic,copy,nullable) NSString * version; +@property (nonatomic,copy,nullable) NSString * deviceName; +@property (nonatomic,copy,nullable) NSString * userId; +@property (nonatomic,assign) NSInteger migrationState; + +/** + * @brief 数据引擎为model赋值 | Assigned to the model + */ +- (void)assignment; + +/** + * @brief model创建表 | Create a table + * @return 是 或 否 | yes or no + */ +- (BOOL)createTable; + +/** + * @brief model 单个数据存储 | Single data storage + * @return 是 或 否 | yes or no + */ +- (BOOL)save; + +/** + * @brief model 单个数据更新 | Single data update + * @return 是 或 否 | yes or no + */ +- (BOOL)update; + +/** + * @brief model 单个数据存储或更新 | Single data storage or update + * @return 是 或 否 | yes or no + */ +- (BOOL)saveOrUpdate; + +/** + * @brief model 单个数据删除 (*不建议使用) | Model single data deletion (*Not recommended) + * @return 是 或 否 | yes or no + */ +- (BOOL)del; + +/** + * @brief model 通过Mac地址查询单个数据 多用于蓝牙设置查询 + * The model queries individual data by Mac address, which is mostly used for bluetooth setting query + * @return 根据设备ID 查询获取最后一个model 不存在会初始化一个新的对象 + * Getting the last model based on the device ID query does not initialize a new object + */ ++ (IDOBluetoothBaseModel *_Nullable)queryCurrentModel; + +/** + * @brief 自定义查询语句 | Custom query statements + * @param sqlStr 查询语句 | Database query for example @"WHERE mac_addr = '%@'" + * @return model 集合 | Array + */ ++ (NSArray *_Nullable)queryModelsWithSqlStr:(NSString *_Nullable)sqlStr; + +/** + * @brief 自定义删除语句 | Custom delete statement + * @param sqlStr 删除语句 | Delete sqlStr for example @"WHERE mac_addr = '%@'" + * @return yes or no + */ ++ (BOOL)deleteModelsWithSqlStr:(NSString *_Nullable)sqlStr; + +/** + * @brief 批量存储或更新model | Bulk store or update models + * @param models model 集合 | Array + * @return 是 或 否 | yes or no + */ + ++ (BOOL)saveOrUpdateModels:(NSArray *_Nullable)models; + +/** + * @brief 批量存储model | Bulk store models + * @param models model 集合 | Array + * @return 是 或 否 | yes or no + */ ++ (BOOL)saveModels:(NSArray *_Nullable)models; + +/** + * @brief 批量删除model (*不建议使用) | Delete models in bulk (*Not recommended) + * @param models model 集合 | Array + * @return 是 或 否 | yes or no + */ ++ (BOOL)deleteModels:(NSArray *_Nullable)models; + +/** + * @brief 删除对应的数据库表数据 (*不建议使用) | Delete the corresponding database table data (*Not recommended) + * @return 是 或 否 | yes or no + */ ++ (BOOL)deleteCurrentTable; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothEngine.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothEngine.h new file mode 100755 index 0000000..fe0fd1c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothEngine.h @@ -0,0 +1,283 @@ +// +// IDOBluetoothEngine.h +// VeryfitSDK +// +// Created by hedongyang on 2018/5/31. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#import +#import + +#if __has_include() +#elif __has_include() +#else +#import "IDOGetInfoBluetoothModel.h" +#endif + +@interface IDOBluetoothManagerInfoEngine : NSObject + +/** + * 蓝牙管理中心 | Bluetooth Management Center + */ +@property (nonatomic,strong) CBCentralManager * centralManager; + +/** + * 外围设备 | Peripherals + */ +@property (nonatomic,strong) CBPeripheral * peripheral; + +/** + * 蓝牙是否开启 | Is Bluetooth enabled? + */ +@property (nonatomic,assign,readonly,getter=isPoweredOn) BOOL poweredOn; + +/** + * 蓝牙是否连接 | Bluetooth is connected + */ +@property (nonatomic,assign,readonly,getter=isConnected) BOOL connected; + +/** + * 蓝牙是否正在连接中 | Bluetooth is connecting + */ +@property (nonatomic,assign,readonly,getter=isConnecting) BOOL connecting; + +/** + * 命令服务特征 | Command Service Features + */ +@property (nonatomic,strong) CBCharacteristic * commandCharacteristic; + +/** + * 健康服务特征 | Health Service Features + */ +@property (nonatomic,strong) CBCharacteristic * healthCharacteristic; + +/** + * 锐捷定制发送服务特征 | Ruijie write service Features + */ +@property (nonatomic,strong) CBCharacteristic * customWriteCharacteristic; + +/** + * 功能列表 | Function List + */ +@property (nonatomic,strong) IDOGetDeviceFuncBluetoothModel * funcTableModel; + +@end + +@interface IDOBluetoothPeripheralInfoEngine : NSObject + +/** + * 当前连接外围设备的uuid | uuid currently connected to peripherals + */ +@property (nonatomic,copy) NSString * uuidStr; + +/** + * 当前连接设备ID | Current connection device ID + */ +@property (nonatomic,copy) NSString * deviceId; + +/** + * 当前连接设备名字 | Current connected device name + */ +@property (nonatomic,copy) NSString * deviceName; + +/** + * 当前连接设备固件版本号 | Current connected device firmware version number + */ +@property (nonatomic,copy) NSString * version; + +/** + * 当前连接设备Mac地址 | Currently connected device Mac address + */ +@property (nonatomic,copy) NSString * macAddr; + +/** + * 当前连接设备授权码 | Currently connected device authorization code + */ +@property (nonatomic,copy) NSString * authCode; + +/** + * 当前设备连接成功的时间 | The time the current device was successfully connected + */ +@property (nonatomic,strong) NSDate * connectedDate; + +/** + * 当前连接设备模式 | Current connected device mode + */ +@property (nonatomic,assign) NSInteger deviceMode; + +/** + * 当前连接设备状态 | Current connected device status + */ +@property (nonatomic,assign) NSInteger battStatus; + +/** + * 当前连接设备电量 | Current connected device power + */ +@property (nonatomic,assign) NSInteger battLevel; + +/** + * 当前连接设备是否重启 | Is the current connected device restarted? + */ +@property (nonatomic,assign) NSInteger rebootFlag; + +/** + * 当前连接设备授权码长度 | Current connection device authorization code length + */ +@property (nonatomic,assign) NSInteger authLength; + +/** + * 当前设备绑定的时间戳 | Current connection device binding timestamp + */ +@property (nonatomic,assign) NSInteger bindTime; + +/** + * 手环的平台 | platform for bracelet + * 0:nordic, 10:realtek 8762x ,20:cypress psoc6,30:Apollo3 + */ +@property (nonatomic,assign) NSInteger platform; + +/** + * 当前连接设备是否绑定 | Is the current connected device bound? + */ +@property (nonatomic,assign) BOOL isBind; + +/** + * 当前连接设备是否配对中 | Is the current connected device pairing? + */ +@property (nonatomic,assign) BOOL isPairing; + +/** + * 当前连接设备是否ota | Is the current connected device ota? + */ +@property (nonatomic,assign) BOOL isOta; + +@end + +@interface IDOBluetoothUserInfoEngine : NSObject + +/** + * 用户ID | User ID + */ +@property (nonatomic,copy) NSString * userId; + +/** + * 用户生日 (例如:2018-10-01) | | User birthday (example: 2018-10-01) + */ +@property (nonatomic,copy) NSString * birthday; + +/** + * 用户目标步数 | User target steps + */ +@property (nonatomic,assign) NSInteger goalStepCount; + +/** + * 目标睡眠 (分钟) | Target sleep (minutes) + */ +@property (nonatomic,assign) NSInteger goalSleepMinute; + +/** + * 目标卡路里 | Goal Calories + */ +@property (nonatomic,assign) NSInteger goalCalorieData; + +/** + * 目标距离 | Target distance + */ +@property (nonatomic,assign) NSInteger goalDistanceData; + +/** + * 目标体重 (千克) | Target weight (kg) + */ +@property (nonatomic,assign) NSInteger goalWeight; + +/** + * 用户性别 | User gender + */ +@property (nonatomic,assign) NSInteger sex; + +/** + * 用户体重 | User weight + */ +@property (nonatomic,assign) NSInteger weight; + +/** + * 用户升高 | User rises + */ +@property (nonatomic,assign) NSInteger height; + +/** + * 是否登陆 | Login + */ +@property (nonatomic,assign) BOOL isLogin; + +@end + +@interface IDOBluetoothAppInfoEngine : NSObject + +/** + * 设备名字 | Device Name + */ +@property (nonatomic,copy) NSString * iphoneName; + +/** + * 手机系统版本 | Mobile phone system version + */ +@property (nonatomic,copy) NSString * sysVersion; + +/** + * sdk版本 | sdk version + */ +@property (nonatomic,copy) NSString * sdkVersion; + +@end + +@interface IDOBluetoothUnitInfoEngine : NSObject + +/** + * 时间格式是否12小时制 | Is the time format 12-hour format? + */ +@property (nonatomic,assign) BOOL is12Hour; + +/** + * 语言单位 | Language unit + */ +@property (nonatomic,assign) NSInteger language; + +/** + * 距离单位 | Distance unit + */ +@property (nonatomic,assign) NSInteger distUnit; + +/** + * 体重单位 | Weight unit + */ +@property (nonatomic,assign) NSInteger weightUnit; + +/** + * 温度单位 | Temperature unit + */ +@property (nonatomic,assign) NSInteger tempUnit; + +/** + * 走路步伐单位 | Walking pace unit + */ +@property (nonatomic,assign) NSInteger strideWalkUnit; + +/** + * 跑步步伐单位 | Running pace unit + */ +@property (nonatomic,assign) NSInteger strideRunUnit; + +@end + +@interface IDOBluetoothEngine : NSObject ++ (IDOBluetoothEngine *)shareInstance; +- (void)deserialization; +@property (nonatomic,strong) IDOBluetoothManagerInfoEngine * managerEngine; +@property (nonatomic,strong) IDOBluetoothPeripheralInfoEngine * peripheralEngine; +@property (nonatomic,strong) IDOBluetoothUserInfoEngine * userEngine; +@property (nonatomic,strong) IDOBluetoothAppInfoEngine * appEngine; +@property (nonatomic,strong) IDOBluetoothUnitInfoEngine * unitEngine; +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothManager.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothManager.h new file mode 100755 index 0000000..72c1a0b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothManager.h @@ -0,0 +1,166 @@ +// +// IDOBluetoothManager.h +// VeryfitSDK +// +// Created by hedongyang on 2018/6/4. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#import +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBlueEnum.h" +#import "IDOPeripheralModel.h" +#endif + +@class IDOBluetoothManager; + +@protocol IDOBluetoothManagerDelegate + +/** + * @brief 扫描所有外围设备 | Scan all peripherals + * @param manager IDO蓝牙管理中心 | IDO Bluetooth Management Center + * @param allDevices 扫描所有外围设备(包括OTA设备集合) | Scan all peripherals (including OTA device collections) + * @param otaDevices OTA 设备集合 | OTA Device Collection + */ +- (void)bluetoothManager:(IDOBluetoothManager *)manager + allDevices:(NSArray *)allDevices + otaDevices:(NSArray *)otaDevices; + + +/** + * @brief 连接设备成功回调 | Connected device successfully callback + * @param manager IDO蓝牙管理中心 | IDO Bluetooth Management Center + * @param centerManager 蓝牙管理中心 | Bluetooth Management Center + * @param peripheral 外围设备 | Peripherals + * @param isOtaMode 连接是否在OTA模式 | Is the connection in OTA mode? + * @return 是或否 | yes or no + */ +- (BOOL)bluetoothManager:(IDOBluetoothManager *)manager + centerManager:(CBCentralManager *)centerManager + didConnectPeripheral:(CBPeripheral *)peripheral + isOatMode:(BOOL)isOtaMode; + +/** + * @brief 蓝牙管理状态 | Bluetooth management status + * @param manager IDO蓝牙管理中心 | IDO Bluetooth Management Center + * @param state 状态 | Status + */ +- (void)bluetoothManager:(IDOBluetoothManager *)manager + didUpdateState:(IDO_BLUETOOTH_MANAGER_STATE)state; + +/** + * @brief 连接设备错误回调,当解绑设备断开连接时不会回调此方法 + * Connection Device Error Callback,This method is not called back when the unbound device is disconnected. + * @param manager IDO蓝牙管理中心 | IDO Bluetooth Management Center + * @param error 错误信息 | Error message + */ +- (void)bluetoothManager:(IDOBluetoothManager *)manager + connectPeripheralError:(NSError *)error; + +@end + +@interface IDOBluetoothManager : NSObject + +/** + 设置代理 | Setting up the agent + */ +@property (nonatomic,weak) id delegate; + +/** + * 自动扫描连接超时时长 默认 20 + * Auto Scan Connection Timeout Duration Default 20 + */ +@property (nonatomic,assign) NSInteger timeout; + +/** + * 设置扫描过滤信号弱的设备 默认值 80 大于80会被过滤 + * Set the device with weak scan filtering signal. Default value 80 is greater than 80 will be filtered. + */ +@property (nonatomic,assign) NSInteger rssiNum; + +/** + * 是否启动超时,间隔扫描 默认 yes 默认10秒间隔扫描一次 + * Whether to start timeout, interval scan Default yes Default scan at 10-second intervals + */ +@property (nonatomic,assign) BOOL isIntervalScan; + +/** + * 是否需要重连机制 默认 YES 如果设置 NO 断线后不会重连 + * Whether a reconnect mechanism is required,if NO set,connection will not be reconnected + */ +@property (nonatomic,assign) BOOL isReconnect; + +/** + * 设置扫描间隔时长 默认 10秒 如果不启动超时间隔扫描,则无效 + * Set the scan interval to 10 seconds by default.if timeout interval scanning is not started, it is not valid. + */ +@property (nonatomic,assign) NSInteger autoScanInterval; + +/** + 蓝牙扫描设备模式 | Bluetooth Scanning Device Mode + */ +@property (nonatomic,assign,readonly) IDO_SCAN_DEVICE_MODE scanMode; + +/** + 蓝牙管理连接状态 | Bluetooth management connection status + */ +@property (nonatomic,assign,readonly) IDO_BLUETOOTH_MANAGER_STATE state; + +/** + 蓝牙连接错误码 | Bluetooth connection error code + */ +@property (nonatomic,assign,readonly) IDO_BLUETOOTH_CONNECT_ERROR_TYPE errorCode; + +/** + * 手动点击连接设备的总时长 + * Total time to manually click on the connected device + */ +@property (nonatomic,assign,readonly) NSInteger manualConnectTotalTime; + +/** + * 自动扫描到成功连接设备的总时长 + * Total time from automatic scanning to successful connection to the device + */ +@property (nonatomic,assign,readonly) NSInteger autoConnectTotalTime; + +/** + * @brief 初始化IDO蓝牙管理中心对象 + * Initialize IDO the Bluetooth Management Center object + * @return IDOBluetoothManager + */ ++ (__kindof IDOBluetoothManager *)shareInstance; + +/** + * @brief 初始化系统蓝牙管理中心对象并刷新蓝牙代理 + * Initializes the system bluetooth management center object and refreshes the bluetooth delegate + */ ++ (void)refreshDelegate; + +/** + 开始扫描 | Start scanning + */ ++ (void)startScan; + +/** + 停止扫描 | Stop scanning + */ ++ (void)stopScan; + +/** + * @brief 1、普通模式下选择外围设备连接 2、ota模式下选择外围设备连接 + * 1. Select peripheral device connection in normal mode + * 2. Select peripheral device connection in ota mode + * @param model IDOPeripheralModel 对象 | IDOPeripheralModel object + */ ++ (void)connectDeviceWithModel:(IDOPeripheralModel *)model; + +/** + 断开当前外围设备的连接 | Disconnect the current peripheral device + */ ++ (void)cancelCurrentPeripheralConnection; + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothServices.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothServices.h new file mode 100755 index 0000000..e26ee59 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOBluetoothServices.h @@ -0,0 +1,75 @@ +// +// IDOBluetoothServices.h +// VeryfitSDK +// +// Created by apple on 2018/8/22. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOGetInfoBluetoothModel.h" +#endif + +// 蓝牙扫描、连接状态通知监听名字 | Bluetooth scan, connection status notification listener name +extern NSString * _Nonnull IDOBluetoothConnectStateNotifyName; + +// 蓝牙扫描、连接过程错误通知监听名字 | Bluetooth scan, connection process error notification listener name +extern NSString * _Nonnull IDOBluetoothConnectErrorNotifyName; + +// 蓝牙主动断开通知监听名字,多在配对和固件升级使用 | Bluetooth disconnect notification listener name +extern NSString * _Nonnull IDOBluetoothDisconnectNotifyName; + +// 蓝牙主动开始扫描通知监听名字,多在配对和固件升级使用 | Bluetooth start scan notification listener name +extern NSString * _Nonnull IDOBluetoothStartScanNotifyName; + +// 蓝牙主动停止扫描通知监听名字,多在配对和固件升级使用 | Bluetooth stop scan notification listener name +extern NSString * _Nonnull IDOBluetoothStopScanNotifyName; + +// 当前连接的手环设备为OTA模式通知监听名字 | The currently connected bracelet device is OTA mode notification listener name +extern NSString * _Nonnull IDOBluetoothOtaModeNotifyName; + +// 蓝牙日志打开记录通知名字 | Bluetooth log opens record notification name +extern NSString * _Nonnull IDOBluetoothOpenLogRecordNotifyName; + +// 数据迁移状态通知名字 | Data migration status notification name +extern NSString * _Nonnull IDOBluetoothDataMigrationNotifyName; + +@interface IDOBluetoothServices : NSObject + +/* + 是否输出蓝牙sdk运行日志 | Whether to output the Bluetooth sdk running log + */ +@property (nonatomic,copy,nullable) IDOBluetoothServices *_Nonnull(^outputSdkLog)(BOOL isOutput); + +/* + 是否输出蓝牙协议运行日志 | Whether to output the Bluetooth protocol running log + */ +@property (nonatomic,copy,nullable) IDOBluetoothServices *_Nonnull(^outputProtocolLog)(BOOL isOutput); + +/* + 是否记录原始数据日志 | Whether to log raw data + */ +@property (nonatomic,copy,nullable) IDOBluetoothServices *_Nonnull(^rawDataLog)(BOOL isRecord); + +/* + 是否添加阿里云日志 默认 No | Add Alibaba Cloud Log Default No + */ +@property (nonatomic,copy,nullable) IDOBluetoothServices *_Nonnull(^addAliYunLog)(BOOL isAdd); + +/** + * 注册SDK服务后,初始化设备信息并返回,需开始启动蓝牙,根据各自业务需求,可以选择自己的APP创建蓝牙管理,也可以使用我们提供的库创建蓝牙管理. + * After the SDK service is registered, the device information is initialized and returned, and bluetooth needs to be started. + * According to their business needs, they can choose their own APP to create bluetooth management, or they can use the library we provide to create bluetooth management. + */ +@property (nonatomic,copy,nullable) void(^startScanBule)(void(^ _Nullable getDeviceInfoBlock)(IDOGetDeviceInfoBluetoothModel * _Nullable model)); + +/** + * @brief 注册SDK服务,初始化设备信息 | Register for SDK service,initializes device info + * @return IDOBluetoothServices + */ +IDOBluetoothServices * _Nonnull registrationServices(void); + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCalculateBluetoothModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCalculateBluetoothModel.h new file mode 100755 index 0000000..df10198 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCalculateBluetoothModel.h @@ -0,0 +1,263 @@ +// +// IDOCalculateBluetoothModel.h +// IDOBluetooth +// +// Created by 何东阳 on 2018/10/16. +// Copyright © 2018年 apple. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOSyncSpo2DataModel.h" +#import "IDOSyncBpDataModel.h" +#import "IDOSyncHeartRateDataModel.h" +#import "IDOSyncSleepDataModel.h" +#import "IDOSyncSportDataModel.h" +#endif + +struct ido_blood_pressure_data +{ + uint32_t sysBlood; + uint32_t diasBlood; +}; + +@interface IDOCalculateBluetoothModel : NSObject + +@end + +@interface IDOCalculateBloodOxygenBluetoothModel : NSObject +/** + 平均血氧 | Average blood oxygen + */ +@property (nonatomic,assign) NSInteger avgBloodOxygen; + +/** + 最大血氧 | Maximum blood oxygen + */ +@property (nonatomic,assign) NSInteger maxBloodOxygen; + +/** + 最小血氧 | Most blood oxygen + */ +@property (nonatomic,assign) NSInteger minBloodOxygen; + +/** + 计算一天血氧平均值 | Calculate the average blood oxygen per day + */ ++ (__kindof IDOCalculateBloodOxygenBluetoothModel *)calculateOneDayBoDataWithHrModel:(__kindof IDOSyncBloodOxygenDataInfoBluetoothModel *)model; +/** + 计算一周、一月血氧平均值 | Calculate the blood oxygen average for one week and one month + */ ++ (__kindof IDOCalculateBloodOxygenBluetoothModel *)calculateOneMonthOrWeekBoDataWithHrModels:(NSArray <__kindof IDOSyncBloodOxygenDataInfoBluetoothModel *>*)models; +/** + 计算一年血氧平均值 | Calculate the annual blood oxygen average + */ ++ (__kindof IDOCalculateBloodOxygenBluetoothModel *)calculateOneYearBoDataWithHrModels:(NSArray *> *)models; + +@end + +@interface IDOCalculateBpBluetoothModel : NSObject + +/** + 记录血压日期时间戳 | Record blood pressure date time stamp + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 最大血压值 struct | Maximum blood pressure value + */ +@property (nonatomic,assign) struct ido_blood_pressure_data maxBp; + +/** + 最小血压值 struct | Minimum blood pressure value + */ +@property (nonatomic,assign) struct ido_blood_pressure_data minBp; + +/** + 平均血压值 struct | Average blood pressure value + */ +@property (nonatomic,assign) struct ido_blood_pressure_data avgBp; + +/** + 最新血压值 struct | Latest blood pressure value + */ +@property (nonatomic,assign) struct ido_blood_pressure_data lastBp; + +/** + 计算一天血压平均值 | Calculate the average blood pressure per day + */ ++ (__kindof IDOCalculateBpBluetoothModel *)calculateOneDayBpDataWithBpModel:(__kindof IDOSyncBpDataInfoBluetoothModel *)model; + +/** + 计算一周、一月血压平均值 | Calculate the average blood pressure for one week and one month + */ ++ (__kindof IDOCalculateBpBluetoothModel *)calculateOneMonthOrWeekBpDataWithBpModels:(NSArray <__kindof IDOSyncBpDataInfoBluetoothModel *>*)models + allDayCalculateBpModels:(NSArray <__kindof IDOCalculateBpBluetoothModel *> **)calculateBpModels; + +@end + + +@interface IDOCalculateHrBluetoothModel : NSObject + +/** + 平均心率 | Average heart rate + */ +@property (nonatomic,assign) NSInteger avgHr; + +/** + 最大心率 | Maximum heart rate + */ +@property (nonatomic,assign) NSInteger maxHr; + +/** + 最小心率 | Most careful rate + */ +@property (nonatomic,assign) NSInteger minHr; + +/** + 脂肪燃烧时长 (单位 :分钟) | Fat burning Duration (unit: minute) + */ +@property (nonatomic,assign) NSUInteger burnFatMins; + +/** + 肌肉锻炼时长 [有氧运动] (单位 :分钟) | Muscle training Duration (unit: minute) + */ +@property (nonatomic,assign) NSUInteger aerobicMins; + +/** + 极限运动时长 (单位 :分钟) | Extreme Sports Duration (unit: minutes) + */ +@property (nonatomic,assign) NSUInteger limitMins; + +/** + 热身运动时长 (单位 :分钟) | Warm up Duration (unit: minutes) + */ +@property (nonatomic,assign) NSUInteger warmUpMins; + +/** + 无氧运动时长 (单位 :分钟) | Anaerobic Duration (unit: minutes) + */ +@property (nonatomic,assign) NSUInteger anaerobicMins; + +/** + * 计算一天心率平均值 | Calculate the average heart rate per day + * 只能传入 IDOSyncHrDataInfoBluetoothModel 和 IDOSyncSecHrDataInfoBluetoothModel 对象 + * Only IDOSyncHrDataInfoBluetoothModel and IDOSyncSecHrDataInfoBluetoothModel object + */ ++ (__kindof IDOCalculateHrBluetoothModel *)calculateOneDayHrDataWithHrModel:(__kindof IDOBluetoothBaseModel *)model; +/** + * 计算一周、一月心率平均值 | Calculate the heart rate average for one week and one month + * 只能传入 IDOSyncHrDataInfoBluetoothModel 和 IDOSyncSecHrDataInfoBluetoothModel 对象 + * Only IDOSyncHrDataInfoBluetoothModel and IDOSyncSecHrDataInfoBluetoothModel object + */ ++ (__kindof IDOCalculateHrBluetoothModel *)calculateOneMonthOrWeekHrDataWithHrModels:(NSArray <__kindof IDOBluetoothBaseModel *>*)models; +/** + * 计算一年心率平均值 | Calculate the annual heart rate average + * 只能传入 IDOSyncHrDataInfoBluetoothModel 和 IDOSyncSecHrDataInfoBluetoothModel 对象 + * Only IDOSyncHrDataInfoBluetoothModel and IDOSyncSecHrDataInfoBluetoothModel object + */ ++ (__kindof IDOCalculateHrBluetoothModel *)calculateOneYearHrDataWithHrModels:(NSArray *> *)models; + +@end + +@interface IDOCalculateSleepBluetoothModel : NSObject + +/** + 平均一天睡眠时长 (单位 :分钟) | Average one-day sleep duration (in minutes) + */ +@property (nonatomic,assign) NSInteger avgSleep; + +/** + 平均一天深睡眠时长 (单位 :分钟) | Average one-day deep sleep duration (unit: minute) + */ +@property (nonatomic,assign) NSInteger avgDeepSleep; + +/** + 平均一天浅睡眠时长 (单位 :分钟) | Average day light sleep duration (unit: minute) + */ +@property (nonatomic,assign) NSInteger avgLightSleep; + +/** + 平均一天醒来时长 (单位 :分钟) | Average wake-up time of one day (unit: minute) + */ +@property (nonatomic,assign) NSInteger avgWakeSleep; + +/** + 平均入睡时间点 (格式 :00:00) | Average sleep time (format: 00:00) + */ +@property (nonatomic,copy) NSString * sleepTime; + +/** + 平均醒来时间点(格式 :00:00) | Average wake-up time (format: 00:00) + */ +@property (nonatomic,copy) NSString * wakeTime; + +/** + 计算一天睡眠平均值 | Calculate the average daily sleep + */ ++ (__kindof IDOCalculateSleepBluetoothModel *)calculateOneDaySleepDataWithSleepModel:(__kindof IDOSyncSleepDataInfoBluetoothModel *)model; + +/** + 计算-周、一月睡眠平均值 | Calculation - Week, January sleep average + */ ++ (__kindof IDOCalculateSleepBluetoothModel *)calculateOneMonthOrWeekSleepDataWithSleepModels:(NSArray <__kindof IDOSyncSleepDataInfoBluetoothModel *>*)models; + +/** + 计算一年睡眠平均值 | Calculate the average sleep value for one year + */ ++ (__kindof IDOCalculateSleepBluetoothModel *)calculateOneYearSleepDataWithSleepModels:(NSArray *> *)models; + +@end + +@interface IDOCalculateSportBluetoothModel : NSObject + +/** + 总运动里程(单位 :米) | Total mileage (in meters) + */ +@property (nonatomic,assign) NSInteger totalMileage; + +/** + 总步数 (单位 :步数) | Total steps (unit: steps) + */ +@property (nonatomic,assign) NSInteger totalStep; + +/** + 总卡路里 (单位 :大卡) | Total calories (unit: big card) + */ +@property (nonatomic,assign) NSInteger totalCalories; + +/** + 平均里程(单位 :米) | Average mileage (in meters) + */ +@property (nonatomic,assign) NSInteger avgMileage; + +/** + 平均步数(单位 :步数) | Average steps (unit: steps) + */ +@property (nonatomic,assign) NSInteger avgStep; + +/** + 平均卡路里(单位 :大卡) | Average calories (unit: big card) + */ +@property (nonatomic,assign) NSInteger avgCalories; + +/** + 计算一天步数平均值 | Calculate the average number of steps per day + */ ++ (__kindof IDOCalculateSportBluetoothModel *)calculateOneDaySportDataWithSportModel:(__kindof IDOSyncSportDataInfoBluetoothModel *)model; + +/** + 计算-周、一月步数平均值 | Calculation - Week, January Step Average + */ ++ (__kindof IDOCalculateSportBluetoothModel *)calculateOneMonthOrWeekSportDataWithSportModels:(NSArray <__kindof IDOSyncSportDataInfoBluetoothModel *>*)models; + +/** + 计算一年步数平均值 | Calculate the average number of steps in a year + */ ++ (__kindof IDOCalculateSportBluetoothModel *)calculateOneYearSportDataWithSportModels:(NSArray *> *)models; + +@end + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCommonMacro.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCommonMacro.h new file mode 100755 index 0000000..f7ca286 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOCommonMacro.h @@ -0,0 +1,89 @@ +// +// IDOCommonMacro.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/7/8. +// Copyright © 2019 何东阳. All rights reserved. +// + +#ifndef IDOCommonMacro_h +#define IDOCommonMacro_h + +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothEngine.h" +#endif + +/** + IDO 当前手环蓝牙引擎 | IDO current bracelet Bluetooth engine + */ +#define IDO_BLUE_ENGINE [IDOBluetoothEngine shareInstance] + +/** + IDO 当前手环蓝牙功能列表 | IDO Current Bracelet Bluetooth Feature List + */ +#define __IDO_FUNCTABLE__ IDO_BLUE_ENGINE.managerEngine.funcTableModel + +/** + IDO 当前蓝牙系统管理对象 | IDO Current Bluetooth System Management Object + */ +#define __IDO_MANAGER__ IDO_BLUE_ENGINE.managerEngine.centralManager + +/** + IDO 当前外围设备对象 | IDO Current Peripheral Object + */ +#define __IDO_PERIPHERAL__ IDO_BLUE_ENGINE.managerEngine.peripheral + +/** + IDO 当前外围设备是否连接 | IDO Current Peripheral is connected + */ +#define __IDO_CONNECTED__ IDO_BLUE_ENGINE.managerEngine.connected + +/** + IDO 当前外围设备是否连接中 | IDO Current Peripheral is connecting + */ +#define __IDO_CONNECTING__ IDO_BLUE_ENGINE.managerEngine.connecting + +/** + IDO 当前蓝牙管理中心是否开启 | IDO Current blue manager is powered on + */ +#define __IDO_POWERED_ON__ IDO_BLUE_ENGINE.managerEngine.poweredOn + +/** + IDO 当前手环UUID | IDO Current Bracelet UUID + */ +#define __IDO_UUID__ IDO_BLUE_ENGINE.peripheralEngine.uuidStr + +/** + IDO 当前手环MAC | IDO Current Bracelet MAC + */ +#define __IDO_MAC_ADDR__ IDO_BLUE_ENGINE.peripheralEngine.macAddr + +/** + IDO 当前手环绑定状态 | IDO Current Bracelet Binding Status + */ +#define __IDO_BIND__ IDO_BLUE_ENGINE.peripheralEngine.isBind + +/** + IDO 当前手环配对中状态 | IDO Current Bracelet pairing Status + */ +#define __IDO_PAIRING__ IDO_BLUE_ENGINE.peripheralEngine.isPairing + +/** + IDO 用户ID | IDO User ID + */ +#define __IDO_USER_ID__ IDO_BLUE_ENGINE.userEngine.userId + +/** + IDO 当前手环ota状态 | IDO current bracelet ota status + */ +#define __IDO_OTA__ IDO_BLUE_ENGINE.peripheralEngine.isOta + +/** + IDO 当前手环名字 | IDO Current Bracelet Name + */ +#define __IDO_NAME__ IDO_BLUE_ENGINE.peripheralEngine.deviceName + + +#endif /* IDOCommonMacro_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataExchangeModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataExchangeModel.h new file mode 100755 index 0000000..3709425 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataExchangeModel.h @@ -0,0 +1,128 @@ +// +// IDODataExchangeModel.h +// IDOBluetooth +// +// Created by apple on 2018/10/5. +// Copyright © 2018年 apple. All rights reserved. +// + +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDODataExchangeModel : IDOBluetoothBaseModel +/** + 日 | day + */ +@property (nonatomic,assign) NSInteger day; +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; +/** + 分 | minute + */ +@property (nonatomic,assign) NSInteger minute; +/** + 秒 | second + */ +@property (nonatomic,assign) NSInteger second; +/** + 运动类型 | sport type + * 0:无,1:走路,2:跑步,3:骑行,4:徒步,5:游泳,6:爬山,7:羽毛球,8:其他, + * 9:健身,10:动感单车,11:椭圆机,12:跑步机,13:仰卧起坐,14:俯卧撑,15:哑铃,16:举重, + * 17:健身操,18:瑜伽,19:跳绳,20:乒乓球,21:篮球,22:足球 ,23:排球,24:网球, + * 25:高尔夫球,26:棒球,27:滑雪,28:轮滑,29:跳舞,48:户外跑步,49:室内跑步,50:户外骑行,51:室内骑行, + * 52:户外走路,53:室内走路,54:泳池游泳,55:开放水域游泳,56:椭圆机,57:划船机,58:高强度间歇训练法 + * 0: none, 1: walk, 2: run, 3: ride, 4: hike, 5: swim, 6: climb, 7: badminton, 8: others, + * 9: fitness, 10: spinning, 11: elliptical, 12: treadmill, 13: sit-ups, 14: push-ups, 15: dumbbells, 16: weightlifting, + * 17: aerobics, 18: yoga, 19: jump rope, 20: table tennis, 21: basketball, 22: football, 23: volleyball, 24: tennis, + * 25: golf, 26: baseball, 27: skiing, 28: roller skating, 29: dancing,48: outdoor running, 49: indoor running, 50: outdoor cycling, 51: indoor cycling, + * 52: outdoor walking, 53: indoor walking, 54: pool swimming, 55: open water swimming, 56: elliptical machine, 57: rowing machine, 58: high-intensity interval training + */ +@property (nonatomic,assign) NSInteger sportType; +/** + 目标类型 | target type + */ +@property (nonatomic,assign) NSInteger targetType; +/** + 目标数值 | target value + */ +@property (nonatomic,assign) NSInteger targetValue; +/** + 是否强制开始 | is mandatory start + */ +@property (nonatomic,assign) NSInteger forceStart; +/** + * 0:成功; 1:设备已经进入运动模式失败;2: 设备电量低失败;3:手环正在充电 + * 0:success 1:into sport mode failed 2:Low power of equipment 3: the bracelet is charging + */ +@property (nonatomic,assign) NSInteger retCode; +/** + status:0:全部有效, 1:距离无效, 2: gps 信号弱 | status 0:all effective 1:distance invalid 2:gps signal weak + */ +@property (nonatomic,assign) NSInteger status; +/** + 0:成功; 1:设备已经进入运动模式失败 | 0:success 1:into sport mode failed + */ +@property (nonatomic,assign) NSInteger errorCode; +/** + 步数 (单位:步) | step + */ +@property (nonatomic,assign) NSInteger step; +/** + 卡路里 (单位:J) | calories + */ +@property (nonatomic,assign) NSInteger calories; +/** + 距离 (单位:米) | distance + */ +@property (nonatomic,assign) NSInteger distance; +/** + 持续时间 (单位:分钟) | durations + */ +@property (nonatomic,assign) NSInteger durations; +/** + 是否存储 | is save + */ +@property (nonatomic,assign) BOOL isSave; +/** + 平均心率 | avg heart rate + */ +@property (nonatomic,assign) NSInteger avgHrValue; +/** + 最大心率 | max heart rate + */ +@property (nonatomic,assign) NSInteger maxHrValue; +/** + 脂肪燃烧时长 (分钟) | burn fat mins (mins) + */ +@property (nonatomic,assign) NSInteger burnFatMins; +/** + 心肺锻炼时长(分钟) | cardiopulmonary exercise mins + */ +@property (nonatomic,assign) NSInteger aerobicMins; +/** + 极限锻炼时长(分钟) | limit exercise mins + */ +@property (nonatomic,assign) NSInteger limitMins; +/** + 当前心率 | current heart rate + */ +@property (nonatomic,assign) NSInteger curHrValue; +/** + 心率间隔 | heart rate interval + */ +@property (nonatomic,assign) NSInteger intervalSecond; +/** + 序列号 | heart rate value serial + */ +@property (nonatomic,assign) NSInteger hrValueSerial; +/** + 心率数据 | heart rate data + */ +@property (nonatomic,copy) NSArray * hrValues; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataMigrationManager.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataMigrationManager.h new file mode 100755 index 0000000..67c4ae0 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDODataMigrationManager.h @@ -0,0 +1,79 @@ +// +// IDODataMigrationManager.h +// IDOBluetooth +// +// Created by 何东阳 on 2018/12/7. +// Copyright © 2018年 apple. All rights reserved. +// + +#import + +@interface IDODataMigrationManager : NSObject + +/** + * 删除本地数据迁移状态(用于本地数据库表删除数据使用) | Delete local data migration state (used for local database table deletion data) + */ ++ (BOOL)deleteDataMigrationState; + +/** + * 是否需要数据迁移,只有需要迁移才会有下面迁移的启动和回调,新的项目不需要执行数据迁移,注意的问题数据迁移是在异步操作,⚠️在数据量大时比较耗时,尽量在执行完数据迁移再去执行其他工作. + * Whether data migration is required, only the migration and the callback of the following migration are required. +  * New projects do not need to perform data migration, pay attention to the problem data migration is in asynchronous operation, +  * ⚠️ It is time consuming when the amount of data is large, try to perform other tasks after performing data migration. + */ ++ (BOOL)isNeedMigration; + +/** + * 判断当前是否在迁移数据 + * Determine if data is currently being migrated. + */ ++ (BOOL)isMigrationRun; + +/** + * 启动数据迁移 + * Start data migration + */ ++ (void)dataMigrationStart; + +/** + * 数据迁移进度 (0-1) + * progress (0-1) + */ ++ (void)dataMigrationProgressBlock:(void(^_Nullable)(float progress))callback; + +/** + * 数据迁移完成 direNames 传入不能删除的目录名字集合,在Documents中其他的目录会在迁移完数据全部删除, + * ⚠️如果不传入目录集合,除了sdk新创建的目录不删除之外其他都会删除,所以根据开发需求自行传入目录名字集合 + * Data migration is completed direNames is passed to the collection of directory names that cannot be deleted. In the other directories in Documents, + * all the data will be deleted after the migration.⚠️if you do not pass the directory collection, except for the newly created directory of sdk, + * it will be deleted,so you will pass the directory name collection according to the development requirements. + */ ++ (void)dataMigrationWithFileNames:(NSArray *_Nullable)names + completeBlock:(void(^_Nullable)(BOOL isSuccess))callback; + + +/** + * 启动数据库转换json文件 ⚠️ 在数据量大时比较耗时,尽量在执行完数据迁移再去执行其他工作. + * 1、若传入json文件路径存在,先把json文件数据同步到数据库中,然后合并的数据库再转成json文件; + * 2、若传入json文件路径为空,只把本地数据库转成json文件,并返回json文件压缩路径; + * 3、jsonDirePath 是从云端下载的健康json文件目录路径; + * start the database to convert the json file ⚠️ it is time consuming when the amount of data is large,try to perform other tasks after performing the data migration. + * 1. If the path to the json file exists, synchronize the json file data to the database, and then merge the database into a json file. + * 2. If the path to the json file is empty, only convert the local database to a json file and return the path to the json file zip. + * 3. jsonDirePath is the path to the healthy json file directory downloaded from the cloud. + */ ++ (void)dataToJsonFileStart:(NSString *_Nullable)jsonZipPath; + +/** + 数据转换json文件进度 (0-1) | Data conversion json file progress (0-1) + */ ++ (void)dataToJsonFileProgressBlock:(void(^_Nullable)(float progress))callback; + +/** + 数据转换json文件完成 + zipPath 本地数据库转换json文件压缩路径 + Data conversion json file completed newDirePath local database conversion json file zip path + */ ++ (void)dataToJsonFileCompleteBlock:(void(^_Nullable)(BOOL isSuccess,NSString * _Nullable zipPath))callback; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOErrorCodeToStr.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOErrorCodeToStr.h new file mode 100755 index 0000000..8dbb529 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOErrorCodeToStr.h @@ -0,0 +1,19 @@ +// +// IDOErrorCodeToStr.h +// VeryfitSDK +// +// Created by hedongyang on 2018/8/30. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#import + +@interface IDOErrorCodeToStr : NSObject + +/** + * @brief 错误码转字符串 | Error code to string + * @param errorCode 错误码 | Error code + * @return 字符串 | string + */ ++ (NSString *)errorCodeToStr:(NSInteger)errorCode; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOFoundationCommand.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOFoundationCommand.h new file mode 100755 index 0000000..cd9b67e --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOFoundationCommand.h @@ -0,0 +1,1178 @@ +// +// IDOAllOrder.h +// VeryfitSDK +// +// Created by hedongyang on 2018/6/12. +// Copyright © 2018年 hedongyang. All rights reserved. +// + + + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBindEnum.h" +#import "IDOBluetoothBaseModel.h" +#import "IDOGetInfoBluetoothModel.h" +#import "IDOSetInfoBluetoothModel.h" +#import "IDODataExchangeModel.h" +#endif + +@interface IDOFoundationCommand : NSObject + +#pragma mark ======= control Command ======= + +/** + 设备进入ota模式通知 | Notification of device enter ota mode + */ ++ (void)didOta; + +/** + 设备退出ota模式通知 | Notification of device exit ota mode + */ ++ (void)disOta; + +/** + 断开发送通知 | Disconnect notification + */ ++ (void)disConnect; + +/** + * 连接失败通知 | connection failed + */ ++ (void)connectionFailed; + +/** + * 发送提示消息 (只用于DH项目中) | Send prompt message (used only for DH) + */ ++ (void)sendPromptInformation:(NSString*_Nullable)info; + +/** + * @brief 音乐开始 | Music begins + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)musicStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 音乐结束 | End of music + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)musicStopCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 相机开始 | Camera starts + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)cameraStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 相机结束 | Camera ends + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)cameraStopCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 开始寻找设备 | Start looking for equipment + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)findDeviceStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 结束寻找设备 | End finding equipment + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)findDeviceStopCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 打开ANCS(苹果通知中心) | Open ANCS (Apple Notification Center) + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)belOpenAncsCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 关闭ANCS(苹果通知中心) | Close ANCS (Apple Notification Center) + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)belCloseAncsCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设备绑定 | Device Binding + * @param bindModel 绑定 model (IDOSetBindingInfoBluetoothModel) (只有在授权绑定才会存储数据) + * Binding model (IDOSetBindingInfoBluetoothModel) (Data will only be stored if the binding is authorized) + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)bindingCommand:(IDOSetBindingInfoBluetoothModel * _Nullable)bindModel + callback:(void (^_Nullable)(IDO_BIND_STATUS status, int errorCode))callback; + +/** + * @brief 连线设备解绑 | Unbundling equipment + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)unbindingCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 解绑切换设备,但不删除手环和app数据 | switch device not delete the bracelet and app data + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)switchDeviceCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设备强制解绑,设备连接时,双方解绑,设备断开时,app单方解绑 | Device forced unbundling + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)mandatoryUnbindingCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 手环主动解绑 | Active unbinding of the bracelet + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str,state:0x00:无效,0x01:手环已经解绑) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr,state:0x00:invalid,0x01:bracelet has been untied) + */ ++ (void)braceletUnbundlingCommand:(void(^_Nullable)(int errorCode,int state))callback; + +/** + * @brief 设备配置复位 | Device Configuration Reset + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)setDefaultConfigCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 控制设备重启(重启设备后手环会马上断线) | Control device restart (The bracelet disconnects immediately after restarting the device) + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)setAppRebootCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 获取扩展功能列表 | Get the list of extended features + * @param callback 执行回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Execute callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)getFuncTableExCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设备进入ota升级模式 | The device enters the ota upgrade mode. + * @param callback 执行回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Execute callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + * state 0x00 : 成功;0x01 :电量过低;0x02 :设备不支持;0x03 :参数不正确 | 0x00: success; 0x01: low power; 0x02: device not supported; 0x03: parameter error + */ ++ (void)setOtaCommand:(void(^_Nullable)(int state , int errorCode))callback; + +/** + * @brief 手环检查版本号 | The bracelet checks the version number. + * @param model | check update version numbder model + * @param callback 执行回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Execute callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + * state 0x00 : 请求成功;0x01 :发生失败; + * state 0x00: success; 0x01: failed; + */ ++ (void)checkUpdateReplyCommand:(IDOCheckUpdateBluetoothModel *_Nullable)model + callback:(void(^_Nullable)(int state , int errorCode))callback; + +#pragma mark ======= set Command ======= + +/** + * @brief 设置授权码绑定 | Set Authorization Code Binding + * @param bindModel 绑定 model (IDOSetBindingInfoBluetoothModel) | binding model + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setAuthCodeCommand:(IDOSetBindingInfoBluetoothModel * _Nullable)bindModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置当前时间 | Set current time + * @param timeModel 时间 model (IDOSetTimeInfoBluetoothModel) | time model (IDOSetTimeInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setCurrentTimeCommand:(IDOSetTimeInfoBluetoothModel * _Nullable)timeModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置闹钟 | Set an alarm + * @param alarmModel 闹钟 model (IDOSetAlarmInfoBluetoothModel) | Alarm clock model (IDOSetAlarmInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setAlarmCommand:(IDOSetAlarmInfoBluetoothModel * _Nullable)alarmModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 批量设置闹钟 | Set alarms in batches + * @param alarmModels 闹钟集合 model (IDOSetAlarmInfoBluetoothModel) | Alarm clock collection model (IDOSetAlarmInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setAllAlarmsCommand:(NSArray * _Nullable)alarmModels callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置用户信息 | Setting user information + * @param userModel 用户信息 model (IDOSetUserInfoBuletoothModel) | User Information model (IDOSetUserInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setUserInfoCommand:(IDOSetUserInfoBuletoothModel * _Nullable)userModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置卡路里和距离目标 | Set calories and distance targets + * @param userModel 用户信息 model (IDOSetUserInfoBuletoothModel) | User Information model (IDOSetUserInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setCalorieAndDistanceGoalCommand:(IDOSetUserInfoBuletoothModel * _Nullable)userModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置目标 | Setting goals + + * @param targetModel 目标信息 model (IDOSetUserInfoBuletoothModel) | targetModel target information model (IDOSetUserInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setTargetInfoCommand:(IDOSetUserInfoBuletoothModel * _Nullable)targetModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置通知中心、来电提醒开关 ⚠️在配对过程中不要执行其他命令。如果设备没有配对,会发起配对,等配对成功后再执行设置子开关状态,需要配对耗时比较长请监听回调。 + * Set up notification center, call alert switch.⚠️Do not execute other commands during pairing. + * If there is no pairing on the device, a pairing will be initiated, and the sub-switch state will be set after the pairing is successful. + * If pairing takes a long time, please listen for the callback. + * @param noticModel 通知开关信息 model (IDOSetNoticeInfoBuletoothModel) + * Notification switch information model (IDOSetNoticeInfoBuletoothModel) + * @param callback 设置后配对过程状态回调 stateCode:0x00为不明异常超时,0x01为系统配对成功,0x02为取消配对,isNeedDisconnect:是否需要断开重连,is need to disconnect and reconnect + * stateCode :0x00 indicates an unknown abnormal timeout,0x01 indicates successful system pairing, and 0x02 indicates unpairing + * @param complete 设置后完成配对回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setSwitchNoticeCommand:(IDOSetNoticeInfoBuletoothModel * _Nullable)noticModel + callback:(void (^_Nullable)(BOOL isNeedDisconnect,int stateCode))callback + complete:(void (^_Nullable)(int errorCode))complete; + +/** + * @brief 设置通知中心、来电提醒开关,此方法只设置子开关状态。 + * Set up notification center, call alert switch.method sets only the subswitch state + * @param noticModel 通知开关信息 model (IDOSetNoticeInfoBuletoothModel) + * Notification switch information model (IDOSetNoticeInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setChildSwitchNoticeStateCommand:(IDOSetNoticeInfoBuletoothModel * _Nullable)noticModel callback:(void (^_Nullable)(int errorCode))callback; + +/** + * @brief 设置蓝牙配对 (不可重复设置,会引起无法再连接设备.只要配对成功,就不需要再设置,只有获取到系统配对设备被忽略,才可设置配对。⚠️在配对过程中不要执行其他命令。) + * Set up Bluetooth pairing (cannot be set repeatedly, it will cause the device to be connected again. As long as the pairing is successful, + * you don't need to set it again. Only when the system pairing device is ignored, the pairing can be set.⚠️Do not execute other commands during pairing.) + * @param callback 设置后配对过程状态回调 stateCode:0x00为不明异常超时,0x01为系统配对成功,0x02为取消配对,isNeedDisconnect:是否需要断开重连,is need to disconnect and reconnect + * stateCode :0x00 indicates an unknown abnormal timeout,0x01 indicates successful system pairing, and 0x02 indicates unpairing + * @param complete 设置后完成配对回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setBluetoothPairingCommandWithCallback:(void (^_Nullable)(BOOL isNeedDisconnect,int stateCode))callback + pairingComplete:(void (^_Nullable)(int errorCode))complete; + +/** + * @brief 设置寻找手机 | Set looking for a mobile phone + * @param findModel 寻找手机信息 model (IDOSetFindPhoneInfoBuletoothModel) + * Find mobile information model (IDOSetFindPhoneInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setFindPhoneCommand:(IDOSetFindPhoneInfoBuletoothModel * _Nullable)findModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置抬腕 | Set the wrist + * @param handUpmodel 抬腕信息 model (IDOSetHandUpInfoBuletoothModel) + * Wrist information model (IDOSetHandUpInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setHandUpCommand:(IDOSetHandUpInfoBuletoothModel * _Nullable)handUpmodel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置左右手佩戴 | Set the left and right hand to wear + * @param handModel 左右手佩戴 model (IDOSetLeftOrRightInfoBuletoothModel) + * Left and right hand wearing model (IDOSetLeftOrRightInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setLeftRightHandCommand:(IDOSetLeftOrRightInfoBuletoothModel *_Nullable)handModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置音乐开关 | Set music switch + * @param openMusicModel 音乐开关 model (IDOSetMusicOpenInfoBuletoothModel) + * Music Switch model (IDOSetMusicOpenInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setOpenMusicCommand:(IDOSetMusicOpenInfoBuletoothModel * _Nullable)openMusicModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置预防丢失 | Set to prevent loss + + * @param lostModel 预防丢失 model (IDOSetPreventLostInfoBuletoothModel) + * Prevent loss model (IDOSetPreventLostInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setPreventLostCommand:(IDOSetPreventLostInfoBuletoothModel * _Nullable)lostModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置显示模式 | Setting the display mode + * @param displaModel 显示模式 model (IDOSetDisplayModeInfoBluetoothModel) + * Display mode model (IDOSetDisplayModeInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setDisplayModeCommand:(IDOSetDisplayModeInfoBluetoothModel * _Nullable)displaModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置久坐 | Set sedentary + * @param longSitModel 久坐 model (IDOSetLongSitInfoBuletoothModel) + * Sedentary model (IDOSetLongSitInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setLongSitCommand:(IDOSetLongSitInfoBuletoothModel * _Nullable)longSitModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置天气预报开关 | Set the weather forecast switch + * @param weatherModel 天气预报开关 model (IDOSetWeatherSwitchInfoBluetoothModel) + * Weather Forecast Switch model (IDOSetWeatherSwitchInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setWeatherCommand:(IDOSetWeatherSwitchInfoBluetoothModel * _Nullable)weatherModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置心率模式 | Set heart rate mode + * @param hrModeModel 心率模式 model (IDOSetHRModeInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setHrModeCommand:(IDOSetHrModeInfoBluetoothModel * _Nullable)hrModeModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置防打扰模式 | Set the anti-disturb mode + * @param noDisturbModeModel 防打扰模式 model (IDOSetNoDisturbModeInfoBluetoothModel) + * Anti-disturbance mode model (IDOSetNoDisturbModeInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setNoDisturbModeCommand:(IDOSetNoDisturbModeInfoBluetoothModel * _Nullable)noDisturbModeModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置心率间隔 | Set heart rate interval + * @param hrIntervalModel 心率间隔 model (IDOSetHrIntervalInfoBluetoothModel) + * Heart Rate Interval model (IDOSetHrIntervalInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setHrIntervalCommand:(IDOSetHrIntervalInfoBluetoothModel * _Nullable)hrIntervalModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置单位 | Setting unit + * @param unitModel 单位 model (IDOSetUnitInfoBluetoothModel) | unit model (IDOSetUnitInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setUnitCommand:(IDOSetUnitInfoBluetoothModel * _Nullable)unitModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置一键呼叫 | Set up a one-click call + * @param oneKeySOSModel 一键呼叫 model (IDOSetOneKeySosInfoBuletoothModel) + * One-click calling model (IDOSetOneKeySosInfoBuletoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setOneKeySosCommand:(IDOSetOneKeySosInfoBuletoothModel * _Nullable)oneKeySOSModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置快捷方式 | Setting shortcuts + * @param shortcutModel 快捷方式 model (IDOSetShortcutInfoBluetoothModel) | Shortcut model (IDOSetShortcutInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setShortcutCommand:(IDOSetShortcutInfoBluetoothModel * _Nullable)shortcutModel callback:(void(^_Nullable)(int errorCode))callback; + + +/** + * @brief 设置血压舒张、收缩 | Set blood pressure to relax and contract + * @param calModel 血压舒张、收缩 model (IDOSetBloodPressureInfoBluetoothModel) + * Blood pressure diastolic, contraction model (IDOSetBloodPressureInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str ; model包含校准状态值) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setBpCalCommand:(IDOSetBloodPressureInfoBluetoothModel * _Nullable)calModel + callback:(void(^_Nullable)(int errorCode,IDOSetBloodPressureInfoBluetoothModel * _Nullable model))callback; + +/** + * @brief 设置运动快捷方式 | Set motion shortcuts + * @param sportSelectModel 运动快捷方式 model (IDOSetSportShortcutInfoBluetoothModel) + * Sports shortcut model (IDOSetSportShortcutInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setSportModeSelectCommand:(IDOSetSportShortcutInfoBluetoothModel * _Nullable)sportSelectModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置运动模式排序 | Set motion shortcuts + * @param sportSortModel 运动模式排序 model (IDOSetSportSortingInfoBluetoothModel) + * sport mode sort Model (IDOSetSportSortingInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setSportModeSortCommand:(IDOSetSportSortingInfoBluetoothModel * _Nullable)sportSortModel callback:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 设置天气预报数据 | Set weather forecast data + * @param weatherDataModel 天气预报数据 model (IDOSetWeatherDataInfoBluetoothModel) + * Weather Forecast Data model (IDOSetWeatherDataInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setWeatherDataCommand:(IDOSetWeatherDataInfoBluetoothModel *_Nullable)weatherDataModel + callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置天气预报数据 (定制扩展功能数据不存储) | Set city name (Extend functionality) + * @param weatherData 天气预报数据 @{@"today":weatherModel,@"city":@"",@"oneHourWeather":@[@{@"type":@(0),@"temp":@(0)}...]} + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) +*/ ++ (void)setWeatherDataExtensionCommand:(NSDictionary *_Nullable)weatherData + callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置iot按钮集合 (定制扩展功能数据不存储) | Set of iot buttons (Extend functionality) + * @param buttonNames iot按钮集合最多可以设置20个按钮 @[@{@"index":@(0),@"button":@""}...] + * callback 设置按钮集合回调进度 (0~1) | Set the button progress callback (0~1) + * @param complete 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post complete (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) +*/ ++ (void)setIotButtonNamesCommand:(NSArray * _Nullable)buttonNames + callback:(void (^ _Nullable)(float progress))callback + complete:(void (^ _Nullable)(int errorCode))complete; + +/** + * @brief 设置屏幕亮度 | Set screen brightness + * @param screenBrightnessModel 屏幕亮度 model (IDOSetScreenBrightnessInfoBluetoothModel) + * Screen Brightness model (IDOSetScreenBrightnessInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setScreenBrightnessCommand:(IDOSetScreenBrightnessInfoBluetoothModel * _Nullable)screenBrightnessModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置GPS信息 | Set GPS information + * @param gpsInfoModel GPS信息 model (IDOSetGpsConfigInfoBluetoothModel) + * GPS information model (IDOSetGpsConfigInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setGpsInfoCommand:(IDOSetGpsConfigInfoBluetoothModel * _Nullable)gpsInfoModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置GPS控制信息 | Set GPS Control Information + * @param gpsControlModel GPS控制信息 model (IDOSetGpsControlInfoBluetoothModel) + * GPS Control Information model (IDOSetGpsControlInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) (status 0 : 写入失败 , 1 : 正在写入 , 2 : 写入完成) + */ ++ (void)setGpsControlCommand:(IDOSetGpsControlInfoBluetoothModel * _Nullable)gpsControlModel + callback:(void (^ _Nullable)(int status,int errorCode))callback; + +/** + * @brief 设置控制连接参数 | Setting Control Connection Parameters + * @param connParamModel 控制连接参数 model (IDOSetConnParamInfoBluetoothModel) + * Control connection parameters model (IDOSetConnParamInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setConnParamCommand:(IDOSetConnParamInfoBluetoothModel * _Nullable)connParamModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置热启动参数 | Setting hot start parameters + * @param hotStartParamModel 热启动参数 model (IDOGetHotStartParamBluetoothModel) + * Hot Start Parameters model (IDOGetHotStartParamBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setHotStartParamCommand:(IDOGetHotStartParamBluetoothModel * _Nullable)hotStartParamModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置传感器实时数据 | Set sensor real-time data + * @param realTimeModel 传感器实时数据 model (IDOSetRealTimeSensorDataInfoBluetoothModel) + * Sensor real-time data model (IDOSetRealTimeSensorDataInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setRealTimeSensorDataCommand:(IDOSetRealTimeSensorDataInfoBluetoothModel * _Nullable)realTimeModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置马达参数 | Setting the motor parameters + * @param startMotorModel 马达参数 model (IDOSetStartMotorInfoBluetoothModel) + * Motor Parameter model (IDOSetStartMotorInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setStartMotorCommand:(IDOSetStartMotorInfoBluetoothModel * _Nullable)startMotorModel callback:(void (^ _Nullable)(int errorCode))callback; + + +/** + * @brief 设置表盘参数 | Setting the dial parameters + * @param watchDiaModel 表盘参数 model (IDOSetWatchDiaInfoBluetoothModel) + * Dial Parameters model (IDOSetWatchDiaInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setWatchDiaCommand:(IDOSetWatchDiaInfoBluetoothModel * _Nullable)watchDiaModel callback:(void (^ _Nullable)(int errorCode))callback; + + +/** + * @brief 设置血压测量参数 | Setting blood pressure measurement parameters + * @param bpMeasureModel 血压测量参数 model (IDOSetBpMeasureInfoBluetoothModel) + * Blood pressure measurement parameters model (IDOSetBpMeasureInfoBluetoothModel) + * @param callback 设置回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str ; model实时血压数据和状态) + * Set callback (errorCode: 0 transmission succeeded, other values are wrong, error code str can be obtained according to IDOErrorCodeToStr; + * model real-time blood pressure data and status) + */ ++ (void)setBpMeasureCommand:(IDOSetBpMeasureInfoBluetoothModel * _Nullable)bpMeasureModel + callback:(void (^ _Nullable)(int errorCode,IDOSetBpMeasureInfoBluetoothModel * _Nullable model))callback;; + + +/** + * @brief 设置睡眠时间段 | Setting the sleep period + * @param sleepPeriodModel 睡眠时间段 model (IDOSetSleepPeriodInfoBluetoothModel) + * Sleep time period model (IDOSetSleepPeriodInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setSleepPeriodCommand:(IDOSetSleepPeriodInfoBluetoothModel * _Nullable)sleepPeriodModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置女性生理周期 (id205) | Setting the female physiological cycle (id205) + * @param menstrualModel 女性生理周期 model (IDOSetMenstruationInfoBluetoothModel) + * Female Physiological Cycle model (IDOSetMenstruationInfoBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setMenstrualCommand:(IDOSetMenstruationInfoBluetoothModel * _Nullable)menstrualModel callback:(void (^ _Nullable)(int errorCode))callback; + + +/** + * @brief 设置女性生理周期提醒 (id205) | Set Women's Physiological Cycle Reminder (id205) + * @param remindModel 女性生理周期提醒 model (IDOSetMenstruationRemindBluetoothModel) + * Female Physiological Cycle Reminder model (IDOSetMenstruationRemindBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setMenstrualRemindCommand:(IDOSetMenstruationRemindBluetoothModel * _Nullable)remindModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置每分钟呼吸次数 (139) | Breaths per minute + * @param breatheModel 每分钟呼吸次数 model (IDOSetBreatheTrainBluetoothModel) + * Breaths per minute model (IDOSetBreatheTrainBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setBreatheTrainCommand:(IDOSetBreatheTrainBluetoothModel * _Nullable)breatheModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置走动提醒开关 (139) | Walking reminder switch + * @param walkModel 走动提醒开关 model (IDOSetWalkReminderBluetoothModel) + * Walking reminder switch model (IDOSetWalkReminderBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setWalkReminderCommand:(IDOSetWalkReminderBluetoothModel * _Nullable)walkModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置血氧开关 (139) | blood oxygen switch + * @param spo2Model 血氧开关 model (IDOSetSpo2SwitchBluetoothModel) + * blood oxygen switch model (IDOSetSpo2SwitchBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setSpo2SwitchCommand:(IDOSetSpo2SwitchBluetoothModel * _Nullable)spo2Model callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置运动开关 (139) | activity switch + * @param switchModel 运动开关 model (IDOSetActivitySwitchBluetoothModel) + * activity switch model (IDOSetActivitySwitchBluetoothModel) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setActivitySwitchCommand:(IDOSetActivitySwitchBluetoothModel * _Nullable)switchModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** +* @brief 设置心率开关同步 (139) | v3 heart rate +* @param v3HrModel 心率开关 model (IDOSetV3HeartRateModeBluetoothModel) +* v3 heart rate switch model (IDOSetV3HeartRateModeBluetoothModel) +* @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) +* Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) +*/ ++ (void)setV3HrModelCommand:(IDOSetV3HeartRateModeBluetoothModel * _Nullable)v3HrModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** +* @brief 设置喝水提醒 | drink water reminder +* @param drinkModel 喝水提醒开关 model (IDOSetDrinkReminderModeBluetoothModel) +* drink water reminder switch model (IDOSetDrinkReminderModeBluetoothModel) +* @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) +* Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) +*/ ++ (void)setDrinkReminderCommand:(IDOSetDrinkReminderModeBluetoothModel * _Nullable)drinkModel callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置星星数量 数据不作存储 (锐捷) | Set the number of stars (ruijie) + * @param startCount 星星数量 (1~5)| number of stars (1~5) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setStartCountCommand:(NSInteger)startCount callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置蓝牙短信推送 数据不作存储 (锐捷) | Set bluetooth SMS push (ruijie) + * @param content 蓝牙短信推送内容 (最长64个字节) | push content (Up to 64 bytes) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setContentCommand:(NSString * _Nullable)content callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置用户名字 数据不作存储 (锐捷) | Set user name (ruijie) + * @param userName 用户名字 (最长10个字节) | user name (Up to 10 bytes) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setUserNameCommand:(NSString * _Nullable)userName callback:(void (^ _Nullable)(int errorCode))callback; + +/** + * @brief 设置用户号码 数据不作存储 (锐捷) | Set user number (ruijie) + * @param userNumber 用户号码 (最长10个字节) | user number (Up to 10 bytes) + * @param callback 设置后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Set post callback (errorCode : 0 transfer succeeds, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)setUserNumberCommand:(NSString * _Nullable)userNumber callback:(void (^ _Nullable)(int errorCode))callback; + +#pragma mark ======= get Command ======= + +/** + * @brief 获取mac地址 | Get mac address + * @param callback 执行后回调 data (IDOGetMacAddrInfoBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetMacAddrInfoBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getMacAddrCommand:(void(^_Nullable)(int errorCode,IDOGetMacAddrInfoBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取设备信息 | Get device information + * @param callback 执行后回调 data (IDOGetDeviceInfoBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetDeviceInfoBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getDeviceInfoCommand:(void(^_Nullable)(int errorCode,IDOGetDeviceInfoBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取功能列表 | Get the list of features + * @param callback 执行后回调 data (IDOGetDeviceFuncBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetDeviceFuncBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getFuncTableCommand:(void(^_Nullable)(int errorCode,IDOGetDeviceFuncBluetoothModel * _Nullable data))callback; + +/** + * 在非OTA模式下连接成功后,需要准备在同步配置时设置的默认数据,回调后根据类型保存需要设置的数据,在同步配置时分别设置,无需单独执行命令(只有支持相应功能类型才会返回) + * After successful connection in non-ota mode, you need to prepare the default data set during synchronization configuration, + * save the data set according to the type after callback, and set them separately during synchronization configuration without executing separate commands + */ ++ (void)syncConfigSetDefaultValuesCallback:(void(^_Nullable)(IDO_SYNC_CONFIG_DATA_TYPE type,BOOL isComplete))callback; + +/** + * @brief 获得实时数据 | Get real-time data + * @param callback 执行后回调 data (IDOGetLiveDataBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetLiveDataBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getLiveDataCommand:(void(^_Nullable)(int errorCode,IDOGetLiveDataBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取设备当前时间 | Get the current time of the device + * @param callback 执行后回调 data (IDOGetDeviceTimeBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetDeviceTimeBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getDeviceTimeCommand:(void(^_Nullable)(int errorCode,IDOGetDeviceTimeBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取通知中心的状态 | Get the status of the notification center + * @param callback 执行后回调 data (IDOSetNoticeInfoBuletoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOSetNoticeInfoBuletoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getNoticeStatusCommand:(void(^_Nullable)(int errorCode,IDOSetNoticeInfoBuletoothModel * _Nullable data))callback; + +/** + * @brief 获取心率传感器参数 | Get Heart Rate Sensor Parameters + * @param callback 执行后回调 data (IDOGetHrSensorParamBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetHrSensorParamBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getHrSensorParamCommand:(void(^_Nullable)(int errorCode,IDOGetHrSensorParamBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取加速度传感器参数 | Acquire acceleration sensor parameters + * @param callback 执行后回调 data (IDOGetGsensorParamBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetGsensorParamBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getGsensorParamCommand:(void(^_Nullable)(int errorCode,IDOGetGsensorParamBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取活动数量 | Get the number of events + * @param callback 执行后回调 data (IDOGetActivityCountBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetActivityCountBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getActivityCountCommand:(void(^_Nullable)(int errorCode,IDOGetActivityCountBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取hid信息 | Get hid information + * @param callback 执行后回调 data (IDOGetHidInfoBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetHidInfoBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getHidInfoCommand:(void(^_Nullable)(int errorCode,IDOGetHidInfoBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取gps信息 | Get gps information + * @param callback 执行后回调 data (IDOGetGpsInfoBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetGpsInfoBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getGpsInfoCommand:(void(^_Nullable)(int errorCode,IDOGetGpsInfoBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取热启动参数 | Get hot start parameters + * @param callback 执行后回调 data (IDOGetHotStartParamBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetHotStartParamBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getHotStartParamCommand:(void(^_Nullable)(int errorCode,IDOGetHotStartParamBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取GPS状态 | Get GPS status + * @param callback 执行后回调 data (IDOGetGpsStatusBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetGpsStatusBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getGpsStatusCommand:(void(^_Nullable)(int errorCode,IDOGetGpsStatusBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取版本信息 | Get version information + * @param callback 执行后回调 data (IDOGetVersionInfoBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetVersionInfoBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getVersionInfoCommand:(void(^_Nullable)(int errorCode,IDOGetVersionInfoBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取realtek平台 ota授权 | Obtain ota authorization of realtek platform + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + * stateCode 0x00:校验成功,0x01:ID号校验失败,0x02:版本号校验失败,0x03:电量不足,0x04:其他错误 + * stateCode 0x00: verification success,0x01:ID number verification failure,0x02: version number verification failure,0x03: insufficient power,0x04: other errors + */ ++ (void)getOtaAuthInfoCommand:(void(^_Nullable)(int errorCode,int stateCode))callback; + +/** + * @brief 获取5个心率区间交换数据 | Exchange data of 5 heart rate intervals were obtained + * @param exchangeModel 运动过程中交互数据模型 | Interactive data model during motion + * @param callback 执行后回调 data (IDOGetFiveHrReplyInfoBluetoothModel) + * (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Post-execution callback data (IDOGetFiveHrReplyInfoBluetoothModel) + * (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getSwithHrInterval:(IDODataExchangeModel * _Nullable)exchangeModel + callback:(void(^_Nullable)(int errorCode,IDOGetFiveHrReplyInfoBluetoothModel * _Nullable data))callback; + + +/** +* @brief 默认的运动类型 | get default sport type +* @param callback 执行后回调 data (IDOGetDefaultSportTypeBluetoothModel) (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) +* Post-execution callback data (IDOGetDefaultSportTypeBluetoothModel) (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) +*/ ++ (void)getDefaultSportTypeCommand:(void(^_Nullable)(int errorCode,IDOGetDefaultSportTypeBluetoothModel * _Nullable data))callback; + +/** + * @brief 获取星星的数量,数据不作存储(锐捷) | Get number of stars (ruijie) + * @param callback 执行后回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * (errorCode : 0 The transfer was successful, the other values are errors, and the error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)getStartCountCommand:(void (^ _Nullable)(int errorCode,NSInteger startCount))callback; + +#pragma mark ======= listen Command ======= + +/** + * @brief 音乐开始 | Music begins + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenMusicStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 音乐暂停 | Music pause + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenMusicPauseCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 音乐结束 | End of music + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenMusicStopCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 音乐上一首 | Music on the first + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenMusicLastCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 音乐下一首 | Music next + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenMusicNextCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 单次拍照 | Single photo + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenPhotoSingleShotCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 连续拍照 | Taking photos continuously + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenPhotoBurstCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 拍照开始 | Take a photo + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenPhotoStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 拍照结束 | End of photo + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenPhotoEndCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 音量+ | Volume + + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenVolumeUpCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 音量- | Volume - + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenVolumeDownCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 寻找手机开始 | Looking for a mobile phone to start + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenFindPhoneStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 寻找手机结束 | Looking for the end of the phone + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenFindPhoneStopCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 防丢启动 | Anti-lost start + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenLostStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 防丢结束 | Anti-lost end + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenLostStopCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 一键求救 | One button for help + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenSosStartCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 闹钟同步完成 | Alarm clock synchronization completed + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenAlarmSyncCompleteCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 配置同步完成 | Configure synchronization completion + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenConfigSyncCompleteCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 健康同步完成 | Health sync completed + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenHealthSyncCompleteCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 数据传输完成 | Data transfer completed + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenDataTranCompleteCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 配置快速同步完成 | Configuring Fast Sync Complete + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenConfigFastSyncCompleteCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief GPS数据同步完成 | GPS data synchronization completed + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenGpsSyncCompleteCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 活动数据同步完成 | Activity data synchronization completed + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenActivitySyncCompleteCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 手环检查版本号 | Bracelet checks the version number + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)listenCheckUpdateReplyCommand:(void(^_Nullable)(int errorCode))callback; + +/** + * @brief 手环发送iot按钮 | Bracelet send iot buttons + * @param callback 监听回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str,index 对应按钮索引) + * Listening callback (errorCode : 0 is successful, other values are wrong, you can get error code str according to IDOErrorCodeToStr) +*/ ++ (void)listenIotButtonCommand:(void(^_Nullable)(int errorCode,int index))callback; + +#pragma mark ======= progress Command ======= + +/** + * @brief 健康数据同步进度 | Health data synchronization progress + * @param callback 健康数据同步进度回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Health data synchronization progress callback (errorCode : 0 transmission success, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)healthSyncProgressCommand:(void(^_Nullable)(int progress,int errorCode))callback; + +/** + * @brief 闹钟数据同步进度 | Alarm data synchronization progress + * @param callback 闹钟数据同步进度回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Alarm data synchronization progress callback (errorCode : 0 transmission success, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)alarmSyncProgressCommand:(void(^_Nullable)(int progress,int errorCode))callback; + +/** + * @brief 活动数据同步进度 | Activity data synchronization progress + * @param callback 活动数据同步进度回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Activity data synchronization progress callback (errorCode : 0 transmission success, other values are errors, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)activitySyncProgressCommand:(void(^_Nullable)(int progress,int errorCode))callback; + +/** + * @brief 数据交换进度 手环->app | Data Exchange Progress Bracelet -> app + * @param callback 数据交换进度回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Data exchange progress callback (errorCode: 0 transmission succeeded, other values are errors, error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)dataTranProgressCommand:(void(^_Nullable)(int progress,int errorCode))callback; + +/** + * @brief gps数据同步进度 | gps data synchronization progress + * @param callback gps数据同步进度回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * gps data synchronization progress callback (errorCode: 0 transmission success, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)gpsProgressCommand:(void(^_Nullable)(int progress,int errorCode))callback; + +/** + * @brief 数据交换进度 app->手环 | Data Exchange Progress app->Bracelet + * @param callback 数据交换进度回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Data exchange progress callback (errorCode: 0 transmission succeeded, other values are errors, error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)appDataTranProgressCommand:(void(^_Nullable)(int progress,int errorCode))callback; + +/** + * @brief 配置同步进度 | Configure synchronization progress + * @param callback 配置同步进度回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Configure synchronization progress callback (errorCode : 0 transmission succeeded, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)configSyncProgressCommand:(void(^_Nullable)(int progress,int errorCode))callback; + +#pragma mark ======= data exchange Command ======= + +/** + * @brief app 发起运动开始 | app starts the campaign + * @param model IDODataExchangeModel (数据交换model, day|hour|minute|second|sportType|targetType|targetValue|forceStart 这些属性需要赋值) + * IDODataExchangeModel (data exchange model, day|hour|minute|second|sportType|targetType|targetValue|forceStart These attributes need to be assigned) + * @param startCallback 运动发起回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Motion initiated callback (errorCode : 0 transmission succeeded, other values are errors, error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)appStartSportCommand:(IDODataExchangeModel * _Nullable)model + startCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))startCallback; + +/** + * @brief app 发起运动结束 | app initiates the end of the campaign + * @param model IDODataExchangeModel 活动时间需要保持一致,才能停止活动不然无效,当前model对象为全局时,只要开始活动记录开始时间, + * 结束时不需要再次给时间赋值,只需要给 durations|calories|distance|sportType|isSave 这些属性需要赋值 + * IDODataExchangeModel activity time needs to be consistent in order to stop the activity or it will be invalid. When the current model object is global, + * just start the activity record start time. You don't need to assign values to the time at the end, just give durations|calories|distance|sportType|isSave + * these properties need to be assigned. + * @param appEndCallback 运动停止回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Motion stop callback (errorCode : 0 transfer succeeded, other values are wrong, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)appEndSportCommand:(IDODataExchangeModel *_Nullable)model + appEndcallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))appEndCallback; + +/** + * @brief app发起的运动 手环主动结束 | App-initiated sports bracelet ends actively + * @param model IDODataExchangeModel 手环主动发起结束 APP需要给手环发送运动数据, durations|calories|distance|errorCode 这些属性需要赋值 + * IDODataExchangeModel The bracelet is actively launched. The APP needs to send motion data to the bracelet. durations|calories|distance|errorCode + * These attributes need to be assigned. + * @param appBleEndCallback 手环发起停止回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * The bracelet initiates a stop callback (errorCode: 0 is successfully transmitted, other values are incorrect, and error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)appBleEndReplyCommand:(IDODataExchangeModel *_Nullable)model + appBleEndCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))appBleEndCallback; + + +/** + * @brief app发起运动暂停 | app initiates a motion pause + * @param model IDODataExchangeModel 活动时间需要保持一致,才能暂停活动不然无效,当前model对象为全局时,只要开始活动记录开始时间,暂停时不需要再次给时间赋值,直接传入当前model + * IDODataExchangeModel activity time needs to be consistent in order to pause activity or not, when the current model object is global,  As soon as you start the activity + * record start time, you don't need to assign time to the timeout when you pause, you can directly pass in the current model. + * @param pauseCallback 运动暂停回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Motion pause callback (errorCode : 0 transmission success, other values are errors, you can get error code str according to IDOErrorCodeToStr) + */ ++ (void)appPauseSportCommand:(IDODataExchangeModel *_Nullable)model + pauseCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))pauseCallback; + + + +/** + * @brief app发起的运动 手环主动暂停 | App-initiated sports bracelet active suspension + * @param model IDODataExchangeModel 手环主动发起暂停 APP需要给手环发送运动数据, errorCode 这个属性需要赋值 + * IDODataExchangeModel The bracelet initiates a pause. The APP needs to send motion data to the bracelet. The errorCode attribute needs to be assigned. + * @param appBlePauseCallback 手环发起暂停回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * The bracelet initiates a pause callback (errorCode: 0 is successfully transmitted, other values are errors, and error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)appBlePauseReplyCommand:(IDODataExchangeModel *_Nullable)model + appBlePauseCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))appBlePauseCallback; + + +/** + * @brief app 发起运动恢复 | app initiates motion recovery + * @param model IDODataExchangeModel 活动时间需要保持一致,才能恢复活动不然无效,当前model对象为全局时,只要开始活动记录开始时间,恢复时不需要再次给时间赋值,直接传入当前model + * IDODataExchangeModel activity time needs to be consistent in order to restore activity or not, when the current model object is global,As soon as you start the activity + * record start time, you don't need to assign time to the time when restoring, you can directly pass in the current model. + * @param appRestoreCallback 运动恢复回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Motion recovery callback (errorCode : 0 transmission succeeded, other values are wrong, error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)appRestoreSportCommand:(IDODataExchangeModel * _Nullable)model + appRestoreCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))appRestoreCallback; + +/** + * @brief app发起的运动 手环主动恢复 | app-initiated sports bracelet active recovery + * @param model IDODataExchangeModel 手环主动发起恢复 APP需要给手环发送运动数据, errorCode 这个属性需要赋值 + * IDODataExchangeModel The bracelet initiates recovery. The APP needs to send motion data to the bracelet. The errorCode attribute needs to be assigned. + * @param appBleRestoreCallback 手环发起恢复回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * The bracelet initiates a recovery callback (errorCode : 0 is successfully transmitted, other values are incorrect, and error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)appBleRestoreReplyCommand:(IDODataExchangeModel *_Nullable)model + appBleRestoreCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))appBleRestoreCallback; + +/** + * @brief app发起数据交换过程 | app initiates the data exchange process + * @param model IDODataExchangeModel 活动时间需要保持一致,才能发送活动数据不然无效,当前model对象为全局时,只要开始活动记录开始时间,发送活动数据时不需要再次给时间赋值, + * 只需要给 status|duration|calories|distance 这些属性需要赋值 + * IDODataExchangeModel Activity time needs to be consistent in order to send active data or it is invalid. When the current model object is global, as long as the activity + * record start time is started, it is not necessary to assign time to the event when sending the activity data, just to status|duration|calories|distance + * These attributes need to be assigned. + * @param appIngCallback 运动发送数据回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * Motion sends data callback (errorCode : 0 transmission succeeded, other values are errors, error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)appIngSportCommand:(IDODataExchangeModel *_Nullable)model + appIngCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))appIngCallback; + +/** + * @brief 手环发起运动开始 | The bracelet starts the campaign + * @param model IDODataExchangeModel 只需要给 retCode 这个属性需要赋值 + * IDODataExchangeModel only needs to assign value to retCode property + * @param bleStartCallback 手环发起运动开始回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * The bracelet initiates a motion start callback (errorCode : 0 is successfully transmitted, other values are wrong, and error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)bleStartSportCommand:(IDODataExchangeModel *_Nullable)model + bleStartCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))bleStartCallback; + +/** + * @brief 手环发起运动暂停 | The bracelet initiates a motion pause + * @param model IDODataExchangeModel 只需要给 retCode 这个属性需要赋值 + * IDODataExchangeModel only needs to assign value to retCode property + * @param blePauseCallback 手环发起运动暂停回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * The bracelet initiates a motion pause callback (errorCode : 0 is successfully transmitted, other values are incorrect, and error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)blePauseSportCommand:(IDODataExchangeModel *_Nullable)model + blePauseCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))blePauseCallback; + +/** + * @brief 手环发起运动恢复 | Bracelet initiates sports recovery + * @param model IDODataExchangeModel 只需要给 retCode 这个属性需要赋值 + * IDODataExchangeModel only needs to assign value to retCode property + * @param bleRestoreCallback 手环发起运动恢复回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * The bracelet initiates a motion recovery callback (errorCode : 0 is successfully transmitted, other values are wrong, and error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)bleRestoreSportCommand:(IDODataExchangeModel *_Nullable)model + bleRestoreCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))bleRestoreCallback; + +/** + * @brief 手环发起运动结束 | The bracelet starts the campaign + * @param model IDODataExchangeModel 只需要给 retCode 这个属性需要赋值 + * IDODataExchangeModel only needs to assign value to retCode property + * @param bleEndCallback 手环发起运动结束回调 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + * The bracelet initiates a motion end callback (errorCode : 0 is successfully transmitted, other values are errors, and error code str can be obtained according to IDOErrorCodeToStr) + */ ++ (void)bleEndSportCommand:(IDODataExchangeModel *_Nullable)model + bleEndCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))bleEndCallback; + +/** + * @brief 手环发起运动发送数据 | The bracelet initiates a motion to send data + * @param model IDODataExchangeModel 只需要给 distance 这个属性需要赋值 + * @param bleIngCallback 手环发起运动发送数据 (errorCode : 0 传输成功,其他值为错误,可以根据 IDOErrorCodeToStr 获取错误码str) + */ ++ (void)bleIngSportCommand:(IDODataExchangeModel *_Nullable)model + bleIngCallback:(void (^_Nullable)(IDODataExchangeModel * _Nullable model,int errorCode))bleIngCallback; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOGetInfoBluetoothModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOGetInfoBluetoothModel.h new file mode 100755 index 0000000..3e84546 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOGetInfoBluetoothModel.h @@ -0,0 +1,1924 @@ +// +// IDOGetInfoBluetoothModel.h +// VeryfitSDK +// +// Created by apple on 2018/7/20. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +#pragma mark ==== 获取下载语言 model ==== + +@interface IDOGetDownLanguageBluetoothModel:IDOBluetoothBaseModel +/** + * 当前使用的语言 | use lang + */ +@property (nonatomic,assign) NSInteger useLang; +/** + * 默认语言 | default lang + */ +@property (nonatomic,assign) NSInteger defaultLang; +/** + * 固定存储语言个数 | fixed lang count + */ +@property (nonatomic,assign) NSInteger fixedLangCount; +/** + * 最大存储语言个数 | max storage lang + */ +@property (nonatomic,assign) NSInteger maxStorageLang; +/** + * 已经存储语言值 | language values + */ +@property (nonatomic,assign) NSArray * languageValues; +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetDownLanguageBluetoothModel + */ ++ (__kindof IDOGetDownLanguageBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 默认运动类型值 model ==== +@interface IDOGetDefaultSportTypeBluetoothModel:IDOBluetoothBaseModel +/** + * 默认运动类型的个数 | sport type count + */ +@property (nonatomic,assign) NSInteger sportTypeCount; + +/** + 运动类型值集合,集合排序就是运动类型排序 | set of motion type values, and set sort is motion type sort + */ +@property (nonatomic,strong) NSArray * sportTypes; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetDefaultSportTypeBluetoothModel + */ ++ (__kindof IDOGetDefaultSportTypeBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 手环检查版本号 model ==== +@interface IDOCheckUpdateBluetoothModel:IDOBluetoothBaseModel +/** + * app 响应状态 | flag code + * 0x00 : 已经是最新版本;0x01 :有新版本;0x02 :网络错误;0x03 :其他错误 + * 0x00 : it is the latest version; 0x01: there are new versions; 0x02: network error; 0x03: other errors + */ +@property (nonatomic,assign) NSInteger flagCode; + +/** + 固件最新版本号 | new version + */ +@property (nonatomic,assign) NSInteger newVersion; + +@end + +#pragma mark ==== 获取5个心率区间交换数据 ==== +@interface IDOGetFiveHrReplyInfoBluetoothModel:IDOBluetoothBaseModel +/** + 燃烧脂肪 | Threshold for burning fat + */ +@property (nonatomic,assign) NSInteger burnFat; + +/** + 有氧运动 | Aerobic threshold + */ +@property (nonatomic,assign) NSInteger aerobic; + +/** + 极限运动 | Limit threshold + */ +@property (nonatomic,assign) NSInteger limitValue; + +/** + 热身运动 | Warm-up + */ +@property (nonatomic,assign) NSInteger warmUp; + +/** + 无氧运动 | Anaerobic exercise + */ +@property (nonatomic,assign) NSInteger anaerobic; + +@end + +#pragma mark ==== 获取版本信息model ==== +@interface IDOGetVersionInfoBluetoothModel:IDOBluetoothBaseModel + +/** + * SDK版本 数值为x10,11表示1.1的版本 + * SDK version number is x10, and 11 represents the 1.1 version + */ +@property (nonatomic,assign) NSInteger sdkVersion; + +/** + * 心率算法版本 数值为x10,11表示1.1的版本 + * Version value of the heart rate algorithm is x10, and 11 represents version 1.1 + */ +@property (nonatomic,assign) NSInteger hrAlgorithmVersion; + +/** + * 睡眠算法版本 数值为x10,11表示1.1的版本 + * Sleep algorithm version number is x10, and 11 represents version 1.1 + */ +@property (nonatomic,assign) NSInteger sleepAlgorithmVersion; + +/** + * 计步算法版本 数值为x10,11表示1.1的版本 + * Step counting algorithm version value is x10,11 represents 1.1 version + */ +@property (nonatomic,assign) NSInteger stepAlgorithmVersion; + +/** + * 手势识别算法 数值为x10,11表示1.1的版本 + * Value of gesture recognition algorithm is x10, and 11 represents version 1.1 + */ +@property (nonatomic,assign) NSInteger gestureRecognitionVersion; + +/** + * PCB 版本 数值为x10,11表示1.1的版本 + * PCB version number is x10, and 11 represents version 1.1 + */ +@property (nonatomic,assign) NSInteger pcbVersion; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetVersionInfoBluetoothModel + */ ++ (__kindof IDOGetVersionInfoBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取GPS状态model ==== +@interface IDOGetGpsStatusBluetoothModel:IDOBluetoothBaseModel +/** + * GPS 运行状态 0 没有运行,1 正在搜星,2 为正在跟踪 + * GPS running status 0 No running, 1 is searching for stars, 2 is tracking + */ +@property (nonatomic,assign) NSInteger gpsRunStatus; + +/** + * AGPS 是否有效,有效期剩余小时,非0为有效, + * AGPS is valid, the remaining period is valid, non-zero is valid, + */ +@property (nonatomic,assign) NSInteger isAgpsVaild; + +@end + + +#pragma mark ==== 获取热启动参数model ==== +@interface IDOGetHotStartParamBluetoothModel:IDOBluetoothBaseModel +/** + 晶振偏移 默认 200 | crystals offset default 200 + */ +@property (nonatomic,assign) NSInteger tcxoOffset; + +/** + * 当前位置的经度 当前经度 x 10^6 , 去掉小数,注意西经为负数 默认 0 + * The current position of the longitude of the current longitude x 10 ^ 6, + * remove the decimal, pay attention to the scriptures is negative. default 0 + */ +@property (nonatomic,assign) NSInteger longitude; + +/** + * 当前位置的纬度, x10^6 ,去掉小数,注意南纬为负数 默认 0 + * The current position of latitude, x10 ^ 6, remove the decimal, + * pay attention to the south of the equator is negative. default 0 + */ +@property (nonatomic,assign) NSInteger latitude; + +/** + 当前位置的海拔高度 x10, 去掉小数 默认 0 + The altitude of the current position x10, get rid of the decimal. default 0 + */ +@property (nonatomic,assign) NSInteger altitude; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetHotStartParamBluetoothModel + */ ++ (__kindof IDOGetHotStartParamBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取GPS信息model ==== +@interface IDOGetGpsInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 错误码 | error code + */ +@property (nonatomic,assign) NSInteger errorCode; + +/** + 固件版本 | Firmware version + */ +@property (nonatomic,assign) NSInteger fwVersion; + +/** + GPS信息 | GPS information + */ +@property (nonatomic,assign) NSInteger agpsInfo; + +/** + GPS错误码 | GPS error code + */ +@property (nonatomic,assign) NSInteger agpsErrCode; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetGpsInfoBluetoothModel + */ ++ (__kindof IDOGetGpsInfoBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取hid信息model ==== +@interface IDOGetHidInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 是否开启 | Whether to open + */ +@property (nonatomic,assign) BOOL isStart; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 (暂停使用,无效) + * Query the database, if the query does not initialize a new model object (suspended, invalid) + * @return IDOGetHidInfoBluetoothModel + */ ++ (__kindof IDOGetHidInfoBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取活动和GPS个数信息model ==== +@interface IDOGetActivityCountBluetoothModel:IDOBluetoothBaseModel + +/** + 活动个数 | Number of activities + */ +@property (nonatomic,assign) NSInteger activityCount; + +/** + 活动包数 | Number of active packages + */ +@property (nonatomic,assign) NSInteger activityPacketCount; + +/** + GPS个数 | Number of GPS data + */ +@property (nonatomic,assign) NSInteger gpsCount; + +/** + GPS包数 | Number of GPS packets + */ +@property (nonatomic,assign) NSInteger gpsPacketCount; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 (未作存储处理,只会初始化新对象) + * Query the database, if the query does not initialize a new model object (not stored for processing, only the new object will be initialized) + * @return IDOGetActivityCountBluetoothModel + */ ++ (__kindof IDOGetActivityCountBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取加速度传感器参数信息model ==== +@interface IDOGetGsensorParamBluetoothModel:IDOBluetoothBaseModel + +/** + 率 | rate + */ +@property (nonatomic,assign) NSInteger rate; + +/** + 间隔 | range + */ +@property (nonatomic,assign) NSInteger range; + +/** + 阀值 | Threshold + */ +@property (nonatomic,assign) NSInteger threshold; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 (暂停使用,无效) + * Query the database, if the query does not initialize a new model object (suspended, invalid) + * @return IDOGetHrSensorParamBluetoothModel + */ ++ (__kindof IDOGetGsensorParamBluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取心率传感器参数信息model ==== +@interface IDOGetHrSensorParamBluetoothModel:IDOBluetoothBaseModel + +/** + 心率值 | Heart rate value + */ +@property (nonatomic,assign) NSInteger rate; + +/** + (未知参数) | (unknown parameter) + */ +@property (nonatomic,assign) NSInteger ledSelect; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 *(暂停使用,无效) + * Query the database, if the query does not initialize a new model object (suspended, invalid) + * @return IDOGetHrSensorParamBluetoothModel + */ ++ (__kindof IDOGetHrSensorParamBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取设备时间信息model ==== +@interface IDOGetDeviceTimeBluetoothModel:IDOBluetoothBaseModel + +/** + * 年 | year + * + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月 | month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日 | day + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; + +/** + 分 | Minute + */ +@property (nonatomic,assign) NSInteger minute; + +/** + 秒 | second + */ +@property (nonatomic,assign) NSInteger second; + +/** + 周 | week + */ +@property (nonatomic,assign) NSInteger week; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 *(暂停使用,无效) + * Query the database, if the query does not initialize a new model object (suspended, invalid) + * @return IDOGetDeviceTimeBluetoothModel + */ ++ (__kindof IDOGetDeviceTimeBluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取实时数据信息model ==== +@interface IDOGetLiveDataBluetoothModel:IDOBluetoothBaseModel + +/** + 步数 | Step count + */ +@property (nonatomic,assign) NSInteger step; + +/** + 卡路里 | Calorie + */ +@property (nonatomic,assign) NSInteger calories; + +/** + 距离 | distance + */ +@property (nonatomic,assign) NSInteger distances; + +/** + 活动时长 | Duration of activity + */ +@property (nonatomic,assign) NSInteger activeTime; + +/** + 心率 | Heart rate + */ +@property (nonatomic,assign) NSInteger heartRate; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetLiveDataBluetoothModel + */ ++ (__kindof IDOGetLiveDataBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取第27个功能表model ==== + +@interface IDOGetFuncTable27BluetoothModel : IDOBluetoothBaseModel +/** + * 泰国语 + * thai + */ +@property (nonatomic,assign) BOOL thai; +/** + * 越南语 + * vietnamese + */ +@property (nonatomic,assign) BOOL vietnamese; +/** + * 缅甸语 + * burmese + */ +@property (nonatomic,assign) BOOL burmese; +/** + * 菲律宾语 + * filipino + */ +@property (nonatomic,assign) BOOL filipino; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable27BluetoothModel + */ ++ (__kindof IDOGetFuncTable27BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取第26个功能表model ==== + +@interface IDOGetFuncTable26BluetoothModel : IDOBluetoothBaseModel +/** + * 支持恢复出厂设置,用于自动解绑 + * Support to restore factory Settings for automatic untying + */ +@property (nonatomic,assign) BOOL factoryReset; +/** + * 抬腕亮背光 命令和抬手亮屏一样,就是app显示的名字不一样,不能和other.upHandGesture共存 + * The backlight command of raising wrist light is the same as raising hand light screen, + * except that the name displayed by app is different and cannot coexist with other.upHandGesture + */ +@property (nonatomic,assign) BOOL liftingWrisBacklight; +/** + * 多运动不能使用app + * No app for more exercise + */ +@property (nonatomic,assign) BOOL multiActivityNoUseApp; +/** + * 多表盘 + * multi dial + */ +@property (nonatomic,assign) BOOL multiDial; +/** + * 中高强度活动 + * medium to high active duration + */ +@property (nonatomic,assign) BOOL mediumToHighActiveDuration; +/** + * 获取手环运动模式 + * default sport type + */ +@property (nonatomic,assign) BOOL defaultSportType; +/** + * 可下载语言 + * download language + */ +@property (nonatomic,assign) BOOL downloadLanguage; +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable26BluetoothModel + */ ++ (__kindof IDOGetFuncTable26BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取第25个功能表model ==== + +@interface IDOGetFuncTable25BluetoothModel:IDOBluetoothBaseModel +/** + 椭圆机 | elliptical + */ +@property (nonatomic,assign) BOOL elliptical; +/** + 划船机 | rower + */ +@property (nonatomic,assign) BOOL rower; +/** + 高强度间歇训练法 | High-intensity interval training + */ +@property (nonatomic,assign) BOOL hiit; +/** + 板球运动 | cricket + */ +@property (nonatomic,assign) BOOL cricket; +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable25BluetoothModel + */ ++ (__kindof IDOGetFuncTable25BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取第24个功能表model ==== + +@interface IDOGetFuncTable24BluetoothModel:IDOBluetoothBaseModel +/** + 户外跑步 | outdoor run + */ +@property (nonatomic,assign) BOOL outdoorRun; +/** + 室内跑步 | indoor run + */ +@property (nonatomic,assign) BOOL indoorRun; +/** + 户外骑行 | outdoor cycle + */ +@property (nonatomic,assign) BOOL outdoorCycle; +/** + 室内骑行 | indoor cycle + */ +@property (nonatomic,assign) BOOL indoorCycle; +/** + 户外走路 | outdoor walk + */ +@property (nonatomic,assign) BOOL outdoorWalk; +/** +室内走路 | indoor walk + */ +@property (nonatomic,assign) BOOL indoorWalk; +/** + 泳池游泳 | pool swim + */ +@property (nonatomic,assign) BOOL poolSwim; +/** + 开放水域游泳 | open water swim + */ +@property (nonatomic,assign) BOOL openWaterSwim; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable24BluetoothModel + */ ++ (__kindof IDOGetFuncTable24BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取第23个功能表model ==== +@interface IDOGetFuncTable23BluetoothModel:IDOBluetoothBaseModel +/** + 5级心率区间 | level 5 hr interval + */ +@property (nonatomic,assign) BOOL level5HrInterval; +/** + 走动提醒 | walk reminder + */ +@property (nonatomic,assign) BOOL walkReminder; +/** + 呼吸训练 | breathe train + */ +@property (nonatomic,assign) BOOL breatheTrain; + +/** + 5级亮度调节 | screen brightness 5 level + */ +@property (nonatomic,assign) BOOL screenBrightness5Level; +/** + 运动模式开关 自动识别 | activity switch + */ +@property (nonatomic,assign) BOOL activitySwitch; +/** + 勿扰 支持可选时间范围和星期 | disturb have rang repeat + */ +@property (nonatomic,assign) BOOL disturbHaveRangRepeat; +/** + 夜间自动亮度 | night auto brightness + */ +@property (nonatomic,assign) BOOL nightAutoBrightness; +/** + 传输长包 | long mtu + */ +@property (nonatomic,assign) BOOL longMtu; +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable23BluetoothModel + */ ++ (__kindof IDOGetFuncTable23BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取22功能列表信息model ==== +@interface IDOGetFuncTable22BluetoothModel:IDOBluetoothBaseModel +/** + 连接后自动配对 | auto pair + */ +@property (nonatomic,assign) BOOL autoPair; + +/** + 不断线配对 | no disconnect pair + */ +@property (nonatomic,assign) BOOL noDisconnectPair; + +/** + v3 心率数据 | v3 hr data + */ +@property (nonatomic,assign) BOOL v3HrData; + +/** + v3 游泳数据 | v3 swim data + */ +@property (nonatomic,assign) BOOL v3SwimData; + +/** + v3 活动数据 | v3 activity data + */ +@property (nonatomic,assign) BOOL v3ActivityData; + +/** + v3 gps 数据 | v3 gps data + */ +@property (nonatomic,assign) BOOL v3GpsData; + +/** + 喝水提醒 | drink water reminder + */ +@property (nonatomic,assign) BOOL drinkWaterReminder; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable22BluetoothModel + */ ++ (__kindof IDOGetFuncTable22BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取21功能列表信息model ==== +@interface IDOGetFuncTable21BluetoothModel:IDOBluetoothBaseModel +/** + chatwork + */ +@property (nonatomic,assign) BOOL chatwork; +/** + slack + */ +@property (nonatomic,assign) BOOL slack; +/** + tumblr + */ +@property (nonatomic,assign) BOOL tumblr; +/** + youtube + */ +@property (nonatomic,assign) BOOL youtube; +/** + yahoo pinterest + */ +@property (nonatomic,assign) BOOL yahooPinterest; +/** + yahoo mail + */ +@property (nonatomic,assign) BOOL yahooMail; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable21BluetoothModel + */ ++ (__kindof IDOGetFuncTable21BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取20功能列表信息model ==== +@interface IDOGetFuncTable20BluetoothModel:IDOBluetoothBaseModel + +/** + 女性生理周期 | Female physiological cycle + */ +@property (nonatomic,assign) BOOL menstruation; + +/** + 卡路里目标 | Calorie goal + */ +@property (nonatomic,assign) BOOL calorieGoal; + +/** + 距离目标 | Distance target + */ +@property (nonatomic,assign) BOOL distanceGoal; + +/** + 血氧数据 | Blood oxygen + */ +@property (nonatomic,assign) BOOL spo2Data; + +/** + 压力数据 | pressure data + */ +@property (nonatomic,assign) BOOL pressureData; + +/** + 获取勿扰模式 | get do not disturb + */ +@property (nonatomic,assign) BOOL getNoDisturb; + +/** + 运动模式排序 | sport mode sort + */ +@property (nonatomic,assign) BOOL sportModeSort; + +/** + 通知消息字节250 | notice message 250 byte + */ +@property (nonatomic,assign) BOOL noticeByte; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable20BluetoothModel + */ ++ (__kindof IDOGetFuncTable20BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取19功能列表信息model ==== +@interface IDOGetFuncTable19BluetoothModel:IDOBluetoothBaseModel + +/** + gps + */ +@property (nonatomic,assign) BOOL gps; + +/** + 睡眠时间段 | Sleep period + */ +@property (nonatomic,assign) BOOL sleepPeriod; + +/** + 屏幕亮度调节 | Screen brightness adjustment + */ +@property (nonatomic,assign) BOOL screenBrightness; + +/** + id107l 表盘 | Id107l dial + */ +@property (nonatomic,assign) BOOL id107Dial; + +/** + 未知 属性 | Unknown attribute + */ +@property (nonatomic,assign) BOOL dhNewAppNotice; + +/** + 128字节通知 | 128 byte notification + */ +@property (nonatomic,assign) BOOL noitice128Byte; + +/** + 获取时间同步 | Get time synchronization + */ +@property (nonatomic,assign) BOOL activityTimeSync; + +/** + v3 收集 | Collection log + */ +@property (nonatomic,assign) BOOL v3Log; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable19BluetoothModel + */ ++ (__kindof IDOGetFuncTable19BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取18列表信息model ==== +@interface IDOGetFuncTable18BluetoothModel:IDOBluetoothBaseModel + +/** + 登陆 | login + */ +@property (nonatomic,assign) BOOL logIn; + +/** + 手环自带相机拍照 | Bracelet comes with a camera to take pictures + */ +@property (nonatomic,assign) BOOL hidPhoto; + +/** + 表盘 | dial + */ +@property (nonatomic,assign) BOOL watchDial; + +/** + 快捷方式 | Shortcut + */ +@property (nonatomic,assign) BOOL shortcut; + +/** + 单位分开设置 | Units are set separately + */ +@property (nonatomic,assign) BOOL unitSet; + +/** + 血压 | blood pressure + */ +@property (nonatomic,assign) BOOL bloodPressure; + +/** + 微信运动 | WeChat Sport + */ +@property (nonatomic,assign) BOOL wechatSport; + +/** + 精细的时间段控制 | Fine time period control + */ +@property (nonatomic,assign) BOOL fineTimeControl; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable18BluetoothModel + */ ++ (__kindof IDOGetFuncTable18BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取17功能列表信息model ==== +@interface IDOGetFuncTable17BluetoothModel:IDOBluetoothBaseModel + +/** + 高尔夫 | Golf + */ +@property (nonatomic,assign) BOOL golf; + +/** + 棒球 | baseball + */ +@property (nonatomic,assign) BOOL baseball; + +/** + 滑雪 | ski + */ +@property (nonatomic,assign) BOOL skiing; + +/** + 轮滑 | Roller + */ +@property (nonatomic,assign) BOOL rollerSkating; + +/** + 跳舞 | dancing + */ +@property (nonatomic,assign) BOOL dance; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable17BluetoothModel + */ ++ (__kindof IDOGetFuncTable17BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取16功能列表信息model ==== +@interface IDOGetFuncTable16BluetoothModel:IDOBluetoothBaseModel + +/** + 健身操 | Aerobics + */ +@property (nonatomic,assign) BOOL bodybuildingExercise; + +/** + 瑜伽 | Yoga + */ +@property (nonatomic,assign) BOOL yoga; + +/** + 跳绳 | rope skipping + */ +@property (nonatomic,assign) BOOL ropeSkipping; +/** + 乒乓球 | pingpong + */ +@property (nonatomic,assign) BOOL tableTennis; + +/** + 篮球 | basketball + */ +@property (nonatomic,assign) BOOL basketball; + +/** + 足球 | football + */ +@property (nonatomic,assign) BOOL football; + +/** + 排球 | volleyball + */ +@property (nonatomic,assign) BOOL volleyball; + +/** + 网球 | tennis + */ +@property (nonatomic,assign) BOOL tennis; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable16BluetoothModel + */ ++ (__kindof IDOGetFuncTable16BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取15功能列表信息model ==== +@interface IDOGetFuncTable15BluetoothModel:IDOBluetoothBaseModel + +/** + 健身 | Fitness + */ +@property (nonatomic,assign) BOOL fitness; + +/** + 动感单车 | Spinning bike + */ +@property (nonatomic,assign) BOOL spinning; + +/** + 椭圆球 | Oval ball + */ +@property (nonatomic,assign) BOOL ellipsoid; + +/** + 跑步机 | Treadmill + */ +@property (nonatomic,assign) BOOL treadmill; + +/** + 仰卧起坐 | Sit-ups + */ +@property (nonatomic,assign) BOOL sitUp; + +/** + 俯卧撑 | push ups + */ +@property (nonatomic,assign) BOOL pushUp; + +/** + 哑铃 | Dumbbell + */ +@property (nonatomic,assign) BOOL dumbbell; + +/** + 举重 | weightlifting + */ +@property (nonatomic,assign) BOOL weightlifting; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable15BluetoothModel + */ + ++ (__kindof IDOGetFuncTable15BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取14功能列表信息model ==== +@interface IDOGetFuncTable14BluetoothModel:IDOBluetoothBaseModel + +/** + 走路 | walk + */ +@property (nonatomic,assign) BOOL walk; + +/** + 跑步 | Run + */ +@property (nonatomic,assign) BOOL run; + +/** + 骑行 | Riding + */ +@property (nonatomic,assign) BOOL byBike; + +/** + 徒步 | on foot + */ +@property (nonatomic,assign) BOOL onFoot; + +/** + 游泳 | Swim + */ +@property (nonatomic,assign) BOOL swim; + +/** + 爬山 | Mountain climbing + */ +@property (nonatomic,assign) BOOL mountainClimbing; + +/** + 羽毛球 | badminton + */ +@property (nonatomic,assign) BOOL badminton; + +/** + 其他 | other + */ +@property (nonatomic,assign) BOOL other; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable14BluetoothModel + */ ++ (__kindof IDOGetFuncTable14BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取13功能列表信息model ==== +@interface IDOGetFuncTable13BluetoothModel:IDOBluetoothBaseModel + +/** + 静态心率 | Static heart rate + */ +@property (nonatomic,assign) BOOL staticHr; + +/** + 防打扰 | Anti-disturbance + */ +@property (nonatomic,assign) BOOL doNotDisturb; + +/** + 显示模式 | Display mode + */ +@property (nonatomic,assign) BOOL displayMode; + +/** + 心率监测 | Heart rate monitoring + */ +@property (nonatomic,assign) BOOL heartRateMonitor; + +/** + 双向防丢 | Two-way anti-lost + */ +@property (nonatomic,assign) BOOL bilateralAntiLost; + +/** + 所有通知提醒 | All notification reminders + */ +@property (nonatomic,assign) BOOL allAppNotice; + +/** + 不显示心率区间 | Does not show heart rate interval + */ +@property (nonatomic,assign) BOOL noShowHrInterval; + +/** + 翻转屏幕 | Flip the screen + */ +@property (nonatomic,assign) BOOL flipScreen; + +/** + *@brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + *@return IDOGetFuncTable13BluetoothModel + */ ++ (__kindof IDOGetFuncTable13BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取12功能列表信息model ==== +@interface IDOGetFuncTable12BluetoothModel:IDOBluetoothBaseModel + +/** + 提示信息联系人 | Tips Contact + */ +@property (nonatomic,assign) BOOL tipInfoContact; + +/** + 提示信息号码 | Message number + */ +@property (nonatomic,assign) BOOL tipInfoNum; + +/** + 提醒信息内容 | Reminder content + */ +@property (nonatomic,assign) BOOL tipInfoContent; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable12BluetoothModel + */ ++ (__kindof IDOGetFuncTable12BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取11功能列表信息model ==== +@interface IDOGetFuncTable11BluetoothModel:IDOBluetoothBaseModel + +/** + 久坐提醒 | Sedentary reminder + */ +@property (nonatomic,assign) BOOL sedentariness; + +/** + 防丢提醒 | Anti-lost reminder + */ +@property (nonatomic,assign) BOOL antilost; + +/** + 一键呼叫 | One-click calling + */ +@property (nonatomic,assign) BOOL onetouchCalling; + +/** + 寻找手机 | Looking for a mobile phone + */ +@property (nonatomic,assign) BOOL findPhone; + +/** + 寻找手环 | Looking for a bracelet + */ +@property (nonatomic,assign) BOOL findDevice; + +/** + 默认模式 | Default mode + */ +@property (nonatomic,assign) BOOL configDefault; + +/** + 手势 | Gestures + */ +@property (nonatomic,assign) BOOL upHandGesture; + +/** + 天气预报 | Weather forecast + */ +@property (nonatomic,assign) BOOL weather; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable11BluetoothModel + */ ++ (__kindof IDOGetFuncTable11BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取10功能列表信息model ==== +@interface IDOGetFuncTable10BluetoothModel:IDOBluetoothBaseModel + +/** + vkontakte + */ +@property (nonatomic,assign) BOOL vkontakte; + +/** + line + */ +@property (nonatomic,assign) BOOL line; + +/** + viber + */ +@property (nonatomic,assign) BOOL viber; + +/** + kakaoTalk + */ +@property (nonatomic,assign) BOOL kakaoTalk; + +/** + gmail + */ +@property (nonatomic,assign) BOOL gmail; + +/** + outlook + */ +@property (nonatomic,assign) BOOL outlook; + +/** + snapchat + */ +@property (nonatomic,assign) BOOL snapchat; + +/** + telegram + */ +@property (nonatomic,assign) BOOL telegram; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable10BluetoothModel + */ ++ (__kindof IDOGetFuncTable10BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取9功能列表信息model ==== +@interface IDOGetFuncTable9BluetoothModel:IDOBluetoothBaseModel + +/** + whatsapp + */ +@property (nonatomic,assign) BOOL whatsapp; + +/** + messengre + */ +@property (nonatomic,assign) BOOL messengre; + +/** + instagram + */ +@property (nonatomic,assign) BOOL instagram; + +/** + linkedIn + */ +@property (nonatomic,assign) BOOL linkedIn; + +/** + calendar + */ +@property (nonatomic,assign) BOOL calendar; + +/** + skype + */ +@property (nonatomic,assign) BOOL skype; + +/** + alarmClock + */ +@property (nonatomic,assign) BOOL alarmClock; + + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable9BluetoothModel + */ ++ (__kindof IDOGetFuncTable9BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取8功能列表信息model ==== +@interface IDOGetFuncTable8BluetoothModel:IDOBluetoothBaseModel + +/** + 短信 | SMS + */ +@property (nonatomic,assign) BOOL message; + +/** + 邮件 | Mail + */ +@property (nonatomic,assign) BOOL email; + +/** + qq + */ +@property (nonatomic,assign) BOOL qq; + +/** + 微信 | WeChat + */ +@property (nonatomic,assign) BOOL weixin; + +/** + 新浪 | Sina + */ +@property (nonatomic,assign) BOOL sinaWeibo; + +/** + facebook + */ +@property (nonatomic,assign) BOOL facebook; + +/** + twitter + */ +@property (nonatomic,assign) BOOL twitter; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable8BluetoothModel + */ ++ (__kindof IDOGetFuncTable8BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取7功能列表信息model ==== +@interface IDOGetFuncTable7BluetoothModel:IDOBluetoothBaseModel + +/** + 来电提醒 | Call reminder + */ +@property (nonatomic,assign) BOOL calling; + +/** + 来电联系人 | Caller contact + */ +@property (nonatomic,assign) BOOL callingContact; + +/** + 来电号码 | Caller ID + */ +@property (nonatomic,assign) BOOL callingNum; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable7BluetoothModel + */ ++ (__kindof IDOGetFuncTable7BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取6功能列表信息model ==== +@interface IDOGetFuncTable6BluetoothModel:IDOBluetoothBaseModel + +/** + 起床 | Get up + */ +@property (nonatomic,assign) BOOL wakeUp; + +/** + 睡觉 | Sleeping + */ +@property (nonatomic,assign) BOOL sleep; + +/** + 锻炼 | Exercise + */ +@property (nonatomic,assign) BOOL sport; + +/** + 吃药 | Taking medicine + */ +@property (nonatomic,assign) BOOL medicine; + +/** + 约会 | Dating + */ +@property (nonatomic,assign) BOOL dating; + +/** + 聚会 | Party + */ +@property (nonatomic,assign) BOOL party; + +/** + 会议 | Meeting + */ +@property (nonatomic,assign) BOOL metting; + +/** + 自定义 | Customization + */ +@property (nonatomic,assign) BOOL custom; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable6BluetoothModel + */ ++ (__kindof IDOGetFuncTable6BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取5功能列表信息model ==== +@interface IDOGetFuncTable5BluetoothModel:IDOBluetoothBaseModel + +/** + 拍照 | taking pictures + */ +@property (nonatomic,assign) BOOL takePhoto; + +/** + 音乐 | Music + */ +@property (nonatomic,assign) BOOL music; + +/** + 控制拍照 | Control photo + */ +@property (nonatomic,assign) BOOL hidPhoto; + +/** + 5个心率区间 | 5 heart rate intervals + */ +@property (nonatomic,assign) BOOL fiveHrInterval; + +/** + 绑定授权 | Binding Authorization + */ +@property (nonatomic,assign) BOOL bindAuth; + +/** + 快速同步 | Quick sync + */ +@property (nonatomic,assign) BOOL fastSync; + +/** + 扩展功能 | Extended Features + */ +@property (nonatomic,assign) BOOL exFuncTable; + +/** + 绑定码授权 | Binding Code Authorization + */ +@property (nonatomic,assign) BOOL bindCodeAuth; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable5BluetoothModel + */ ++ (__kindof IDOGetFuncTable5BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取4功能列表信息model ==== +@interface IDOGetFuncTable4BluetoothModel:IDOBluetoothBaseModel + +/** + 步数 | Number of steps + */ +@property (nonatomic,assign) BOOL stepCalculation; + +/** + 睡眠检测 | Sleep detection + */ +@property (nonatomic,assign) BOOL sleepMonitor; + +/** + 单次运动 | Single movement + */ +@property (nonatomic,assign) BOOL singleSport; + +/** + 实时数据 | Real-time data + */ +@property (nonatomic,assign) BOOL realtimeData; + +/** + 设备更新 | Equipment Update + */ +@property (nonatomic,assign) BOOL deviceUpdate; + +/** + 心率功能 | Heart rate function + */ +@property (nonatomic,assign) BOOL heartRate; + +/** + 通知中心 | Notification Center + */ +@property (nonatomic,assign) BOOL ancs; + +/** + 时间线 | Timeline + */ +@property (nonatomic,assign) BOOL timeLine; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable4BluetoothModel + */ ++ (__kindof IDOGetFuncTable4BluetoothModel *)currentModel; + +@end + +#pragma mark ==== 获取3功能列表信息model ==== +@interface IDOGetFuncTable3BluetoothModel:IDOBluetoothBaseModel + +/** + 斯洛伐克语 | Slovak + */ +@property (nonatomic,assign) BOOL slovak; + +/** + 丹麦语 | Danish + */ +@property (nonatomic,assign) BOOL danish; + +/** + 克罗地亚语 | Croatian + */ +@property (nonatomic,assign) BOOL croatian; + +/** + 印尼语 | Indonesian + */ +@property (nonatomic,assign) BOOL indonesian; + +/** + 韩语 | korean + */ +@property (nonatomic,assign) BOOL korean; + +/** + 印地语 | hindi + */ +@property (nonatomic,assign) BOOL hindi; + +/** + 葡萄牙语 | portuguese + */ +@property (nonatomic,assign) BOOL portuguese; + +/** + 土耳其 | turkish + */ +@property (nonatomic,assign) BOOL turkish; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable3BluetoothModel + */ ++ (__kindof IDOGetFuncTable3BluetoothModel *)currentModel; + +@end + + +#pragma mark ==== 获取2功能列表信息model ==== +@interface IDOGetFuncTable2BluetoothModel:IDOBluetoothBaseModel + +/** + 罗马尼亚文 | Romanian + */ +@property (nonatomic,assign) BOOL romanian; + +/** + 立陶宛文 | Lithuanian + */ +@property (nonatomic,assign) BOOL lithuanian; + +/** + 荷兰文 | Dutch + */ +@property (nonatomic,assign) BOOL dutch; + +/** + 斯洛文尼亚文 | Slovenian + */ +@property (nonatomic,assign) BOOL slovenian; + +/** + 匈牙利文 | Hungarian + */ +@property (nonatomic,assign) BOOL hungarian; + +/** + 波兰文 | Polish + */ +@property (nonatomic,assign) BOOL polish; + +/** + 俄罗斯文 | Russian + */ +@property (nonatomic,assign) BOOL russian; + +/** + 乌克兰文 | Ukrainian + */ +@property (nonatomic,assign) BOOL ukrainian; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable2BluetoothModel + */ ++ (__kindof IDOGetFuncTable2BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取1功能列表信息model ==== +@interface IDOGetFuncTable1BluetoothModel:IDOBluetoothBaseModel + +/** + 中文 | Chinese + */ +@property (nonatomic,assign) BOOL ch; + +/** + 英文 | English + */ +@property (nonatomic,assign) BOOL eng; + +/** + 法文 | French + */ +@property (nonatomic,assign) BOOL french; + +/** + 德文 | German + */ +@property (nonatomic,assign) BOOL german; + +/** + 意大利文 | Italian + */ +@property (nonatomic,assign) BOOL italian; + +/** + 西班牙文 | Spanish + */ +@property (nonatomic,assign) BOOL spanish; + +/** + 日文 | Japanese + */ +@property (nonatomic,assign) BOOL japanese; + +/** + 捷克文 | Czech + */ +@property (nonatomic,assign) BOOL czech; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetFuncTable1BluetoothModel + */ ++ (__kindof IDOGetFuncTable1BluetoothModel *)currentModel; +@end + +#pragma mark ==== 获取功能列表信息model ==== +@interface IDOGetDeviceFuncBluetoothModel:IDOBluetoothBaseModel + +/** + 1功能列表 语言1 | 1 func table + */ +@property (nonatomic,strong) IDOGetFuncTable1BluetoothModel * funcTable1Model; + +/** + 2功能列表 语言2 | 2 func table + */ +@property (nonatomic,strong) IDOGetFuncTable2BluetoothModel * funcTable2Model; + +/** + 3功能列表 语言3 | 3 func table + */ +@property (nonatomic,strong) IDOGetFuncTable3BluetoothModel * funcTable3Model; + +/** + 4功能列表 | 4 func table + */ +@property (nonatomic,strong) IDOGetFuncTable4BluetoothModel * funcTable4Model; + +/** + 5功能列表 | 5 func table + */ +@property (nonatomic,strong) IDOGetFuncTable5BluetoothModel * funcTable5Model; + +/** + 6功能列表 闹钟功能 | 6 func table + */ +@property (nonatomic,strong) IDOGetFuncTable6BluetoothModel * funcTable6Model; + +/** + 7功能列表 来电提醒 | 7 func table + */ +@property (nonatomic,strong) IDOGetFuncTable7BluetoothModel * funcTable7Model; + +/** + 8功能列表 智能提醒1 | 8 func table + */ +@property (nonatomic,strong) IDOGetFuncTable8BluetoothModel * funcTable8Model; + +/** + 9功能列表 智能提醒2 | 9 func table + */ +@property (nonatomic,strong) IDOGetFuncTable9BluetoothModel * funcTable9Model; + +/** + 10功能列表 智能提醒3 | 10 func table + */ +@property (nonatomic,strong) IDOGetFuncTable10BluetoothModel * funcTable10Model; + +/** + 11功能列表 久坐、防丢 | 11 func table + */ +@property (nonatomic,strong) IDOGetFuncTable11BluetoothModel * funcTable11Model; + +/** + 12功能列表 短信号码 | 12 func table + */ +@property (nonatomic,strong) IDOGetFuncTable12BluetoothModel * funcTable12Model; + +/** + 13功能列表 静态心率、显示模式 | 13 func table + */ +@property (nonatomic,strong) IDOGetFuncTable13BluetoothModel * funcTable13Model; + +/** + 14功能列表 运动模式1 | 14 func table + */ +@property (nonatomic,strong) IDOGetFuncTable14BluetoothModel * funcTable14Model; + +/** + 15功能列表 运动模式2 | 15 func table + */ +@property (nonatomic,strong) IDOGetFuncTable15BluetoothModel * funcTable15Model; + +/** + 16功能列表 运动模式3 | 16 func table + */ +@property (nonatomic,strong) IDOGetFuncTable16BluetoothModel * funcTable16Model; + +/** + 17功能列表 运动模式4 | 17 func table + */ +@property (nonatomic,strong) IDOGetFuncTable17BluetoothModel * funcTable17Model; + +/** + 18功能列表 表盘、血压 | 18 func table + */ +@property (nonatomic,strong) IDOGetFuncTable18BluetoothModel * funcTable18Model; + +/** + 19功能列表 GPS、亮度 | 19 func table + */ +@property (nonatomic,strong) IDOGetFuncTable19BluetoothModel * funcTable19Model; + +/** + 20功能列表 女性健康、运动排序 | 20 func table + */ +@property (nonatomic,strong) IDOGetFuncTable20BluetoothModel * funcTable20Model; + +/** + 21功能列表 | 21 func table + */ +@property (nonatomic,strong) IDOGetFuncTable21BluetoothModel * funcTable21Model; + +/** + 22功能列表 连接后自动配对、v3数据 | 22 func table + */ +@property (nonatomic,strong) IDOGetFuncTable22BluetoothModel * funcTable22Model; + +/** + 23功能列表 走动提醒、呼吸训练 | 23 func table + */ +@property (nonatomic,strong) IDOGetFuncTable23BluetoothModel * funcTable23Model; + +/** + 24功能列表 运动模式5 | 24 func table + */ +@property (nonatomic,strong) IDOGetFuncTable24BluetoothModel * funcTable24Model; + +/** + 25功能列表 运动模式6 | 25 func table + */ +@property (nonatomic,strong) IDOGetFuncTable25BluetoothModel * funcTable25Model; + +/** + 26功能列表 运动模式6 | 26 func table + */ +@property (nonatomic,strong) IDOGetFuncTable26BluetoothModel * funcTable26Model; + +/** + 27功能列表 语言4 | 27 func table + */ +@property (nonatomic,strong) IDOGetFuncTable27BluetoothModel * funcTable27Model; + +/** + 是否支持版本信息 | version information is supported + */ +@property (nonatomic,assign) BOOL versionInfo; + +/** + 闹钟个数 | Number of alarms + */ +@property (nonatomic,assign) NSInteger alarmCount; + +/** + 运动显示个数 | Number of sports displays + */ +@property (nonatomic,assign) NSInteger sportShowCount; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetDeviceFuncBluetoothModel + */ ++ (__kindof IDOGetDeviceFuncBluetoothModel *)currentModel; + +/** + * @brief 判断是否有运动模式 | Determine if there are movement patterns + */ ++ (BOOL)isHaveMovment; + +@end + +#pragma mark ==== 获取设备信息model ==== +@interface IDOGetDeviceInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 设备模式 | Device mode + */ +@property (nonatomic,assign) NSUInteger mode; + +/** + * 电量状态 (0x0:正常,0x01:正在充电,0x02:充满,0x03:电量低) + * Battery status (0x0: normal,0x01: charging,0x02: full,0x03: low power) + */ +@property (nonatomic,assign) NSUInteger battStatus; + +/** + 电量级别 (0~100)| Battery level + */ +@property (nonatomic,assign) NSUInteger battLevel; + +/** + 是否重启 | Whether to restart + */ +@property (nonatomic,assign) NSUInteger rebootFlag; + +/** + 绑定时间戳 | Binding timestamp + */ +@property (nonatomic,copy) NSString * bindTimeStr; + +/** + 绑定状态 | Binding status + */ +@property (nonatomic,assign) NSInteger bindState; + +/** + * 绑定类型 | Binding type + * 0x00默认(注意以前ID号定制),超时时间无效, + * 0x01(单击[按键在下面]), + * 0x02(为长按[按键在下面]), + * 0x03(屏幕点击 横向确认和取消,确认在左边), + * 0x04(屏幕点击 横向确认和取消,确认在右边), + * 0x05(屏幕点击 竖向确认和取消,确认在上边), + * 0x06(屏幕点击 竖向确认和取消,确认在下边), + * 0x07点击(右边一个按键)) + */ +@property (nonatomic,assign) NSInteger bindType; + +/** + * 绑定超时 | Binding timeout + * 最长为15秒,0表示不超时 + */ +@property (nonatomic,assign) NSInteger bindTimeout; + +/** + * 手环的平台 | platform for bracelet + * 0:nordic, 10:realtek 8762x ,20:cypress psoc6,30:Apollo3 + */ +@property (nonatomic,assign) NSInteger platform; + +/** + * 手环是否同步过配置 | is sync config + * + */ +@property (nonatomic,assign) BOOL isSyncConfig; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetDeviceInfoBluetoothModel + */ ++ (__kindof IDOGetDeviceInfoBluetoothModel *)currentModel; + +/** + * @brief 查询本地所有设备信息(不包括Mac地址不存在的设备) + * Query all local device information (excluding devices where Mac addresses do not exist) + * @return IDOGetDeviceInfoBluetoothModel array + */ ++ (NSArray <__kindof IDOGetDeviceInfoBluetoothModel *>*)queryAllDeviceModels; + +@end + +#pragma mark ==== 获取mac地址model ==== +@interface IDOGetMacAddrInfoBluetoothModel:IDOBluetoothBaseModel + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOGetMacAddrInfoBluetoothModel + */ ++ (__kindof IDOGetMacAddrInfoBluetoothModel *)currentModel; +@end + +@interface IDOGetInfoBluetoothModel : IDOBluetoothBaseModel + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOLogEnum.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOLogEnum.h new file mode 100755 index 0000000..af811d3 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOLogEnum.h @@ -0,0 +1,165 @@ +// +// IDOLogEnum.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/3. +// Copyright © 2019 何东阳. All rights reserved. +// + +#ifndef IDOLogEnum_h +#define IDOLogEnum_h + +/** + * 记录日志类型 + * Log type + */ +typedef NS_ENUM(NSInteger, IDO_RECORD_LOG_TYPE) { + /** + * 手动连接手环 + * Manually connect the bracelet + */ + IDO_MANUAL_CONNECT_LOG = 1, + /** + * 自动连接手环 + * Automatic connection bracelet + */ + IDO_AUTO_CONNECT_LOG, + /** + * 手环绑定 + * Bracelet binding + */ + IDO_BIND_DEVICE_LOG, + /** + * 手环解绑 + * Untie the bracelet + */ + IDO_UNBIND_DEVICE_LOG, + /** + * 同步配置 + * Synchronous configuration + */ + IDO_SYNC_CONFIG_LOG, + /** + * 同步健康 + * Synchronous Health + */ + IDO_SYNC_HEALTH_LOG, + /** + * 同步健康 步数 + * Synchronous Health Steps + */ + IDO_SYNC_HEALTH_SPORT_LOG, + /** + * 同步健康 睡眠 + * Synchronized Health Sleep + */ + IDO_SYNC_HEALTH_SLEEP_LOG, + /** + * 同步健康 心率 + * Synchronized Health Heart Rate + */ + IDO_SYNC_HEALTH_HR_LOG, + /** + * 同步健康 血压 + * Synchronized Health Blood Pressure + */ + IDO_SYNC_HEALTH_BP_LOG, + /** + * 同步 血氧 + * Synchronized blood oxygen + */ + IDO_SYNC_BLOOD_OXYGEN_LOG, + /** + * 同步 压力 + * Synchronized Pressure + */ + IDO_SYNC_PRESSURE_LOG, + /** + * 同步 游泳 + * Synchronized Swimming + */ + IDO_SYNC_SWIMMING_LOG, + /** + * 同步活动 + * Synchronous activity + */ + IDO_SYNC_ACTIVITY_LOG, + /** + * 同步gps + * Synchronous gps + */ + IDO_SYNC_GPS_LOG, + /** + * 同步结束 + * End of synchronization + */ + IDO_SYNC_COMPLETE_LOG, + /** + * 蓝牙写入数据 + * Bluetooth write data + */ + IDO_WRITE_DATA_LOG, + /** + * 蓝牙接收数据 + * Bluetooth receiving data + */ + IDO_RECEIVE_DATA_LOG, + /** + * 手环开始升级 + * The bracelet starts to upgrade + */ + IDO_START_UPDATE_LOG, + /** + * 手环升级失败 + * Failed to upgrade the bracelet + */ + IDO_UPDATE_FAILED_LOG, + /** + * 手环升级成功 + * Bracelet upgraded successfully + */ + IDO_UPDATE_SUCCESS_LOG, + /** + * 手环启动配对 + * Bracelet starts pairing + */ + IDO_PAIRING_START_LOG, + /** + * 手环配对失败 + * Bracelet pairing failed + */ + IDO_PAIRING_FAILED_LOG, + /** + * 手环配对后重连失败 + * The bracelet failed to reconnect after pairing + */ + IDO_PAIRING_RECONNECT_FAILED_LOG, + /** + * 手环配对后重连成功 + * The bracelet successfully to reconnect after pairing + */ + IDO_PAIRING_RECONNECT_SUCCESS_LOG, + /** + * 手环配对后启动设置子开关 + * After the bracelet is paired, start the setting sub-switch + */ + IDO_PAIRING_RECONNECT_SET_SUB_SWITCH_LOG, + /** + * 手环配对后设置子开关失败 + * Failed to set sub-switch after bracelet pairing + */ + IDO_PAIRING_RECONNECT_SET_SUB_SWITCH_FAILED_LOG, + /** + * 手环配对后设置子开关成功 + * Set the sub-switch successfully after the bracelet is paired + */ + IDO_PAIRING_RECONNECT_SET_SUB_SWITCH_SUCCESS_LOG, + /** + * 协议库日志记录 + * protocol c log + */ + IDO_PROTOCOL_C_LOG +}; + + +#endif /* IDOLogEnum_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOPeripheralModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOPeripheralModel.h new file mode 100755 index 0000000..717874a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOPeripheralModel.h @@ -0,0 +1,59 @@ +// +// IDOPeripheralModel.h +// VeryfitSDK +// +// Created by hedongyang on 2018/6/4. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#import +#import + +@interface IDOPeripheralModel : NSObject + +/** + 外围设备 | peripheral + */ +@property (nullable,nonatomic,strong) CBPeripheral * peripheral; + +/** + 手环名字 | Bracelet name + */ +@property (nullable,nonatomic,copy) NSString * name; + +/** + 手环uuid | Bracelet uuid + */ +@property (nullable,nonatomic,copy) NSString * uuidStr; + +/** + 手环rssi | bracelet rssi + */ +@property (nonatomic,assign) NSInteger rssi; + +/** + 手环距离 单位 米 | Bracelet Distance Units + */ +@property (nonatomic,assign) float distance; + +/** + 是否是OTA | Is it OTA? + */ +@property (nonatomic,assign) BOOL isOta; + +/** + mac 地址 | mac address + */ +@property (nullable,nonatomic,copy) NSString * macAddr; + +/** + 设备ID | Device ID + */ +@property (nonatomic,assign) int deviceId; + +/** + 固件版本 | Firmware version + */ +@property (nonatomic,assign) int bltVersion; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDORecordDeviceLog.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDORecordDeviceLog.h new file mode 100755 index 0000000..d846789 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDORecordDeviceLog.h @@ -0,0 +1,56 @@ +// +// IDORecordDeviceLog.h +// IDOBluetooth +// +// Created by hedongyang on 2018/9/25. +// Copyright © 2018年 apple. All rights reserved. +// + +#import + +#if __has_include() +#elif __has_include() +#else +#import "IDOLogEnum.h" +#endif + +@interface IDORecordDeviceLog : NSObject + +/** + * @brief 获取设备日志信息 (在设备连接ota模式下不能使用获取设备重启日志) + * Obtain device log information (When the device is connected, it is not used in the ota mode to get the device restart log) + * @param callback 日志信息获取完成回调 | Log information acquisition completion callback + */ ++ (void)getDeviceLogWithCallback:(void(^_Nullable)(BOOL isComplete))callback; + +/** + * @brief 记录协议库外的蓝牙日志 + * Record bluetooth logs outside the protocol library + * @param type 日志类型 | Log type + * @param logStr 日志记录 | Log str + */ ++ (void)recordBlueLogWithType:(IDO_RECORD_LOG_TYPE)type + logStr:(NSString *_Nullable)logStr; + +/** + * @brief 设备重启日志路径 | Device restart log path + * @return 日志存储目录 目录下可能有多个日志文件 日志文件是按日期生成的 + * Log Storage Directory There may be multiple log files under the directory. The log files are generated by date. + */ ++ (NSString *_Nullable)rebootLogFloderPath; + +/** + * @brief 命令执行记录日志路径 | Command execution logging path + * @return 日志存储目录 目录下可能有多个日志文件 日志文件是按日期生成的 + * log Storage Directory There may be multiple log files under the directory. The log files are generated by date. + */ ++ (NSString *_Nullable)recordLogFloaderPath; + +/** + * sdk 更新日志文件路径(html) + * sdk update log file path(html) + */ ++ (NSString *_Nullable)updateLogFilePath DEPRECATED_MSG_ATTRIBUTE("method is deprecated"); + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSetInfoBluetoothModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSetInfoBluetoothModel.h new file mode 100755 index 0000000..9f244b4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSetInfoBluetoothModel.h @@ -0,0 +1,1760 @@ +// +// IDOSetBuletoothModel.h +// VeryfitSDK +// +// Created by hedongyang on 2018/6/13. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +#pragma mark ==== 设置喝水提醒 model ==== +@interface IDOSetDrinkReminderModeBluetoothModel:IDOBluetoothBaseModel +/** + 喝水提醒开关 | drink water reminder + */ +@property (nonatomic,assign) BOOL onOff; +/** + 提醒间隔,单位分钟 | interval (unit minutes) + */ +@property (nonatomic,assign) NSInteger interval; +/** + 开始时间(时) | start time (hours) + */ +@property (nonatomic,assign) NSInteger startHour; +/** + 开始时间(分) | start time (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; +/** + 结束时间 (时) | end time (hours) + */ +@property (nonatomic,assign) NSInteger endHour; +/** + 结束时间 (分) | end time (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; +/** + * 重复集合 [星期一、星期二、星期三、星期四、星期五、星期六、星期日] + * Repeat collection [monday,tuesday,wednesday,thursday,friday,saturday,sunday] + */ +@property (nonatomic,strong)NSArray * repeat; +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetDrinkReminderModeBluetoothModel + */ ++ (__kindof IDOSetDrinkReminderModeBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置心率开关同步 model ==== +@interface IDOSetV3HeartRateModeBluetoothModel:IDOBluetoothBaseModel +/** + * 心率模式 0:关闭心率监测功能 1:手动模式 2:自动模式 3:持续监测(默认:自动模式) + * Heart Rate Mode 0: Turn off heart rate monitoring function 1: Manual mode 2: Auto mode 3:Continuously monitor(Default: Auto mode) + */ +@property (nonatomic,assign) NSInteger modeType; +/** + * 更新时间unix 时间戳,秒级 (eg 14442361933) + * Update time Unix timestamp, in seconds + */ +@property (nonatomic,copy) NSString * updateTime; +/** + 是否有相隔时间 | Is there a time interval? + */ +@property (nonatomic,assign) BOOL isHasTimeRange; +/** + 开始 (时) | Start (hours) + */ +@property (nonatomic,assign) NSInteger startHour; +/** + 开始 (分) | Start (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; +/** + 结束 (时) | End (hours) + */ +@property (nonatomic,assign) NSInteger endHour; +/** + 结束 (分) | End (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; +/** + 测量间隔,单位分钟 | measurement Interval,unit:minutes + */ +@property (nonatomic,assign) NSInteger measurementInterval; +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetV3HeartRateModeBluetoothModel + */ ++ (__kindof IDOSetV3HeartRateModeBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置运动开关 model ==== +@interface IDOSetActivitySwitchBluetoothModel:IDOBluetoothBaseModel +/** + 自动识别运动类型开关 | sport type on Off + */ +@property (nonatomic,assign) BOOL sportTypeOnOff DEPRECATED_MSG_ATTRIBUTE("this attribute is discarded"); +/** + 自动识别走路开关 | auto identify sport walk + */ +@property (nonatomic,assign) BOOL sportWalkOnOff; +/** + 自动识别跑步开关 | auto identify sport run + */ +@property (nonatomic,assign) BOOL sportRunOnOff; +/** + 自动识别自行车开关 | auto identify sport bicycle + */ +@property (nonatomic,assign) BOOL sportBicycleOnOff; +/** + 运动自动暂停开关 | auto pause on off + */ +@property (nonatomic,assign) BOOL autoPauseOnOff; +/** + 结束提醒开关 | end remind on off + */ +@property (nonatomic,assign) BOOL endRemindOnOff; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetActivitySwitchBluetoothModel + */ ++ (__kindof IDOSetActivitySwitchBluetoothModel *)currentModel; + +@end + + +#pragma mark ==== 设置血氧开关控制 model ==== +@interface IDOSetSpo2SwitchBluetoothModel:IDOBluetoothBaseModel +/** + 开关 | on off + */ +@property (nonatomic,assign) BOOL onOff; + +/** + 开始时间 (时) | start hour + */ +@property (nonatomic,assign) NSInteger startHour; + +/** + 开始时间 (分) | start minute + */ +@property (nonatomic,assign) NSInteger startMinute; + +/** + 结束时间 (时) | end hour + */ +@property (nonatomic,assign) NSInteger endHour; + +/** + 结束时间 (分) | end minute + */ +@property (nonatomic,assign) NSInteger endMinute; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetSpo2SwitchBluetoothModel + */ ++ (__kindof IDOSetSpo2SwitchBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 设置呼吸训练 model ==== +@interface IDOSetBreatheTrainBluetoothModel:IDOBluetoothBaseModel +/** + 每分钟呼吸次数 | Breaths per minute + */ +@property (nonatomic,assign) NSInteger frequency; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetBreatheTrainBluetoothModel + */ ++ (__kindof IDOSetBreatheTrainBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置走动提醒 model ==== +@interface IDOSetWalkReminderBluetoothModel:IDOBluetoothBaseModel +/** + 走动提醒开关 | Walking reminder switch + */ +@property (nonatomic,assign) BOOL onOff; +/** + 目标步数 | goal step + */ +@property (nonatomic,assign) NSInteger goalStep; +/** + 开始时间(时) | start time (hours) + */ +@property (nonatomic,assign) NSInteger startHour; +/** + 开始时间(分) | start time (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; +/** + 结束时间 (时) | end time (hours) + */ +@property (nonatomic,assign) NSInteger endHour; +/** + 结束时间 (分) | end time (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; +/** + * 重复集合 [星期一、星期二、星期三、星期四、星期五、星期六、星期日] + * Repeat collection [monday,tuesday,wednesday,thursday,friday,saturday,sunday] + */ +@property (nonatomic,strong)NSArray * repeat; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetWalkReminderBluetoothModel + */ ++ (__kindof IDOSetWalkReminderBluetoothModel *)currentModel; + +@end +#pragma mark ==== 设置经期提醒 model ==== +@interface IDOSetMenstruationRemindBluetoothModel:IDOBluetoothBaseModel +/** + 开始日提醒 提前天数 | Start Day Reminder + */ +@property (nonatomic,assign) NSInteger startDay; +/** + 排卵日提醒 提前天数 | Ovulation Day Reminder + */ +@property (nonatomic,assign) NSInteger ovulationDay; +/** + 提醒时间 (时) | Reminder time (hours) + */ +@property (nonatomic,assign) NSInteger hour; +/** + 提醒时间 (分) | Reminder time (minutes) + */ +@property (nonatomic,assign) NSInteger minute; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetMenstruationRemindBluetoothModel + */ ++ (__kindof IDOSetMenstruationRemindBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 设置经期 model ==== +@interface IDOSetMenstruationInfoBluetoothModel:IDOBluetoothBaseModel +/** + 开关 | onoff + */ +@property (nonatomic,assign) BOOL onOff; +/** + 经期长度 | length of menstruation + */ +@property (nonatomic,assign) NSInteger menstrualLength; +/** + 经期周期 | Menstrual cycle + */ +@property (nonatomic,assign) NSInteger menstrualCycle; +/** + 最近经期年份 | Recent menstrual years + */ +@property (nonatomic,assign) NSInteger lastMenstrualYear; +/** + 最近经期月份 | Recent menstrual months + */ +@property (nonatomic,assign) NSInteger lastMenstrualMonth; +/** + 最近经期日期 | Recent menstrual date + */ +@property (nonatomic,assign) NSInteger lastMenstrualDay; +/** + 排卵日的间隔 | ovulation interval day + */ +@property (nonatomic,assign) NSInteger ovulationIntervalDay; +/** + 经期前一天 | | The day before the menstrual period + */ +@property (nonatomic,assign) NSInteger ovulationBeforeDay; +/** + 经期后一天 | | One day after menstruation + */ +@property (nonatomic,assign) NSInteger ovulationAfterDay; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetMenstruationInfoBluetoothModel + */ ++ (__kindof IDOSetMenstruationInfoBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 绑定model ==== +@interface IDOSetBindingInfoBluetoothModel:IDOBluetoothBaseModel +/** + 授权码长度 | Authorization code length + */ +@property (nonatomic,assign) NSUInteger authLength; + +/** + 授权码 | Authorization code + */ +@property (nonatomic,copy) NSString * authCode; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 (只有在授权绑定才会存储数据) + * Query the database, if the query does not initialize the new model object (only the authorization binding will store the data) + * @return IDOSetBindingInfoBluetoothModel + */ ++ (__kindof IDOSetBindingInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置设置睡眠时间段model ==== +@interface IDOSetSleepPeriodInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 睡眠开关 | Sleep switch + */ +@property (nonatomic,assign) BOOL OnOff; + +/** + 开始 (时) | Start (hours) + */ +@property (nonatomic,assign) NSInteger startHour; + +/** + 开始 (分) | Start (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; + +/** + 结束 (时) | End (hours) + */ +@property (nonatomic,assign) NSInteger endHour; + +/** + 结束 (分) | End (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 | Query the database, if the query does not initialize a new model object + * @return IDOSetSleepPeriodInfoBluetoothModel + */ ++ (__kindof IDOSetSleepPeriodInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置血压测量指令model ==== +@interface IDOSetBpMeasureInfoBluetoothModel:IDOBluetoothBaseModel + +/** + * 参数标志 0x01:开始测量,0x02:结束测量,0x03:获得血压数据 + * Parameter flag 0x01: Start measurement, 0x02: End measurement, 0x03: Obtain blood pressure data + */ +@property (nonatomic,assign) NSInteger flag; + +/** + * 返回状态 0x00:不支持,0x01:正在测量,0x02:测量成功 0x03:测量失败 0x04:设备正在运动模式 + * Return status 0x00: Not supported, 0x01: Positive measurement, 0x02: Measurement success 0x03: Measurement failure 0x04: Device is in motion mode + */ +@property (nonatomic,assign) NSInteger status; + +/** + 高压(收缩压) | High pressure (systolic pressure) + */ +@property (nonatomic,assign) NSInteger systolicBp; + +/** + 低压(舒张压) | Low pressure (diastolic pressure) + */ +@property (nonatomic,assign) NSInteger diastolicBp; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetBpMeasureInfoBluetoothModel + */ ++ (__kindof IDOSetBpMeasureInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置表盘参数model ==== +@interface IDOSetWatchDiaInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 表盘ID | Dial ID + */ +@property (nonatomic,assign) NSInteger dialId; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetWatchDiaInfoBluetoothModel + */ ++ (__kindof IDOSetWatchDiaInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置马达参数model ==== +@interface IDOSetStartMotorInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 马达状态 | Motor status + */ +@property (nonatomic,assign) NSInteger status; + +/** + 马达超时时长 | Motor timeout duration + */ +@property (nonatomic,assign) NSInteger timeout; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetStartMotorInfoBluetoothModel + */ ++ (__kindof IDOSetStartMotorInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置传感器实时数据model ==== +@interface IDOSetRealTimeSensorDataInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 未知传感器状态 | Unknown sensor status + */ +@property (nonatomic,assign) NSInteger gsensorStatus; + +/** + 心率传感器状态 | Heart Rate Sensor Status + */ +@property (nonatomic,assign) NSInteger heartRateSensorStatus; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetRealTimeSensorDataInfoBluetoothModel + */ ++ (__kindof IDOSetRealTimeSensorDataInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置连接参数信息model ==== +@interface IDOSetConnParamInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 连接模式 | Connection mode + */ +@property (nonatomic,assign) NSInteger mode; + +/** + 修改快速模式连接间隔 | Modify Quick Mode Connection Interval + */ +@property (nonatomic,assign) NSInteger modifConnParam; + +/** + 最大间隔 | Maximum interval + */ +@property (nonatomic,assign) NSInteger maxInterval; + +/** + 最小间隔 | Minimum interval + */ +@property (nonatomic,assign) NSInteger minInterval; + +/** + 延迟 | Delay + */ +@property (nonatomic,assign) NSInteger slaveLatency; + +/** + 连接超时 | Connection timeout + */ +@property (nonatomic,assign) NSInteger connTimeout; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetConnParamInfoBluetoothModel + */ ++ (__kindof IDOSetConnParamInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置GPS控制信息model ==== +@interface IDOSetGpsControlInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 1: 控制 , 2: 查询 | 1: Control, 2: Query + */ +@property (nonatomic,assign) NSInteger operate; + +/** + * 0x01 开启log,0x02 关闭log,0x03 agps写入,0x04 agps 擦除,0x05 gps_fw 写入 + * 0x01 turns on log, 0x02 turns off log, 0x03 agps writes, 0x04 agps erases, 0x05 gps_fw writes + */ +@property (nonatomic,assign) NSInteger type; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetGpsControlInfoBluetoothModel + */ ++ (__kindof IDOSetGpsControlInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置GPS信息model ==== +@interface IDOSetGpsConfigInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 0x01 冷启动,0x02 热启动 默认2 | 0x01 Cold Start, 0x02 Hot Start Default 2 + */ +@property (nonatomic,assign) NSInteger startMode; + +/** + * 操作模式,1为正常;2为低功耗;4为Balance,5为1PPS 默认1 + * Operation mode, 1 is normal; 2 is low power consumption; 4 is Balance, 5 is 1PPS default 1 + */ +@property (nonatomic,assign) NSInteger gsopOperationMode; + +/** + 定位周期,默认1000 1s | Positioning period, default 1000 1s + */ +@property (nonatomic,assign) NSInteger gsopCycleMs; + +/** + * 定位星mode,1为GPS,2为GLONASS,3为1为GPS + GLONASS 默认1 + * Positioning star mode, 1 is GPS, 2 is GLONASS, 3 is 1 for GPS + GLONASS Default 1 + */ +@property (nonatomic,assign) NSInteger gnsValue; + +/** + 年 | year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日 | day + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; + +/** + 分 | minute + */ +@property (nonatomic,assign) NSInteger minute; + +/** + 秒 | seconds + */ +@property (nonatomic,assign) NSInteger second; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetGpsConfigInfoBluetoothModel + */ ++ (__kindof IDOSetGpsConfigInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置屏幕亮度model ==== +@interface IDOSetScreenBrightnessInfoBluetoothModel:IDOBluetoothBaseModel +/** + 屏幕亮度级别 (1-100) | Screen brightness level (1-100) + */ +@property (nonatomic,assign) NSInteger levelValue; +/** + 是否用户调节 | is manual + */ +@property (nonatomic,assign) BOOL isManual; +/** + * 0x00关闭自动调整,0x01 使用环境光传感器,0x02,夜间自动调整亮度,0x03 夜间降亮度使用设置的时间 + * 0x00 turns off automatic adjustment,0x01 USES ambient light sensor, + * 0x02, automatic adjustment of brightness at night,0x03 set time for reducing brightness at night + */ +@property (nonatomic,assign) NSInteger mode; +/** + * 夜间自动亮度调整 0x00,无效,由固件定义,0x01关闭,0x02,夜间自动调整亮度,0x03 夜间降亮度使用设置的时间 + * Automatic overnight brightness adjustment 0x00, invalid, as defined by firmware,0x01 is off,0x02, + * automatic night brightness adjustment,0x03 night brightness reduction USES the set time + */ +@property (nonatomic,assign) NSInteger autoAdjustNight; +/** + 开始 时钟 | start hour + */ +@property (nonatomic,assign) NSInteger startHour; +/** + 开始 分钟 | start minute + */ +@property (nonatomic,assign) NSInteger startMinute; +/** + 结束 时钟 | end hour + */ +@property (nonatomic,assign) NSInteger endHour; +/** + 结束 分钟 | end minute + */ +@property (nonatomic,assign) NSInteger endMinute; +/** + 夜间亮度 (realme项目) | night level + */ +@property (nonatomic,assign) NSInteger nightLevel; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetScreenBrightnessInfoBluetoothModel + */ ++ (__kindof IDOSetScreenBrightnessInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置天气数据model ==== +@interface IDOSetWeatherDataInfoBluetoothModel:IDOBluetoothBaseModel + +/** + * 天气预报更新的时间戳 time interval since 1970 (如:1444361933) + * Time stamp of weather forecast update time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * timeStr; + +/** + 今天平均温度 | Average temperature today + */ +@property (nonatomic,assign) NSInteger todayTemp; + +/** + * 天气类型 | Weather type + * 天气情况(0:其他, 1:晴, 2:多云, 3:阴,4:雨,5:暴雨, + * 6:雷阵雨, 7:雪, 8:雨夹雪,9:台风, 10:沙尘暴, 11:夜 间晴, + * 12:夜间多云, 13:热, 14:冷, 15:清风, 16:大风, 17:雾霭,18:阵雨, 19:多云转晴) + * weather conditions (0: others, 1: sunny, 2: cloudy, 3: cloudy, 4: rain, 5: rainstorm, + * 6: thunderstorm, 7: snow, 8: sleet, 9: typhoon, 10: sandstorm, 11: night clear, + * 12: cloudy night, 13: hot, 14: cold, 15: breezy, 16: blustery, 17: mist, 18: showers, 19: cloudy to clear) + */ +@property (nonatomic,assign) NSInteger todayType; + +/** + 今天最高温度 | Today's highest temperature + */ +@property (nonatomic,assign) NSInteger todayMaxTemp; + +/** + 今天最小温度 | Today's minimum temperature + */ +@property (nonatomic,assign) NSInteger todayMinTemp; + +/** + 湿度 | Humidity + */ +@property (nonatomic,assign) NSInteger humidity; + +/** + 紫外线强度 | UV intensity + */ +@property (nonatomic,assign) NSInteger todayUvIntensity; + +/** + 空气污染指数 | Air Pollution Index + */ +@property (nonatomic,assign) NSInteger todayAqi; + +/** + * 后三天天的天气集合 @{@"type":@(0),@"maxTemp":@(0),@"minTemp":@(0)} + * Weather collection for the last three days @{@"type":@(0),@"maxTemp":@(0),@"minTemp":@(0)} + */ +@property (nonatomic,strong) NSArray* future; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetWeatherDataInfoBluetoothModel + */ ++ (__kindof IDOSetWeatherDataInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置运动快捷模式排序model ==== + +@interface IDOSetSportSortingItemModel:NSObject + +/** + * 排序索引 index //排序,从1、2、3、4....,0:无效 + * Sort index // sort from 1, 2, 3, 4... , 0: invalid + */ +@property (nonatomic,assign) NSInteger index; + +/** + * 运动模式 | Sport mode + * 0:无,1:走路,2:跑步,3:骑行,4:徒步,5:游泳,6:爬山,7:羽毛球,8:其他, + * 9:健身,10:动感单车,11:椭圆机,12:跑步机,13:仰卧起坐,14:俯卧撑,15:哑铃,16:举重, + * 17:健身操,18:瑜伽,19:跳绳,20:乒乓球,21:篮球,22:足球 ,23:排球,24:网球, + * 25:高尔夫球,26:棒球,27:滑雪,28:轮滑,29:跳舞,48:户外跑步,49:室内跑步,50:户外骑行,51:室内骑行, + * 52:户外走路,53:室内走路,54:泳池游泳,55:开放水域游泳,56:椭圆机,57:划船机,58:高强度间歇训练法,59:板球运动 + * 0: none, 1: walk, 2: run, 3: ride, 4: hike, 5: swim, 6: climb, 7: badminton, 8: others, + * 9: fitness, 10: spinning, 11: elliptical, 12: treadmill, 13: sit-ups, 14: push-ups, 15: dumbbells, 16: weightlifting, + * 17: aerobics, 18: yoga, 19: jump rope, 20: table tennis, 21: basketball, 22: football, 23: volleyball, 24: tennis, + * 25: golf, 26: baseball, 27: skiing, 28: roller skating, 29: dancing,48: outdoor running, 49: indoor running, 50: outdoor cycling, 51: indoor cycling, + * 52: outdoor walking, 53: indoor walking, 54: pool swimming, 55: open water swimming, 56: elliptical machine, 57: rowing machine, 58: high-intensity interval training + * 59:cricket + */ +@property (nonatomic,assign) NSInteger type; + +@end + +@interface IDOSetSportSortingInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 运动模式排序集合最多8个 | Sports mode sort set up to 8 + */ +@property (nonatomic,strong)NSArray * sportSortingItems; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetSportSortingInfoBluetoothModel + */ ++ (__kindof IDOSetSportSortingInfoBluetoothModel *)currentModel; + +@end + +#pragma mark ==== 设置运动快捷模式model ==== + +@interface IDOSetSportShortcutInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 走路 | Walking + */ +@property (nonatomic,assign) BOOL isWalk; + +/** + 跑步 | Running + */ +@property (nonatomic,assign) BOOL isRun; + +/** + 骑自行车 | Cycling + */ +@property (nonatomic,assign) BOOL isByBike; + +/** + 步行 | Walking + */ +@property (nonatomic,assign) BOOL isOnFoot; + +/** + 游泳 | Swimming + */ +@property (nonatomic,assign) BOOL isSwim; + +/** + 爬山 | Mountain climbing + */ +@property (nonatomic,assign) BOOL isMountainClimbing; + +/** + 羽毛球 | Badminton + */ +@property (nonatomic,assign) BOOL isBadminton; + +/** + 其他 | Other + */ +@property (nonatomic,assign) BOOL isOther; + +/** + 健身 | Fitness + */ +@property (nonatomic,assign) BOOL isFitness; + +/** + 动感单车 | Spinning bike + */ +@property (nonatomic,assign) BOOL isSpinning; + +/** + 橄榄球 | Rugby + */ +@property (nonatomic,assign) BOOL isEllipsoid; + +/** + 跑步机 | Treadmill + */ +@property (nonatomic,assign) BOOL isTreadmill; + +/** + 仰卧起坐 | Sit ups + */ +@property (nonatomic,assign) BOOL isSitUp; + +/** + 俯卧撑 | Push-ups + */ +@property (nonatomic,assign) BOOL isPushUp; + +/** + 哑铃 | Dumbbell + */ +@property (nonatomic,assign) BOOL isDumbbell; + +/** + 举重 | Weightlifting + */ +@property (nonatomic,assign) BOOL isWeightlifting; + +/** + 体操 | Gymnastics + */ +@property (nonatomic,assign) BOOL isBodybuildingExercise; + +/** + 瑜伽 | Yoga + */ +@property (nonatomic,assign) BOOL isYoga; + +/** + 跳绳 | Jumping rope + */ +@property (nonatomic,assign) BOOL isRopeSkipping; + +/** + 乒乓球 | Table tennis + */ +@property (nonatomic,assign) BOOL isTableTennis; + +/** + 篮球 | Basketball + */ +@property (nonatomic,assign) BOOL isBasketball; + +/** + 足球 | Football + */ +@property (nonatomic,assign) BOOL isFootball; + +/** + 排球 | Volleyball + */ +@property (nonatomic,assign) BOOL isVolleyball; + +/** + 网球 | Tennis + */ +@property (nonatomic,assign) BOOL isTennis; + +/** + 高尔夫 | Golf + */ +@property (nonatomic,assign) BOOL isGolf; + +/** + 棒球 | Baseball + */ +@property (nonatomic,assign) BOOL isBaseball; + +/** + 滑雪 | Skiing + */ +@property (nonatomic,assign) BOOL isSkiing; + +/** + 滑旱冰 | Roller Skating + */ +@property (nonatomic,assign) BOOL isRollerSkating; + +/** + 跳舞 | Dancing + */ +@property (nonatomic,assign) BOOL isDance; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetSportShortcutInfoBluetoothModel + */ ++ (__kindof IDOSetSportShortcutInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置血压校准model ==== +@interface IDOSetBloodPressureInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 舒张压 | Diastolic blood pressure + */ +@property (nonatomic,assign) NSInteger diastolic; + +/** + 收缩压 | Systolic pressure + */ +@property (nonatomic,assign) NSInteger shrinkage; + +/** + * 返回校准状态 0x01.成功进入校准模式,正在校准 0x02.在运动模式, 0x03.设备忙碌 0x04.无效的状态 0x06.校准失败 0x00.校准成功 + * Return to calibration status: 0x01. Successfully entered calibration mode, calibration; + * 0x02. In motion mode; 0x03. Device busy; 0x04. Invalid status; 0x06. Calibration failed; 0x00. Calibration successful + */ +@property (nonatomic,assign) NSInteger statusCode; + +/** + * 血压校准控制 0x01 血压校准开始 0x02 血压校准查询 + * Blood Pressure Calibration Control 0x01 Blood Pressure Calibration Start 0x02 Blood Pressure Calibration Query + */ +@property (nonatomic,assign) NSInteger flag; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetBloodPressureInfoBluetoothModel + */ ++ (__kindof IDOSetBloodPressureInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置快捷方式model ==== +@interface IDOSetShortcutInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 快捷方式类型 | Shortcut Type + */ +@property (nonatomic,assign) NSInteger shortcutType; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetShortcutInfoBluetoothModel + */ ++ (__kindof IDOSetShortcutInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置闹钟model ==== +@interface IDOSetAlarmInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 开关 | Switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + 是否同步 | Synchronization + */ +@property (nonatomic,assign) BOOL isSync; + +/** + 是否删除 | Delete + */ +@property (nonatomic,assign) BOOL isDelete; + +/** + 类型 | Type + */ +@property (nonatomic,assign) NSInteger type; + +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; + +/** + 分 | minute + */ +@property (nonatomic,assign) NSInteger minute; + +/** + * 重复集合 [星期一、星期二、星期三、星期四、星期五、星期六、星期日] + * Repeat collection [monday,tuesday,wednesday,thursday,friday,saturday,sunday] + */ +@property (nonatomic,strong)NSArray * repeat; + +/** + 贪睡时长 | Sleepy time + */ +@property (nonatomic,assign) NSInteger tsnoozeDuration; + +/** + 闹钟ID | Alarm ID + */ +@property (nonatomic,assign) NSInteger alarmId; + +/** + * @brief 初始化闹钟集合 | Initialize the alarm collection + * @return 闹钟集合 | Alarm clock collection + */ ++ (NSArray *)queryAllAlarms; + +/** + * @brief 查询没有被开启的闹钟集合 | Querying an alarm set that is not turned on + * @return 闹钟集合 | Alarm clock collection + */ ++ (NSArray *)queryAllNoOpenAlarms; + +@end + +#pragma mark ==== 设置时间model ==== +@interface IDOSetTimeInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 年 | year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日 | day + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; + +/** + 分 | minute + */ +@property (nonatomic,assign) NSInteger minute; + +/** + 秒 | seconds + */ +@property (nonatomic,assign) NSInteger second; + +/** + 星期 | week + */ +@property (nonatomic,assign) NSInteger weekDay; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetTimeInfoBluetoothModel + */ ++ (__kindof IDOSetTimeInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置单位model ==== +@interface IDOSetUnitInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 距离单位 0x00:无效, 0x01:km,0x02:mi | Distance unit 0x00: Invalid, 0x01:km, 0x02:mi + */ +@property (nonatomic,assign) NSInteger distanceUnit; + +/** + 重量单位 0x00: 无效,0x01:kg, 0x02:lb, 0x03: 英石 | Weight Unit 0x00: Invalid, 0x01:kg, 0x02:lb, 0x03: Stone + */ +@property (nonatomic,assign) NSInteger weightUnit; + +/** + 温度单位 0x00:无效, 0x01:°C, 0x02:°F | Temperature unit 0x00: Invalid, 0x01: °C, 0x02: °F + */ +@property (nonatomic,assign) NSInteger tempUnit; + +/** + * 语言单位 无效:0,中文:1,英文:2,法语:3,德语:4,意大利语:5,西班牙语:6,日语:7, + * 波兰语:8,捷克语:9,罗马尼亚:10,立陶宛语:11,荷兰语:12,斯洛文尼亚:13, + * 匈牙利语:14,俄罗斯语:15,乌克兰语:16,斯洛伐克语:17,丹麦语:18,克罗地亚:19,印尼语:20, + * 韩语:21,印地语:22,葡萄牙语:23,土耳其:24,泰国语:25,越南语:26,缅甸语:27,菲律宾语:28 + * Language unit Invalid: 0, Chinese: 1, English: 2, French: 3, German: 4, Italian: 5, Spanish: 6, Japanese: 7, + * Polish: 8, Czech: 9, Romania: 10, Lithuanian: 11, Dutch: 12, Slovenia: 13, + * Hungarian: 14, Russian: 15, Ukrainian: 16, Slovak: 17, Danish: 18, Croatia: 19,Indonesian: 20,korean:21,hindi:22 + * portuguese:23,turkish:24,thai:25,vietnamese:26,burmese:27,filipino:28 + */ +@property (nonatomic,assign) NSInteger languageUnit; + +/** + * 走路步伐 根据男性换算 默认值 72 (单位 :cm) + * Walking pace According to male conversion Default value 72 (unit: cm) + */ +@property (nonatomic,assign) NSInteger strideWalk; + +/** + * 跑步步伐 根据男性换算 默认值 90 (单位 :cm) + * Running pace Converted by male Default 90 (Unit: cm) + */ +@property (nonatomic,assign) NSInteger strideRun; + +/** + * gps校准步长 0x00:无效, 0x01:开, 0x02: 关 + * gps calibration step size 0x00: invalid, 0x01: on, 0x02: off + */ +@property (nonatomic,assign) NSInteger strideGps; + +/** + * 时间单位 0x00:无效, 0x01:24 小时制,0x02: 12 小时制 + * Time unit 0x00: Invalid, 0x01: 24-hour clock, 0x02: 12-hour clock + */ +@property (nonatomic,assign) NSInteger timeUnit; + +/** + * 星期的开始日 星期日:0x01,星期一 :0x00,星期六 :0x03 + * Start of the week Sunday: 0x01, Monday: 0x00, Saturday: 0x03 + */ +@property (nonatomic,assign) NSInteger weekStart; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetUnitInfoBluetoothModel + */ ++ (__kindof IDOSetUnitInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置心率区间model ==== +@interface IDOSetHrIntervalInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 燃烧脂肪 | Threshold for burning fat + */ +@property (nonatomic,assign) NSInteger burnFat; + +/** + 有氧运动 | Aerobic threshold + */ +@property (nonatomic,assign) NSInteger aerobic; + +/** + 极限运动 | Limit threshold + */ +@property (nonatomic,assign) NSInteger limitValue; + +/** + 最大心率 | Maximum heart rate + */ +@property (nonatomic,assign) NSInteger userMaxHr; + +/** + 热身运动 | Warm-up + */ +@property (nonatomic,assign) NSInteger warmUp; + +/** + 无氧运动 | Anaerobic exercise + */ +@property (nonatomic,assign) NSInteger anaerobic; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetHrIntervalInfoBluetoothModel + */ ++ (__kindof IDOSetHrIntervalInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置勿扰模式model ==== +@interface IDOSetNoDisturbModeInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 开关 | Switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + 开始 (时) | Start (hours) + */ +@property (nonatomic,assign) NSInteger startHour; + +/** + 开始 (分) | Start (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; + +/** + 结束 (时) | End (hours) + */ +@property (nonatomic,assign) NSInteger endHour; + +/** + 结束 (分) | End (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; + +/** + * 是否有间隔重复提醒 + * interval repeat reminder + */ +@property (nonatomic,assign) BOOL isHaveRangRepeat; + +/** + * 重复集合 [星期一、星期二、星期三、星期四、星期五、星期六、星期日] + * Repeat collection [monday,tuesday,wednesday,thursday,friday,saturday,sunday] + */ +@property (nonatomic,strong)NSArray * repeat; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetNoDisturbModeInfoBluetoothModel + */ ++ (__kindof IDOSetNoDisturbModeInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置心率模式model ==== +@interface IDOSetHrModeInfoBluetoothModel:IDOBluetoothBaseModel + +/** + * 心率模式 0:关闭心率监测功能 1:手动模式 2:自动模式 3:持续监测(默认:自动模式) + * Heart Rate Mode 0: Turn off heart rate monitoring function 1: Manual mode 2: Auto mode 3:Continuously monitor(Default: Auto mode) + */ +@property (nonatomic,assign) NSInteger modeType; + +/** + 是否有相隔时间 | Is there a time interval? + */ +@property (nonatomic,assign) BOOL isHasTimeRange; + +/** + 开始 (时) | Start (hours) + */ +@property (nonatomic,assign) NSInteger startHour; + +/** + 开始 (分) | Start (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; + +/** + 结束 (时) | End (hours) + */ +@property (nonatomic,assign) NSInteger endHour; + +/** + 结束 (分) | End (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; + +/** + 测量间隔,单位分钟 | measurement Interval,unit:minutes + */ +@property (nonatomic,assign) NSInteger measurementInterval; +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetHRModeInfoBluetoothModel + */ ++ (__kindof IDOSetHrModeInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置手环横竖屏model ==== +@interface IDOSetDisplayModeInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 显示模式 | Display mode + */ +@property (nonatomic,assign) NSInteger modeType; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetDisplayModeInfoBluetoothModel + */ ++ (__kindof IDOSetDisplayModeInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置抬腕手势model ==== +@interface IDOSetHandUpInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 开关 | Switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + 是否有相隔时间 | Is there a time interval? + */ +@property (nonatomic,assign) BOOL isHasTimeRange; + +/** + 显示时长 3~10 秒 | Display time 3~10 second + */ +@property (nonatomic,assign) NSInteger showSecond; + +/** + 开始 (时) | Start (hours) + */ +@property (nonatomic,assign) NSInteger startHour; + +/** + 开始 (分) | Start (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; + +/** + 结束 (时) | End (hours) + */ +@property (nonatomic,assign) NSInteger endHour; + +/** + 结束 (分) | End (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetHandUpInfoBuletoothModel + */ ++ (__kindof IDOSetHandUpInfoBuletoothModel *)currentModel; +@end + +#pragma mark ==== 设置久坐提醒model ==== +@interface IDOSetLongSitInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 开始 (时) | Start (hours) + */ +@property (nonatomic,assign) NSInteger startHour; + +/** + 开始 (分) | Start (minutes) + */ +@property (nonatomic,assign) NSInteger startMinute; + +/** + 结束 (时) | End (hours) + */ +@property (nonatomic,assign) NSInteger endHour; + +/** + 结束 (分) | End (minutes) + */ +@property (nonatomic,assign) NSInteger endMinute; + +/** + 间隔 | Interval + */ +@property (nonatomic,assign) NSInteger interval; + +/** + 开关 | Switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + * 重复集合 [星期一、星期二、星期三、星期四、星期五、星期六、星期日] + * Repeat collection [monday,tuesday,wednesday,thursday,friday,saturday,sunday] + */ +@property (nonatomic,strong) NSArray * selectWeeks; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetLongSitInfoBuletoothModel + */ ++ (__kindof IDOSetLongSitInfoBuletoothModel *)currentModel; +@end + +#pragma mark ==== 设置天气预报开关model ==== +@interface IDOSetWeatherSwitchInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 天气预报开关 | Weather forecast switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetWeatherSwitchInfoBluetoothModel + */ ++ (__kindof IDOSetWeatherSwitchInfoBluetoothModel *)currentModel; +@end + +#pragma mark ==== 设置相机开关model ==== +@interface IDOSetCameraInfoBluetoothModel:IDOBluetoothBaseModel + +/** + 相机开关 | Camera switch + */ +@property (nonatomic,assign) BOOL isOpen; + +@end + +#pragma mark ==== 设置音乐开关model ==== +@interface IDOSetMusicOpenInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 音乐开关 | Music switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetMusicOpenInfoBuletoothModel + */ ++ (__kindof IDOSetMusicOpenInfoBuletoothModel *)currentModel; +@end + +#pragma mark ==== 设置防止丢失model ==== +@interface IDOSetPreventLostInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 防丢失级别 | Loss prevention level + */ +@property (nonatomic,assign) NSInteger levelType; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetPreventLostInfoBuletoothModel + */ ++ (__kindof IDOSetPreventLostInfoBuletoothModel *)currentModel; +@end + +#pragma mark ==== 设置左右手穿戴model ==== +@interface IDOSetLeftOrRightInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 是否右手佩戴 | Is it worn on the right hand? + */ +@property (nonatomic,assign) BOOL isRight; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetLeftOrRightInfoBuletoothModel + */ ++ (__kindof IDOSetLeftOrRightInfoBuletoothModel *)currentModel; +@end + +#pragma mark ==== 设置寻找手机model ==== +@interface IDOSetFindPhoneInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 寻找手机开关 | Looking for a phone switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetFindPhoneInfoBuletoothModel + */ ++ (__kindof IDOSetFindPhoneInfoBuletoothModel *)currentModel; +@end + +#pragma mark ==== 设置一键呼叫model ==== +@interface IDOSetOneKeySosInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 一键呼叫开关 | One-touch call switch + */ +@property (nonatomic,assign) BOOL isOpen; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetOneKeySosInfoBuletoothModel + */ ++ (__kindof IDOSetOneKeySosInfoBuletoothModel *)currentModel; +@end + +#pragma mark ==== 设置开启蓝牙配对model ==== +@interface IDOSetPairingInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 配对时间戳 time interval since 1970 (如:1444361933) + * Pairing timestamp time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * pairingTimeStr; + +/** + 是否配对 | Pairing + */ +@property (nonatomic,assign) BOOL isPairing; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetPairingInfoBuletoothModel + */ ++ (__kindof IDOSetPairingInfoBuletoothModel *)currentModel; + +@end + +#pragma mark ==== 设置智能提醒model ==== +@interface IDOSetNoticeInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 是否配对 | Pairing + */ +@property (nonatomic,assign) BOOL isPairing; + +/** + 来电延迟 | Call delay + */ +@property (nonatomic,assign) NSInteger callDelay; + +/** + * 是否开启子开关 (只对智能提醒有效,对来电提醒无效) + * Whether to enable the sub-switch (only valid for smart reminders, invalid for incoming call reminders) + */ +@property (nonatomic,assign) BOOL isOnChild; + +/** + 来电提醒 | Call reminder + */ +@property (nonatomic,assign) BOOL isOnCall; + +/** + 短信提醒 | SMS reminder + */ +@property (nonatomic,assign) BOOL isOnSms; + +/** + 邮件提醒 | Email alert + */ +@property (nonatomic,assign) BOOL isOnEmail; + +/** + 微信提醒 | WeChat reminder + */ +@property (nonatomic,assign) BOOL isOnWeChat; + +/** + qq提醒 | qq reminder + */ +@property (nonatomic,assign) BOOL isOnQq; + +/** + 微博提醒 | Weibo reminder + */ +@property (nonatomic,assign) BOOL isOnWeibo; + +/** + FaceBook 提醒 | FaceBook Reminder + */ +@property (nonatomic,assign) BOOL isOnFaceBook; + +/** + Twitter 提醒 | Twitter Reminder + */ +@property (nonatomic,assign) BOOL isOnTwitter; + +/** + Whatsapp 提醒 | Whatsapp Reminder + */ +@property (nonatomic,assign) BOOL isOnWhatsapp; + +/** + Messenger 提醒 | Messenger reminder + */ +@property (nonatomic,assign) BOOL isOnMessenger; + +/** + Instagram 提醒 | Instagram reminder + */ +@property (nonatomic,assign) BOOL isOnInstagram; + +/** + LinkedIn 提醒 | LinkedIn Reminder + */ +@property (nonatomic,assign) BOOL isOnLinkedIn; + +/** + Calendar 提醒 | Calendar Reminder + */ +@property (nonatomic,assign) BOOL isOnCalendar; + +/** + Skype 提醒 | Skype reminder + */ +@property (nonatomic,assign) BOOL isOnSkype; + +/** + Alarm 提醒 | Alarm Reminder + */ +@property (nonatomic,assign) BOOL isOnAlarm; + +/** + Pokeman 提醒 | Pokemon Reminder + */ +@property (nonatomic,assign) BOOL isOnPokeman; + +/** + Vkontakte 提醒 | Vkontakte Reminder + */ +@property (nonatomic,assign) BOOL isOnVkontakte; + +/** + Line 提醒 | Line reminder + */ +@property (nonatomic,assign) BOOL isOnLine; + +/** + Viber 提醒 | Viber reminder + */ +@property (nonatomic,assign) BOOL isOnViber; + +/** + KakaoTalk 提醒 | KakaoTalk Reminder + */ +@property (nonatomic,assign) BOOL isOnKakaoTalk; + +/** + Gmail 提醒 | Gmail reminder + */ +@property (nonatomic,assign) BOOL isOnGmail; + +/** + Outlook 提醒 | Outlook reminder + */ +@property (nonatomic,assign) BOOL isOnOutlook; + +/** + Snapchat 提醒 | Snapchat Reminder + */ +@property (nonatomic,assign) BOOL isOnSnapchat; + +/** + Telegram 提醒 | Telegram Reminder + */ +@property (nonatomic,assign) BOOL isOnTelegram; + +/** + Chatwork 提醒 | Chatwork + */ +@property (nonatomic,assign) BOOL isOnChatwork; + +/** + Slack 提醒 | Slack + */ +@property (nonatomic,assign) BOOL isOnSlack; + +/** + Yahoo Mail 提醒 | Yahoo Mail + */ +@property (nonatomic,assign) BOOL isOnYahooMail; + +/** + Tumblr 提醒 | Tumblr + */ +@property (nonatomic,assign) BOOL isOnTumblr; + +/** + Youtube 提醒 | Youtube + */ +@property (nonatomic,assign) BOOL isOnYoutube; + +/** + Yahoo Pinterest 提醒 | Yahoo Pinterest + */ +@property (nonatomic,assign) BOOL isOnYahooPinterest; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetNoticeInfoBuletoothModel + */ ++ (__kindof IDOSetNoticeInfoBuletoothModel *)currentModel; + +@end + +#pragma mark ==== 设置用户信息model ==== +@interface IDOSetUserInfoBuletoothModel : IDOBluetoothBaseModel + +/** + 身高(厘米) | Height(cm) + */ +@property (nonatomic,assign) NSInteger height; + +/** + 当前体重(千克) | Current weight(kg) + */ +@property (nonatomic,assign) NSInteger weight; + +/** + 性别 1: 男 2 :女 | Gender 1: Male 2: Female + */ +@property (nonatomic,assign) NSInteger gender; + +/** + 年 | year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日 | day + */ +@property (nonatomic,assign) NSInteger day; + +/** + 目标睡眠 (时) | Target sleep (hours) + */ +@property (nonatomic,assign) NSInteger goalSleepDataHour; + +/** + 目标睡眠 (分) | Target sleep (minutes) + */ +@property (nonatomic,assign) NSInteger goalSleepDataMinute; + +/** + 目标步数 | Target steps + */ +@property (nonatomic,assign) NSInteger goalStepData; + +/** + 目标卡路里 | Goal Calories + */ +@property (nonatomic,assign) NSInteger goalCalorieData; + +/** + 目标距离(米) | Target distance(m) + */ +@property (nonatomic,assign) NSInteger goalDistanceData; + +/** + 目标体重(千克) | Target weight(kg) + */ +@property (nonatomic,assign) NSInteger goalWeightData; + +/** + * 目标类型 (类型 : 0 : 步数 1 : 卡路里 2 : 距离) 设置一种类型的目标需要执行一次命令 + * Target type (type : 0 : step 1 : calories 2 : distance) Setting a type of target requires a command to be executed + */ +@property (nonatomic,assign) NSInteger goalType; + +/** + 是否登陆 | Login + */ +@property (nonatomic,assign) BOOL isLogin; + +/** + 绑定状态 | Binding status + */ +@property (nonatomic,assign) NSInteger bindState; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOSetUserInfoBuletoothModel + */ ++ (__kindof IDOSetUserInfoBuletoothModel *)currentModel; + + +@end + + +@interface IDOSetInfoBluetoothModel : IDOBluetoothBaseModel + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncActivityDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncActivityDataModel.h new file mode 100755 index 0000000..8aaab8b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncActivityDataModel.h @@ -0,0 +1,207 @@ +// +// IDOSyncActivityDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncActivityDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; + +/** + 分 | minutes + */ +@property (nonatomic,assign) NSInteger minute; + +/** + 秒 | seconds + */ +@property (nonatomic,assign) NSInteger second; + +/** + 日期 精确到日期 date interval since 1970 (如:1444361933) | Date time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 开始时间 精确到秒 | start time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * timeStr; + +/** + 数据长度 | Data length + */ +@property (nonatomic,assign) NSInteger dataLength; + +/** + 心率数据产生间隔 (单位 : s) | Heart rate data generation interval (unit: s) + */ +@property (nonatomic,assign) NSInteger hrInterval; + +/** + 心率项数据个数 | Heart rate item data + */ +@property (nonatomic,assign) NSInteger hrItemCount; + +/** + 包的总数 | Total number of packages + */ +@property (nonatomic,assign) NSInteger packetCount; + +/* + * 类型:0x01:走路, 0x02:跑步, 0x03:骑行 0x04:徒步 这些类型才有轨迹运动 + * Type: 0x01: Walk, 0x02: Running, 0x03: Cycling 0x04: Walking These types have track motion + */ +@property (nonatomic,assign) NSInteger type; + +/** + 步数(骑行 时,步数为 0) | Number of steps (when riding, the number of steps is 0) + */ +@property (nonatomic,assign) NSInteger step; + +/** + 持续时长 (单位:s) | Duration (unit: s) + */ +@property (nonatomic,assign) NSInteger durations; + +/** + 卡路里(单 位:大卡) | Calories (Unit: Big Card) + */ +@property (nonatomic,assign) NSInteger calories; + +/** + 距离(单位: 米) | Distance (in meters) + */ +@property (nonatomic,assign) NSInteger distance; + +/** + 平均心率 | Average heart rate + */ +@property (nonatomic,assign) NSInteger avgHrValue; + +/** + 最大心率 | Maximum heart rate + */ +@property (nonatomic,assign) NSInteger maxHrValue; + +/** + 脂肪燃烧时长 | Fat burning time + */ +@property (nonatomic,assign) NSInteger burnFatMins; + +/** + 心肺锻炼时长 [有氧运动时长] (分钟) | Cardio workout time (minutes) + */ +@property (nonatomic,assign) NSInteger aerobicMins; + +/** + 极限锻炼时长 (分钟) | Extreme workout time (minutes) + */ +@property (nonatomic,assign) NSInteger limitMins; + +/** + 无氧锻炼时长 (分钟) | Anaerobic workout time (minutes) + */ +@property (nonatomic,assign) NSInteger anaerobicMins; + +/** + 热身锻炼时长 (分钟) | Warm up workout time (minutes) + */ +@property (nonatomic,assign) NSInteger warmUpMins; + +/** + 有序列号的心率集合 json字符串 | Heart rate collection with serial number json string + */ +@property (nonatomic,copy) NSString * hrValuesStr; + +/** + 是否需要保存数据 (用于数据交换) | Do you need to save data (for data exchange) + */ +@property (nonatomic,assign) BOOL isSave; + +/** + * 运动发起端 (1 : 手环发起 0 : app发起) + * Sports Initiator (1 : Bracelet Initiation 0 : app initiated) + */ +@property (nonatomic,assign) NSInteger startFrom; + +@end + +@interface IDOSyncActivityDataModel : NSObject +/** + * @brief 当前设备根据活动开始时间查询某个活动详情 + * The current device queries an event details based on the event start time + * @param macAddr mac地址 | Mac address + * @param timeStr 活动开始时间 | Event start time + * @return model IDOSyncActivityDataInfoBluetoothModel + */ ++ (__kindof IDOSyncActivityDataInfoBluetoothModel *)queryOneActivityDataWithTimeStr:(NSString *)timeStr + macAddr:(NSString *)macAddr; + +/** + * @brief 当前设备根据日期查询某天的活动集合 + * The current device queries the collection of events for a certain day based on the date + * @param macAddr mac地址 | Mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 活动集合 | Activity collection + */ ++ (NSArray <__kindof IDOSyncActivityDataInfoBluetoothModel *>*)queryOneDayActivityDataWithMacAddr:(NSString *)macAddr + year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + + +/** + * @brief 当前设备活动分页查询活动集合 | Current Device Activity Paging Query Activity Collection + * @param pageIndex 页码 第几页 (如 : 0,1,2,3,4,...) | Page Number of pages (eg : 0,1,2,3,4,...) + * @param numOfPage 每页的数据个数 (如 : 10,20,30...) | The number of data per page (eg: 10, 20, 30...) + * @param macAddr mac地址 | Mac address + * @return 活动集合 + */ ++ (NSArray <__kindof IDOSyncActivityDataInfoBluetoothModel *>*)queryOnePageActivityDataWithPageIndex:(NSInteger)pageIndex + numOfPage:(NSInteger)numOfPage + macAddr:(NSString *)macAddr; + +/** + * @brief 当前设备所有轨迹运动 | Current track motion of all devices + * @param macAddr mac 地址 | mac address + * @return 活动集合 | Activity collection + */ ++ (NSArray <__kindof IDOSyncActivityDataInfoBluetoothModel *>*)queryAllTrajectorySportActivitysWithMac:(NSString *)macAddr; + +/** + * @brief 当前设备所有轻运动 | Current equipment all light sports + * @param macAddr mac 地址 | mac address + * @return 活动集合 | Activity collection + */ ++ (NSArray <__kindof IDOSyncActivityDataInfoBluetoothModel *>*)queryAllLightSportActivitysWithMac:(NSString *)macAddr; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncBpDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncBpDataModel.h new file mode 100755 index 0000000..e475df2 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncBpDataModel.h @@ -0,0 +1,191 @@ +// +// IDOSyncBpDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncBpDataItemInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 较大收缩压 | Large systolic pressure + */ +@property (nonatomic,assign) NSInteger sysBlood; + +/** + 较小舒张压 | Small diastolic pressure + */ +@property (nonatomic,assign) NSInteger diasBlood; + +/** + 子时间偏移量 (分钟) | Subtime offset (minutes) + */ +@property (nonatomic,assign) NSInteger offset DEPRECATED_MSG_ATTRIBUTE("parameter is invalidp,please use \"timeStr\""); + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber DEPRECATED_MSG_ATTRIBUTE("parameter is invalid,please use \"timeStr\""); + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 时间戳 精确到分钟 time interval since 1970 (如:1444361933) | Timestamp time interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * timeStr; + +/** + 本地设置数据,区分手环同步的数据 | Locally set data to distinguish the data of the bracelet synchronization + */ +@property (nonatomic,assign) BOOL isLocal; + +@end + +@interface IDOSyncBpDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 血压数据包量 | Blood pressure data package + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + 睡眠平均血压 | Average blood pressure in sleep + */ +@property (nonatomic,assign) NSInteger sleepAvgBp; + +/** + 最大血压值 | Maximum blood pressure value + */ +@property (nonatomic,assign) NSInteger maxBp; + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + * 血压集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * Blood pressure collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly + * converted into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * bloodbPressures; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 总时间偏移量 (分钟) | Total time offset (minutes) + */ +@property (nonatomic,assign) NSUInteger minuteOffset; + +/** + 本地设置数据,区分手环同步的数据 | Locally set data to distinguish the data of the bracelet synchronization + */ +@property (nonatomic,assign) BOOL isLocal; + +@end + +@interface IDOSyncBpDataModel : NSObject +/** + * @brief 查询当前设备某年12个月所有数据 (如果查询当月无数据,会创建空的数据对象,大于当月的数据不累加) + * Query all data of the current device for 12 months in a certain year (If there is no data in the current month, an empty data object will be created, + * and the data larger than the current month will not be accumulated) + * @param year 年 (如 : 2018) | year (eg 2018) + * @param isQuery 是否查询items | is query items + * @return 一年12个月的血压数据集合,其中IDOSyncBpDataInfoBluetoothModel对象是一天总血压数据模型 + * A 12-month blood pressure data collection, where the IDOSyncBpDataInfoBluetoothModel object is a total blood pressure data model for the day + */ ++ (NSArray *> *)queryOneYearBloodPressuresWithYear:(NSInteger)year + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某月份的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain month (If there is no data on the query day, an empty data object will be created, + * which is larger than the data of the day) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param month 月 (如 : 9) | Month (eg: 9) + * @param dates 当前查询月份的所有日期集合的指针 (格式 :[10/01...10/31]) + * Pointer to all date collections for the current query month (format: [10/01...10/31]) + * @param isQuery 是否查询items | is query items + * @return 一个月的血压数据集合,其中IDOSyncBpDataInfoBluetoothModel对象是一天总血压数据模型 + * One month blood pressure data set, where the IDOSyncBpDataInfoBluetoothModel object is the total day blood pressure data model + */ ++ (NSArray <__kindof IDOSyncBpDataInfoBluetoothModel *>*)queryOneMonthBloodPressuresWithYear:(NSInteger)year + month:(NSInteger)month + macAddr:(NSString *)macAddr + datesOfMonth:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某周的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain week (If there is no data on the day of the query, an empty data object will be created, + * and the data larger than the current day will not be accumulated) + * @param weekIndex 周的查询索引 (0 : 当周, 1 : 上一周, 2 : 上两周 ...) | Week's query index (0: week, 1 : last week, 2 : last two weeks...) + * @param weekStartDay 星期的开始日 (0 : 星期日, 1 : 星期一, 2 : 星期二 ...) | Start of the week (0: Sunday, 1 : Monday, 2 : Tuesday ...) + * @param dates 当前查询周的所有日期集合的指针 (格式 :[10/01...10/07]) + * Pointer to all date collections for the current query week (format: [10/01...10/07]) + * @param isQuery 是否查询items | is query items + * @return 一周的血压数据集合,其中IDOSyncBpDataInfoBluetoothModel对象是一天总血压数据模型 + * A week's blood pressure data collection, where the IDOSyncBpDataInfoBluetoothModel object is the total day blood pressure data model + */ ++ (NSArray <__kindof IDOSyncBpDataInfoBluetoothModel *>*)queryOneWeekBloodPressuresWithWeekIndex:(NSInteger)weekIndex + weekStartDay:(NSInteger)weekStartDay + macAddr:(NSString *)macAddr + datesOfWeek:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某天血压数据并有详情数据 + * Query current device blood pressure data for one day and have detailed data + * @param macAddr mac 地址 | mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 一天血压数据的集合和详情数据集合 | Collection of day blood pressure data and detailed data + */ ++ (NSArray<__kindof IDOSyncBpDataInfoBluetoothModel *> *)queryOneDayBloodPressureDetailWithMac:(NSString *)macAddr + year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + +/** + * @brief 查询当前设备最近一天血压数据并有详情数据 + * Query the current day's blood pressure data of the device and have detailed data + * @param macAddr mac 地址 | mac address + * @return 一天血压数据的集合和详情数据 | Collection of day blood pressure data and detailed data + */ ++ (__kindof IDOSyncBpDataInfoBluetoothModel *)queryLastDayBloodPressureDetailWithMac:(NSString *)macAddr; + +/** + * @brief 查询所有血压数据 血压包数大于0 + * Query all blood pressure data The number of blood pressure packets is greater than 0 + * @param macAddr mac 地址 | mac address + * @return 所有血压数据的集合和详情数据 | Collection and detailed data of all blood pressure data + */ ++ (NSArray <__kindof IDOSyncBpDataInfoBluetoothModel *>*)queryAllBloodPressuresWithMac:(NSString *)macAddr; +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncEnum.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncEnum.h new file mode 100755 index 0000000..a559371 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncEnum.h @@ -0,0 +1,316 @@ +// +// IDOSyncEnum.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/3. +// Copyright © 2019 何东阳. All rights reserved. +// + +#ifndef IDOSyncEnum_h +#define IDOSyncEnum_h + +/** + * 同步状态枚举 + * Synchronization status enumeration + */ +typedef NS_ENUM(NSInteger, IDO_SYNC_COMPLETE_STATUS) { + /** + * 全部同步完成 + * All sync completed + */ + IDO_SYNC_GLOBAL_COMPLETE = 1, + + /** + * 配置同步完成 + * Configuration synchronization completed + */ + IDO_SYNC_CONFIG_COMPLETE, + + /** + * 配置同步完成异常 + * Configure synchronization completion exception + */ + IDO_SYNC_CONFIG_COMPLETE_EXCEPTION, + + /** + * 健康同步完成 + * Health synchronization completed + */ + IDO_SYNC_HEALTH_COMPLETE, + + /** + * 健康同步完成异常 + * Health synchronization completes exception + */ + IDO_SYNC_HEALTH_COMPLETE_EXCEPTION, + + /** + * v3健康同步完成 + * v3 health synchronization completed + */ + IDO_SYNC_V3_HEALTH_COMPLETE, + + /** + * v3健康同步完成异常 + * v3 health synchronization completes exception + */ + IDO_SYNC_V3_HEALTH_COMPLETE_EXCEPTION, + + /** + * 活动同步完成 + * Activity synchronization completed + */ + IDO_SYNC_ACTIVITY_COMPLETE, + + /** + * 活动同步完成异常 + * Activity synchronization completes exception + */ + IDO_SYNC_ACTIVITY_COMPLETE_EXCEPTION, + + /** + * GPS同步完成 + * GPS synchronization completed + */ + IDO_SYNC_GPS_COMPLETE, + + /** + * GPS同步完成异常 + * GPS synchronization completes exception + */ + IDO_SYNC_GPS_COMPLETE_EXCEPTION, + +}; + +/** + * 当前同步类型枚举 + * Current sync type enumeration + */ +typedef NS_ENUM(NSInteger, IDO_CURRENT_SYNC_TYPE) { + /** + * 当前同步配置 + * Current synchronization configuration + */ + IDO_SYNC_CONFIG_TYPE = 1, + + /** + * 当前同步健康 + * Current sync health + */ + IDO_SYNC_HEALTH_TYPE, + + /** + * 当前同步V3健康 + * Current sync Blood oxygen and pressure + */ + IDO_SYNC_V3_HEALTH_TYPE, + + /** + * 当前同步活动 + * Current synchronization activity + */ + IDO_SYNC_ACTIVITY_TYPE, + + /** + * 当前同步GPS + * Current synchronous GPS + */ + IDO_SYNC_GPS_TYPE, + +}; + +/** + * 同步配置数据类型 + * Synchronous configuration data type + */ +typedef NS_ENUM(NSInteger, IDO_SYNC_CONFIG_DATA_TYPE) { + /* + * 不设置默认数据 + * set none + */ + IDO_SYNC_DEFAULT_NONE = 0, + /* + * 设置当前时间 + * set time + */ + IDO_SYNC_SET_TIME_TYPE = 1, + /* + * 设置闹钟 + * set alarm + */ + IDO_SYNC_SET_ALARM_TYPE, + /* + * 设置久坐 + * set long sit + */ + IDO_SYNC_SET_LONG_SIT_TYPE, + /* + * 设置防丢失 + * set lost find + */ + IDO_SYNC_SET_LOST_FIND_TYPE, + /* + * 设置寻找手机 + * set find phone + */ + IDO_SYNC_SET_FIND_PHONE_TYPE, + /* + * 设置运动目标(步数) + * set sport goal + */ + IDO_SYNC_SET_SPORT_GOAL_TYPE, + /* + * 设置用户信息 + * set user info + */ + IDO_SYNC_SET_USER_INFO_TYPE, + /* + * 设置单位 + * set unit + */ + IDO_SYNC_SET_UNIT_TYPE, + /* + * 设置开启授权 + * set open auth + */ + IDO_SYNC_SET_AUTH_TYPE, + /* + * 设置心率模式 + * set heart rate mode + */ + IDO_SYNC_SET_HEART_RATE_MODE_TYPE, + /* + * 设置抬手 + * set up hand gesture + */ + IDO_SYNC_SET_UP_HAND_GESTURE_TYPE, + /* + * 设置勿扰模式 + * set do not disturb + */ + IDO_SYNC_SET_DO_NOT_DISTURB_TYPE, + /* + * 设置显示模式 + * set display mode + */ + IDO_SYNC_SET_DISPLAY_MODE_TYPE, + /* + * 设置一键呼叫 + * set one key sos + */ + IDO_SYNC_SET_ONE_KEY_SOS_TYPE, + /* + * 设置音乐开关 + * set muisc on off + */ + IDO_SYNC_SET_MUISC_ON_OFF_TYPE, + /* + * 设置天气开关 + * set weather switch + */ + IDO_SYNC_SET_WEATHER_SWITCH_TYPE, + /* + * 设置心率区间 + * set heart rate interval + */ + IDO_SYNC_SET_HEART_RATE_INTERVAL_TYPE, + /* + * 设置运动模式选择 + * set sport mode select + */ + IDO_SYNC_SET_SPORT_MODE_SELECT_TYPE, + /* + * 设置运动模式排序 + * set sport mode sort + */ + IDO_SYNC_SET_SPORT_MODE_SORT_TYPE, + /* + * 设置表盘 + * set watch dial + */ + IDO_SYNC_SET_WATCH_DIAL_TYPE, + /* + * 设置快捷方式 + * set shortcut + */ + IDO_SYNC_SET_SHORTCUT_TYPE, + /* + * 设置睡眠时间段 + * set sleep period + */ + IDO_SYNC_SET_SLEEP_PERIOD_TYPE, + /* + * 设置屏幕亮度 + * set screen brightness + */ + IDO_SYNC_SET_SCREEN_BRIGHTNESS_TYPE, + /* + * 设置女性生理周期提醒 + * set menstruation remind + */ + IDO_SYNC_SET_MENSTRUATION_REMIND_TYPE, + /* + * 设置女性生理周期 + * set menstruation + */ + IDO_SYNC_SET_SET_MENSTRUATION_TYPE, + /* + * 设置卡路里和距离目标 + * set calorie distance goal + */ + IDO_SYNC_SET_CALORIE_DISTANCE_GOAL_TYPE, + /* + * 设置GPS信息 + * set gps config + */ + IDO_SYNC_SET_CONFIG_GPS_TYPE, + /* + * 设置打开苹果通知开关 + * set open ancs + */ + IDO_SYNC_SET_BLE_OPEN_ANCS_TYPE, + /* + * 设置走路提醒 + * set walk reminder + */ + IDO_SYNC_SET_WALK_REMINDER_TYPE, + /* + * 设置血氧训练 + * set breathe train + */ + IDO_SYNC_SET_BREATHE_TRAIN_TYPE, + /* + * 设置活动识别开关 + * set activity switch + */ + IDO_SYNC_SET_ACTIVITY_SWITCH_TYPE, +}; + +/** + * 设置同步项类型 + * set want to sync item type + */ +typedef NS_ENUM(NSInteger, IDO_WANT_TO_SYNC_ITEM_TYPE) { + /* + * 同步配置 + * sync config + */ + IDO_WANT_TO_SYNC_CONFIG_ITEM_TYPE = 1 << 0, + /* + * 同步健康 + * sync health + */ + IDO_WANT_TO_SYNC_HEALTH_ITEM_TYPE = 1 << 1, + /* + * 同步活动 + * sync activity + */ + IDO_WANT_TO_SYNC_ACTIVITY_ITEM_TYPE = 1 << 2, + /* + * 同步 GPS + * sync gps + */ + IDO_WANT_TO_SYNC_GPS_ITEM_TYPE = 1 << 3 +}; + +#endif /* IDOSyncEnum_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncGpsDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncGpsDataModel.h new file mode 100755 index 0000000..d985aa1 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncGpsDataModel.h @@ -0,0 +1,133 @@ +// +// IDOSyncGpsDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncGpsDataItemInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +/** + 经度 | Longitude + */ +@property (nonatomic,copy) NSString * latitudeStr; + +/** + 纬度 | Latitude + */ +@property (nonatomic,copy) NSString * longitudeStr; + +/** + * 发起运动时间 时间戳 精确到秒 time interval since 1970 (如:1444361933) + * Initiate exercise time Timestamp time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * timeStr; + +/** + 日期 精确到日期 date interval since 1970 (如:1444361933) | date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +@end + + +@interface IDOSyncGpsDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; + +/** + 分 | minutes + */ +@property (nonatomic,assign) NSInteger minute; + +/** + 秒 | seconds + */ +@property (nonatomic,assign) NSInteger second; + +/** + * 发起运动时间 时间戳 精确到秒 time interval since 1970 (如:1444361933) + * Initiate exercise time Timestamp time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * timeStr; + +/** + 日期 精确到日期 date interval since 1970 (如:1444361933) | date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + gps数据包数量 | gps packet number + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + 间隔时长 (单位:秒)| Interval length (unit:second) + */ +@property (nonatomic,assign) int interval; + +/** + 运动发起端 (1 : 手环发起 0 : app发起) | Sports Initiator (1 : Bracelet Initiation 0 : app initiated) + */ +@property (nonatomic,assign) NSInteger startFrom; + +/** + * GPS 坐标点集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * GPS coordinate point set Only defined query methods can be converted into model collections. Custom query methods cannot be directly + * converted into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * gpsItems; + +@end + +@interface IDOSyncGpsDataModel : NSObject +/** + * @brief 根据时间戳查询某个活动的GPS信息 | Querying the GPS information of an activity based on the timestamp + * @param timeStr 时间戳 time interval since 1970 (如:1444361933) | Timestamp time interval since 1970 (eg: 14443361933) + * @param macAddr mac 地址 | mac address + * @return gps信息数据 坐标item对象集合 | gps information data coordinate item object collection + */ ++ (__kindof IDOSyncGpsDataInfoBluetoothModel *)queryOneActivityCoordinatesWithTimeStr:(NSString *)timeStr + macAddr:(NSString *)macAddr; + +/** + * @brief 根据时间戳查询某个活动是否存在轨迹 | Query whether an activity has a track based on a timestamp + * @param timeStr 时间戳 time interval since 1970 (如:1444361933) | Timestamp time interval since 1970 (eg: 14443361933) + * @param macAddr mac 地址 | mac address + * @return 是否存在轨迹 yes or no | Is there a track? + */ ++ (BOOL)queryActivityHasCoordinatesWithTimeStr:(NSString *)timeStr + macAddr:(NSString *)macAddr; +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncHeartRateDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncHeartRateDataModel.h new file mode 100755 index 0000000..c160915 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncHeartRateDataModel.h @@ -0,0 +1,442 @@ +// +// IDOSyncHeartRateDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncHrDataItemInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 子时间偏移量 (单位:分钟) | Total time offset (unit: minute) + */ +@property (nonatomic,assign) NSInteger offset; + +/** + 心率值 | Heart rate value + */ +@property (nonatomic,assign) NSInteger data; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +@end + +@interface IDOSyncHrDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 心率数据包数量 | Heart Rate Packets + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + 总时间偏移量 (单位:分钟) | Total time offset (unit: minute) + */ +@property (nonatomic,assign) NSUInteger minuteOffset; + +/** + 静态心率 | Static heart rate + */ +@property (nonatomic,assign) NSUInteger silentHeartRate; + +/** + 燃烧脂肪阀值 | Burning fat threshold + */ +@property (nonatomic,assign) NSUInteger burnFatThreshold; + +/** + 肌肉锻炼阀值 | Muscle exercise threshold + */ +@property (nonatomic,assign) NSUInteger aerobicThreshold; + +/** + 极限阀值 | Limit threshold + */ +@property (nonatomic,assign) NSUInteger limitThreshold; + +/** + 脂肪燃烧时长 (单位 :分钟) | Fat burning time (unit: minute) + */ +@property (nonatomic,assign) NSUInteger burnFatMins; + +/** + 肌肉锻炼时长 (单位 :分钟) | Muscle training time (unit: minute) + */ +@property (nonatomic,assign) NSUInteger aerobicMins; + +/** + 极限运动时长 (单位 :分钟) | Extreme Sports Duration (Unit: Minutes) + */ +@property (nonatomic,assign) NSUInteger limitMins; + +/** + 用户最大心率 | User maximum heart rate + */ +@property (nonatomic,assign) NSUInteger userMaxHr; + +/** + 热身运动阈值 | warm up threshold + */ +@property (nonatomic,assign) NSUInteger warmUpThreshold; + +/** + 热身运动时间 (单位 :分钟) | warm up mins + */ +@property (nonatomic,assign) NSUInteger warmUpMins; + +/** + 无氧运动阈值 | anaerobic threshold + */ +@property (nonatomic,assign) NSUInteger anaerobicThreshold; + +/** + 无氧运动时间 (单位 :分钟) | anaerobic mins + */ +@property (nonatomic,assign) NSUInteger anaerobicMins; + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + * 心率集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * Heart rate collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly + * converted into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * heartRates; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +@end + +@interface IDOSyncSecHrDataItemInfoBluetoothModel : IDOBluetoothBaseModel +/** + 子时间偏移量 (单位:秒钟) | Total time offset (unit: second) + */ +@property (nonatomic,assign) NSInteger offset; + +/** + 心率值 | Heart rate value + */ +@property (nonatomic,assign) NSInteger hrValue; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +@end + +@interface IDOSyncSecHrDataInfoBluetoothModel : IDOBluetoothBaseModel +/** + 心率数据包数量 | Heart Rate Packets + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + 总时间偏移量 (单位:秒钟) | Total time offset (unit: second) + */ +@property (nonatomic,assign) NSUInteger secondOffset; + +/** + 静态心率 | Static heart rate + */ +@property (nonatomic,assign) NSUInteger silentHeartRate; + +/** + 燃烧脂肪阀值 | Burning fat threshold + */ +@property (nonatomic,assign) NSUInteger burnFatThreshold; + +/** + 肌肉锻炼阀值 | Muscle exercise threshold + */ +@property (nonatomic,assign) NSUInteger aerobicThreshold; + +/** + 极限阀值 | Limit threshold + */ +@property (nonatomic,assign) NSUInteger limitThreshold; + +/** + 脂肪燃烧时长 (单位 :分钟) | Fat burning time (unit: minute) + */ +@property (nonatomic,assign) NSUInteger burnFatMins; + +/** + 肌肉锻炼时长 (单位 :分钟) | Muscle training time (unit: minute) + */ +@property (nonatomic,assign) NSUInteger aerobicMins; + +/** + 极限运动时长 (单位 :分钟) | Extreme Sports Duration (Unit: Minutes) + */ +@property (nonatomic,assign) NSUInteger limitMins; + +/** + 用户最大心率 | User maximum heart rate + */ +@property (nonatomic,assign) NSUInteger userMaxHr; + +/** + 热身运动阈值 | warm up threshold + */ +@property (nonatomic,assign) NSUInteger warmUpThreshold; + +/** + 热身运动时间 (单位 :分钟) | warm up mins + */ +@property (nonatomic,assign) NSUInteger warmUpMins; + +/** + 无氧运动阈值 | anaerobic threshold + */ +@property (nonatomic,assign) NSUInteger anaerobicThreshold; + +/** + 无氧运动阈值 (单位 :分钟) | anaerobic mins + */ +@property (nonatomic,assign) NSUInteger anaerobicMins; + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + * 心率集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * Heart rate collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly + * converted into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * heartRates; + +/** + * 5分钟间隔心率集合和总心率时长 | Heart rate set at 5-minute intervals and total heart rate duration + * @{@"total_offset":@(0),@"heart_rates":@[@{@"offset":@(0),@"value":@(0)}...]}; + */ +@property (nonatomic,copy) NSDictionary * minutesHrDic; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +@end + + +@interface IDOSyncHeartRateDataModel : NSObject + +#pragma mark ======================== offset minunte =============================== +/** + * @brief 查询当前设备某年12个月所有数据 (如果查询当月无数据,会创建空的数据对象,大于当月的数据不累加) + * Query all data of the current device for 12 months in a certain year (If there is no data in the query month, an empty data object will be created, + * and the data larger than the current month will not be accumulated) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param macAddr mac 地址 | mac address + * @param isQuery 是否查询items | is query items + * @return 一年12个月的心率数据集合,其中IDOSyncHrDataInfoBluetoothModel对象是一天总心率数据模型 + * Heart rate data collection for 12 months a year, where the IDOSyncHrDataInfoBluetoothModel object is the total heart rate data model for the day + */ ++ (NSArray *> *)queryOneYearHearRatesWithYear:(NSInteger)year + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某月份的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain month (If there is no data on the query day, an empty data object will be created, + * which is larger than the data of the day) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param month 月 (如 : 9) | Month (eg: 9) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询月份的所有日期集合的指针 (格式 :[10/01...10/31]) + * Pointer to all date collections for the current query month (format: [10/01...10/31]) + * @param isQuery 是否查询items | is query items + * @return 一个月的心率数据集合,其中IDOSyncHrDataInfoBluetoothModel对象是一天总心率数据模型 + * A one-month heart rate data collection, where the IDOSyncHrDataInfoBluetoothModel object is the total heart rate data model for the day + */ ++ (NSArray <__kindof IDOSyncHrDataInfoBluetoothModel *>*)queryOneMonthHearRatesWithYear:(NSInteger)year + month:(NSInteger)month + macAddr:(NSString *)macAddr + datesOfMonth:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某周的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain week (If there is no data on the day of the query, an empty data object will be created, + * and the data larger than the current day will not be accumulated) + * @param weekIndex 周的查询索引 (0 : 当周, 1 : 上一周, 2 : 上两周 ...) | Week's query index (0: week, 1 : last week, 2 : last two weeks...) + * @param weekStartDay 星期的开始日 (0 : 星期日, 1 : 星期一, 2 : 星期二 ...) | Start of the week (0: Sunday, 1 : Monday, 2 : Tuesday ...) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询周的所有日期集合的指针 (格式 :[10/01...10/07]) + * Pointer to all date collections for the current query week (format: [10/01...10/07]) + * @param isQuery 是否查询items | is query items + * @return 一周的心率数据集合,其中IDOSyncHrDataInfoBluetoothModel对象是一天总心率数据模型 + * A week's heart rate data collection, where the IDOSyncHrDataInfoBluetoothModel object is the total heart rate data model for the day + */ ++ (NSArray <__kindof IDOSyncHrDataInfoBluetoothModel *>*)queryOneWeekHearRatesWithWeekIndex:(NSInteger)weekIndex + weekStartDay:(NSInteger)weekStartDay + macAddr:(NSString *)macAddr + datesOfWeek:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某天心率数据并有详情数据 | Query current heart rate data of the current device and have detailed data + * @param macAddr mac 地址 | mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 一天心率数据的集合和详情数据集合 | Collection of day heart rate data and details data + */ ++ (NSArray<__kindof IDOSyncHrDataInfoBluetoothModel *> *)queryOneDayHearRatesDetailWithMac:(NSString *)macAddr + year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + +/** + * @brief 查询所有心率数据 心率包个数大于0 | Query all heart rate data The number of heart rate packets is greater than 0 + * @param macAddr mac 地址 | mac address + * @return 所有心率数据的集合 | Collection of all heart rate data and details data + */ ++ (NSArray <__kindof IDOSyncHrDataInfoBluetoothModel *>*)queryAllHearRatesWithMac:(NSString *)macAddr; + + +/** + * @brief 查询所有心率数据 心率包个数大于0 只包含静心心率和日期时间戳 + * Query all heart rate data The number of heart rate packets is greater than 0 + * Contains only meditation heart rate and date and time stamp + * @param macAddr mac 地址 | mac address + * @return 所有心率数据的集合 | Collection of all heart rate data + */ ++ (NSArray <__kindof IDOSyncHrDataInfoBluetoothModel *>*)queryAllContractedHearRatesWithMac:(NSString *)macAddr; + +#pragma mark ======================== offset second =============================== + +/** + * @brief 查询当前设备某年12个月所有数据 (如果查询当月无数据,会创建空的数据对象,大于当月的数据不累加) + * Query all data of the current device for 12 months in a certain year (If there is no data in the query month, an empty data object will be created, + * and the data larger than the current month will not be accumulated) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param macAddr mac 地址 | mac address + * @param isQuery 是否查询items | is query items + * @return 一年12个月的秒钟心率数据集合,其中IDOSyncSecHrDataInfoBluetoothModel对象是一天总心率数据模型 + * second heart rate data collection for 12 months a year, where the IDOSyncSecHrDataInfoBluetoothModel object is the total heart rate data model for the day + */ ++ (NSArray *> *)queryOneYearSecHearRatesWithYear:(NSInteger)year + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某月份的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain month (If there is no data on the query day, an empty data object will be created, + * which is larger than the data of the day) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param month 月 (如 : 9) | Month (eg: 9) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询月份的所有日期集合的指针 (格式 :[10/01...10/31]) + * Pointer to all date collections for the current query month (format: [10/01...10/31]) + * @param isQuery 是否查询items | is query items + * @return 一个月的秒钟心率数据集合,其中IDOSyncSecHrDataInfoBluetoothModel对象是一天总心率数据模型 + * one-month second heart rate data collection, where the IDOSyncSecHrDataInfoBluetoothModel object is the total heart rate data model for the day + */ ++ (NSArray <__kindof IDOSyncSecHrDataInfoBluetoothModel *>*)queryOneMonthSecHearRatesWithYear:(NSInteger)year + month:(NSInteger)month + macAddr:(NSString *)macAddr + datesOfMonth:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某周的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain week (If there is no data on the day of the query, an empty data object will be created, + * and the data larger than the current day will not be accumulated) + * @param weekIndex 周的查询索引 (0 : 当周, 1 : 上一周, 2 : 上两周 ...) | Week's query index (0: week, 1 : last week, 2 : last two weeks...) + * @param weekStartDay 星期的开始日 (0 : 星期日, 1 : 星期一, 2 : 星期二 ...) | Start of the week (0: Sunday, 1 : Monday, 2 : Tuesday ...) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询周的所有日期集合的指针 (格式 :[10/01...10/07]) + * Pointer to all date collections for the current query week (format: [10/01...10/07]) + * @param isQuery 是否查询items | is query items + * @return 一周的秒钟心率数据集合,其中IDOSyncSecHrDataInfoBluetoothModel对象是一天总心率数据模型 + * one week second heart rate data collection, where the IDOSyncSecHrDataInfoBluetoothModel object is the total heart rate data model for the day + */ ++ (NSArray <__kindof IDOSyncSecHrDataInfoBluetoothModel *>*)queryOneWeekSecHearRatesWithWeekIndex:(NSInteger)weekIndex + weekStartDay:(NSInteger)weekStartDay + macAddr:(NSString *)macAddr + datesOfWeek:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某天秒钟心率数据并有详情数据 | Query current day second heart rate data of the current device and have detailed data + * @param macAddr mac 地址 | mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @param isQuery 是否查询items | is query items + * @return 一天秒钟心率数据的集合和详情数据集合 | Collection of day second heart rate data and details data + */ ++ (NSArray<__kindof IDOSyncSecHrDataInfoBluetoothModel *> *)queryOneDaySecHearRatesDetailWithMac:(NSString *)macAddr + year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询所有秒钟心率数据 心率包个数大于0 | Query all second heart rate data The number of heart rate packets is greater than 0 + * @param macAddr mac 地址 | mac address + * @return 所有秒钟心率数据的集合 | Collection of all second heart rate data and details data + */ ++ (NSArray <__kindof IDOSyncSecHrDataInfoBluetoothModel *>*)queryAllSecHearRatesWithMac:(NSString *)macAddr; + +/** + * @brief 查询所有秒钟心率数据 心率包个数大于0 只包含静心心率和日期时间戳 + * Query all second heart rate data The number of heart rate packets is greater than 0 + * Contains only meditation heart rate and date and time stamp + * @param macAddr mac 地址 | mac address + * @return 所有心率数据的集合 | Collection of all heart rate data + */ ++ (NSArray <__kindof IDOSyncSecHrDataInfoBluetoothModel *>*)queryAllContractedSecHearRatesWithMac:(NSString *)macAddr; + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncManager.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncManager.h new file mode 100755 index 0000000..7911ce7 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncManager.h @@ -0,0 +1,161 @@ +// +// IDOSyncManager.h +// VeryfitSDK +// +// Created by hedongyang on 2018/5/25. +// Copyright © 2018年 hedongyang. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOSyncEnum.h" +#endif + +@interface IDOSyncManager : NSObject + +/** + * 当前连接设备是否正在同步,⚠️配置同步不纳入正在同步中,其他(步数、心率、血压、睡眠、血氧、压力、活动、gps、游泳)数据同步纳入其中 + * Whether the currently connected device is synchronizing, ⚠️ configuration synchronization is not included in the synchronization, + * and other (step, heart rate, blood pressure, sleep, activity, gps、swim) data synchronization is included. + */ +@property (nonatomic,assign,readonly) BOOL isSyncHealthRun; + +/** + * 当前连接设备是否在同步配置信息 + * Is the currently connected device synchronizing configuration information? + */ +@property (nonatomic,assign,readonly) BOOL isSyncConfigRun; + +/** + * 当前连接设备是否需要同步配置 + * Does the current connected device require synchronization configuration? + */ +@property (nonatomic,assign,readonly) BOOL isNeedSyncConfig; + +/** + * 设置需要同步的选项(同步配置、同步健康、同步活动、同步GPS) + * Set the options that need to be synchronized (sync config、sync health、sync activity、sync GPS) + */ +@property (nonatomic,assign) IDO_WANT_TO_SYNC_ITEM_TYPE wantToSyncType; + +/** + * 同步的数据是否存入SDK数据库中,默认YES + * Whether the synchronized data is stored in the SDK database, the default is YES + */ +@property (nonatomic,assign) BOOL isSave; + +/** + * 同步的数据超时时长,默认 60秒 + * Synchronous data timeout duration, default 60 seconds + */ +@property (nonatomic,assign) NSInteger syncTimeout; + +/** + * 同步配置日志回调 + * Synchronize configuration log callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncConfig)(void(^ _Nullable configLogCallback)(NSString * _Nullable logStr)); + +/** + * 同步健康心率数据回调 + * Synchronize healthy heart rate data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncHeartRate)(void(^ _Nullable heartRateDataCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步健康睡眠数据回调 + * Synchronize healthy sleep data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncSleep)(void(^ _Nullable sleepDataCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步健康步数数据回调 + * Synchronize health step data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncSport)(void(^ _Nullable sportDataCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步健康血压数据回调 + * Synchronize healthy blood pressure data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncBp)(void(^ _Nullable bpDataCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步活动数据回调 + * Synchronize active data callbacks + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncActivity)(void(^ _Nullable activityDataCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步gps数据回调 + * Synchronize GPS data callbacks + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncGps)(void(^ _Nullable gpsDataCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步游泳数据回调 + * Synchronize swim data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncSwim)(void(^ _Nullable swimCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步健康血氧数据回调 + * Synchronize healthy blood oxygen data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncBloodOxygen)(void(^ _Nullable bloodOxygenDataCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步压力数据回调 + * Synchronize pressure data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncPressure)(void(^ _Nullable pressureCallback)(NSString * _Nullable jsonStr)); + +/** + * 同步统一进度回调 + * Synchronize unified progress callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncProgess)(void(^ _Nullable syncProgessCallback)(IDO_CURRENT_SYNC_TYPE type,float progress)); + +/** + * 同步完成回调 + * Synchronize completes the callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncComplete)(void(^ _Nullable syncCompleteCallback)(IDO_SYNC_COMPLETE_STATUS stateCode)); + +/** + * 同步失败回调 如: 超时、断线、OTA + * Synchronize failed callback eg: timeout, disconnect, OTA + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^addSyncFailed)(void(^ _Nullable syncFailedCallback)(int errorCode)); + +/** + * 删除当天数据回调 + * Delete current day data callback + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^deleteCurrentDayData)(void(^ _Nullable deleteCallback)(BOOL success)); + +/** + * 强制执行或不执行同步配置 + * Enforce or not enforce the synchronize configuration + */ +@property (nonatomic,copy,nullable) IDOSyncManager *_Nonnull(^mandatorySyncConfig)(BOOL isSync); + +/** + * 初始化同步单例对象 + * init sync manager + */ +IDOSyncManager * _Nonnull initSyncManager(void); + +/** + 开始同步 | Start sync + */ ++ (void)startSync; + +/** + 结束同步 | End sync + */ ++ (void)stopSync; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncPressureDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncPressureDataModel.h new file mode 100755 index 0000000..c6301aa --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncPressureDataModel.h @@ -0,0 +1,158 @@ +// +// IDOSyncPressureDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncPressureItemInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 日期 精确到日期 date interval since 1970 (如:1444361933) | Date time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 子时间偏移量 (分钟) | Subtime offset (minutes) + */ +@property (nonatomic,assign) NSUInteger offset; + +/** + 压力值 | pressure value 0 ~ 255 + */ +@property (nonatomic,assign) NSInteger pressureVal; + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +@end + +@interface IDOSyncPressureDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + 日期 精确到日期 date interval since 1970 (如:1444361933) | Date time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 总时间偏移量 (分钟) | Total time offset (minutes) + */ +@property (nonatomic,assign) NSUInteger minuteOffset; + +/** + 压力数据包量 | Pressure data package + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + * @brief 压力集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * pressure collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly converted + * into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * pressures; + +@end + +@interface IDOSyncPressureDataModel : NSObject +/** + * @brief 查询当前设备某年12个月所有数据 (如果查询当月无数据,会创建空的数据对象,大于当月的数据不累加) + * Query all data of the current device for 12 months in a certain year (If there is no data in the query month, an empty data object will be created, + * and the data larger than the current month will not be accumulated) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param macAddr mac 地址 | mac address + * @param isQuery 是否查询items | is query items + * @return 一年12个月的压力数据集合,其中IDOSyncPressureDataInfoBluetoothModel对象是一天总血氧数据模型 + * pressure data collection for 12 months a year, where the IDOSyncPressureDataInfoBluetoothModel object is the total pressure data model for the day + */ ++ (NSArray *> *)queryOneYearPressureWithYear:(NSInteger)year + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某月份的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain month (If there is no data on the query day, an empty data object will be created, + * which is larger than the data of the day) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param month 月 (如 : 9) | Month (eg: 9) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询月份的所有日期集合的指针 (格式 :[10/01...10/31]) + * Pointer to all date collections for the current query month (format: [10/01...10/31]) + * @param isQuery 是否查询items | is query items + * @return 一个月的压力数据集合,其中IDOSyncPressureDataInfoBluetoothModel对象是一天总压力数据模型 + * A one-month pressure data collection, where the IDOSyncPressureDataInfoBluetoothModel object is the total pressure data model for the day + */ ++ (NSArray <__kindof IDOSyncPressureDataInfoBluetoothModel *>*)queryOneMonthPressureWithYear:(NSInteger)year + month:(NSInteger)month + macAddr:(NSString *)macAddr + datesOfMonth:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某周的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain week (If there is no data on the day of the query, an empty data object will be created, + * and the data larger than the current day will not be accumulated) + * @param weekIndex 周的查询索引 (0 : 当周, 1 : 上一周, 2 : 上两周 ...) | Week's query index (0: week, 1 : last week, 2 : last two weeks...) + * @param weekStartDay 星期的开始日 (0 : 星期日, 1 : 星期一, 2 : 星期二 ...) | Start of the week (0: Sunday, 1 : Monday, 2 : Tuesday ...) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询周的所有日期集合的指针 (格式 :[10/01...10/07]) + * Pointer to all date collections for the current query week (format: [10/01...10/07]) + * @param isQuery 是否查询items | is query items + * @return 一周的压力数据集合,其中IDOSyncPressureDataInfoBluetoothModel对象是一天总压力数据模型 + * A week's pressure data collection, where the IDOSyncPressureDataInfoBluetoothModel object is the total pressure data model for the day + */ ++ (NSArray <__kindof IDOSyncPressureDataInfoBluetoothModel *>*)queryOneWeekPressureWithWeekIndex:(NSInteger)weekIndex + weekStartDay:(NSInteger)weekStartDay + macAddr:(NSString *)macAddr + datesOfWeek:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某天压力数据并有详情数据 + * Query current pressure data of the current device and have detailed data + * @param macAddr mac 地址 | mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 一天压力数据的集合和详情数据集合 | Collection of day pressure data and details data + */ ++ (NSArray <__kindof IDOSyncPressureDataInfoBluetoothModel *>*)queryOneDayPressureDetailWithMac:(NSString *)macAddr + Year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + +/** + * @brief 查询所有压力数据,压力包个数大于0 + * Query all pressure data The number of pressure packets is greater than 0 + * @param macAddr mac地址 | mac address + * @return 所有压力数据的集合和详情数据(不包括当天数据) + * Collection of all pressure data and details data(Data for the day are not included) + */ ++ (NSArray <__kindof IDOSyncPressureDataInfoBluetoothModel *>*)queryAllPressuresWithMac:(NSString *)macAddr; + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSleepDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSleepDataModel.h new file mode 100755 index 0000000..608df6b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSleepDataModel.h @@ -0,0 +1,224 @@ +// +// IDOSyncSleepDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncSleepDataItemInfoBluetoothModel : IDOBluetoothBaseModel + +/** + * 睡眠状态 睡眠状态(0x01: 醒着, 0x02:浅睡, 0x03:深睡) + * Sleep state Sleep state (0x01: awake, 0x02: light sleep, 0x03: deep sleep) + */ +@property (nonatomic,assign) NSInteger sleepStatus; + +/** + 持续时间 | Duration + */ +@property (nonatomic,assign) NSInteger durations; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 时间戳 精确到分钟 start time interval since 1970 (如:1444361933) | Timestamp minute interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * startTimeStr; + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +@end + +@interface IDOSyncSleepDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 睡眠数据包数量 | Number of sleep packets + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + 睡眠结束时钟 | End of sleep clock + */ +@property (nonatomic,assign) NSInteger endHour; + +/** + 睡眠结束分钟 | End of sleep minutes + */ +@property (nonatomic,assign) NSInteger endMinute; + +/** + 总睡眠时长 (单位 :分钟) | Total sleep duration (unit: minute) + */ +@property (nonatomic,assign) NSInteger totalMinute; + +/** + 浅睡眠次数 | Light sleep times + */ +@property (nonatomic,assign) NSInteger lightSleepCount; + +/** + 深睡眠次数 | Deep sleep times + */ +@property (nonatomic,assign) NSInteger deepSleepCount; + +/** + 醒来次数 | Wake up times + */ +@property (nonatomic,assign) NSInteger wakeCount; + +/** + 醒来时长 | Wake up Duration + */ +@property (nonatomic,assign) NSInteger wakeMinute; + +/** + 浅睡眠时长 | Light sleep duration + */ +@property (nonatomic,assign) NSInteger lightSleepMinute; + +/** + 深睡眠时长 | Deep sleep duration + */ +@property (nonatomic,assign) NSInteger deepSleepMinute; + +/** + 目标睡眠时长 (单位 : 分钟) | Target sleep duration (unit: minute) + */ +@property (nonatomic,assign) NSInteger goalSleepData; + +/** + * 睡眠数据集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * Sleep data collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly converted + * into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * sleepItems; + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 时间戳 精确到分钟 start time interval since 1970 (如:1444361933) | Timestamp minute interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * startTimeStr; + +/** + 睡眠评分 | sleep score (1-100) + */ +@property (nonatomic,assign) NSInteger sleepScore; + +@end + +@interface IDOSyncSleepDataModel : NSObject +/** + * @brief 查询当前设备某年12个月所有数据 (如果查询当月无数据,会创建空的数据对象,大于当月的数据不累加) + * Query all data of the current device for 12 months in a certain year (If there is no data in the current month, an empty data object will be created, + * and the data larger than the current month will not be accumulated) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param macAddr mac 地址 | mac address + * @param isQuery 是否查询items | is query items + * @return 一年12个月的睡眠数据集合,其中IDOSyncSleepDataInfoBluetoothModel对象是一天总睡眠数据模型 + * 12 months of sleep data collection, IDOSyncSleepDataInfoBluetoothModel object is the total day sleep data model + */ ++ (NSArray *>*)queryOneYearSleepsWithYear:(NSInteger)year + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某月份的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain month (If there is no data on the query day, an empty data object will be created, + * which is larger than the data of the day) + * @param year 年 (如 : 2018) | year year (eg 2018) + * @param month 月 (如 : 9) | Month (eg: 9) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询月份的所有日期集合的指针 (格式 :[10/01...10/31]) + * Pointer to all date collections for the current query month (format: [10/01...10/31]) + * @param isQuery 是否查询items | is query items + * @return 一个月的睡眠数据集合,其中IDOSyncSleepDataInfoBluetoothModel对象是一天总睡眠数据模型 + * A one-month sleep data collection, where the IDOSyncSleepDataInfoBluetoothModel object is the total day sleep data model + */ ++ (NSArray <__kindof IDOSyncSleepDataInfoBluetoothModel *>*)queryOneMonthSleepsWithYear:(NSInteger)year + month:(NSInteger)month + macAddr:(NSString *)macAddr + datesOfMonth:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某周的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain week (If there is no data on the day of the query, an empty data object will be created, + * and the data larger than the current day will not be accumulated) + * @param weekIndex 周的查询索引 (0 : 当周, 1 : 上一周, 2 : 上两周 ...) | Week's query index (0: week, 1 : last week, 2 : last two weeks...) + * @param weekStartDay 星期的开始日 (0 : 星期日, 1 : 星期一, 2 : 星期二 ...) | Start of the week (0: Sunday, 1 : Monday, 2 : Tuesday ...) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询周的所有日期集合的指针 (格式 :[10/01...10/07]) | Pointer to all date collections for the current query week (format: [10/01...10/07]) + * @param isQuery 是否查询items | is query items + * @return 一周的睡眠数据集合,其中IDOSyncSleepDataInfoBluetoothModel对象是一天总睡眠数据模型 + * A week's sleep data collection, where the IDOSyncSleepDataInfoBluetoothModel object is the total day sleep data model + */ ++ (NSArray <__kindof IDOSyncSleepDataInfoBluetoothModel *>*)queryOneWeekSleepsWithWeekIndex:(NSInteger)weekIndex + weekStartDay:(NSInteger)weekStartDay + macAddr:(NSString *)macAddr + datesOfWeek:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某天睡眠数据并有详情数据 | Query the current device's sleep data and have detailed data + * @param macAddr mac 地址 | mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 一天睡眠数据的集合和详情数据集合 | Collection of daily sleep data and detailed data + */ ++ (NSArray <__kindof IDOSyncSleepDataInfoBluetoothModel *>*)queryOneDaySleepsDetailWithMac:(NSString *)macAddr + year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + +/** + * @brief 查询所有睡眠数据 睡眠时长大于0 | Query all sleep data Sleep duration is greater than 0 + * @param macAddr mac 地址 | mac address + * @return 所有睡眠数据的集合 | Collection and details of all sleep data + */ ++ (NSArray <__kindof IDOSyncSleepDataInfoBluetoothModel *>*)queryAllSleepsWithMac:(NSString *)macAddr; + + +/** + * @brief 查询所有睡眠数据 睡眠时长大于0 只包含睡眠总时长和日期时间戳 + * Query all sleep data Sleep duration is greater than 0 Just the total amount of sleep and the date and timestamp + * @param macAddr mac 地址 | mac address + * @return 所有睡眠数据的集合 | Collection of all sleep data + */ ++ (NSArray <__kindof IDOSyncSleepDataInfoBluetoothModel *>*)queryAllContractedSleepsWithMac:(NSString *)macAddr; + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSpo2DataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSpo2DataModel.h new file mode 100755 index 0000000..ec06a91 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSpo2DataModel.h @@ -0,0 +1,175 @@ +// +// IDOSyncSpo2DataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncBloodOxygenItemInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 日期 time interval since 1970 (如:1444361933) | Date time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 子时间偏移量 (秒钟) | Subtime offset (second) + */ +@property (nonatomic,assign) NSUInteger offset; + +/** + 血氧值 | Blood oxygen value 0 ~ 255 + */ +@property (nonatomic,assign) NSInteger spo2Val; + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +@end + +@interface IDOSyncBloodOxygenDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + 日期 精确到日期 date interval since 1970 (如:1444361933) | Date time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 总时间偏移量 (秒钟) | Total time offset (second) + */ +@property (nonatomic,assign) NSUInteger minuteOffset; + +/** + 血氧数据包量 | Blood pressure data package + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + * 血氧集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * blood oxygen collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly converted + * into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * bloodOxygens; + +/** + 平均血氧 | Average blood oxygen + */ +@property (nonatomic,assign) NSInteger avgBloodOxygen; + +/** + 最大血氧 | Maximum blood oxygen + */ +@property (nonatomic,assign) NSInteger maxBloodOxygen; + +/** + 最小血氧 | Most blood oxygen + */ +@property (nonatomic,assign) NSInteger minBloodOxygen; + +@end + + +@interface IDOSyncSpo2DataModel : NSObject +/** + * @brief 查询当前设备某年12个月所有数据 (如果查询当月无数据,会创建空的数据对象,大于当月的数据不累加) + * Query all data of the current device for 12 months in a certain year (If there is no data in the query month, an empty data object will be created, + * and the data larger than the current month will not be accumulated) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param macAddr mac 地址 | mac address + * @param isQuery 是否查询items | is query items + * @return 一年12个月的血氧数据集合,其中IDOSyncBloodOxygenDataInfoBluetoothModel对象是一天总血氧数据模型 + * Blood oxygen data collection for 12 months a year, where the IDOSyncBloodOxygenDataInfoBluetoothModel object is the total blood oxygen data model for the day + */ ++ (NSArray *> *)queryOneYearBloodOxygenWithYear:(NSInteger)year + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某月份的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain month (If there is no data on the query day, an empty data object will be created, + * which is larger than the data of the day) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param month 月 (如 : 9) | Month (eg: 9) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询月份的所有日期集合的指针 (格式 :[10/01...10/31]) + * Pointer to all date collections for the current query month (format: [10/01...10/31]) + * @param isQuery 是否查询items | is query items + * @return 一个月的血氧数据集合,其中IDOSyncBloodOxygenDataInfoBluetoothModel对象是一天总血氧数据模型 + * A one-month blood oxygen data collection, where the IDOSyncHrDataInfoBluetoothModel object is the total blood oxygen data model for the day + */ ++ (NSArray <__kindof IDOSyncBloodOxygenDataInfoBluetoothModel *>*)queryOneMonthBloodOxygenWithYear:(NSInteger)year + month:(NSInteger)month + macAddr:(NSString *)macAddr + datesOfMonth:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某周的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain week (If there is no data on the day of the query, an empty data object will be created, + * and the data larger than the current day will not be accumulated) + * @param weekIndex 周的查询索引 (0 : 当周, 1 : 上一周, 2 : 上两周 ...) | Week's query index (0: week, 1 : last week, 2 : last two weeks...) + * @param weekStartDay 星期的开始日 (0 : 星期日, 1 : 星期一, 2 : 星期二 ...) | Start of the week (0: Sunday, 1 : Monday, 2 : Tuesday ...) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询周的所有日期集合的指针 (格式 :[10/01...10/07]) + * Pointer to all date collections for the current query week (format: [10/01...10/07]) + * @param isQuery 是否查询items | is query items + * @return 一周的血氧数据集合,其中IDOSyncBloodOxygenDataInfoBluetoothModel对象是一天总血氧数据模型 + * A week's blood oxygen data collection, where the IDOSyncBloodOxygenDataInfoBluetoothModel object is the total blood oxygen data model for the day + */ ++ (NSArray <__kindof IDOSyncBloodOxygenDataInfoBluetoothModel *>*)queryOneWeekBloodOxygenWithWeekIndex:(NSInteger)weekIndex + weekStartDay:(NSInteger)weekStartDay + macAddr:(NSString *)macAddr + datesOfWeek:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某天血氧数据并有详情数据 + * Query current blood oxygen data of the current device and have detailed data + * @param macAddr mac 地址 | mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 一天血氧数据的集合和详情数据结合 | Collection of day blood oxygen data and details data + */ ++ (NSArray <__kindof IDOSyncBloodOxygenDataInfoBluetoothModel *>*)queryOneDayBloodOxygenDetailWithMac:(NSString *)macAddr + year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + +/** + * @brief 查询所有血氧数据,血氧包个数大于0 + * Query all blood oxygen data The number of blood oxygen packets is greater than 0 + * @param macAddr mac地址 | mac address + * @return 所有血氧数据的集合和详情数据(不包括当天数据) + * Collection of all blood oxygen data and details data + */ ++ (NSArray <__kindof IDOSyncBloodOxygenDataInfoBluetoothModel *>*)queryAllBloodOxygensWithMac:(NSString *)macAddr; + + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSportDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSportDataModel.h new file mode 100755 index 0000000..5db27b8 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSportDataModel.h @@ -0,0 +1,221 @@ +// +// IDOSyncSportDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncSportDataItemInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 运动模式 | Sports mode (unit: number of steps) + */ +@property (nonatomic,assign) NSInteger mode; + +/** + 运动步数 | Number of steps + */ +@property (nonatomic,assign) NSInteger sportCount; + +/** + 活跃时间 (秒) | Active time (seconds) + */ +@property (nonatomic,assign) NSInteger activeTime; + +/** + 卡路里(大卡) | Calories (unit: big card) + */ +@property (nonatomic,assign) NSInteger calories; + +/** + 运动距离(米) | Sport distance (unit: m) + */ +@property (nonatomic,assign) NSInteger distance; + +/** + 运动时间日期 精确到日期 | Sports time and date + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +@end + +@interface IDOSyncSportDataInfoBluetoothModel : IDOBluetoothBaseModel + +/** + 运动数据包数量 | Number of sports packets + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时间戳 精确到日期 date interval since 1970 (如:1444361933) | Timestamp date interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + * 运动数据集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * Motion data collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly + * converted into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * sportItems; + +/** + 运动总步数(单位 :步数) | Total number of steps in sports (unit: number of steps) + */ +@property (nonatomic,assign) NSInteger totalStep; + +/** + 运动总消耗卡路里(单位 :大卡) | Total calories burned by exercise (unit: big card) + */ +@property (nonatomic,assign) NSInteger totalCalories; + +/** + 运动总距离(单位 :米) | Total distance of movement (unit: m) + */ +@property (nonatomic,assign) NSInteger totalDistances; + +/** + 运动总时长 (秒) | Total length of exercise (seconds) + */ +@property (nonatomic,assign) NSInteger totalActiveTime; + +/** + 开始偏移量 | Start offset + */ +@property (nonatomic,assign) NSInteger minuteOffset; + +/** + 产生数据间隔 | Generate data interval + */ +@property (nonatomic,assign) NSInteger perMinute; + +/** + 目标运动数量 | Number of target sports + */ +@property (nonatomic,assign) NSInteger goalSportData; + +/** + 一天步数items个数 | one day total items count + */ +@property (nonatomic,assign) NSInteger totalCount; + +/** + 只有用于 Donha app | Only for the Donha app + 关键字 0:无效;1:超;2:浪;3:稳;4:慢;5:懒;6:香;7:安;8:困;9:燃;10:暖;11:动;12:佛;13:秀;14:拼;15:惯;16:凉; + */ +@property (nonatomic,assign) NSInteger keyWord; + +@end + + +@interface IDOSyncSportDataModel : NSObject +/** + * @brief 查询当前设备某年12个月所有数据 (如果查询当月无数据,会创建空的数据对象,大于当月的数据不累加) + * Query all data of the current device for 12 months in a certain year (If there is no data in the current month, an empty data object will be created, + * and the data larger than the current month will not be accumulated) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param macAddr mac 地址 | mac address + * @param isQuery 是否查询items | is query items + * @return 一年12个月的运动数据集合,其中IDOSyncSportDataInfoBluetoothModel对象是一天总运动数据模型 + * A 12-month sports data collection, where the IDOSyncSportDataInfoBluetoothModel object is a total day motion data model + */ ++ (NSArray *>*)queryOneYearSportsWithYear:(NSInteger)year + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某月份的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain month (If there is no data on the query day, an empty data object will be created, + * which is larger than the data of the day) + * @param year 年 (如 : 2018) | Year (eg: 2018) + * @param month 月 (如 : 9) | Month (eg: 9) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询月份的所有日期集合的指针 (格式 :[10/01...10/31]) + * Pointer to all date collections for the current query month (format: [10/01...10/31]) + * @param isQuery 是否查询items | is query items + * @return 一个月的运动数据集合,其中IDOSyncSportDataInfoBluetoothModel对象是一天总运动数据模型 + * One month of motion data collection, where the IDOSyncSportDataInfoBluetoothModel object is the total day motion data model + */ ++ (NSArray <__kindof IDOSyncSportDataInfoBluetoothModel *>*)queryOneMonthSportsWithYear:(NSInteger)year + month:(NSInteger)month + macAddr:(NSString *)macAddr + datesOfMonth:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + +/** + * @brief 查询当前设备某周的所有数据 (如果查询当天无数据,会创建空的数据对象,大于当天的数据不累加) + * Query all data of the current device for a certain week (If there is no data on the day of the query, an empty data object will be created, + * and the data larger than the current day will not be accumulated) + * @param weekIndex 周的查询索引 (0 : 当周, 1 : 上一周, 2 : 上两周 ...) | Week's query index (0: week, 1 : last week, 2 : last two weeks...) + * @param weekStartDay 星期的开始日 (0 : 星期日, 1 : 星期一, 2 : 星期二 ...) | Start of the week (0: Sunday, 1 : Monday, 2 : Tuesday ...) + * @param macAddr mac 地址 | mac address + * @param dates 当前查询周的所有日期集合的指针 (格式 :[10/01...10/07]) + * Pointer to all date collections for the current query week (format: [10/01...10/07]) + * @param isQuery 是否查询items | is query items + * @return 一周的运动数据集合,其中IDOSyncSportDataInfoBluetoothModel对象是一天总运动数据模型 + * A week of motion data collection, where the IDOSyncSportDataInfoBluetoothModel object is the total day motion data model + */ ++ (NSArray <__kindof IDOSyncSportDataInfoBluetoothModel *>*)queryOneWeekSportsWithWeekIndex:(NSInteger)weekIndex + weekStartDay:(NSInteger)weekStartDay + macAddr:(NSString *)macAddr + datesOfWeek:(NSArray **)dates + isQueryItems:(BOOL)isQuery; + + +/** + * @brief 查询当前设备某天运动据并有详情数据 | Query the current device's mobile data and have detailed data + * @param macAddr mac 地址 | mac address + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 一天运动数据的集合和详情数据集合 | Collection of daily exercise data and detailed data + */ ++ (NSArray <__kindof IDOSyncSportDataInfoBluetoothModel *>*)queryOneDaySportDetailWithMac:(NSString *)macAddr + year:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + +/** + * @brief 查询所有运动数据 步数大于0 | Query all motion data Steps greater than 0 + * @param macAddr mac 地址 | mac address + * @return 所有运动数据的集合 | Collection of all the motion data + */ ++ (NSArray <__kindof IDOSyncSportDataInfoBluetoothModel *>*)queryAllSportsWithMac:(NSString *)macAddr; + +/** + * @brief 查询所有运动数据 步数大于0 只包含总步数和日期时间戳 + * Query all motion data Steps greater than 0 ; Contains only the total number of steps and the date and time stamp + * @param macAddr mac 地址 | mac address + * @return 所有运动数据的集合 | Collection of all the motion data + */ ++ (NSArray <__kindof IDOSyncSportDataInfoBluetoothModel *>*)queryAllContractedSportsWithMac:(NSString *)macAddr; + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSwimDataModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSwimDataModel.h new file mode 100755 index 0000000..2719fdb --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOSyncSwimDataModel.h @@ -0,0 +1,188 @@ +// +// IDOSyncSwimDataModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/6. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import + +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOSyncSwimItemDataInfoBluetoothModel : IDOBluetoothBaseModel +/** + 开始时间 精确到秒 | start time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * timeStr; + +/** + 持续时间 (单位:秒) | duration (unit:second) + */ +@property (nonatomic,assign) NSInteger duration; + +/** + 划水次数 | strokes number + */ +@property (nonatomic,assign) NSInteger strokesNumber; + +/** + 评分 | swolf + */ +@property (nonatomic,assign) NSInteger swolf; + +/** + 序列号 | Serial number + */ +@property (nonatomic,assign) NSInteger serialNumber; + +/** + * 每一趟的泳姿 | swimming posture + * 0x00 : 混合泳; 0x01 : 自由泳; 0x02 : 蛙泳; 0x03 : 仰泳; 0x04 : 蝶泳; + * 0x00: medley; 0x01: freestyle; 0x02: breaststroke; 0x03: backstroke; 0x04: butterfly stroke; + */ +@property (nonatomic,assign) NSInteger swimmingPosture; + +/** + 每一趟的距离 (单位:米) | distance (unit:m) + */ +@property (nonatomic,assign) NSInteger distance; + +@end + +@interface IDOSyncSwimmingDataInfoBluetoothModel : IDOBluetoothBaseModel +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/** + 时 | hour + */ +@property (nonatomic,assign) NSInteger hour; + +/** + 分 | minutes + */ +@property (nonatomic,assign) NSInteger minute; + +/** + 秒 | seconds + */ +@property (nonatomic,assign) NSInteger second; + +/** + 日期 精确到日期 date interval since 1970 (如:1444361933) | Date time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/** + 开始时间 精确到秒 | start time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * timeStr; + +/** + 游泳类型 0x00:无效,0x01:室内游泳,0x02:开阔水域游泳 | 0x00:invalid,0x01:Indoor swimming,0x02:Open water swimming + */ +@property (nonatomic,assign) NSInteger type; + +/** + 卡路里(单 位:大卡) | Calories (Unit: Big Card) + */ +@property (nonatomic,assign) NSInteger calories; + +/** + 距离(单位: 米) | Distance (in meters) + */ +@property (nonatomic,assign) NSInteger distance; + +/** + 游泳趟数 | Swimming train number + */ +@property (nonatomic,assign) NSInteger trips; + +/** + 平均 swolf | average swolf + */ +@property (nonatomic,assign) NSInteger averageSwolf; + +/** + 总划水次数 | total strokes number + */ +@property (nonatomic,assign) NSInteger totalStrokesNumber; + +/** + * 主泳姿 | swimming posture + * 0x00 : 混合泳; 0x01 : 自由泳; 0x02 : 蛙泳; 0x03 : 仰泳; 0x04 : 蝶泳; + * 0x00: medley; 0x01: freestyle; 0x02: breaststroke; 0x03: backstroke; 0x04: butterfly stroke; + */ +@property (nonatomic,assign) NSInteger swimmingPosture; + +/** + 泳池距离 (单位:cm) | pool distance (unit:cm) + */ +@property (nonatomic,assign) NSInteger poolDistance; + +/** + 游泳数据包量 | swimming data package + */ +@property (nonatomic,assign) NSInteger itemsCount; + +/** + * @brief 游泳集合 只有定义好的查询方法才能转成model集合,自定义的查询方法无法直接转成model集合,需要再查询itemModel赋给当前属性 + * swimming collection Only defined query methods can be converted into model collections. Custom query methods cannot be directly converted + * into model collections. You need to query itemModel to assign current attributes. + */ +@property (nonatomic,copy) NSArray * swimmingItems; + +/** + 用户确认的距离 | confirm distance + */ +@property (nonatomic,assign) NSInteger confirmDistance; + +/** + 游泳持续时长 单位:分钟 | duration unit:minute + */ +@property (nonatomic,assign) NSInteger duration; + +@end + + +@interface IDOSyncSwimDataModel : NSObject +/** + * @brief 当前设备根据游泳开始时间查询某个游泳详情 + * The current device queries an swim details based on the event start time + * @param macAddr mac地址 | Mac address + * @param timeStr 游泳开始时间 | swim start time + * @return model IDOSyncSwimmingDataInfoBluetoothModel + */ ++ (__kindof IDOSyncSwimmingDataInfoBluetoothModel *)querySwimDataWithTimeStr:(NSString *)timeStr + macAddr:(NSString *)macAddr; + +/** + * @brief 当前设备查询一天所有游泳数据 + * The current device queries an swim details based on the event start time + * @param macAddr mac地址 | Mac address + * @param dateStr 日期时间戳 | Date time stamp + * @param isQuery 是否查询items | is query items + * @return 一天游泳数据的集合 | Collection of day swim data + */ ++ (NSArray <__kindof IDOSyncSwimmingDataInfoBluetoothModel *>*)querySwimDataWithDateStr:(NSString *)dateStr + macAddr:(NSString *)macAddr + isQueryItems:(BOOL)isQuery; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTranEnum.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTranEnum.h new file mode 100755 index 0000000..53d7ad3 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTranEnum.h @@ -0,0 +1,93 @@ +// +// IDOTranEnum.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/7. +// Copyright © 2019 何东阳. All rights reserved. +// + +#ifndef IDOTranEnum_h +#define IDOTranEnum_h + +/** + 压缩类型 | compression type + */ +typedef NS_ENUM(NSInteger, IDO_DATA_TRAN_COMPRESSION_TYPE) { + /** + 不适用压缩 | no use + */ + IDO_DATA_TRAN_COMPRESSION_NO_USE_TYPE = 0, + /** + zlib压缩 | zlib + */ + IDO_DATA_TRAN_COMPRESSION_ZLIB_TYPE = 1, + /** + fastlz压缩 | fastlz + */ + IDO_DATA_TRAN_COMPRESSION_FASTLZ_TYPE = 2, + +}; + +/** + 文件传输类型 | file transfer type + */ +typedef NS_ENUM(NSInteger, IDO_DATA_FILE_TRAN_TYPE) { + /** + AGPS 文件 | AGPS file type + */ + IDO_DATA_FILE_TRAN_AGPS_TYPE = 1, + /** + 表盘 文件 | dial file type + */ + IDO_DATA_FILE_TRAN_DIAL_TYPE = 2, + /** + 字库 文件 | word file type + */ + IDO_DATA_FILE_TRAN_WORD_TYPE = 3, + /** + 图片文件 | photo file type + */ + IDO_DATA_FILE_TRAN_PHOTO_TYPE = 4 +}; + +/** + 文件传输状态 | file transfer state type + */ +typedef NS_ENUM(NSInteger, IDO_DATA_FILE_TRAN_STATE_TYPE) { + /** + 文件传输初始值 | transmission init + */ + IDO_DATA_FILE_TRAN_INIT_TYPE = 0, + /** + 文件开始传输 | start transmission + */ + IDO_DATA_FILE_TRAN_START_TYPE = 1, + /** + 文件传输中 | transmissioning + */ + IDO_DATA_FILE_TRAN_ING_TYPE = 2, + /** + 文件传输成功 | transmission success + */ + IDO_DATA_FILE_TRAN_SUCCESS_TYPE = 3, + /** + 文件传输失败 | transmission failed + */ + IDO_DATA_FILE_TRAN_FAILED_TYPE = 4, + /** + 文件开始写入 | start write + */ + IDO_DATA_FILE_WRITE_TYPE = 5, + /** + 文件写入成功 | write success + */ + IDO_DATA_FILE_WRITE_SUCCESS_TYPE = 6, + /** + 文件写入失败 | write failed + */ + IDO_DATA_FILE_WRITE_FAILED_TYPE = 7, + +}; + + +#endif /* IDOTranEnum_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTransferFileManager.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTransferFileManager.h new file mode 100755 index 0000000..bf390b1 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOTransferFileManager.h @@ -0,0 +1,116 @@ +// +// IDOTransferFileManager.h +// IDOBluetooth +// +// Created by hedongyang on 2018/9/30. +// Copyright © 2018年 apple. All rights reserved. +// + +#import +#if __has_include() +#elif __has_include() +#else +#import "IDOTranEnum.h" +#endif + +@interface IDOTransferFileManager : NSObject + +/** + * 传输文件类型 agps文件、表盘文件、字库文件、图片文件 + * Transfer file type agps file, dial file + */ +@property (nonatomic,assign) IDO_DATA_FILE_TRAN_TYPE transferType; + +/** + * 传输文件压缩类型 不适用压缩、zlib压缩、fastlz压缩 + * Transfer file compression types not suitable for compression, zlib compression, fastlz compression + */ +@property (nonatomic,assign) IDO_DATA_TRAN_COMPRESSION_TYPE compressionType; + +/** + * 传输文件过程状态 + * Transfer file process status + */ +@property (nonatomic,assign) IDO_DATA_FILE_TRAN_STATE_TYPE tranStateType; + +/** + * 设置传输文件包文个数 默认 10 + * Set the number of transfer file packet default 10 + */ +@property (nonatomic,assign) NSInteger numberPackets; + +/** + * 传输文件名称 + * Transfer file name + */ +@property (nonatomic,copy,nullable) NSString * fileName; + +/** + * 传输文件路径 + * Transfer file path + */ +@property (nonatomic,copy,nullable) NSString * filePath; + +/* + * 传输文件的二进制数据 + * Transfer the binary data of the file + */ +@property (nonatomic,copy,nullable) NSData * fileData; + +/** + * 蓝牙写入数据是否响应 + * Bluetooth sends data in response + */ +@property (nonatomic,assign) BOOL isResponse; + +/** + * 是否设置连接参数 + * Set connection parameters + */ +@property (nonatomic,assign) BOOL isSetConnectParam; + +/** + * 检测文件回调 + * Detect file callback + */ +@property (nonatomic,copy,nullable) IDOTransferFileManager *_Nonnull(^addDetection)(void(^ _Nullable detectionCallback)(int errorCode)); + +/** + * 文件传输进度回调 (1-100) + * file transfer progress (1-100) + */ +@property (nonatomic,copy,nullable) IDOTransferFileManager *_Nonnull(^addProgress)(void(^ _Nullable progressCallback)(int progress)); + +/** + * 文件传输完成回调 + * File transfer complete callback + */ +@property (nonatomic,copy,nullable) IDOTransferFileManager *_Nonnull(^addTransfer)(void(^ _Nullable transferComplete)(int errorCode)); + +/** + * 文件写入完成回调 agps文件传输完成后需要查询写入状态 + * File write complete callback + */ +@property (nonatomic,copy,nullable) IDOTransferFileManager *_Nonnull(^addWrite)(void(^ _Nullable writeComplete)(int errorCode)); + +/** + * 初始化传输文件管理对象(单例) + * Initialize the transfer file management object (singleton) + */ +IDOTransferFileManager * _Nonnull initTransferManager(void); + +/** + * 文件开始传输 + * file start transfer + */ ++ (void)startTransfer; + +/** + * 文件结束传输 + * file stop transfer + */ ++ (void)stopTransfer; + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialInfoModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialInfoModel.h new file mode 100755 index 0000000..2e5c7db --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialInfoModel.h @@ -0,0 +1,95 @@ +// +// IDOWatchDialInfoModel.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/21. +// Copyright © 2019 何东阳. All rights reserved. +// + +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOWatchScreenInfoModel : IDOBluetoothBaseModel +/** + 表盘家族名称 | family name + */ +@property (nonatomic,copy) NSString * familyName; +/** + 宽度 | width + */ +@property (nonatomic,assign) NSInteger width; +/** + 高度 | height + */ +@property (nonatomic,assign) NSInteger height; +/** + 颜色格式 | color format + */ +@property (nonatomic,assign) NSInteger colorFormat; +/** + 尺寸 * 100 | size * 100 + */ +@property (nonatomic,assign) NSInteger size; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOWatchScreenInfoModel + */ ++ (__kindof IDOWatchScreenInfoModel *)currentModel; + +@end + +@interface IDOWatchDialInfoItemModel : IDOBluetoothBaseModel +/** + 表盘名称(唯一标示) | file name (only sign) + */ +@property (nonatomic,copy) NSString * fileName; + +/** + * 操作 0x00:查询正在使用表盘 0x01:设置表盘 0x02:删除表盘 + * Operation 0x00: query is using the dial 0x01: set the dial 0x02: delete the dial + */ +@property (nonatomic,assign) NSInteger operate; + +@end + + +@interface IDOWatchDialInfoModel : IDOBluetoothBaseModel +/** + * 文件个数 + * file count + */ +@property (nonatomic,assign) NSInteger fileCount; +/** + * 剩余空间 KB + * remaining Space + */ +@property (nonatomic,assign) NSInteger remainingSpace; +/** + * 单个文件最大size KB + * file max size + */ +@property (nonatomic,assign) NSInteger fileMaxSize; +/** + * 当前设置的表盘名称 + * name of the dial currently set +*/ +@property (nonatomic,copy) NSString * currentDialName; +/** + * 当前手环所有表盘信息集合 + * Current bracelet all dial information set + */ +@property (nonatomic,strong) NSArray * dialArray; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOWatchDialInfoModel + */ ++ (__kindof IDOWatchDialInfoModel *)currentModel; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialManager.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialManager.h new file mode 100755 index 0000000..3145921 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWatchDialManager.h @@ -0,0 +1,75 @@ +// +// IDOWatchDialManager.h +// IDOBluetoothInternal +// +// Created by 何东阳 on 2019/8/21. +// Copyright © 2019 何东阳. All rights reserved. +// + +#import + +typedef void(^ _Nullable setComplete)(IDOWatchDialInfoModel * _Nullable model,int errorCode); + +@interface IDOWatchDialManager : NSObject + +/** + * 表盘文件传输路径 (zip) + * Transfer file path + */ +@property (nonatomic,copy,nullable) NSString * filePath; + +/** + * 获取当前设备屏幕信息 + * Gets the current device screen information + */ +@property (nonatomic,copy,nullable) IDOWatchDialManager *_Nonnull(^getDialScreenInfo)(void(^ _Nullable dialScreenCallback)(IDOWatchScreenInfoModel * _Nullable model,int errorCode)); + +/** + * 获取当前设备所有表盘信息 + * Gets all dial information of the current device + */ +@property (nonatomic,copy,nullable) IDOWatchDialManager *_Nonnull(^getDialListInfo)(void(^ _Nullable dialListCallback)(IDOWatchDialInfoModel * _Nullable model,int errorCode)); + +/** + * 获取当前设备当前表盘信息 + * Gets current dial information of the current device + */ +@property (nonatomic,copy,nullable) IDOWatchDialManager *_Nonnull(^getCurrentDialInfo)(void(^ _Nullable currentDialCallback)(IDOWatchDialInfoModel * _Nullable model,int errorCode)); + +/** + * 设置当前表盘并回调 + * Set the current dial and call back + */ +@property (nonatomic,copy,nullable) IDOWatchDialManager *_Nonnull(^setCurrentDial)(setComplete block,IDOWatchDialInfoItemModel * _Nullable model); + +/** + * 表盘传输进度回调 (1-100) + * file transfer progress (1-100) + */ +@property (nonatomic,copy,nullable) IDOWatchDialManager *_Nonnull(^addDialProgress)(void(^ _Nullable progressCallback)(int progress)); + +/** + * 表盘传输完成回调 + * File transfer complete callback + */ +@property (nonatomic,copy,nullable) IDOWatchDialManager *_Nonnull(^addDialTransfer)(void(^ _Nullable transferComplete)(int errorCode)); + +/** + * 初始化表盘传输管理对象(单例) + * Initialize the transfer file management object (singleton) + */ +IDOWatchDialManager * _Nonnull initWatchDialManager(void); + +/** + * 表盘开始传输 + * file start transfer + */ ++ (void)startDialTransfer; + +/** + * 表盘结束传输 + * file stop transfer + */ ++ (void)stopDialTransfer; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWeightBluetoothModel.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWeightBluetoothModel.h new file mode 100755 index 0000000..8b0fc1b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IDOWeightBluetoothModel.h @@ -0,0 +1,124 @@ +// +// IDOWeightBluetoothModel.h +// IDOBluetooth +// +// Created by 何东阳 on 2018/10/27. +// Copyright © 2018年 apple. All rights reserved. +// + +#if __has_include() +#elif __has_include() +#else +#import "IDOBluetoothBaseModel.h" +#endif + +@interface IDOWeightBluetoothModel : IDOBluetoothBaseModel + +/** + 年份 | Year + */ +@property (nonatomic,assign) NSInteger year; + +/** + 月份 | Month + */ +@property (nonatomic,assign) NSInteger month; + +/** + 日期 | Date + */ +@property (nonatomic,assign) NSInteger day; + +/* + * 日期时间戳 time interval since 1970 (如:1444361933) + * Date Timestamp time interval since 1970 (eg 14442361933) + */ +@property (nonatomic,copy) NSString * dateStr; + +/* + * 时间戳 time interval since 1970 (如:1444361933) + * Timestamp time interval since 1970 (eg: 14443361933) + */ +@property (nonatomic,copy) NSString * timeStamp; + +/* + 体重值 | Weight value + */ +@property (nonatomic,copy) NSString * weightValue; + +/* + 体重单位 0是磅 1是公斤 | Weight unit 0 is pound 1 is kg + */ +@property (nonatomic,copy) NSString * weightUnit; + +/* + 最后一次记录的体重单位 0是磅 1是公斤 | Last recorded weight unit 0 is pound 1 is kg + */ +@property (nonatomic,copy) NSString * lastWeightUnit; + +/* + 最后一次记录的体重 | Last recorded weight + */ +@property (nonatomic,copy) NSString * lastWeightValue; + +/* + 手动输入? | Manual input + */ +@property (nonatomic,assign) BOOL isHandsRecord; + +/* + BMI + */ +@property (nonatomic,copy) NSString * bmi; + +/* + 体脂率 | Body fat rate + */ +@property (nonatomic,copy) NSString * bodyFat; + +/* + 内脏脂肪 | Visceral fat + */ +@property (nonatomic,copy) NSString * visFat; + +/* + 体水分 | Body water + */ +@property (nonatomic,copy) NSString * water; + +/* + 蛋白质 | Protein + */ +@property (nonatomic,copy) NSString * protein; + +/* + 骨量 | Bone mass + */ +@property (nonatomic,copy) NSString * bone; + +/** + * @brief 查询数据库,如果查询不到初始化新的model对象 + * Query the database, if the query does not initialize a new model object + * @return IDOUserWeightModel + */ ++ (__kindof IDOWeightBluetoothModel *)currentModel; + +/** + * @brief 查询指定日期前七次体重数据,如果没有数据会初始化体重为0的数据对象 + * Query the weight data seven times before the specified date, if there is no data, initialize the data object with weight 0 + * @return IDOUserWeightModel + */ ++ (NSArray <__kindof IDOWeightBluetoothModel *>*)querySevenTimesRecentlyWithDateStr:(NSString *)dateStr; + +/** + * @brief 查询当前设备某天体重详情数据 | Query current device weight data for one day + * @param year 年份 | year + * @param month 月份 | month + * @param day 日期 | day + * @return 体重详情数据 | Weight details data + */ ++ (__kindof IDOWeightBluetoothModel *)queryOneDayDataWithYear:(NSInteger)year + month:(NSInteger)month + day:(NSInteger)day; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IHSDKCloudUser.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IHSDKCloudUser.h new file mode 100644 index 0000000..201af0f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/IHSDKCloudUser.h @@ -0,0 +1,104 @@ +// +// IHSDKCloudUser.h +// iHealthDemoCode +// +// Created by daiqingquan on 16/5/5. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import +#import "HealthUser.h" + + + +@interface IHSDKCloudUser : NSObject + +@property (strong, nonatomic) NSString *thirdUserID; + + +/** + * Initialize IHSDKCloudUser class + */ + ++(IHSDKCloudUser*)commandGetSDKUserInstance; + + +/** User authentication + + * Import Parameters: + tempUser included properties: clientID, clientSecret, userAccount + userAccount: either email or mobile phone number (mobile phone number is not currently supported yet) + clientID & clientSecret: the only identification for users of the SDK, requires registration from iHealth administrator, please email: heguangming@ihealthlabs.com.cn for more information. + + * Return Parameters: + * @param userValidationSuccess The return parameters of ’‘userid’, ‘height’, ’clientID’, and ‘clientSecret’ after verification + + The interpretation for the verification: + UserAuthen_RegisterSuccess: New-user registration succeeded. + UserAuthen_LoginSuccess: User login succeeded. + UserAuthen_CombinedSuccess: The user is an iHealth user as well, measurement via SDK has been activated, and the data from the measurement belongs to the user. + UserAuthen_TrySuccess: Testing without internet connection succeeded. + UserAuthen_InvalidateUserInfo: Userid/clientID/clientSecret verification failed. + UserAuthen_SDKInvalidateRight: SDK has not been authorized. + UserAuthen_UserInvalidateRight: User has not been authorized. + UserAuthen_InternetError: Internet error, verification failed. + The measurement via SDK will be operated in the case of 1-4, and will be terminated if any of 5-8 occurs. The interface needs to be re-called after analyzing the return parameters. + Notice: when a new user registers via SDK, an ‘iHealth disclaimer’ will pop up automatically, and will require the user to agree in order to continue. SDK applications require an Internet connection; there is 10-day trial period if the SDK cannot connect to the internet, the SDK is fully functional during tryout period, but will be terminated without a working internet connection after 10 days. + + * @param userDeviceAccess + ( + OpenApiActivity, + OpenApiBG, + OpenApiBP, + OpenApiFood, + OpenApiSleep, + OpenApiSpO2, + OpenApiSport, + OpenApiUserInfo, + OpenApiWeight + ) + + * @param userValidationReturn userID + * @paramdisposeValidationErrorBlock: Error code + + */ + +-(void)commandSDKUserValidation:(HealthUser *)tempUser UserDeviceAccess:(DisposeSDKUserDeviceAccess)userDeviceAccess UserValidationSuccess:(DisposeSDKUserValidationSuccess)userValidationSuccess UserValidationReturn:(DisposeSDKUserValidationReturn)userValidationReturn DisposeErrorBlock:(DisposeSDKUserValidationErrorBlock)disposeValidationErrorBlock; + +/** User authentication with AppSecret + + * Import Parameters: + appSecret + * Return Parameters: + * @param userValidationSuccess UserAuthen_AppSecretVerifySuccess + + * @param disposeValidationErrorBlock UserAuthen_AppSecretVerifyFailed + +*/ +-(void)commandSDKUserValidationWithAppSecret:(NSString *)appSecret UserValidationSuccess:(DisposeSDKUserValidationSuccess)userValidationSuccess DisposeErrorBlock:(DisposeSDKUserValidationErrorBlock)disposeValidationErrorBlock; + + +/** User authentication with License + + * Import Parameters: + + licenseData + + * Return Parameters: + + * @param userDeviceAccess + ( + { + deviceName = am3s; + expiredDate = "2017-05-15"; + }, + + ) + * @param userValidationSuccess UserAuthen_AppSecretVerifySuccess + + * @param disposeValidationErrorBlock UserAuthen_AppSecretVerifyFailed + + */ +-(void)commandSDKUserValidationWithLicense:(NSData *)licenseData UserDeviceAccess:(DisposeSDKUserDeviceAccess)userDeviceAccess UserValidationSuccess:(DisposeSDKUserValidationSuccess)userValidationSuccess DisposeErrorBlock:(DisposeSDKUserValidationErrorBlock)disposeValidationErrorBlock; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BT.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BT.h new file mode 100644 index 0000000..867f059 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BT.h @@ -0,0 +1,115 @@ +// +// KN550BT.h +// testShareCommunication +// +// Created by my on 8/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPAV10Device.h" +#import + + +/** + KN550BT device class + */ +@interface KN550BT : BPAV10Device + +@property (nonatomic, assign, readonly) BOOL isSupportDisplayConfig; + + +#pragma mark - Hypogenous query + +/** + * Synchronize time and judge if the device supports the function of up Air Measurement, arm Measurement, Angle Sensor, Angle Setting, HSD, Offline Memory, mutable Groups Upload, Self Upgrade. ‘True’ means yes or on, ‘False’ means no or off. + * @param function A block to return the function and states that the device supports. + * @param error A block to refer ‘error’ in ‘Establish measurement connection’ in KN550BT. + */ +-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error; + +/** + * Query battery remaining energy. + * @param energyValue A block to return the device battery remaining energy percentage, ‘80’ stands for 80%. + * @param error A block to return the error in ‘Establish measurement connection’ + */ +-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error; + + +/** + * Upload offline data total Count. + * @param totalCount item quantity of total data. + * @param error A block to return the error. + */ +-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error; + +/** + * Upload offline data. + * @param totalCount item quantity of total data + * @param progress upload completion ratio , from 0.0 to 1.0 or 0%~100%, 100% means upload completed. + * @param uploadDataArray offline data set, including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment. corresponding KEYs are time, sys, dia, heartRate, irregular. + * @param error error codes. + * Specification: + * 1. BPError0 = 0: Unable to take measurements due to arm/wrist movements. + * 2. BPError1: Failed to detect systolic pressure. + * 3. BPError2: Failed to detect diastolic pressure. + * 4. BPError3: Pneumatic system blocked or cuff is too tight during inflation. + * 5. BPError4: Pneumatic system leakage or cuff is too loose during inflation. + * 6. BPError5: Cuff pressure reached over 300mmHg. + * 7. BPError6: Cuff pressure reached over 15 mmHg for more than 160 seconds. + * 8. BPError7: Data retrieving error. + * 9. BPError8: Data retrieving error. + * 10. BPError9: Data retrieving error. + * 11. BPError10: Data retrieving error. + * 12. BPError11: Communication Error. + * 13. BPError12: Communication Error. + * 14. BPError13: Low battery. + * 15. BPError14: Device bluetooth set failed. + * 16. BPError15: Systolic exceeds 260mmHg or diastolic exceeds 199mmHg. + * 17. BPError16: Systolic below 60mmHg or diastolic below 40mmHg. + * 18. BPError17: Arm/wrist movement beyond range. + * 19. BPNormalError=30: device error, error message displayed automatically. + * 20. BPOverTimeError: Abnormal communication. + * 21. BPNoRespondError: Abnormal communication. + * 22. BPBeyondRangeError: device is out of communication range. + * 23. BPDidDisconnect: device is disconnected. + * 24. BPAskToStopMeasure: measurement has been stopped. + * 25. BPInputParameterError=400: Parameter input error. + */ +-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error; + +/** + * Set units for the Device + * @param UnitName The unit name string that KN550BT show result should use, must be @"mmHg" or @"kPa". + * @param setResult This block return means set success. + * @param error A block to return the error in set Unit communication. + */ +-(void)commandSetUnit:(NSString *)UnitName disposeSetReslut:(BlockSuccess)setResult errorBlock:(BlockError)error; + + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + + +/** + get status of device display + + @param displayStatusBlock feedback status + @param errorBlock A block to return the error + */ +-(void)commandGetStatusOfDisplay:(BlockDisplayStatus)displayStatusBlock error:(BlockError)errorBlock; + + +/** + set status of device display + + @param backLightOn turn on back light or not + @param clockOn show clock or not + @param successBlock This block return means set success + @param errorBlock A block to return the error + */ +-(void)commandSetStatusOfDisplayForBackLight:(BOOL)backLightOn andClock:(BOOL)clockOn resultSuccess:(BlockSuccess)successBlock error:(BlockError)errorBlock; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BTController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BTController.h new file mode 100644 index 0000000..bdc6f05 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/KN550BTController.h @@ -0,0 +1,32 @@ +// +// KN550BTController.h +// testShareCommunication +// +// Created by my on 8/10/13. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "BPController.h" + +/** + KN550BT controller class + */ +@interface KN550BTController : BPController{ + NSMutableArray *KN550BTDeviceArray; +} + +/** + * Initialize KN550BT controller class + */ ++(KN550BTController *)shareKN550BTController; + +/** + * Get all KN550BT instance,Access control class instance after receiving KN550BTConnectNoti, then use instance to call KN550BT related communication methods. + */ +-(NSArray *)getAllCurrentKN550BTInstace; + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ManageDeviceController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ManageDeviceController.h new file mode 100644 index 0000000..a6c9cc4 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ManageDeviceController.h @@ -0,0 +1,34 @@ +// +// ManageDeviceController.h +// iHealthDemoCode +// +// Created by daiqingquan on 16/7/3. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + +/** + ManageDeviceController + */ +@interface ManageDeviceController : NSObject + ++(ManageDeviceController *)commandGetInstance; + +/** + * Get All Connect iHealth device + */ + +- (NSArray *)commandGetAllConnectDeviceArray; + +/** + * Dicconnect iHealth device with bluretooth low energy + * @param uuidString iHealth device currentUUID, you can get it from device property. + */ + +-(void)commandDisconnectSelectDevice:(NSString *)uuidString; + +-(void)commandConnectReadDeviceIDPS:(NSString *)uuidString; + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13B.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13B.h new file mode 100644 index 0000000..e31b2ad --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13B.h @@ -0,0 +1,33 @@ +// +// NT13B.h +// iHealthSDKStatic +// +// Created by user on 2019/9/20. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import +#import "NT13BMacroFile.h" +NS_ASSUME_NONNULL_BEGIN + +@interface NT13B : NSObject + +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; + +/** + * Get Measure Data + * @param resultBlock result NSDictionary key: bodyFlag (1:Humanity 0:object)unit(1:NT13BTemperatureUnit_C 2:NT13BTemperatureUnit_F) + */ +-(void)commandStartMeasure:(DisposeMeasureBlock)resultBlock; + + +/** + * Disconnect connection + * @param disconnectBlock yes = success, no = fail. + */ +-(void)commandDisconnect:(DisposeDisconnectBlock)disconnectBlock; + +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BController.h new file mode 100644 index 0000000..5ccd4fd --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BController.h @@ -0,0 +1,28 @@ +// +// NT13BController.h +// iHealthSDKStatic +// +// Created by user on 2019/9/20. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NT13BController : NSObject + +/** + * Initialize NT13B controller class + */ ++(NT13BController *)shareIHNT13BController; + + +/** + * Access control class instance after receiving NT13BConnectNoti, then use instance to call NT13B related communication methods + */ +-(NSArray *)getAllCurrentNT13BInstace; + +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BHeader.h new file mode 100644 index 0000000..b765126 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BHeader.h @@ -0,0 +1,16 @@ +// +// NT13BHeader.h +// iHealthSDKStatic +// +// Created by user on 2019/9/20. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#ifndef NT13BHeader_h +#define NT13BHeader_h + +#import "NT13B.h" +#import "NT13BController.h" +#import "NT13BMacroFile.h" + +#endif /* NT13BHeader_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BMacroFile.h new file mode 100644 index 0000000..ce76451 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/NT13BMacroFile.h @@ -0,0 +1,34 @@ +// +// NT13BMacroFile.h +// iHealthSDKStatic +// +// Created by user on 2019/9/20. +// Copyright © 2019 ihealthSDK. All rights reserved. +// + +#ifndef NT13BMacroFile_h +#define NT13BMacroFile_h +#define NT13BDiscover @"NT13BDiscover" +#define NT13BConnectFailed @"NT13BConnectFailed" +#define NT13BConnectNoti @"NT13BConnectNoti" +#define NT13BDisConnectNoti @"NT13BDisConnectNoti" + + +/** + TemperatureUnit + */ +typedef NS_ENUM(NSInteger, NT13BTemperatureUnit) { + /// NotDefined + NT13BTemperatureUnit_NotDefined = 0, + /// Degrees Celsius + NT13BTemperatureUnit_C, + /// Fahrenheit + NT13BTemperatureUnit_F, +}; + +typedef void (^DisposeMeasureBlock)(NSDictionary *result); + +typedef void (^DisposeDisconnectBlock)(BOOL result); + + +#endif /* NT13BMacroFile_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1.h new file mode 100644 index 0000000..1b3c907 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1.h @@ -0,0 +1,82 @@ +// +// PO1.h +// testShareCommunication +// +// Created by daiqingquan on 13-11-29. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "POMacroFile.h" + + +/** + PO1 + */ +@interface PO1 : NSObject + +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *firmwareVersion; + + +/** + * Get device IDPS + * @param function A block to return the function and states that the device supports. + * { + MAC = 60A4232504ED; + accessoryName = "Pulse Oximeter"; + firmwareVersion = "1.0.0"; + hardwareVersion = "1.0.0"; + manufaturer = iHealth; + modelNumber = "PO1 11070"; + protocol = "com.jiuan.PO1"; + } + * @param errorBlock A block to refer ‘error’ in ‘Establish measurement connection’ in PO1. + */ +-(void)commandFunction:(DisposePO1DeviceFunctionBlock)function DisposeErrorBlock:(DisposePO1ErrorBlock)errorBlock; + +/** + * Query power status + * @param batteryBlock Battery,from 0~100 + * @param errorBlock Communication error codes + */ +-(void)commandPO1GetDeviceBattery:(DisposePO1BatteryBlock)batteryBlock withErrorBlock:(DisposePO1ErrorBlock)errorBlock; + + +/** +Measure data Notification + + PO1NotificationMeasureData + +You need to listen to this message to get real-time measurements + + The unit of PI is %. + +Content of measurement results: +{ + PI = "5.8"; + bpm = 90; + height = 4; + spo2 = 98; + wave = ( + 42, + 41, + 41, + 41, + 40 + ); +} + */ + + +/* + Disconnect current device + */ + +-(void)commandDisconnectDevice; + +@end + + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1Controller.h new file mode 100644 index 0000000..2fe88b6 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO1Controller.h @@ -0,0 +1,29 @@ +// +// PO1Controller.h +// testShareCommunication +// +// Created by daiqingquan on 13-11-29. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import + +/** + PO1Controller + */ +@interface PO1Controller : NSObject +/** + * Initialize PO1 controller class + */ ++(PO1Controller *)shareIHPO1Controller; + + +/** + * Access control class instance after receiving PO1ConnectNoti, then use instance to call PO1 related communication methods + */ +-(NSArray *)getAllCurrentPO1Instace; + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3.h new file mode 100644 index 0000000..5f4c70a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3.h @@ -0,0 +1,96 @@ +// +// PO3.h +// testShareCommunication +// +// Created by daiqingquan on 13-11-29. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import +#import "POMacroFile.h" + + +/** + PO3 + */ +@interface PO3 : NSObject + +@property (strong, nonatomic) NSString *currentUUID; +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *firmwareVersion; + + + +/** + * Restore Sync time + * @param syncTimeBlock Sync completed. Yes = Success, No = Fail. + * @param errorBlock Communication error codes + */ +-(void)commandPO3SyncTime:(DisposePO3SyncTimeBlock)syncTimeBlock withErrorBlock:(DisposePO3ErrorBlock)errorBlock; + + + + +/** + * Restore Real-time measurements + * @param startMeasure Start measurement, Return no for fail, return yes for success. + * @param measureData SpO2 values, including SpO2, pulse rate, pulse intensity. Corresponding keys are spo2, bpm, wave, and pi. + * @param finishMeasure Finish measurement. No for fail, yes for success. + * @param errorBlock Communication error codes + */ + +-(void)commandPO3StartMeasure:(DisposePO3StartMeasure)startMeasure withMeasureData:(DisposePO3MeasureData)measureData withFinishMeasure:(DisposePO3FinishMeasure)finishMeasure withErrorBlock:(DisposePO3ErrorBlock)errorBlock; + + + + +/** + * Restore Historical data + * @param offlineDataCount Number of historical offline data measurements. + * @param offlineData date, spo2, bpm, and wave. + * @param offlineWaveData Pulse intensity, corresponding key: wave + * @param finishUpload End transmission of data, yes for success, no for fail. + * @param errorBlock Communication error codes + */ +-(void)commandPO3OfflineDataCount:(DisposePO3OfflineDataCount)offlineDataCount withOfflineData:(DisposePO3OfflineData)offlineData withOfflineWaveData:(DisposePO3OfflineWaveData)offlineWaveData withFinishMeasure:(DisposePO3FinishUpload)finishUpload withErrorBlock:(DisposePO3ErrorBlock)errorBlock; + + + + +/** + * Query power status + * @param batteryBlock Battery,from 0~100 + * @param errorBlock Communication error codes + */ +-(void)commandPO3GetDeviceBattery:(DisposePO3BatteryBlock)batteryBlock withErrorBlock:(DisposePO3ErrorBlock)errorBlock; + + + +/** + * Disconnect connection + * @param disconnectBlock yes = success, no = fail. + * @param errorBlock Communication error codes + */ +-(void)commandPO3Disconnect:(DisposePO3DisconnectBlock)disconnectBlock withErrorBlock:(DisposePO3ErrorBlock)errorBlock; + +/** + * Only a specific version supports this feature, if the version does not support this feature, an error that does not support the feature will be returned + * @param spo2 spo2 + * @param bpm bpm + * @param height height + * @param disposePO3EndMeasureResult yes = success, no = fail. + * @param errorBlock Communication error codes + */ +-(void)commandPO3EndMeasureWithSpo2:(NSNumber*)spo2 bpm:(NSNumber*)bpm height:(NSNumber*)height disposePO3EndMeasureResult:(DisposePO3EndMeasure)disposePO3EndMeasureResult withErrorBlock:(DisposePO3ErrorBlock)errorBlock; + + +/** + * Turn Off Bluetooth(Only a specific version supports this feature, if the version does not support this feature, an error that does not support the feature will be returned) + * @param disconnectBlock yes = success, no = fail. + * @param errorBlock Communication error codes + */ +-(void)commandPO3TurnOffBT:(DisposePO3TurnOffBT)disposePO3TurnOffBTBlock withErrorBlock:(DisposePO3ErrorBlock)errorBlock; + +@end + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3Controller.h new file mode 100644 index 0000000..94e9b7b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PO3Controller.h @@ -0,0 +1,29 @@ +// +// PO3Controller.h +// testShareCommunication +// +// Created by daiqingquan on 13-11-29. +// Copyright (c) 2013年 my. All rights reserved. +// + +#import + +/** + PO3Controller + */ +@interface PO3Controller : NSObject +/** + * Initialize PO3 controller class + */ ++(PO3Controller *)shareIHPO3Controller; + + +/** + * Access control class instance after receiving PO3ConnectNoti, then use instance to call PO3 related communication methods + */ +-(NSArray *)getAllCurrentPO3Instace; + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POHeader.h new file mode 100644 index 0000000..8bd2300 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POHeader.h @@ -0,0 +1,20 @@ +// +// POHeader.h +// POSDK +// +// Created by 小翼 on 14-8-13. +// Copyright (c) 2014年 hejiasu. All rights reserved. +// + +#ifndef POSDK_POHeader_h +#define POSDK_POHeader_h + +#import "PO1.h" +#import "PO1Controller.h" +#import "PO3.h" +#import "PO3Controller.h" +#import "POMacroFile.h" +#import "HealthUser.h" + +#endif + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POMacroFile.h new file mode 100644 index 0000000..21d7f7f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/POMacroFile.h @@ -0,0 +1,142 @@ +// +// POMacroFile.h +// POSDK +// +// Created by 小翼 on 14-8-11. +// Copyright (c) 2014年 hejiasu. All rights reserved. +// + +#import "HealthUser.h" + +#ifndef POSDK_POMacroFile_h +#define POSDK_POMacroFile_h + +#define PO3DeviceID @"ID" +#define PO3SDKRightApi @"OpenApiSpO2" + +#define PO3Discover @"PO3Discover" +#define PO3ConnectFailed @"PO3ConnectFailed" +#define PO3ConnectNoti @"PO3ConnectNoti" +#define PO3DisConnectNoti @"PO3DisConnectNoti" + +#define PO1Discover @"PO1Discover" +#define PO1ConnectFailed @"PO1ConnectFailed" +#define PO1ConnectNoti @"PO1ConnectNoti" +#define PO1DisConnectNoti @"PO1DisConnectNoti" +/** + PO3 error code + */ +typedef NS_ENUM(NSUInteger, PO3ErrorID) { + /// Bluetooth Communication Error + PO3Error_OverTime = 0, + /// Send failed + PO3Error_ResetDeviceFaild, + /// Device is disconnected + PO3Error_Disconnect, + /// ParameterError + PO3Error_ParameterError = 400, + /// firmware version is not supported + PO3Error_FirmwareVersionIsNotSupported +}; + +typedef NS_ENUM(NSUInteger, PO1ErrorID) { + /// Bluetooth Communication Error + PO1Error_OverTime = 0, + /// Send failed + PO1Error_ResetDeviceFaild, + /// Device is disconnected + PO1Error_Disconnect, + /// ParameterError + PO1Error_ParameterError = 400, + /// firmware version is not supported + PO1Error_FirmwareVersionIsNotSupported +}; + + +/** + PO3ErrorID + */ +typedef void (^DisposePO3ErrorBlock)(PO3ErrorID errorID); +/** + sync time + */ +typedef void (^DisposePO3SyncTimeBlock)(BOOL resetSuc); +/** + start measure + */ +typedef void (^DisposePO3StartMeasure)(BOOL resetSuc); +/** + measure data + */ +typedef void (^DisposePO3MeasureData)(NSDictionary *measureDataDic); +/** + finish measure + */ +typedef void (^DisposePO3FinishMeasure)(BOOL finishData); + +/** + offline data count + */ +typedef void (^DisposePO3OfflineDataCount)(NSNumber* dataCount); +/** + offline data + */ +typedef void (^DisposePO3OfflineData)(NSDictionary *OfflineData); +/** + offline wave data + */ +typedef void (^DisposePO3OfflineWaveData)(NSDictionary *offlineWaveDataDic); +/** + finish upload + */ +typedef void (^DisposePO3FinishUpload)(BOOL resetSuc); +/** + reset device + */ +typedef void (^DisposePO3ResetDeviceBlock)(BOOL resetSuc); +/** + battery + */ +typedef void (^DisposePO3BatteryBlock)(NSNumber *battery); +/** + disconnect + */ +typedef void (^DisposePO3DisconnectBlock)(BOOL resetSuc); +/** + send data + */ +typedef void (^DisposeSendPO3DataBlock)(void); + +/** + end measure + */ +typedef void (^DisposePO3EndMeasure)(BOOL setSuc); + +/** + turn off bt + */ +typedef void (^DisposePO3TurnOffBT)(BOOL setSuc); + + +/** + PO1ErrorID + */ +typedef void (^DisposePO1ErrorBlock)(PO1ErrorID errorID); +/** + battery + */ +typedef void (^DisposePO1BatteryBlock)(NSNumber *battery); +/** + disconnect + */ +typedef void (^DisposePO1DisconnectBlock)(BOOL resetSuc); + +/** + set beep + */ +typedef void (^DisposePO1SetDeviceBeep)(BOOL setResult); + + +typedef void(^DisposePO1DeviceFunctionBlock)(NSDictionary *functionDict); + +#endif diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBT.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBT.h new file mode 100644 index 0000000..5364d89 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBT.h @@ -0,0 +1,167 @@ +// +// PT3SBT.h +// iHealthSDKStatic +// +// Created by user on 2020/9/7. +// Copyright © 2020 ihealthSDK. All rights reserved. +// + +#import +#import "PT3SBTMacroFile.h" +NS_ASSUME_NONNULL_BEGIN + +@interface PT3SBT : NSObject + +@property (strong, nonatomic) NSString *serialNumber; +@property (strong, nonatomic) NSString *currentUUID; + +/** + * Get device IDPS (After the PT3SBT device is successfully connected, the interface must be called to synchronize the device time. Otherwise, the offline data measurement time error will be caused) + * @param function A block to return the function and states that the device supports. + * { + MAC = D379D238F6B3; + accessoryName = PT; + firmwareVersion = "1.1.0"; + hardwareVersion = "1.0.0"; + manufaturer = iHealth; + modelNumber = PT3SBT; + protocol = "com.jiuan.PT3SBT"; + } + * @param disposeErrorBlock A block to refer ‘error’ in ‘Establish measurement connection’ in PT3SBT. + */ +-(void)commandFunction:(DisposePT3SBTDeviceFunctionBlock)function DisposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + +/** + *Get Battery + + * @param battery [Range:0~100]% + * @param disposeErrorBlock error code + */ +-(void)commandGetPT3SBTBattery:(DisposePT3SBTBatteryBlock)battery DiaposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + + +/** + * Set Unit + * @param unitState + * /// Degrees Celsius + PT3SBTTemperatureUnit_C=1, + /// Fahrenheit + PT3SBTTemperatureUnit_F, + * @param disposeSetUnitResult YES:success NO:fail + * @param disposeErrorBlock This block returns error codes,please refer to error codes list in PT3SBTMacroFile. + */ +-(void)commandPT3SBTSetUnit:(PT3SBTTemperatureUnit)unitState + DisposeSetUnitResult:(DisposePT3SBTSetUnit)disposeSetUnitResult + DisposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + +/** + * Get Unit + * @param disposeGetUnitResult PT3SBTTemperatureUnit + * @param disposeErrorBlock This block returns error codes,please refer to error codes list in PT3SBTMacroFile. + */ +-(void)commandPT3SBTGetUnit:(DisposePT3SBTGetUnit)disposeGetUnitResult + DisposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + +/** + * Get memory data count + * @param disposeMemoryCount count + * @param disposeErrorBlock This block returns error codes,please refer to error codes list in PT3SBTMacroFile. + */ +-(void)commandPT3SBTGetMemoryCount:(DisposePT3SBTGetMemoryCount)disposeMemoryCount + DisposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + +/** + Tranfer offline history records. + For PT3SBT, after calling this method, you should call commandDeleteMemorryData: method. Otherwise, the measure date may be wrong. + [ + { + Distance = 1783; + TS = 1600064558; + Tamb = 274; + Tbody = 3520; + Tex = 268; + Tobj = 273; + Vbat = 282; + } +] + @param disposeMemoryData The offline history records detail, result means result, date means the measurement time. + @param disposeErrorBlock This block returns error codes,please refer to error codes list in PT3SBTMacroFile. + */ +-(void)commandGetMemorryData:(DisposePT3SBTMemoryData)disposeMemoryData + DisposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + +/** + Delete offline history records + + @param disposeDeleteData YES or NO + @param disposeErrorBlock This block returns error codes,please refer to error codes list in PT3SBTMacroFile. + */ +-(void)commandDeleteMemorryData:(DisposePT3SBTDeleteData)disposeDeleteData + DisposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + +/** + Measure data Notification + + PT3SBTNotificationGetResult + + You need to listen to this message to get real-time measurements + + Content of measurement results: + { + Distance = 1663; + Tamb = 275; + Tbody = 3521; + Tex = 269; + Tobj = 274; + Vbat = 281; + } +*/ + +/** + PT3SBT unit change Notification + + PT3SBTNotificationDeviceUnitChange + + If the PT3SBT unit changes, you will receive this notification + + /// Degrees Celsius + PT3SBTTemperatureUnit_C=1, + /// Fahrenheit + PT3SBTTemperatureUnit_F, + + Content of PT3SBTNotificationDeviceUnitChange results: + { + unit=1; + } +*/ + +/** + Get Device Info + + @param disposeDeviceInfo device info + { + "Amb16_OBJ37_Temp" = 4209; + "Amb25_ByCb2" = 2459; + "Amb25_NtcR25" = 10028; + "Check_AmbTemp" = 2438; + "Corr16_AmbTemp" = 1807; + "Corr25_AmbTemp" = 2484; + "Corr_k1_Value" = 10336; + "Corr_k2_Value" = 9896; + "Distance_CorrValue" = 284; + Version = 1112; + VersionDate = 200904; + } + @param disposeErrorBlock This block returns error codes,please refer to error codes list in PT3SBTMacroFile. + */ +-(void)commandGetDeviceInfo:(DisposePT3SBTDeviceInfo)disposeDeviceInfo + DisposeErrorBlock:(DisposePT3SBTErrorBlock)disposeErrorBlock; + +/** + * Disconnect current device + */ +-(void)commandDisconnectDevice; + +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTController.h new file mode 100644 index 0000000..1d62f0b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTController.h @@ -0,0 +1,27 @@ +// +// PT3SBTController.h +// iHealthSDKStatic +// +// Created by user on 2020/9/7. +// Copyright © 2020 ihealthSDK. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PT3SBTController : NSObject + +/** + * Initialize PT3SBT controller class + */ ++(PT3SBTController *)shareIHPT3SBTController; + +/** + * Get all scale instance,use hsInstance to call PT3SBT related communication methods. + */ +-(NSArray *)getAllCurrentPT3SBTInstace; + +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTMacroFile.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTMacroFile.h new file mode 100644 index 0000000..014e7ae --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/PT3SBTMacroFile.h @@ -0,0 +1,92 @@ +// +// PT3SBTMacroFile.h +// iHealthSDKStatic +// +// Created by user on 2020/9/7. +// Copyright © 2020 ihealthSDK. All rights reserved. +// + +#ifndef PT3SBTMacroFile_h +#define PT3SBTMacroFile_h + + +/** + PT3SBT Device Error Code + */ +typedef NS_ENUM(int, PT3SBTDeviceError) { + PT3SBTDeviceError_Unknown = -1,// device send wrong error code + PT3SBTDeviceError_CommunicationTimeout = 0, + PT3SBTDeviceError_ReceivedCommandError, + PT3SBTDeviceError_InputParameterError, + PT3SBTDeviceError_MoreThanMaxNumbersOfUser, + PT3SBTDeviceError_WriteFlashError, + PT3SBTDeviceError_Disconnect, +}; + +typedef void(^DisposePT3SBTDeviceFunctionBlock)(NSDictionary *functionDict); + +typedef void(^DisposePT3SBTErrorBlock)(PT3SBTDeviceError error); + +/** + battery + + @param battary battery + */ +typedef void (^DisposePT3SBTBatteryBlock)(NSNumber *battary); + +/** + TemperatureUnit + */ +typedef NS_ENUM(NSInteger, PT3SBTTemperatureUnit) { + /// Degrees Celsius + PT3SBTTemperatureUnit_C=1, + /// Fahrenheit + PT3SBTTemperatureUnit_F, +}; +/** + set unit result + + @param setResult YES:success NO:fail + */ +typedef void (^DisposePT3SBTSetUnit)(BOOL setResult); +/** + get unit + + @param unit PT3SBTTemperatureUnit + */ +typedef void (^DisposePT3SBTGetUnit)(PT3SBTTemperatureUnit unit); + +/** + get memory data count + + @param count data + */ +typedef void (^DisposePT3SBTGetMemoryCount)(NSNumber* count); + +/** + get memory data + + @param memoryDataArray data + */ +typedef void (^DisposePT3SBTMemoryData)(NSMutableArray *memoryDataArray); + +/** + delete offline measurement data result block + + @param deleteResult YES:success NO:fail + */ +typedef void (^DisposePT3SBTDeleteData)(BOOL deleteResult); + +/** + get device info + + @param deviceInfoDic data + */ +typedef void (^DisposePT3SBTDeviceInfo)(NSDictionary *deviceInfoDic); + +#define PT3SBTDiscover @"PT3SBTDiscover" +#define PT3SBTConnectFailed @"PT3SBTConnectFailed" +#define PT3SBTConnectNoti @"PT3SBTConnectNoti" +#define PT3SBTDisConnectNoti @"PT3SBTDisConnectNoti" + +#endif /* PT3SBTMacroFile_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKFlowUpdateDevice.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKFlowUpdateDevice.h new file mode 100644 index 0000000..7459bd9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKFlowUpdateDevice.h @@ -0,0 +1,196 @@ +// +// SDKUpdateDevice.h +// iHealthDemoCode +// +// Created by daiqingquan on 16/7/27. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + +/** + UpdateDeviceError + */ +typedef NS_ENUM(NSUInteger, UpdateFlowDeviceError) { + /// UpdateNetworkError + UpdateFlowNetworkError=200, + /// Before starting the upgrade must go to query version first + UpdateFlowOrderError=201, + /// UpdateDeviceDisconnect + UpdateFlowDeviceDisconnect = 300, + /// UpdateDeviceEnd + UpdateFlowDeviceEnd = 301, + /// UpdateInputError + UpdateFlowInputError=302, + /// UpdateErrorUnKnow + UpdateFlowErrorUnKnow=303, + /// UpdateErrorLowPower + UpdateFlowErrorLowPower=304, + /// UpdateErrorMeasuring + UpdateFlowErrorMeasuring=305, + /// cannot update + UpdateFlowNOUpdateUpgrade=400, +}; + +/** + UpdateModelStatus + */ +typedef NS_ENUM(NSUInteger, UpdateFlowModelStatus) { + /// not busy + UpdateFlowModelStatusFree = 1, + /// busy + UpdateFlowModelStatusBusy +}; + +/** + UpdateDeviceType + */ +typedef NS_ENUM(NSUInteger, UpdateFlowDeviceType) { + /// HS2S + UpdateFlowDeviceType_HS2S, + /// BG1S + UpdateFlowDeviceType_BG1S, + /// PT3SBT + UpdateFlowDeviceType_PT3SBT, + /// BG5S + UpdateFlowDeviceType_BG5S, +}; + + +/** + DisposeUpdateVersionResult + + @param updateVersionDic information dictionary + */ +typedef void (^DisposeUpdateFlowVersionResult)(NSDictionary * updateVersionDic); + +/** + DisposeUpdateErrorBlock + + @param errorID UpdateDeviceError enum + */ +typedef void (^DisposeUpdateFlowErrorBlock)(UpdateFlowDeviceError errorID); + +/** + UpdateModuleState + + @param updateModuleState UpdateModelStatus enum + */ +typedef void (^UpdateFlowModuleState)(NSNumber*updateModuleState); + +/** + DisposeEndUpdateResult + + @param endUpdate <#endUpdate description#> + */ +typedef void (^DisposeEndUpdateFlowResult)(NSNumber* endUpdate); + +/** + DisposeDownloadFirmwareStart + */ +typedef void (^DisposeFlowDownloadFirmwareStart)(void); + +/** + DisposeDownloadFirmwareFinish + */ +typedef void (^DisposeFlowDownloadFirmwareFinish)(void); + +/** + DisposeUpdateProgress + + @param progress 0-100 + */ +typedef void (^DisposeUpdateFlowProgress)(NSNumber *progress); + +/** + DisposeUpdateResult + + @param updateResult <#updateResult description#> + */ +typedef void (^DisposeUpdateFlowResult)(NSNumber*updateResult); + +/** + TransferSuccess + + @param transferSuccess <#transferSuccess description#> + */ +typedef void (^TransferFlowSuccess)(NSNumber*transferSuccess); + +/** + DisposeDownloadProgress + + @param progress 0-100 + */ +typedef void (^DisposeFlowDownloadProgress)(NSNumber *progress); + + +/** + SDKUpdateDevice + */ +@interface SDKFlowUpdateDevice : NSObject + +@property(nonatomic,strong)NSString *currentDeviceUUID; + +/** + * Initialize SDKFlowUpdateDevice controller class + */ ++(SDKFlowUpdateDevice*)shareSDKUpdateDeviceInstance; + +/** + Get device Version and cloudDeviceVersion. + + @param uuidString device UUID + @param deviceType UpdateFlowDeviceType enum + @param updateVersionDic include:DeviceType、DeviceVersion、DeviceStatus(1:YES,0:NO)、CloudDeviceVersion、KeepUpdateFlag(flag,0:firstUpdate,1:go on update)、CloudUpdateServer(1:enforce update 0: optional update). + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + @note DeviceVerion means firmware version in Flash, may not match with the current running firmware version. + */ +-(void)commandGetUpdateVersionWithDeviceUUID:(NSString*)uuidString DeviceType:(UpdateFlowDeviceType)deviceType DisposeUpdateVersionResult:(DisposeUpdateFlowVersionResult)updateVersionDic DisposeErrorBlock:(DisposeUpdateFlowErrorBlock)disposeErrorBlock; +/** + * Get Update Module State. + * @param updateModuleState (0:free,1:uploading) + */ +-(void)commandGetUpdateModuleState:(UpdateFlowModuleState)updateModuleState; +/** + Stop Update. + @param uuidString device UUID + @param deviceType UpdateFlowDeviceType enum + @param endUpdateResult (bool 1:sucess,0:fail) + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandEndUpdateWithDeviceUUID:(NSString*)uuidString DeviceType:(UpdateFlowDeviceType)deviceType DisposeEndUpdateResult:(DisposeEndUpdateFlowResult)endUpdateResult DisposeErrorBlock:(DisposeUpdateFlowErrorBlock)disposeErrorBlock; + +/** + Update Device with local file + + @param uuidString device UUID + @param deviceType UpdateFlowDeviceType enum + @param infoFilePath path of info file + @param upadteFilePath path of update file + @param disposeUpdateProgress Update Device progress(0-100) + @param disposeUpdateResult Update Device result(bool 1:sucess,0:fail)Applicable to the protocol of 100. + @param transferSuccess TransferSuccess + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandStartUpdateWithDeviceUUID:(NSString*)uuidString DeviceType:(UpdateFlowDeviceType)deviceType InfoFilePath:(NSString*)infoFilePath UpadteFilePath:(NSString*)upadteFilePath DisposeUpdateProgress:(DisposeUpdateFlowProgress)disposeUpdateProgress DisposeUpdateResult:(DisposeUpdateFlowResult)disposeUpdateResult TransferSuccess:(TransferFlowSuccess)transferSuccess DisposeErrorBlock:(DisposeUpdateFlowErrorBlock)disposeErrorBlock; + +/** + Update Device showing download progress + + @param uuidString device UUID + @param deviceType UpdateFlowDeviceType enum + @param disposeDownloadFirmwareStart start update firmware from cloud + @param disposeDownloadFirmwareFinish finish update firmware from cloud + @param disposeDownloadProgress Update Device progress(0-100) + @param disposeUpdateProgress Download file progress(0-100) + @param disposeUpdateResult Update Device result(bool 1:sucess,0:fail). + @param transferSuccess TransferSuccess . + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandStartUpdateWithDeviceUUID:(NSString*)uuidString DeviceType:(UpdateFlowDeviceType)deviceType DownloadFirmwareStart:(DisposeFlowDownloadFirmwareStart)disposeDownloadFirmwareStart DisposeDownloadFirmwareFinish:(DisposeFlowDownloadFirmwareFinish)disposeDownloadFirmwareFinish DisposeDownloadProgress:(DisposeFlowDownloadProgress)disposeDownloadProgress DisposeUpdateProgress:(DisposeUpdateFlowProgress)disposeUpdateProgress DisposeUpdateResult:(DisposeUpdateFlowResult)disposeUpdateResult TransferSuccess:(TransferFlowSuccess)transferSuccess DisposeErrorBlock:(DisposeUpdateFlowErrorBlock)disposeErrorBlock; + + + +-(void)commandsetCloudModel:(NSNumber*)cloudModel; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKInfo.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKInfo.h new file mode 100644 index 0000000..dccb813 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKInfo.h @@ -0,0 +1,30 @@ +// +// SDKInfo.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/10/19. +// Copyright © 2017年 ihealthSDK. All rights reserved. +// + +#import + +/** + SDKInfo + */ +@interface SDKInfo : NSObject + +/** + Get sdk version + + @return sdk version + */ ++ (NSString *)version; + +/** + Get sdk uuid. It will change with every App's installation + + @return sdk uuid (128-bit) + */ ++ (NSString *)uuid; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKUpdateDevice.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKUpdateDevice.h new file mode 100644 index 0000000..be07c02 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/SDKUpdateDevice.h @@ -0,0 +1,235 @@ +// +// SDKUpdateDevice.h +// iHealthDemoCode +// +// Created by daiqingquan on 16/7/27. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + +/** + UpdateDeviceError + */ +typedef NS_ENUM(NSUInteger, UpdateDeviceError) { + /// UpdateNetworkError + UpdateNetworkError=200, + /// Before starting the upgrade must go to query version first + UpdateOrderError=201, + /// UpdateDeviceDisconnect + UpdateDeviceDisconnect = 300, + /// UpdateDeviceEnd + UpdateDeviceEnd = 301, + /// UpdateInputError + UpdateInputError=302, + /// cannot update + NOUpdateUpgrade=400, +}; + +/** + UpdateModelStatus + */ +typedef NS_ENUM(NSUInteger, UpdateModelStatus) { + /// not busy + UpdateModelStatusFree = 1, + /// busy + UpdateModelStatusBusy +}; + +/** + UpdateDeviceType + */ +typedef NS_ENUM(NSUInteger, UpdateDeviceType) { + /// AM3 + UpdateDeviceType_AM3 = 1, + /// AM3S + UpdateDeviceType_AM3S, + /// AM4 + UpdateDeviceType_AM4, + /// PO3 + UpdateDeviceType_PO3, + /// HS4 + UpdateDeviceType_HS4, + /// BP5S + UpdateDeviceType_BP5S, + /// ECG + UpdateDeviceType_ECG, + /// ABPM + UpdateDeviceType_ABPM, + /// HS2 + UpdateDeviceType_HS2, +}; + + +/** + DisposeUpdateVersionResult + + @param updateVersionDic information dictionary + */ +typedef void (^DisposeUpdateVersionResult)(NSDictionary * updateVersionDic); + +/** + DisposeUpdateErrorBlock + + @param errorID UpdateDeviceError enum + */ +typedef void (^DisposeUpdateErrorBlock)(UpdateDeviceError errorID); + +/** + UpdateModuleState + + @param updateModuleState UpdateModelStatus enum + */ +typedef void (^UpdateModuleState)(NSNumber*updateModuleState); + +/** + DisposeEndUpdateResult + + @param endUpdate <#endUpdate description#> + */ +typedef void (^DisposeEndUpdateResult)(NSNumber* endUpdate); + +/** + DisposeDownloadFirmwareStart + */ +typedef void (^DisposeDownloadFirmwareStart)(void); + +/** + DisposeDownloadFirmwareFinish + */ +typedef void (^DisposeDownloadFirmwareFinish)(void); + +/** + DisposeUpdateProgress + + @param progress 0-100 + */ +typedef void (^DisposeUpdateProgress)(NSNumber *progress); + +/** + DisposeUpdateResult + + @param updateResult <#updateResult description#> + */ +typedef void (^DisposeUpdateResult)(NSNumber*updateResult); + +/** + TransferSuccess + + @param transferSuccess <#transferSuccess description#> + */ +typedef void (^TransferSuccess)(NSNumber*transferSuccess); + +/** + DisposeDownloadProgress + + @param progress 0-100 + */ +typedef void (^DisposeDownloadProgress)(NSNumber *progress); + + +/** + SDKUpdateDevice + */ +@interface SDKUpdateDevice : NSObject + +@property(nonatomic,strong)NSString *currentDeviceUUID; + +/** + * Initialize SDKUpdateDevice controller class + */ ++(SDKUpdateDevice*)shareSDKUpdateDeviceInstance; + +/** + Get device Version and cloudDeviceVersion. + + @param uuidString device UUID + @param updateVersionDic include:DeviceType、DeviceVersion、DeviceStatus(1:YES,0:NO)、CloudDeviceVersion、KeepUpdateFlag(flag,0:firstUpdate,1:go on update)、CloudUpdateServer(1:enforce update 0: optional update)、UpdateProtocolVersion(100:Equipment upgrades returned directly after the success or failure 101:Upgrade is complete only on behalf of the firmware successfully transferred, reconnect the device after the upgrade success or failure). + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + @note DeviceVerion means firmware version in Flash, may not match with the current running firmware version. + */ +-(void)commandGetUpdateVersionWithDeviceUUID:(NSString*)uuidString DisposeUpdateVersionResult:(DisposeUpdateVersionResult)updateVersionDic DisposeErrorBlock:(DisposeUpdateErrorBlock)disposeErrorBlock; +/** + * Get Update Module State. + * @param updateModuleState (0:free,1:uploading) + */ +-(void)commandGetUpdateModuleState:(UpdateModuleState)updateModuleState; +/** + Stop Update. + @param uuidString device UUID + @param endUpdateResult (bool 1:sucess,0:fail) + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandEndUpdateWithDeviceUUID:(NSString*)uuidString DisposeEndUpdateResult:(DisposeEndUpdateResult)endUpdateResult DisposeErrorBlock:(DisposeUpdateErrorBlock)disposeErrorBlock; + +/** + Update Device. + @param uuidString device UUID + @param disposeDownloadFirmwareStart start update firmware from cloud. + @param disposeDownloadFirmwareFinish finish update firmware from cloud. + @param disposeUpdateProgress Update Device progress(0-100). + @param disposeUpdateResult Update Device result(bool 1:sucess,0:fail)Applicable to the protocol of 100. + @param transferSuccess TransferSuccess Applicable to the protocol of 101. + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ + +-(void)commandStartUpdateWithDeviceUUID:(NSString*)uuidString DownloadFirmwareStart:(DisposeDownloadFirmwareStart)disposeDownloadFirmwareStart DisposeDownloadFirmwareFinish:(DisposeDownloadFirmwareFinish)disposeDownloadFirmwareFinish DisposeUpdateProgress:(DisposeUpdateProgress)disposeUpdateProgress DisposeUpdateResult:(DisposeUpdateResult)disposeUpdateResult TransferSuccess:(TransferSuccess)transferSuccess DisposeErrorBlock:(DisposeUpdateErrorBlock)disposeErrorBlock; + +/** + Update Device with local file + + @param uuidString device UUID + @param deviceType UpdateDeviceType enum + @param infoFilePath path of info file + @param upadteFilePath path of update file + @param fileCRC info file CRC + @param disposeUpdateProgress Update Device progress(0-100) + @param disposeUpdateResult Update Device result(bool 1:sucess,0:fail)Applicable to the protocol of 100. + @param transferSuccess TransferSuccess Applicable to the protocol of 101. + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandStartUpdateWithDeviceUUID:(NSString*)uuidString DeviceType:(UpdateDeviceType)deviceType InfoFilePath:(NSString*)infoFilePath UpadteFilePath:(NSString*)upadteFilePath FileCRC:(NSNumber*)fileCRC DisposeUpdateProgress:(DisposeUpdateProgress)disposeUpdateProgress DisposeUpdateResult:(DisposeUpdateResult)disposeUpdateResult TransferSuccess:(TransferSuccess)transferSuccess DisposeErrorBlock:(DisposeUpdateErrorBlock)disposeErrorBlock; + +/** + Update Device showing download progress + + @param uuidString device UUID + @param disposeDownloadFirmwareStart start update firmware from cloud + @param disposeDownloadFirmwareFinish finish update firmware from cloud + @param disposeDownloadProgress Update Device progress(0-100) + @param disposeUpdateProgress Download file progress(0-100) + @param disposeUpdateResult Update Device result(bool 1:sucess,0:fail)Applicable to the protocol of 100. + @param transferSuccess TransferSuccess Applicable to the protocol of 101. + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandStartUpdateWithDeviceUUID:(NSString*)uuidString DownloadFirmwareStart:(DisposeDownloadFirmwareStart)disposeDownloadFirmwareStart DisposeDownloadFirmwareFinish:(DisposeDownloadFirmwareFinish)disposeDownloadFirmwareFinish DisposeDownloadProgress:(DisposeDownloadProgress)disposeDownloadProgress DisposeUpdateProgress:(DisposeUpdateProgress)disposeUpdateProgress DisposeUpdateResult:(DisposeUpdateResult)disposeUpdateResult TransferSuccess:(TransferSuccess)transferSuccess DisposeErrorBlock:(DisposeUpdateErrorBlock)disposeErrorBlock; + + +/** + Update Device showing download progress + + @param uuidString device UUID + @param disposeDownloadFirmwareStart start update firmware from cloud + @param disposeDownloadFirmwareFinish finish update firmware from cloud + @param disposeDownloadProgress Update Device progress(0-100) + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandStartDownloadWithDeviceUUID:(NSString*)uuidString DownloadFirmwareStart:(DisposeDownloadFirmwareStart)disposeDownloadFirmwareStart DisposeDownloadFirmwareFinish:(DisposeDownloadFirmwareFinish)disposeDownloadFirmwareFinish DisposeDownloadProgress:(DisposeDownloadProgress)disposeDownloadProgress DisposeErrorBlock:(DisposeUpdateErrorBlock)disposeErrorBlock; + + +/** + Update Device (You must download the firmware before calling this interface) + + @param uuidString device UUID + + @param disposeUpdateProgress Download file progress(0-100) + @param disposeUpdateResult Update Device result(bool 1:sucess,0:fail)Applicable to the protocol of 100. + @param transferSuccess TransferSuccess Applicable to the protocol of 101. + @param disposeErrorBlock Update error codes, see UpdateDeviceError error descriptions. + */ +-(void)commandStartUpdateWithDeviceUUID:(NSString*)uuidString DisposeUpdateProgress:(DisposeUpdateProgress)disposeUpdateProgress DisposeUpdateResult:(DisposeUpdateResult)disposeUpdateResult TransferSuccess:(TransferSuccess)transferSuccess DisposeErrorBlock:(DisposeUpdateErrorBlock)disposeErrorBlock; + + +-(void)commandsetCloudModel:(NSNumber*)cloudModel; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ScanDeviceController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ScanDeviceController.h new file mode 100644 index 0000000..a8700f9 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ScanDeviceController.h @@ -0,0 +1,47 @@ +// +// ScanDeviceController.h +// iHealthDemoCode +// +// Created by zhiwei jing on 1/24/16. +// Copyright © 2016 zhiwei jing. All rights reserved. +// + +#import +#import "HealthHeader.h" + +/** + ScanDeviceController + */ +@interface ScanDeviceController : NSObject + ++(ScanDeviceController *)commandGetInstance; + +/** + Start scan iHealth device with bluetooth low energy (scan maintains 12s, then auto stop scan) + + @param tempDeviceType HealthDeviceType enum + @note Before call the Api, should register discover Notification. such as :[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(devicePO3Discover:) name:PO3Discover object:nil]; + You will get two type result: + { + DeviceName = PO3; + ID = 60EC1538-46B7-3830-DDE2-0642AC9649F3; + } + or + { + DeviceName = PO3; + SerialNumber = 883314776729; + } + Then call [ConnectDeviceController :commandContectDeviceWithDeviceType:andSerialNub] to connect. + Attentation: Stop scan befroe connect device, otherwise connect may fail. + @return 0 + */ +-(int)commandScanDeviceType:(HealthDeviceType)tempDeviceType; + + +/** + * Stop scan iHealth device with bluretooth low energy + * @param tempDeviceType iHealth DeviceType + */ +-(int)commandStopScanDeviceType:(HealthDeviceType)tempDeviceType; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3.h new file mode 100644 index 0000000..ebcaef7 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3.h @@ -0,0 +1,104 @@ +// +// THV3.h +// iHealthDemoCode +// +// Created by Realank on 2016/12/23. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + +/** + THV3RcvDataType + */ +typedef NS_ENUM(NSUInteger, THV3RcvDataType) { + /// recieve real time temperature + THV3RcvDataRT, + /// recieve button event + THV3RcvDataButtonStatus, +}; + +/** + THV3RcvButtonType + */ +typedef NS_ENUM(NSUInteger, THV3RcvButtonType) { + /// placeholder + THV3RcvBtnNone, + /// power button + THV3RcvBtnPower, + /// audio button + THV3RcvBtnAudio, + /// M button + THV3RcvBtnMemory, + /// unit button + THV3RcvBtnCF + +}; + +/** + THV3Status + */ +typedef NS_ENUM(NSUInteger, THV3Status) { + /// not init + THV3StatusUnInit, + /// init time + THV3StatusInitTime, + /// init configuration + THV3StatusInitConfig, + /// working + THV3StatusWorking, +}; + +@interface THV3HistoryData : NSObject +@property (nonatomic, strong) NSDate* measureDate; +@property (nonatomic, assign) float temperature; +@property (nonatomic, assign) BOOL isHumanBody; +@end + +/** + ReceiveHistoryBlock + + @param dataArray THV3HistoryData object's array + */ +typedef void(^ReceiveHistoryBlock)(NSArray* dataArray); + +/** + ConfigResultBlock + + @param success YES:success NO:fail + */ +typedef void(^ConfigResultBlock)(BOOL success); + +@interface THV3 : NSObject + +@property (nonatomic, assign) THV3Status status;//status to flag whether device is ready +@property (strong, nonatomic) NSString *name; +@property (strong, nonatomic) NSString *currentUUID; +//‘serialNumber’ is for separating different device when multiple device have been connected. +@property (strong, nonatomic) NSString *serialNumber;//MAC +@property (strong, nonatomic) NSTimer *firmwareVersion; + +@property (nonatomic, assign) THV3RcvDataType rtDataType; +@property (nonatomic, strong) THV3HistoryData* rtTemperature;// for temperature +@property (nonatomic, assign) BOOL voltIsNormal;// for battary +@property (nonatomic, assign) THV3RcvButtonType buttonType;//for button use +@property (nonatomic, assign) BOOL isButtonOn;//for button use + +//status +@property (nonatomic, assign) NSInteger idleTimeInterval; +@property (nonatomic, assign) BOOL isUnitCelsius; +@property (nonatomic, assign) BOOL isTargetHuman; +@property (nonatomic, assign) BOOL isOfflineMode; + +- (void)readHistoryDataWithResultBlock:(ReceiveHistoryBlock)receivedDataBlock; + +- (void)configIdleTime:(NSUInteger)timeInterval withResultBlock:(ConfigResultBlock)resultBlock; +- (void)configTemperUnit:(BOOL)isCelsius withResultBlock:(ConfigResultBlock)resultBlock; +- (void)configMeasureTarget:(BOOL)isHumanBody withResultBlock:(ConfigResultBlock)resultBlock; +- (void)configOfflineMode:(BOOL)isOffline withResultBlock:(ConfigResultBlock)resultBlock; + +/** + Disconnect device. If this method is called immediately after "readHistoryDataWithResultBlock:" method, the history data will not be cleared automatically. + */ +- (void)commandDisconnectDevice; +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Controller.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Controller.h new file mode 100644 index 0000000..4f0090c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Controller.h @@ -0,0 +1,30 @@ +// +// THV3Controller.h +// iHealthDemoCode +// +// Created by Realank on 2016/12/23. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#import + +/** + THV3Controller + */ +@interface THV3Controller : NSObject + +@property (nonatomic,assign) NSInteger defaultIdelTime; +@property (nonatomic,assign) BOOL defaultUnitIsCelsius; +@property (nonatomic,assign) BOOL defaultTargetIsHumanBody; +@property (nonatomic,assign) BOOL defaultIsOffline; +/** + * Initialize THV3 controller class + */ ++(THV3Controller *)sharedController; + +/** + * Get all THV3 instance,Access control class instance after receiving THV3ConnectNoti then use instance to call THV3 related communication methods. + */ +-(NSArray *)allCurrentInstance; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Macro.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Macro.h new file mode 100644 index 0000000..492a62c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/THV3Macro.h @@ -0,0 +1,17 @@ +// +// THV3Macro.h +// iHealthDemoCode +// +// Created by Realank on 2016/12/26. +// Copyright © 2016年 zhiwei jing. All rights reserved. +// + +#ifndef THV3Macro_h +#define THV3Macro_h +#import "THV3Controller.h" +#define THV3Discover @"THV3Discover" +#define THV3ConnectFailed @"THV3ConnectFailed" +#define THV3ConnectNoti @"THV3ConnectNoti" +#define THV3DisConnectNoti @"THV3DisConnectNoti" +#define THV3_NEW_DATA @"THV3NewDataCome" +#endif /* THV3Macro_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28B.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28B.h new file mode 100644 index 0000000..0f49926 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28B.h @@ -0,0 +1,26 @@ +// +// TS28B.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/6/13. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import +@class CBPeripheral; + +@interface TS28B : NSObject + +@property (strong, nonatomic,readonly) CBPeripheral *peripheral; +@property (copy, nonatomic) NSString *systemID; +@property (copy, nonatomic) NSString *modelNumber; +@property (copy, nonatomic) NSString *serialNumber; +@property (copy, nonatomic) NSString *firmwareVersion; +@property (copy, nonatomic) NSString *hardwareVersion; +@property (copy, nonatomic) NSString *softwareVersion; +@property (copy, nonatomic) NSString *manufacturerName; +@property (copy, nonatomic) NSNumber *batteryValue; + ++ (instancetype)modelWithPeripheral:(CBPeripheral *)peripheral; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BController.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BController.h new file mode 100644 index 0000000..998a4c8 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BController.h @@ -0,0 +1,142 @@ +// +// TS28BController.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/6/13. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#import + +/** + TemperatureType + */ +typedef NS_ENUM(NSInteger, TemperatureType) { + /// NotDefined + TemperatureType_NotDefined = 0, + /// Armpit + TemperatureType_Armpit, + /// Body + TemperatureType_Body, + /// Ear + TemperatureType_Ear, + /// Finger + TemperatureType_Finger, + /// GastroIntestinalTract + TemperatureType_GastroIntestinalTract, + /// Mouth + TemperatureType_Mouth, + /// Rectum + TemperatureType_Rectum, + /// Toe + TemperatureType_Toe, + /// Tympanum + TemperatureType_Tympanum, +}; + +/** + TemperatureUnit + */ +typedef NS_ENUM(NSInteger, TemperatureUnit) { + /// NotDefined + TemperatureUnit_NotDefined = 0, + /// Degrees Celsius + TemperatureUnit_C, + /// Fahrenheit + TemperatureUnit_F, +}; + +@class TS28B; +@class TS28BController; + +/** + TS28BControllerDelegate + */ +@protocol TS28BControllerDelegate + +@optional + +/** + Discover device. + + @param controller who calls this method + @param device Discovered device + */ +- (void)controller:(TS28BController *)controller didDiscoverDevice:(TS28B *)device; + +/** + Connect device successfully.After connect and read Device Information, this method will be called. + + @param controller who calls this method + @param device Connected device + */ +- (void)controller:(TS28BController *)controller didConnectSuccessDevice:(TS28B *)device; + +/** + Connect device Fail. + + @param controller who calls this method + @param device The spectific device + */ +- (void)controller:(TS28BController *)controller didConnectFailDevice:(TS28B *)device; + +/** + Device is disconnected. If you turn off your phone’s Bluetooth, please listen for the notification: @"BTLEPowerOff" + + @param controller who calls this method + @param device The spectific device + */ +- (void)controller:(TS28BController *)controller didDisconnectDevice:(TS28B *)device; + +/** + Temperature is uploaded. + + @param controller who calls this method + @param device The spectific device + @param value temperature value. + @param unit temperature unit.TemperatureUnit type, reference: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.temperature_measurement.xml + @param date measure date + @param type measure location. TemperatureType type, reference: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.temperature_type.xml + */ +- (void)controller:(TS28BController *)controller device:(TS28B *)device didUpdateTemperature:(float)value temperatureUnit:(TemperatureUnit)unit measureDate:(NSDate *)date measureLocation:(TemperatureType)type; + +@end + +/** + TS28BController + */ +@interface TS28BController : NSObject + +@property (weak, nonatomic) id delegate; + +/** + Initialize TS28BController class + + @return TS28BController class object + */ ++ (TS28BController *)sharedController; +/** + Star to scan TS28B device + */ +- (void)startScan; + +/** + Stop scanning + */ +- (void)stopScan; + +/** + Connect with spectific device + + @param device TS28B object. You can get it from - (void)controller:(TS28BController *)controller didDiscoverDevice:(TS28B *)device; + */ +- (void)connectDevice:(TS28B *)device; + +/** + Connect with spectific device + + @param device TS28B object. You can get it from - (void)controller:(TS28BController *)controller didConnectSuccessDevice:(TS28B *)device; + */ +- (void)disconnectDevice:(TS28B *)device; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BHeader.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BHeader.h new file mode 100644 index 0000000..e5e54a7 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/TS28BHeader.h @@ -0,0 +1,15 @@ +// +// TS28BHeader.h +// iHealthSDKStatic +// +// Created by Lei Bao on 2017/6/13. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#ifndef TS28BHeader_h +#define TS28BHeader_h + +#import "TS28B.h" +#import "TS28BController.h" + +#endif /* TS28BHeader_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/iHealthHS6.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/iHealthHS6.h new file mode 100644 index 0000000..8e137d5 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/iHealthHS6.h @@ -0,0 +1,174 @@ +// +// iHealthHS6.h +// iHealthHS6 +// +// Created by daiqingquan on 15/11/25. +// Copyright © 2015年 daiqingquan. All rights reserved. +// + +#import +#import "HealthUser.h" +#import "HSMacroFile.h" + +/*HS6 error instruction*/ +/* + error code: + + 7:User verify error; + + 101,102,103,104:networkerror + + */ + + + +/** + HS6 + */ +@interface iHealthHS6 : NSObject + ++(iHealthHS6 *)shareIHHS6Controller; + + + +/** + Binding QR Device + When using the SDK for the first time, measuring method needs to be called to finish user verification. + Import parameter: + @param tempUser Properties included: clientID,clientSecret,userAccount,height,weight,isAthlete,birthday,sex. + clientID & clientSecret: the only identification for users of the SDK, requires registration from iHealth administrator, please email: daiqingquan@ihealthlabs.com.cn for more information. + @param tempDeviceID device Mac + Return parameters: + The measurement via SDK will be operated in the case of 1-4, and will be terminated if any of 5-8 occurs. The interface needs to be re-called after analyzing the return parameters. + Notice: when a new user registers via SDK, an ‘iHealth disclaimer’ will pop up automatically, and will require the user to agree in order to continue. SDK applications require an Internet connection; there is 10-day trial period if the SDK cannot connect to the internet, the SDK is fully functional during tryout period, but will be terminated without a working internet connection after 10 days. + @param result Action = 1;(1:bind sucess 2:full user bind faild 3,:ts error bind faild 4 other), + BineNum=10 + MAC + Position = 1;(user in weight number) + SetWifi=0 + Status = 1;(1:binding 2:unbind) + TS (time); + @param error error code + */ +-(void)cloudCommandUserBinedQRDeviceWithUser:(HealthUser *)tempUser deviceID:(NSString *)tempDeviceID binedResult:(BinedQRDeviceBlock)result binedError:(BinedQRDeviceErrorBlock)error; + + + +/** + unBind QR Device + +Import parameter: + @param tempUser Properties included:clientID,clientSecret,userAccount. + + @param tempDeviceID device Mac +Return parameters: + @param result Action = 1;(1:bind sucess 2:full user bind faild 3,:ts error bind faild 4 other), + MAC + Status = 2;(1:binding 2:unbind) + TS + @param error error code + */ +-(void)cloudCommandUserDisBinedQRDeviceForUser:(HealthUser *)tempUser withDeviceID:(NSString *)tempDeviceID disBinedResult:(DisBinedQRDeviceBlock)result disBinedError:(DisBinedQRDeviceErrorBlock)error; + +/** + * set HS6 wifi + * Import parameter: + * @param password - wifi password. + * Return parameters: + + * @param disposeHS6SuccessBlock - set sucess + + * @param disposeHS6FailBlock - set faild + + * @param disposeHS6EndBlock - end set + + * @param disposeHS6ErrorBlock - error code + * Error code definition: + * refer to “error” : HS6 error instruction. + */ + +/** + Set HS6 wifi +Import parameter: + @param password wifi password. + +Return parameters: + @param disposeHS6SuccessBlock set sucess + @param disposeHS6FailBlock set faild + @param disposeHS6EndBlock end set + @param disposeHS6ErrorBlock error code + */ +-(void)commandSetHS6WithPassWord:(NSString*)password disposeHS6SuccessBlock:(DisposeHS6SuccessBlock)disposeHS6SuccessBlock disposeHS6FailBlock:(DisposeHS6FailBlock)disposeHS6FailBlock disposeHS6EndBlock:(DisposeHS6EndBlock)disposeHS6EndBlock disposeHS6ErrorBlock:(DisposeHS6ErrorBlock)disposeHS6ErrorBlock; + + + +/** + Get open APItoken + Get AccessToken of HS6 user,and this method is a time consuming operation that cannot be calledin the main thread. + After get AccessToken, you can call openApi(http://developer.ihealthlabs.com) to pull data form iHealth cloud. + Import parameter: + @param tempUser Properties included: clientID,clientSecret,userAccount. + Return parameters: + @param getOpenAPIBlock (NSDictionary){@link iHealthDeviceHs6Callback#onNotify(String, String, String, String)} and its' + action is {@link #ACTION_HS6_GET_TOKEN}. + + eg. {APIName="OpenApiActivity OpenApiBG OpenApiBP OpenApiFood OpenApiSleep OpenApiSpO2 OpenApiSport + OpenApiUserInfo OpenApiWeight", + AccessToken="9fuIPl3Bo6lqJfbYjXFjuPnNwNqVfxjiUE7cMCZSjrX22RJSoKf28jtIhI0v86wjV5GJ21bc6LvMNbfYG0QsZ7cYuUSO0EkaiFTST*GcjZvvTKxfEOmhQTfLXTXYAOA + wCoXlEs0DRqJaHZU5JS30ssyLNlqADPV9dlvWZitQmIfXjF6CSZM2SuRCD*bbbrqtwBsn*sC24OEoQCRpDau6wQ", + ClassParamentKey = { + "client_id" = 2a8387e3f4e94407a3a767a72dfd52ea; + "client_para" = 99; + "client_secret" = fd5e845c47944a818bc511fb7edb0a77; + hash = d86bf92a851bf9211851d8e6827eea55; + username = "he@12.com"; + }; + "Expires":3672000, + *"RefreshToken":"9fuIPl3Bo6lqJfbYjXFjuPnNwNqVfxjiUE7cMCZSjrX22RJSoKf28jtIhI0v86wjV5GJ21bc6LvMNbfYG0QsZ2TcvTQNInn85XdPIJRIe-9zB-eaY5utBVKmtLjJdEEmBlx5le5mT6oF7WBwVkwx*CUpSsdgUcyE3mG3FJnSHlajogaUSUgvMgmgUaVEMYzv4pcbCUltGNAMqJt5wwvBZA", + * "RefreshTokenExpires":31536000, + * "UUID":"", + * "UserID":"51027f3e09a14a55917e687c628a0f13", + * "UserNameKey" + * "UserOpenID" + * "UserRegion":"https:\/\/api.ihealthlabs.com.cn:8443", + * "client_para":"random_str"} + @param errorBlock HS6 error instruction. + */ +-(void)commandHS6GetOpenAPITokenWithUser:(HealthUser *)tempUser withSuccessBlock:(DisposeHS6GetOpenAPISuccessBlock)getOpenAPIBlock withErrorBlock:(DisposeHS6GetOpenAPIErrorBlock)errorBlock; + + + + + + + +/** + sync Weight Unit +Import parameter: + @param tempUser Properties included:clientID,clientSecret,userAccount. + @param unit IHHS6SDKUnitWeight_kg,IHHS6SDKUnitWeight_lb,IHHS6SDKUnitWeight_oz +Return parameters: + @param unitBlock YES or NO + @param errorBlock error code + */ +-(void)commandHS6WithUser:(HealthUser *)tempUser withSyncWeightUnit:(IHHS6SDKUnitWeight)unit withSuccessBlock:(DisposeHS6SyncWeightUnitSuccessBlock)unitBlock withErrorBlock:(DisposeHS6SyncWeightUnitErrorBlock)errorBlock; + + +/** + DownloadHS6Data + + Import parameter: + @param tempUser Properties included: clientID,clientSecret,userAccount + clientID & clientSecret: the only identification for users of the SDK, requires registration from iHealth administrator, please email: sdk@ihealthlabs.com.cn for more information. + @param downloadTS :From 1970, the number of ms, download data download all data after this point in time. + @param PageSize :Number of downloads per data. + Return parameters: + @param getHS6Data AllHS6Data + + @param blockHS6LastTSFromCloud The last timestamp of the data download can be passed in at the next download, and all the data after the timestamp is downloaded. + + @param errorBlock error code 101,102,103,104:networkerror 400:input error 209/225:The user doesn't exist + */ +-(void)commandDownloadHS6Data:(HealthUser *)tempUser withDownloadTS:(long)downloadTS withPageSize:(long)PageSize withSuccessBlock:(BlockHS6DataFromCloud)getHS6Data blockHS6LastTSFromCloud:(BlockHS6LastTSFromCloud)blockHS6LastTSFromCloud withErrorBlock:(DisposeHS6ErrorBlock)errorBlock; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.5.a b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.5.a new file mode 100644 index 0000000..68201d0 Binary files /dev/null and b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/libiHealthSDK2.7.5.a differ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.h new file mode 100644 index 0000000..2702865 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.h @@ -0,0 +1,17 @@ +// +// ECGModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2018/1/5. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface ECGModule : RCTEventEmitter + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.m new file mode 100644 index 0000000..9cc04ea --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGModule.m @@ -0,0 +1,245 @@ +// +// ECGModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2018/1/5. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import "ECGModule.h" +#import "ECGHeader.h" +#import "ECGProfileModule.h" +#import "ManageDeviceController.h" + +#define EVENT_NOTIFY @"event_notify_ecg" + +@implementation ECGModule + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +#pragma mark +#pragma mark - constantsToExport +- (NSDictionary *)constantsToExport{ + return @{@"Event_Notify": EVENT_NOTIFY }; + +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Init +-(id)init{ + if (self=[super init]){ + } + return self; +} + +-(ECG3*)getECG3WithMac:(nonnull NSString*)mac{ + + ECG3Controller *controller = [ECG3Controller shareECG3Controller]; + NSArray *ecgDeviceArray = [controller getAllCurrentECG3Instace]; + + for(ECG3 *tempECG3 in ecgDeviceArray){ + if([mac isEqualToString:tempECG3.serialNumber]){ + return tempECG3; + } + } + + return nil; +} + +#pragma mark - +#pragma mark - Method + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*ecg3array= [[ECG3Controller shareECG3Controller] getAllCurrentECG3Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[ecg3array count]; i++) { + + ECG3 *ecg3=[ecg3array objectAtIndex:i]; + [deviceMacArray addObject:ecg3.serialNumber]; + } + + NSDictionary* deviceInfo = @{kACTION:kACTION_GET_ALL_CONNECTED_DEVICES,kDEVICES:deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getECG3WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getECG3WithMac:mac] commandECG3GetBatteryInfo:^(NSNumber *battery) { + + NSDictionary* deviceInfo = @{kACTION:kACTION_BATTERY_ECG,kBATTERY_ECG:battery,kMAC:mac,kType:@"ECG3"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(ECG3ErrorID errorID) { + [weakSelf commandReturnECGError:errorID MAC:mac]; + }]; + }else{ + + [self commandReturnECGError:ECG3Error_Disconnect MAC:mac]; + + } + + +} + +RCT_EXPORT_METHOD(sysTime:(nonnull NSString *)mac){ + + if ([self getECG3WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getECG3WithMac:mac] commandECG3SyncTime:^{ + + NSDictionary* deviceInfo = @{kACTION:kACTION_SYSTIME,kMAC:mac,kType:@"ECG3"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(ECG3ErrorID errorId) { + [weakSelf commandReturnECGError:errorId MAC:mac]; + }]; + + }else{ + [self commandReturnECGError:ECG3Error_Disconnect MAC:mac]; + } +} + +RCT_EXPORT_METHOD(stopMeasure:(nonnull NSString *)mac){ + + + if ([self getECG3WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getECG3WithMac:mac] commandECG3FinishMeasure:^{ + + + NSDictionary* deviceInfo = @{kACTION:kACTION_STOPMEASURE_ECG,kMAC:mac,kType:@"ECG3"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(ECG3ErrorID errorId) { + [weakSelf commandReturnECGError:errorId MAC:mac]; + }]; + + }else{ + + [self commandReturnECGError:ECG3Error_Disconnect MAC:mac]; + } + +} + + +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac){ + + if ([self getECG3WithMac:mac]!=nil) { + __weak typeof(self) weakSelf = self; + [[self getECG3WithMac:mac] commandECG3StartMeasure:^{ + + } withWaveData:^(NSArray *waveDataArray) { + + NSDictionary* deviceInfo = @{kACTION:kACTION_MEASURE_WAVEData,kMEASURE_WAVEData:waveDataArray,kMAC:mac,kType:@"ECG3"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withPulseResult:^(BOOL hasHR, NSUInteger HR) { + + NSDictionary* deviceInfo = @{kACTION:kACTION_MEASURE_ECGPulse,kMEASURE_ECGPulse:@(HR),kMAC:mac,kType:@"ECG3"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(ECG3ErrorID errorId) { + + if (errorId>= ECG3Error_ElectrodeLoss && errorId <= ECG3Error_ElectrodeLossTimeout) { + NSDictionary* deviceInfo = @{kACTION:kACTION_ELECTRODE_STATUS,kELECTRODE_STATUS:@(errorId),kMAC:mac,kType:@"ECG3"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } else { + [weakSelf commandReturnECGError:errorId MAC:mac]; + } + + }]; + + + }else{ + [self commandReturnECGError:ECG3Error_Disconnect MAC:mac]; + } + +} + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + if ([self getECG3WithMac:mac]!=nil) { + [[ManageDeviceController commandGetInstance] commandDisconnectSelectDevice:[self getECG3WithMac:mac].currentUUID]; + } +} + +-(void)commandReturnECGError:(ECG3ErrorID)errorID MAC:(NSString *)MAC{ + + + NSMutableDictionary*deviceInfo=[NSMutableDictionary dictionary]; + + [deviceInfo setValue:kACTION_ERROR_ECG forKey:kACTION]; + + NSString*errorDes=[NSString string]; + + switch (errorID) { + case ECG3Error_ElectrodeLoss: + errorDes=@"Electrode Loss"; + break; + case ECG3Error_ElectrodeLossRecovery: + errorDes=@"Electrode Loss Recovery"; + break; + case ECG3Error_ElectrodeLossTimeout: + errorDes=@"Electrode Loss Timeout"; + break; + case ECG3Error_SDCardCommunicationError: + errorDes=@"SDCard Communication Error"; + break; + case ECG3Error_SampleModuleError: + errorDes=@"Sample Module Error"; + break; + case ECG3Error_LowPower: + errorDes=@"Low Power"; + break; + case ECG3Error_DeviceMemoryFull: + errorDes=@"Device Memory Full"; + break; + case ECG3Error_Disconnect: + errorDes=@"Disconnect"; + break; + case ECG3Error_ParameterError: + errorDes=@"Parameter Error"; + break; + case ECG3Error_CommandTimeout: + errorDes=@"Command timeout"; + break; + default: + break; + } + + [deviceInfo setValue:[NSNumber numberWithInt:errorID] forKey:kERROR_NUM_ECG]; + + [deviceInfo setValue:errorDes forKey:kERROR_DESCRIPTION_ECG]; + + [deviceInfo setValue:@"ECG3" forKey:kType]; + if (MAC) { + [deviceInfo setValue:MAC forKey:kMAC]; + } + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.h new file mode 100644 index 0000000..1966a64 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.h @@ -0,0 +1,75 @@ +// +// ECGProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2018/1/5. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + +#pragma mark - General + +#define kACTION @"action" +#define kMAC @"mac" +#define kType @"type" + +#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" +#define kDEVICES @"devices" + +#pragma mark - ECG3 +// Error +#define kACTION_ERROR_ECG @"ACTION_ERROR_ECG" +#define kERROR_NUM_ECG @"ERROR_NUM_ECG" +#define kERROR_DESCRIPTION_ECG @"ERROR_DESCRIPTION_ECG" +// Battery +#define kACTION_BATTERY_ECG @"ACTION_BATTERY_ECG" +#define kBATTERY_ECG @"BATTERY_ECG" +// Sync time +#define kACTION_SYSTIME @"ACTION_SYSTIME" +// Start measure +#define kACTION_MEASURE_WAVEData @"ACTION_MEASURE_WAVEData" +#define kACTION_MEASURE_ECGPulse @"ACTION_MEASURE_ECGPulse" +#define kMEASURE_WAVEData @"MEASURE_WAVEData" +#define kMEASURE_ECGPulse @"MEASURE_ECGPulse" +// Stop measure +#define kACTION_STOPMEASURE_ECG @"ACTION_STOPMEASURE_ECG" +// Electrod status +#define kACTION_ELECTRODE_STATUS @"ACTION_ELECTRODE_STATUS" +#define kELECTRODE_STATUS @"ELECTRODE_STATUS" + +#pragma mark - ECG3USB +// Error +#define kACTION_ERROR_ECGUSB @"ACTION_ERROR_ECGUSB" +#define kERROR_DESCRIPTION_ECGUSB @"ERROR_DESCRIPTION_ECGUSB" +#define kERROR_NUM_ECGUSB @"ERROR_NUM_ECGUSB" +// Sync data +#define kACTION_SYNCDATA_ECGUSB @"ACTION_SYNCDATA_ECGUSB" +#define kACTION_STARTSYNCDATA_ECGUSB @"ACTION_STARTSYNCDATA_ECGUSB" +#define kACTION_SYNCDATAINFO_ECGUSB @"ACTION_SYNCDATAINFO_ECGUSB" +#define kDATAINFO @"DATAINFO" +#define kACTION_FINISHSYNCDATA_ECGUSB @"ACTION_FINISHSYNCDATA_ECGUSB" +#define kACTION_SYNCDATAPROGRESS_ECGUSB @"ACTION_SYNCDATAPROGRESS_ECGUSB" +#define kPROGRESS @"PROGRESS" +// Delete data +#define kACTION_DELETEDATA_ECGUSB @"ACTION_DELETEDATA_ECGUSB" +// SPLICE +#define kACTION_SPLICE @"ACTION_SPLICE" +#define kSPLICE_DATA @"SPLICE_DATA" +#define kSPLICE_ERROR_DESCRIPTION @"SPLICE_ERROR_DESCRIPTION" +// Get cache +#define kACTION_GET_CACHE @"ACTION_GET_CACHE" +#define kGET_CACHE_DATA @"GET_CACHE_DATA" +// Filter +#define kACTION_FILTER @"ACTION_FILTER" +#define kFILTER_DATA @"FILTER_DATA" +#define kFILTER_ERROR_DESCRIPTION @"FILTER_ERROR_DESCRIPTION" + +@interface ECGProfileModule : NSObject + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.m new file mode 100644 index 0000000..c7e8103 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGProfileModule.m @@ -0,0 +1,76 @@ +// +// ECGProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2018/1/5. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import "ECGProfileModule.h" + +@implementation ECGProfileModule + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + kACTION_GET_ALL_CONNECTED_DEVICES:kACTION_GET_ALL_CONNECTED_DEVICES, + + kACTION_ERROR_ECG:kACTION_ERROR_ECG, + kERROR_NUM_ECG:kERROR_NUM_ECG, + kERROR_DESCRIPTION_ECG:kERROR_DESCRIPTION_ECG, + + kACTION_BATTERY_ECG:kACTION_BATTERY_ECG, + kBATTERY_ECG:kBATTERY_ECG, + + kACTION_SYSTIME:kACTION_SYSTIME, + + kACTION_MEASURE_WAVEData:kACTION_MEASURE_WAVEData, + kACTION_MEASURE_ECGPulse:kACTION_MEASURE_ECGPulse, + kMEASURE_WAVEData:kMEASURE_WAVEData, + kMEASURE_ECGPulse:kMEASURE_ECGPulse, + + kACTION_STOPMEASURE_ECG:kACTION_STOPMEASURE_ECG, + + kACTION_ELECTRODE_STATUS:kACTION_ELECTRODE_STATUS, + kELECTRODE_STATUS:kELECTRODE_STATUS, + + kACTION_ERROR_ECGUSB:kACTION_ERROR_ECGUSB, + kERROR_NUM_ECGUSB:kERROR_NUM_ECGUSB, + kERROR_DESCRIPTION_ECGUSB:kERROR_DESCRIPTION_ECGUSB, + + kACTION_SYNCDATA_ECGUSB:kACTION_SYNCDATA_ECGUSB, + kACTION_STARTSYNCDATA_ECGUSB:kACTION_STARTSYNCDATA_ECGUSB, + kACTION_SYNCDATAINFO_ECGUSB:kACTION_SYNCDATAINFO_ECGUSB, + kDATAINFO:kDATAINFO, + kACTION_FINISHSYNCDATA_ECGUSB:kACTION_FINISHSYNCDATA_ECGUSB, + kACTION_SYNCDATAPROGRESS_ECGUSB:kACTION_SYNCDATAPROGRESS_ECGUSB, + kPROGRESS:kPROGRESS, + + kACTION_DELETEDATA_ECGUSB:kACTION_DELETEDATA_ECGUSB, + + kACTION_SPLICE:kACTION_SPLICE, + kSPLICE_DATA:kSPLICE_DATA, + kSPLICE_ERROR_DESCRIPTION:kSPLICE_ERROR_DESCRIPTION, + + kACTION_GET_CACHE:kACTION_GET_CACHE, + kGET_CACHE_DATA:kGET_CACHE_DATA, + + kACTION_FILTER:kACTION_FILTER, + kFILTER_DATA:kFILTER_DATA, + kFILTER_ERROR_DESCRIPTION:kFILTER_ERROR_DESCRIPTION, + + }; +}; + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.h new file mode 100644 index 0000000..370dedb --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.h @@ -0,0 +1,18 @@ +// +// ECGUSBModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2018/1/5. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface ECGUSBModule : RCTEventEmitter + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.m new file mode 100644 index 0000000..10db55d --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/ECGUSBModule.m @@ -0,0 +1,258 @@ +// +// ECGUSBModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2018/1/5. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import "ECGUSBModule.h" +#import "ECGHeader.h" +#import "ECGProfileModule.h" + +#define EVENT_NOTIFY @"event_notify_ecgusb" + +@implementation ECGUSBModule + + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +#pragma mark +#pragma mark - constantsToExport +- (NSDictionary *)constantsToExport +{ + return @{@"Event_Notify": EVENT_NOTIFY }; + +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Method + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + ECG3USB *ecg=[[ECG3USBController shareECG3USBController] getCurrentECG3USBInstace]; + + if (ecg!=nil) { + + NSDictionary* deviceInfo = @{kACTION:kACTION_GET_ALL_CONNECTED_DEVICES,kDEVICES:ecg.serialNumber}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } + + +} +RCT_EXPORT_METHOD(getIdps){ + + + NSMutableDictionary*deviceInfo=[NSMutableDictionary dictionary]; + + [deviceInfo setValue:@(404) forKey:kERROR_NUM_ECGUSB]; + + [deviceInfo setValue:@"This method iOS is not supported" forKey:kERROR_DESCRIPTION_ECGUSB]; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +} +/** + Sync Data + + @param startBlock means start + @param progressBlock 0-100 + @param resultBlock You can get filtered data from the NSDocumentDirectory path. + Abnormal Point Marked by User: OBData_FileName.txt + Filtered ECG Data: ECGAnalyseResult_FileName.txt + Lead Off Begin Point: ECGLeadOffBegin_FileName.txt + Lead Off End Point: ECGLeadOffEnd_FileName.txt + ECG HR Information EveryHour: ECGHREveryHour_FileName.txt + Abnormal Point Filtered by Algorithm: ECGOBbyFilter_FileName.txt + ECG HR Information for Day: ECGDetail_FileName.txt + @param errorBlock error + */ + +RCT_EXPORT_METHOD(syncData){ + + ECG3USB *device = [[ECG3USBController shareECG3USBController] getCurrentECG3USBInstace]; + if (device) { + __weak typeof(self) weakSelf = self; + [device syncDataWithStartBlock:^{ + + NSDictionary* deviceInfo = @{kACTION:kACTION_STARTSYNCDATA_ECGUSB,kMAC:device.serialNumber,kType:@"ECG3USB"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } progressBlock:^(NSUInteger progress) { + + NSDictionary* deviceInfo = @{kACTION:kACTION_SYNCDATAPROGRESS_ECGUSB,kPROGRESS:@(progress),kMAC:device.serialNumber,kType:@"ECG3USB"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } resultBlock:^(NSArray *resultArray, BOOL finish) { + + NSDictionary* deviceInfo = @{kACTION:kACTION_SYNCDATAINFO_ECGUSB,kDATAINFO:resultArray,kMAC:device.serialNumber,kType:@"ECG3USB"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } errorBlock:^(ECG3USBError errorID) { + + [weakSelf commandReturnECGUSBError:errorID MAC:device.serialNumber]; + }]; + + }else{ + [self commandReturnECGUSBError:ECG3USBError_DeviceDisconnect MAC:@""]; + } +} + +-(void)commandReturnECGUSBError:(ECG3USBError)errorID MAC:(NSString*)mac{ + + + NSMutableDictionary*deviceInfo=[NSMutableDictionary dictionary]; + [deviceInfo setValue:@"ECG3USB" forKey:kType]; + if (mac) { + [deviceInfo setValue:mac forKey:kMAC]; + } + [deviceInfo setValue:@"ACTION_ERROR_ECGUSB" forKey:kACTION]; + + NSString*errorDes=[NSString string]; + + switch (errorID) { + case ECG3USBError_QuerySDCardInfoTimeout: + errorDes=@"Query command timeout"; + break; + case ECG3USBError_SDCardInfoError: + errorDes=@"Received SD card info is wrong"; + break; + case ECG3USBError_SDCardError: + errorDes=@"Receive devce's error log: SD card error"; + break; + case ECG3USBError_iOSDeviceFlashNotEnough: + errorDes=@"There is not enough space for ECG's offline data"; + break; + case ECG3USBError_AFilePackageIndexNotMatch: + errorDes=@"Receive wrong data"; + break; + case ECG3USBError_BFilePackageIndexNotMatch: + errorDes=@"Receive wrong data"; + break; + case ECG3USBError_ReceiveDataTimeout: + errorDes=@"Receive data timeout"; + break; + case ECG3USBError_SaveFileError: + errorDes=@"Save file error"; + break; + case ECG3USBError_DeviceDisconnect: + errorDes=@"Device is disconnected"; + break; + case ECG3USBError_DeviceReplyFormatFail: + errorDes=@"Format fail"; + break; + case ECG3USBError_DeviceFormatTimeout: + errorDes=@"Format command timeout."; + break; + case ECG3USBError_CommandTimeout: + errorDes=@"Command timeout"; + break; + + default: + break; + } + + [deviceInfo setValue:@(errorID) forKey:kERROR_NUM_ECGUSB]; + + [deviceInfo setValue:errorDes forKey:kERROR_DESCRIPTION_ECGUSB]; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +} + +/** + Format SD Card + + @param successBlock Success + @param progressBlock 0-100 + @param failBlock Fail + */ + +RCT_EXPORT_METHOD(deleteData){ + + ECG3USB *device = [[ECG3USBController shareECG3USBController] getCurrentECG3USBInstace]; + if (device) { + __weak typeof(self) weakSelf = self; + [device formatSDCard:^{ + NSDictionary* deviceInfo = @{kACTION:kACTION_DELETEDATA_ECGUSB,kType:@"ECG3USB",kMAC:device.serialNumber}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } progressBlock:^(NSUInteger progress) { + + } errorBlock:^(ECG3USBError error) { + [weakSelf commandReturnECGUSBError:error MAC:device.serialNumber]; + }]; + + }else{ + [self commandReturnECGUSBError:ECG3USBError_DeviceDisconnect MAC:@""]; + } +} + +/** + Splice data + + @param fileNames An Array with FileName value from ECG3USBSyncResultBlock + @param success a block contains a dictionary with two keys: success(@{@"DataFileName":dataFileName,@"MarkFileName":markFileName}); + @param error a block contains error message + */ +RCT_EXPORT_METHOD(spliceData:(nonnull NSArray*)array){ + __weak typeof(self) weakSelf = self; + [ECG3USB spliceWithFileNames:array successBlock:^(NSDictionary *dic) { + NSDictionary* deviceInfo = @{kACTION:kACTION_SPLICE,kSPLICE_DATA:dic,kType:@"ECG3USB",kMAC:@""}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } errorBlock:^(ECG3USBError error, NSString *message) { + NSDictionary* deviceInfo = @{kACTION:kACTION_SPLICE,kSPLICE_ERROR_DESCRIPTION:message,kType:@"ECG3USB",kMAC:@""}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; +} + +RCT_EXPORT_METHOD(getCache){ + ECG3USB *device = [[ECG3USBController shareECG3USBController] getCurrentECG3USBInstace]; + if (device) { + __weak typeof(self) weakSelf = self; + [device getCacheDataWithBlock:^(NSArray *array) { + NSDictionary* deviceInfo = @{kACTION:kACTION_GET_CACHE,kGET_CACHE_DATA:array,kMAC:device.serialNumber,kType:@"ECG3USB"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + }]; + }else{ + [self commandReturnECGUSBError:ECG3USBError_DeviceDisconnect MAC:@""]; + } +} + +RCT_EXPORT_METHOD(getFilterDataByFileName:(nonnull NSString*)dataFileName markName:(nonnull NSString *)markFileName){ + ECG3USB *device = [[ECG3USBController shareECG3USBController] getCurrentECG3USBInstace]; + if (device) { + if (!dataFileName || !markFileName){ + NSString *message = @"input parameter cannot be null"; + NSDictionary* deviceInfo = @{kACTION:kACTION_SPLICE,kFILTER_ERROR_DESCRIPTION:message,kType:@"ECG3USB",kMAC:device.serialNumber}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } else { + __weak typeof(self) weakSelf = self; + [device getFilterDataWithDic:@{@"MarkFileName":markFileName,@"DataFileName":dataFileName} success:^(NSArray *resultArray, BOOL finish) { + NSDictionary* deviceInfo = @{kACTION:kACTION_FILTER,kFILTER_DATA:resultArray,kMAC:device.serialNumber,kType:@"ECG3USB"}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + } error:^(NSString *message) { + NSDictionary* deviceInfo = @{kACTION:kACTION_SPLICE,kFILTER_ERROR_DESCRIPTION:message,kType:@"ECG3USB",kMAC:device.serialNumber}; + [weakSelf sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + }]; + } + + + + }else{ + [self commandReturnECGUSBError:ECG3USBError_DeviceDisconnect MAC:@""]; + } +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.h new file mode 100644 index 0000000..42d9d21 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.h @@ -0,0 +1,19 @@ +// +// HS2Module.h +// ReactNativeIOSLibrary +// +// Created by jing on 2018/11/26. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface HS2Module : RCTEventEmitter + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.m new file mode 100644 index 0000000..376f2f3 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2Module.m @@ -0,0 +1,277 @@ +// +// HS2Module.m +// ReactNativeIOSLibrary +// +// Created by jing on 2018/11/26. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import "HS2Module.h" +#import "HSProfileModule.h" +#import "HSMacroFile.h" +#import "HS2Controller.h" +#import "HS2.h" +#import "iHealthDeviceManagerModule.h" +#import "ManageDeviceController.h" + +#define EVENT_NOTIFY @"HS2.MODULE.NOTIFY" + +@implementation HS2Module + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +#pragma mark-init + +-(NSDictionary *)constantsToExport{ + return @{ + @"Event_Notify" : EVENT_NOTIFY + }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +-(HS2 *)getHS2WithMac:(NSString *)mac{ + HS2Controller *controller = [HS2Controller shareIHHs2Controller]; + NSArray *hs2DeviceArray = [controller getAllCurrentHS2Instace]; + for (HS2 *tempHS2 in hs2DeviceArray) { + if ([mac isEqualToString:tempHS2.deviceID]){ + return tempHS2; + break; + } + } + return nil; +} + +#pragma mark +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*hs2array= [[HS2Controller shareIHHs2Controller] getAllCurrentHS2Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[hs2array count]; i++) { + + HS2*hs2=[hs2array objectAtIndex:i]; + + [deviceMacArray addObject:hs2.deviceID]; + + } + + NSDictionary* deviceInfo = @{@"action":@"action_get_all_connected_devices",@"devices":deviceMacArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString*)mac){ + if ([self getHS2WithMac:mac] != nil) { + + [[self getHS2WithMac:mac]commandGetHS2Battery:^(NSNumber *battary) { + + NSDictionary *deviceInfo = @{@"mac":mac,@"action":ACTION_BATTARY_HS,BATTERY_HS:battary}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } DiaposeErrorBlock:^(HS2DeviceError errorID) { + + }]; + + } +} +RCT_EXPORT_METHOD(getOfflineData:(nonnull NSString*)mac){ + if ([self getHS2WithMac:mac] != nil) { + + NSLog(@"上传离线数据"); + + [[self getHS2WithMac:mac]commandHS2TransferMemorryData:^(NSDictionary *startDataDictionary) { + + } DisposeProgress:^(NSNumber *progress) { + + } MemorryData:^(NSArray *historyDataArray) { + if(historyDataArray != nil){ + + if(historyDataArray.count){ + + NSMutableArray*dataArray=[NSMutableArray array]; + + for (int i=0; i + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface HS2SModule : RCTEventEmitter + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SModule.m new file mode 100644 index 0000000..c048ca8 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SModule.m @@ -0,0 +1,1052 @@ +// +// HS2Module.m +// ReactNativeIOSLibrary +// +// Created by jing on 2018/11/26. +// Copyright © 2018年 daiqingquan. All rights reserved. +// + +#import "HS2SModule.h" +#import "HS2SProfileModule.h" +#import "HSMacroFile.h" +#import "HS2SController.h" +#import "HS2S.h" +#import "iHealthDeviceManagerModule.h" +#import "ManageDeviceController.h" + +#define EVENT_NOTIFY @"HS2S.MODULE.NOTIFY" +#define kMAC_KEY @"mac" +#define kACTION_KEY @"action" +#define kTYPE_KEY @"type" + +#define kTYPE_HS2S @"HS2S" + +@implementation HS2SModule + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +#pragma mark-init + +-(NSDictionary *)constantsToExport{ + return @{ + @"Event_Notify" : EVENT_NOTIFY + }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +-(HS2S *)getHS2SWithMac:(NSString *)mac{ + HS2SController *controller = [HS2SController shareIHHS2SController]; + NSArray *hs2sDeviceArray = [controller getAllCurrentHS2SInstace]; + for (HS2S *tempHS2S in hs2sDeviceArray) { + if ([mac isEqualToString:tempHS2S.serialNumber]){ + return tempHS2S; + break; + } + } + return nil; +} + +#pragma mark +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*hs2sarray= [[HS2SController shareIHHS2SController] getAllCurrentHS2SInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[hs2sarray count]; i++) { + + HS2S*hs2s=[hs2sarray objectAtIndex:i]; + + [deviceMacArray addObject:hs2s.serialNumber]; + + } + + NSDictionary* deviceInfo = @{kACTION_KEY:ACTION_GET_ALL_CONNECTED_DEVICES,@"devices":deviceMacArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + +RCT_EXPORT_METHOD(getDeviceInfo:(nonnull NSString*)mac){ + if ([self getHS2SWithMac:mac] != nil) { + + [[self getHS2SWithMac:mac] commandGetHS2SDeviceInfo:^(NSDictionary *deviceInfo) { + + + NSDictionary* deviceInfoDic = @{kMAC_KEY:mac, + kTYPE_KEY:kTYPE_HS2S, + kACTION_KEY:ACTION_GET_HS2S_DEVICE_INFO, + HS2S_DEVICE_BATTERY:[deviceInfo valueForKey:@"Battary"], + HS2S_DEVICE_UNIT:[deviceInfo valueForKey:@"Unit"], + HS2S_DEVICE_USER_COUNT:[deviceInfo valueForKey:@"UserCount"] + }; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfoDic]; + + } DiaposeErrorBlock:^(HS2SDeviceError errorID) { + + [self sendHS2SErrorCode:errorID mac:mac]; + }]; + + } +} + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString*)mac){ + if ([self getHS2SWithMac:mac] != nil) { + + [[self getHS2SWithMac:mac]commandGetHS2SBattery:^(NSNumber *battary) { + + NSDictionary *deviceInfo = @{kMAC_KEY:mac,kTYPE_KEY:kTYPE_HS2S,kACTION_KEY:ACTION_BATTARY_HS,BATTERY_HS:battary}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + + } DiaposeErrorBlock:^(HS2SDeviceError errorID) { + + [self sendHS2SErrorCode:errorID mac:mac]; + + }]; + + } +} +RCT_EXPORT_METHOD(setUnit:(nonnull NSString*)mac :(nonnull NSNumber*)unit){ + + + if ([self getHS2SWithMac:mac] != nil) { + + HSUnit tempUnit; + + switch ([unit intValue]) { + case 1: + tempUnit=HSUnit_Kg; + break; + case 2: + tempUnit=HSUnit_LB; + break; + case 3: + tempUnit=HSUnit_ST; + break; + default: + tempUnit=HSUnit_Kg; + break; + } + + + __weak typeof(self) weakSelf = self; + + [[self getHS2SWithMac:mac] commandSetHS2SUnit:tempUnit result:^(BOOL result) { + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + + kMAC_KEY:mac, + + kTYPE_KEY:kTYPE_HS2S, + + kACTION_KEY:ACTION_SET_HS2S_UNIT, + + HS2S_SET_RESULT:[NSNumber numberWithBool:result] + + }]; + + } DisposeErrorBlock:^(HS2SDeviceError errorID) { + + [self sendHS2SErrorCode:errorID mac:mac]; + + }]; + + } + +} + +RCT_EXPORT_METHOD(getUserInfo:(nonnull NSString*)mac){ + + if ([self getHS2SWithMac:mac] != nil) { + + __weak typeof(self) weakSelf = self; + + [[self getHS2SWithMac:mac]commandGetHS2SUserInfo:^(NSDictionary *userInfo) { + + + NSMutableArray*tempUserArray=[userInfo valueForKey:@"UserInfo"]; + + NSMutableArray*resultArray=[NSMutableArray array]; + + + if (tempUserArray>0) { + + for (int i=0; i0) { + + for (int i=0; i0) { + + for (int i=0; i +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + +@interface HS2SProfileModule : NSObject + +#define ACTION_LIVEDATA_HS @"liveData_hs" +#define LIVEDATA_HS @"value" + +#define ACTION_ONLINE_RESULT_HS @"online_result_hs" +#define DATAID @"dataID" +#define WEIGHT_HS @"value" +#define FAT_HS @"" +#define WATER_HS @"" +#define MUSCLE_HS @"" +#define SKELETON_HS @"" +#define FATELEVEL_HS @"" +#define DCI_HS @"" + +#define ACTION_GET_ALL_CONNECTED_DEVICES @"action_get_all_connected_devices" +#define ACTION_HISTORICAL_DATA_HS @"historicaldata_hs" +#define HISTORDATA_HS @"historyData" +#define MEASUREMENT_DATE_HS @"date" +#define ACTION_HISTORICAL_DATA_COMPLETE_HS @"finishTranslate" +#define ACTION_NO_HISTORICALDATA @"noHistoryData" +#define BATTERY_HS @"battery_hs" +#define ACTION_BATTARY_HS @"action_get_battery_hs" +#define ACTION_ERROR_HS @"error_hs" +#define ERROR_NUM_HS @"error" +#define ERROR_ID_ILLEGAL_ARGUMENT @"400" +#define ERROR_ID_WIFI_DISABLED @"" +#define ERROR_DESCRIPTION_HS @"description" + + + +#define ACTION_GET_HS2S_DEVICE_INFO @"action_get_device_info" + +#define ACTION_SET_HS2S_UNIT @"action_set_unit" + +#define ACTION_GET_HS2S_USER_INFO @"action_get_user_info" + +#define ACTION_UPDATE_HS2S_USER_INFO @"action_create_or_update_user_info" + +#define ACTION_DELETE_HS2S_USER @"action_delete_user_info" + +#define ACTION_GET_HS2S_MEMORY_COUNT @"action_history_data_num" + +#define ACTION_GET_HS2S_MEMORY_DATA @"action_history_data" + +#define ACTION_DELETE_HS2S_MEMORY_DATA @"action_delete_history_data" + +#define ACTION_GET_HS2S_ANONYMOUS_MEMORY_COUNT @"action_anonymous_data_num" + +#define ACTION_GET_HS2S_ANONYMOUS_MEMORY_DATA @"action_anonymous_data" + +#define ACTION_DELETE_HS2S_ANONYMOUS_MEMORY_DATA @"action_delete_anonymous_history_data" + +#define ACTION_HS2S_ONLINE_DATA @"action_online_real_time_data" + +#define ACTION_HS2S_ONLINE_RESULT @"action_online_result" + +#define ACTION_HS2S_BODYFAT_RESULT @"action_body_fat_result" + +#define ACTION_ONLINE_WEIGHTANDBody_INFO @"online_weigthandbody_info" + +#define ACTION_BroadCastType_DEVICE @"broadCastType_device" + +#define ACTION_RESET_DEVICE @"reset_device" + +#define ACTION_MEASURE_FINISH @"measure_finish" + +#define HS2S_DEVICE_INFO @"device_info" + +#define HS2S_DEVICE_BATTERY @"battery" + +#define HS2S_DEVICE_UNIT @"unit_current" + +#define HS2S_DEVICE_USER_COUNT @"user_count" + +#define HS2S_USER_INFO_ARRAY @"user_info_array" + +#define HS2S_USER_INFO_COUNT @"user_info_count" + +#define HS2S_BODYBUILDING @"body_building" + +#define HS2S_IMPEDANCE @"impedance" + +#define HS2S_HEIGHT @"height" + +#define HS2S_AGE @"age" + +#define HS2S_GENDER @"gender" + +#define HS2S_WEIGTH @"weight" + +#define HS2S_CREATE_TIME @"create_time" + +#define HS2S_INSTRUCTION_TYPE @"instruction_type" + +#define HS2S_USER_ID @"user_id" + +#define MEMORY_COUNT @"history_data_count" + +#define MEMORY_DATA @"history_data" + +#define HS2S_DATA_BODY_FAT_RESULT @"data_body_fat_result" + +#define HS2S_SET_RESULT @"result" + +#define ACTION_HS2S_MEASURE_FINISH @"action_measure_finish_at_critical" + +#define ACTION_HS2S_RESET_DEVICE @"action_restore_fatory_settings" + +#define HS2S_FAT_WEIGHT @"fat_weight" + +#define HS2S_FAT_CONTROL @"fat_control" + +#define HS2S_WEIGHT_CONTROL @"weight_control" + +#define HS2S_STANDARD_WEIGHT @"standard_weight" + +#define HS2S_SKELETAL_MUSCLE_MASS @"skeletal_muscle_mass" + +#define HS2S_BODY_WATER_RATE @"body_water_rate" + +#define HS2S_MUSCLE_MASS @"muscle_mass" + +#define HS2S_MUSCLE_CONTROL @"muscle_control" + +#define HS2S_PHYSICAL_AGE @"physical_age" + +#define HS2S_VISCERAL_FAT_GRADE @"visceral_fat_grade" + +#define HS2S_PROTEIN_RATE @"protein_rate" + +#define HS2S_BONE_SALT_CONTENT @"bone_salt_content" + +#define HS2S_BODY_FIT_PERCENTAGE @"body_fit_percentage" + +#define HS2S_MEASURE_TIME @"measure_time" + + +#define ACTION_HS2S_LightUp_DEVICE @"action_lightup_settings" + +#define HS2S_DEVICE_STATUS @"device_status" + +#define ACTION_HS2S_MEASURE_HEARTRATE_DEVICE_STATUS @"action_measure_heartrate_device_status" + +#define ACTION_HS2S_MEASURE_HEARTRATE @"action_measure_heartrate" + +#define HS2S_MEASURE_HEARTRATE_RESULT @"measure_heartrate_result" + + +#define ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS @"action_exit_measure_heartrate_status" + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SProfileModule.m new file mode 100644 index 0000000..f906a83 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS2SProfileModule.m @@ -0,0 +1,167 @@ +// +// HSProfileModule.m +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/2. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "HS2SProfileModule.h" + +@implementation HS2SProfileModule + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport +@synthesize bridge = _bridge; + +-(NSDictionary *)constantsToExport{ + return @{ + @"ACTION_LIVEDATA_HS" : ACTION_LIVEDATA_HS, + @"LIVEDATA_HS" : LIVEDATA_HS, + + @"ACTION_ONLINE_RESULT_HS" : ACTION_ONLINE_RESULT_HS, + @"DATAID" : DATAID, + @"WEIGHT_HS" : WEIGHT_HS, + @"FAT_HS" : FAT_HS, + @"WATER_HS" : WATER_HS, + @"MUSCLE_HS" : MUSCLE_HS, + @"SKELETON_HS" : SKELETON_HS, + @"FATELEVEL_HS" : FATELEVEL_HS, + @"DCI_HS" : DCI_HS, + + + @"ACTION_HISTORICAL_DATA_HS" : ACTION_HISTORICAL_DATA_HS, + @"HISTORDATA_HS" :HISTORDATA_HS, + @"MEASUREMENT_DATE_HS" : MEASUREMENT_DATE_HS, + @"ACTION_HISTORICAL_DATA_COMPLETE_HS" :ACTION_HISTORICAL_DATA_COMPLETE_HS, + @"ACTION_NO_HISTORICALDATA" : ACTION_NO_HISTORICALDATA, + + @"ACTION_ERROR_HS" : ACTION_ERROR_HS, + @"ERROR_NUM_HS" : ERROR_NUM_HS, + @"ERROR_ID_ILLEGAL_ARGUMENT" : ERROR_ID_ILLEGAL_ARGUMENT, + @"ERROR_ID_WIFI_DISABLED" : ERROR_ID_WIFI_DISABLED, + @"ERROR_DESCRIPTION_HS" : ERROR_DESCRIPTION_HS, + + @"ACTION_GET_ALL_CONNECTED_DEVICES":ACTION_GET_ALL_CONNECTED_DEVICES, + + @"ACTION_BATTERY_HS":ACTION_BATTARY_HS, + @"BATTERY_HS":BATTERY_HS, + + @"ACTION_GET_HS2S_DEVICE_INFO":ACTION_GET_HS2S_DEVICE_INFO, + + @"ACTION_SET_HS2S_UNIT":ACTION_SET_HS2S_UNIT, + + @"HS2S_DEVICE_INFO":HS2S_DEVICE_INFO, + + @"HS2S_SET_RESULT":HS2S_SET_RESULT, + + @"ACTION_GET_HS2S_USER_INFO":ACTION_GET_HS2S_USER_INFO, + + @"HS2S_USER_INFO_ARRAY":HS2S_USER_INFO_ARRAY, + + @"HS2S_USER_INFO_COUNT":HS2S_USER_INFO_COUNT, + + @"ACTION_UPDATE_HS2S_USER_INFO":ACTION_UPDATE_HS2S_USER_INFO, + + @"ACTION_DELETE_HS2S_USER":ACTION_DELETE_HS2S_USER, + + @"ACTION_GET_HS2S_MEMORY_COUNT":ACTION_GET_HS2S_MEMORY_COUNT, + + @"MEMORY_COUNT":MEMORY_COUNT, + + @"ACTION_GET_HS2S_MEMORY_DATA":ACTION_GET_HS2S_MEMORY_DATA, + + @"MEMORY_DATA":MEMORY_DATA, + + @"ACTION_GET_HS2S_ANONYMOUS_MEMORY_COUNT":ACTION_GET_HS2S_ANONYMOUS_MEMORY_COUNT, + + @"ACTION_GET_HS2S_ANONYMOUS_MEMORY_DATA":ACTION_GET_HS2S_ANONYMOUS_MEMORY_DATA, + + @"ACTION_DELETE_HS2S_ANONYMOUS_MEMORY_DATA":ACTION_DELETE_HS2S_ANONYMOUS_MEMORY_DATA, + + @"ACTION_ONLINE_WEIGHTANDBody_INFO":ACTION_ONLINE_WEIGHTANDBody_INFO, + + @"ACTION_MEASURE_FINISH":ACTION_MEASURE_FINISH, + + @"ACTION_RESET_DEVICE":ACTION_RESET_DEVICE, + + @"ACTION_BroadCastType_DEVICE":ACTION_BroadCastType_DEVICE, + + @"HS2S_DEVICE_BATTERY":HS2S_DEVICE_BATTERY, + + @"HS2S_DEVICE_UNIT":HS2S_DEVICE_UNIT, + + @"HS2S_DEVICE_USER_COUNT":HS2S_DEVICE_USER_COUNT, + + @"HS2S_BODYBUILDING":HS2S_BODYBUILDING, + + @"HS2S_IMPEDANCE":HS2S_IMPEDANCE, + + @"HS2S_HEIGHT":HS2S_HEIGHT, + + @"HS2S_AGE":HS2S_AGE, + + @"HS2S_GENDER":HS2S_GENDER, + + @"HS2S_WEIGTH":HS2S_WEIGTH, + + @"HS2S_CREATE_TIME":HS2S_CREATE_TIME, + + @"HS2S_USER_ID":HS2S_USER_ID, + + @"HS2S_INSTRUCTION_TYPE":HS2S_INSTRUCTION_TYPE, + + @"HS2S_DATA_BODY_FAT_RESULT":HS2S_DATA_BODY_FAT_RESULT, + + @"ACTION_HS2S_ONLINE_DATA":ACTION_HS2S_ONLINE_DATA, + + @"ACTION_HS2S_ONLINE_RESULT":ACTION_HS2S_ONLINE_RESULT, + + @"ACTION_HS2S_BODYFAT_RESULT":ACTION_HS2S_BODYFAT_RESULT, + + @"ACTION_HS2S_MEASURE_FINISH":ACTION_HS2S_MEASURE_FINISH, + + @"ACTION_HS2S_RESET_DEVICE":ACTION_HS2S_RESET_DEVICE, + + @"HS2S_FAT_WEIGHT":HS2S_FAT_WEIGHT, + + @"HS2S_FAT_CONTROL":HS2S_FAT_CONTROL, + + @"HS2S_WEIGHT_CONTROL":HS2S_WEIGHT_CONTROL, + + @"HS2S_WEIGHT_CONTROL":HS2S_WEIGHT_CONTROL, + + @"HS2S_STANDARD_WEIGHT":HS2S_STANDARD_WEIGHT, + + @"HS2S_SKELETAL_MUSCLE_MASS":HS2S_SKELETAL_MUSCLE_MASS, + + @"HS2S_BODY_WATER_RATE":HS2S_BODY_WATER_RATE, + + @"HS2S_MUSCLE_MASS":HS2S_MUSCLE_MASS, + + @"HS2S_MUSCLE_CONTROL":HS2S_MUSCLE_CONTROL, + + @"HS2S_PHYSICAL_AGE":HS2S_PHYSICAL_AGE, + + @"HS2S_VISCERAL_FAT_GRADE":HS2S_VISCERAL_FAT_GRADE, + + @"HS2S_PROTEIN_RATE":HS2S_PROTEIN_RATE, + + @"HS2S_BONE_SALT_CONTENT":HS2S_BONE_SALT_CONTENT, + + @"HS2S_BODY_FIT_PERCENTAGE":HS2S_BODY_FIT_PERCENTAGE, + + @"HS2S_MEASURE_TIME":HS2S_MEASURE_TIME, + + }; + +} + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.h new file mode 100644 index 0000000..7f4b43e --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.h @@ -0,0 +1,20 @@ +// +// HS4SModule.h +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/2. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + + +@interface HS4SModule : RCTEventEmitter + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.m new file mode 100644 index 0000000..8538c6f --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS4SModule.m @@ -0,0 +1,257 @@ +// +// HS4SModule.m +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/2. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "HS4SModule.h" +#import "HSProfileModule.h" +#import "HSMacroFile.h" +#import "HS4Controller.h" +#import "HS4.h" +#import "iHealthDeviceManagerModule.h" +#import "ManageDeviceController.h" + + +#define EVENT_NOTIFY @"HS4.MODULE.NOTIFY" + +@implementation HS4SModule + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +#pragma mark-init + +-(NSDictionary *)constantsToExport{ + return @{ + @"Event_Notify" : EVENT_NOTIFY + }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +-(HS4 *)getHS4WithMac:(NSString *)mac{ + HS4Controller *controller = [HS4Controller shareIHHs4Controller]; + NSArray *hs4DeviceArray = [controller getAllCurrentHS4Instace]; + for (HS4 *tempHS4 in hs4DeviceArray) { + if ([mac isEqualToString:tempHS4.deviceID]){ + return tempHS4; + break; + } + } + return nil; +} + +#pragma mark +#pragma mark - Notification +#pragma mark - HS4 +-(void)DeviceConnectForHS4S:(NSNotification *)notify{ + HS4Controller *controller = [HS4Controller shareIHHs4Controller]; + NSArray *hs4DeviceArray = [controller getAllCurrentHS4Instace]; + + HS4 *hs4Instance = [hs4DeviceArray objectAtIndex:0]; +} + +#pragma mark +#pragma mark - Method + + +#pragma mark-获取连接设备 +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*hs4array= [[HS4Controller shareIHHs4Controller] getAllCurrentHS4Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[hs4array count]; i++) { + + HS4*hs4=[hs4array objectAtIndex:i]; + + [deviceMacArray addObject:hs4.deviceID]; + + } + + NSDictionary* deviceInfo = @{@"action":@"action_get_all_connected_devices",@"devices":deviceMacArray}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + +RCT_EXPORT_METHOD(getOfflineData:(nonnull NSString*)mac){ + if ([self getHS4WithMac:mac] != nil) { + + NSLog(@"上传离线数据"); + [[self getHS4WithMac:mac]commandTransferMemorryData:^(NSDictionary *startDataDictionary) { + + + } DisposeProgress:^(NSNumber *progress) { + + } MemorryData:^(NSArray *historyDataArray) { + + if(historyDataArray != nil){ + + if(historyDataArray.count){ + + NSMutableArray*dataArray=[NSMutableArray array]; + + for (int i=0; i + + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + + + + +@interface HS6Module : RCTEventEmitter + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6Module.m new file mode 100644 index 0000000..401697b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6Module.m @@ -0,0 +1,339 @@ +// +// HS6Module.m +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/12. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "HS6Module.h" +#import "HS6ProfileModule.h" +#import "HSMacroFile.h" +#import "iHealthHS6.h" +#import "HealthUser.h" +#import "iHealthDeviceManagerModule.h" + +#define EVENT_NOTIFY @"HS6.MODULE.NOTIFY" + +#define HS6_CLIENT_ID @"e33d489fdd6d4961a33c4065f7cedb30" + +#define HS6_CLIENT_SECRET @"17075697306e4930b87beffc58ceb2a4" + +@implementation HS6Module{ + + NSString*userAccount; + +} + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +#pragma mark-init + +-(NSDictionary *)constantsToExport{ + return @{ + @"Event_Notify" : EVENT_NOTIFY + }; +} ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +- (void)sendErrorWithCode:(NSInteger)errorCode{ + [self sendEventWithAction:@"ACTION_ERROR_HS" keyString:@"value" valueString:@(errorCode)]; +} + +- (void)sendEventWithAction:(NSString*)actionName keyString:(NSString*)key valueString:(id)value{ + [self sendEventWithName:@"HS6.MODULE.NOTIFY" body:@{@"action":actionName,key:value}]; +} + +#pragma mark +#pragma mark - Method + RCT_EXPORT_METHOD(init:(nonnull NSString*)userName){ + + [iHealthHS6 shareIHHS6Controller]; + + userAccount=[userName copy]; + + NSLog(@"Set User Succeed!"); +} + +/** + * set HS6 wifi + * Import parameter: + * @param password - wifi password. + * Return parameters: + + * @param disposeHS6SuccessBlock - set sucess + + * @param disposeHS6FailBlock - set faild + + * @param disposeHS6EndBlock - end set + + * @param disposeHS6ErrorBlock - error code + * Error code definition: + * refer to “error” : HS6 error instruction. + */ + +/** + Set HS6 wifi + Import parameter: + @param password wifi password. + + Return parameters: + @param disposeHS6SuccessBlock set sucess + @param disposeHS6FailBlock set faild + @param disposeHS6EndBlock end set + @param disposeHS6ErrorBlock error code + */ + +RCT_EXPORT_METHOD(setWifi:(nonnull NSString*)ssid :(nonnull NSString*)password){ + + + iHealthHS6 *hs6Controller = [iHealthHS6 shareIHHS6Controller]; + if (hs6Controller != nil) { + [hs6Controller commandSetHS6WithPassWord:password disposeHS6SuccessBlock:^(NSDictionary *deviceInfo) { + + NSMutableArray*deviceArray=[NSMutableArray array]; + + [deviceArray addObject:@true]; + + NSDictionary *deviceInf = @{@"action":ACTION_HS6_SETWIFI,SETWIFI_RESULT:deviceArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + NSLog(@"WIFI sucess"); + } disposeHS6FailBlock:^(NSString *failmsg) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_SETWIFI,SETWIFI_RESULT:failmsg}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + + } disposeHS6EndBlock:^(NSDictionary *deviceDic) { + NSLog(@"set WIFI over"); + + } disposeHS6ErrorBlock:^(NSNumber *error) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_ERROR,HS6_ERROR:[NSNumber numberWithInteger:error]}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + }]; + } + } + +/** + Binding QR Device + When using the SDK for the first time, measuring method needs to be called to finish user verification. + + @param tempDeviceID device Mac + Return parameters: + The measurement via SDK will be operated in the case of 1-4, and will be terminated if any of 5-8 occurs. The interface needs to be re-called after analyzing the return parameters. + Notice: when a new user registers via SDK, an ‘iHealth disclaimer’ will pop up automatically, and will require the user to agree in order to continue. SDK applications require an Internet connection; there is 10-day trial period if the SDK cannot connect to the internet, the SDK is fully functional during tryout period, but will be terminated without a working internet connection after 10 days. + @param result Action = 1;(1:bind sucess 2:full user bind faild 3,:ts error bind faild 4 other), + BineNum=10 + MAC + Position = 1;(user in weight number) + SetWifi=0 + Status = 1;(1:binding 2:unbind) + TS (time); + @param error error code + */ + +RCT_EXPORT_METHOD(bindDeviceHS6:(nonnull NSString*)birthday :(nonnull NSNumber*)weight :(nonnull NSNumber*)height :(nonnull NSNumber*)isSporter :(nonnull NSNumber*)gender :(nonnull NSString*)serialNumber){ + iHealthHS6 *hs6Controller = [iHealthHS6 shareIHHS6Controller]; + if (hs6Controller != nil) { + HealthUser* healthUser = [[HealthUser alloc] init]; + healthUser.userAccount = userAccount; + healthUser.clientID = HS6_CLIENT_ID; + healthUser.clientSecret = HS6_CLIENT_SECRET; + + + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + + [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + + healthUser.birthday=[dateFormatter dateFromString:birthday]; + + healthUser.weight=weight; + + healthUser.height=height; + + healthUser.isAthlete=isSporter.intValue; + + healthUser.sex=gender.intValue; + + [hs6Controller cloudCommandUserBinedQRDeviceWithUser:healthUser deviceID:serialNumber binedResult:^(NSArray *resultArray) { + + NSDictionary*deviceDic=[resultArray objectAtIndex:0]; + + NSMutableArray*deviceArray=[NSMutableArray array]; + + NSDictionary *deviceBackDic = @{BIND_HS6_RESULT:[deviceDic objectForKey:@"Action"],HS6_MODEL:[deviceDic objectForKey:@"Status"],HS6_POSITION:[deviceDic objectForKey:@"Position"],HS6_SETTED_WIFI:[deviceDic objectForKey:@"SetWifi"]}; + + [deviceArray addObject:deviceBackDic]; + + NSDictionary *deviceInf = @{@"action":ACTION_HS6_BIND,HS6_BIND_EXTRA:deviceArray}; + NSLog(@"ResultArray%@",resultArray); + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + } binedError:^(NSString *errorCode) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_ERROR,HS6_ERROR:errorCode}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + + }]; + } +} +/** + unBind QR Device + + Import parameter: + @param tempUser Properties included: clientID,clientSecret,userAccount,height. + clientID & clientSecret: the only identification for users of the SDK, requires registration from iHealth administrator, please email: sdk@ihealthlabs.com.cn for more information. + @param serialNumber device Mac + Return parameters: + @param result Action = 1;(1:bind sucess 2:full user bind faild 3,:ts error bind faild 4 other), + MAC + Status = 2;(1:binding 2:unbind) + TS + @param error error code + */ +RCT_EXPORT_METHOD(unBindDeviceHS6:(nonnull NSString*)serialNumber){ + + iHealthHS6 *hs6Controller = [iHealthHS6 shareIHHS6Controller]; + + if (hs6Controller != nil) { + HealthUser* healthUser = [[HealthUser alloc] init]; + healthUser.userAccount = userAccount; + healthUser.clientID = HS6_CLIENT_ID; + healthUser.clientSecret = HS6_CLIENT_SECRET; + + [hs6Controller cloudCommandUserDisBinedQRDeviceForUser:healthUser withDeviceID:serialNumber disBinedResult:^(NSArray *resultArray) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_UNBIND,HS6_UNBIND_RESULT:resultArray}; + + NSLog(@"unBindDeviceHS6:%@",resultArray); + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + + } disBinedError:^(NSString *errorCode) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_ERROR,HS6_ERROR:[NSString stringWithFormat:@"%@", errorCode]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + }]; + } +} + +RCT_EXPORT_METHOD(getToken:(nonnull NSString*)clientId :(nonnull NSString*)clientSecret:(nonnull NSString*)username :(nonnull NSString*)clientPara){ + + iHealthHS6 *hs6Controller = [iHealthHS6 shareIHHS6Controller]; + + if (hs6Controller != nil) { + HealthUser* healthUser = [[HealthUser alloc] init]; + healthUser.userAccount = username; + healthUser.clientID = clientId; + healthUser.clientSecret = clientSecret; + + + [hs6Controller commandHS6GetOpenAPITokenWithUser:healthUser withSuccessBlock:^(NSDictionary*openAPIInfoDic) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_GET_TOKEN,GET_TOKEN_RESULT:openAPIInfoDic}; + NSLog(@"openAPIInfoDic%@",openAPIInfoDic); + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + } withErrorBlock:^(NSDictionary *errorCode) { + + if (errorCode!=nil && [errorCode isKindOfClass:[NSDictionary class]]) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_ERROR, HS6_ERROR:[errorCode valueForKey:@"ErrorCode"],HS6_ERROR:[errorCode valueForKey:@"ErrorDescription"]}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + } + + }]; + } +} + +/** + sync Weight Unit + Import parameter: + @param tempUser Properties included: clientID,clientSecret,userAccount,serialNub. + @param unit IHHS6SDKUnitWeight_kg,IHHS6SDKUnitWeight_lb,IHHS6SDKUnitWeight_oz + + /// kg + IHHS6SDKUnitWeight_kg = 0, + /// lb + IHHS6SDKUnitWeight_lbs =1 , + /// st + IHHS6SDKUnitWeight_oz = 2, + + Return parameters: + @param unitBlock YES or NO + @param errorBlock error code + */ + +RCT_EXPORT_METHOD(setUnit:(nonnull NSString*)username :(nonnull NSNumber*)unitType){ + iHealthHS6 *hs6Controller = [iHealthHS6 shareIHHS6Controller]; + if (hs6Controller != nil) { + HealthUser* healthUser = [[HealthUser alloc] init]; + healthUser.userAccount = username; + healthUser.clientID = HS6_CLIENT_ID; + healthUser.clientSecret = HS6_CLIENT_SECRET; + + [hs6Controller commandHS6WithUser:healthUser withSyncWeightUnit:unitType.intValue withSuccessBlock:^(BOOL syncWeightUnit) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_SET_UNIT,SET_UNIT_RESULT:[NSNumber numberWithBool:syncWeightUnit]}; + NSLog(@"setUnitResult:%d",syncWeightUnit); + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + + } withErrorBlock:^(NSString *errorCode) { + NSDictionary *deviceInf = @{@"action":ACTION_HS6_ERROR,HS6_ERROR:errorCode}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + }]; + } + +} + +/** + DownloadHS6Data + + Import parameter: + @param tempUser Properties included: clientID,clientSecret,userAccount + clientID & clientSecret: the only identification for users of the SDK, requires registration from iHealth administrator, please email: sdk@ihealthlabs.com.cn for more information. + @param downloadTS :From 1970, the number of seconds, download data download all data after this point in time. + Return parameters: + @param getHS6Data AllHS6Data + + @param blockHS6LastTSFromCloud The last timestamp of the data download can be passed in at the next download, and all the data after the timestamp is downloaded. + + @param errorBlock error code 101,102,103,104:networkerror 400:input error 209:The user doesn't exist + */ + +RCT_EXPORT_METHOD(getCloudData:(nonnull NSString*)clientId :(nonnull NSString*)clientSecret :(nonnull NSString*)username :(nonnull NSNumber*)ts :(nonnull NSNumber*)pageSize){ + + iHealthHS6 *hs6Controller = [iHealthHS6 shareIHHS6Controller]; + + if (hs6Controller != nil) { + HealthUser* healthUser = [[HealthUser alloc] init]; + healthUser.userAccount = username; + healthUser.clientID = clientId; + healthUser.clientSecret = clientSecret; + + [hs6Controller commandDownloadHS6Data:healthUser withDownloadTS:[ts longValue] withPageSize:[pageSize longValue] withSuccessBlock:^(NSDictionary *dataDic) { + + NSDictionary *deviceInf = @{@"action":ACTION_HS6_GET_CLOUDDATA,HS6_CLOUDDATA:dataDic}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + + } blockHS6LastTSFromCloud:^(NSNumber *lastTS) { + + NSDictionary *deviceInf = @{@"action":ACTION_HS6_GET_CLOUDDATA_LASTTS,HS6_CLOUDDATA_LASTTS:lastTS}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + + + } withErrorBlock:^(NSNumber *error) { + + NSDictionary *deviceInf = @{@"action":ACTION_HS6_ERROR,HS6_ERROR:error}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInf]; + + }]; + + + } +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.h new file mode 100644 index 0000000..7974898 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.h @@ -0,0 +1,51 @@ +// +// HS6ProfileModule.h +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/20. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + +@interface HS6ProfileModule : NSObject + +//HS6 +#define ACTION_HS6_SETWIFI @"hs6_setwifi" +#define SETWIFI_RESULT @"setWifiResult" + +#define ACTION_HS6_BIND @"hs6_bind" +#define HS6_BIND_EXTRA @"bindData" +#define BIND_HS6_RESULT @"bindResult" +#define HS6_MODEL @"model" +#define HS6_POSITION @"position" +#define HS6_SETTED_WIFI @"settedWifi" + +#define ACTION_HS6_UNBIND @"hs6_unbind" +#define HS6_UNBIND_RESULT @"unBind" + +#define ACTION_HS6_GET_TOKEN @"hs6_get_token" +#define GET_TOKEN_RESULT @"getTokenResult" + +#define ACTION_HS6_SET_UNIT @"hs6_set_unit" +#define SET_UNIT_RESULT @"setUnitResult" + +#define ACTION_HS6_ERROR @"hs6_error" +#define HS6_ERROR @"hs6_error" + + +#define ACTION_HS6_GET_CLOUDDATA @"hs6_get_clouddata" +#define HS6_CLOUDDATA @"HS6_CLOUDDATA" +#define ACTION_HS6_GET_CLOUDDATA_LASTTS @"hs6_get_clouddata_lastts" +#define HS6_CLOUDDATA_LASTTS @"HS6_CLOUDDATA_LASTTS" +#define ACTION_HS6_GET_CLOUDDATA_LEFTNUM @"hs6_get_clouddata_leftnum" +#define HS6_CLOUDDATA_LEFTNUM @"HS6_CLOUDDATA_LEFTNUM" + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.m new file mode 100644 index 0000000..83ff55b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HS6ProfileModule.m @@ -0,0 +1,70 @@ +// +// HS6ProfileModule.m +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/20. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "HS6ProfileModule.h" + +@implementation HS6ProfileModule +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport +@synthesize bridge = _bridge; + +-(NSDictionary *)constantsToExport{ + + + return @{ + + @"ACTION_HS6_SETWIFI":ACTION_HS6_SETWIFI, + + @"SETWIFI_RESULT":SETWIFI_RESULT, + + @"ACTION_HS6_BIND":ACTION_HS6_BIND, + + @"HS6_BIND_EXTRA":HS6_BIND_EXTRA, + + @"BIND_HS6_RESULT":BIND_HS6_RESULT, + + @"HS6_MODEL":HS6_MODEL, + + @"HS6_POSITION":HS6_POSITION, + + @"HS6_SETTED_WIFI":HS6_SETTED_WIFI, + + @"ACTION_HS6_UNBIND":ACTION_HS6_UNBIND, + + @"HS6_UNBIND_RESULT":HS6_UNBIND_RESULT, + + @"ACTION_HS6_GET_TOKEN":ACTION_HS6_GET_TOKEN, + + @"GET_TOKEN_RESULT":GET_TOKEN_RESULT, + + @"ACTION_HS6_SET_UNIT":ACTION_HS6_SET_UNIT, + + @"SET_UNIT_RESULT":SET_UNIT_RESULT, + + @"ACTION_HS6_GET_CLOUDDATA":ACTION_HS6_GET_CLOUDDATA, + + @"HS6_CLOUDDATA":HS6_CLOUDDATA, + + @"ACTION_HS6_GET_CLOUDDATA_LASTTS":ACTION_HS6_GET_CLOUDDATA_LASTTS, + + @"HS6_CLOUDDATA_LASTTS":HS6_CLOUDDATA_LASTTS, + + @"ACTION_HS6_GET_CLOUDDATA_LEFTNUM":ACTION_HS6_GET_CLOUDDATA_LEFTNUM, + + @"HS6_CLOUDDATA_LEFTNUM":HS6_CLOUDDATA_LEFTNUM, + + @"ACTION_HS6_ERROR":ACTION_HS6_ERROR, + + @"HS6_ERROR":HS6_ERROR, + }; + + +} +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.h new file mode 100644 index 0000000..506c300 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.h @@ -0,0 +1,60 @@ +// +// HSProfileModule.h +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/2. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + +@interface HSProfileModule : NSObject + +#define ACTION_LIVEDATA_HS @"liveData_hs" +#define LIVEDATA_HS @"value" + +#define ACTION_ONLINE_RESULT_HS @"online_result_hs" +#define DATAID @"dataID" +#define WEIGHT_HS @"value" +#define FAT_HS @"" +#define WATER_HS @"" +#define MUSCLE_HS @"" +#define SKELETON_HS @"" +#define FATELEVEL_HS @"" +#define DCI_HS @"" + +#define ACTION_GET_ALL_CONNECTED_DEVICES @"action_get_all_connected_devices" +#define ACTION_HISTORICAL_DATA_HS @"historicaldata_hs" +#define HISTORDATA_HS @"historyData" +#define MEASUREMENT_DATE_HS @"date" +#define ACTION_HISTORICAL_DATA_COMPLETE_HS @"finishTranslate" +#define ACTION_NO_HISTORICALDATA @"noHistoryData" +#define BATTERY_HS @"battery_hs" +#define ACTION_BATTARY_HS @"action_get_battery_hs" +#define ACTION_ERROR_HS @"error_hs" +#define ERROR_NUM_HS @"error" +#define ERROR_ID_ILLEGAL_ARGUMENT @"400" +#define ERROR_ID_WIFI_DISABLED @"" +#define ERROR_DESCRIPTION_HS @"description" + + +#define ACTION_ONLINE_WEIGHTANDBody_INFO @"online_weigthandbody_info" + +#define ACTION_BroadCastType_DEVICE @"broadCastType_device" + +#define ACTION_RESET_DEVICE @"reset_device" + +#define ACTION_MEASURE_FINISH @"measure_finish" + +#define MEMORY_COUNT @"history_data_count" + +#define MEMORY_DATA @"history_data" + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.m new file mode 100644 index 0000000..b76347c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/HSProfileModule.m @@ -0,0 +1,79 @@ +// +// HSProfileModule.m +// ReactNativeIOSLibrary +// +// Created by ihealth on 16/12/2. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "HSProfileModule.h" + +@implementation HSProfileModule + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport +@synthesize bridge = _bridge; + +-(NSDictionary *)constantsToExport{ + return @{ + @"ACTION_LIVEDATA_HS" : ACTION_LIVEDATA_HS, + @"LIVEDATA_HS" : LIVEDATA_HS, + + @"ACTION_ONLINE_RESULT_HS" : ACTION_ONLINE_RESULT_HS, + @"DATAID" : DATAID, + @"WEIGHT_HS" : WEIGHT_HS, + @"FAT_HS" : FAT_HS, + @"WATER_HS" : WATER_HS, + @"MUSCLE_HS" : MUSCLE_HS, + @"SKELETON_HS" : SKELETON_HS, + @"FATELEVEL_HS" : FATELEVEL_HS, + @"DCI_HS" : DCI_HS, + + + @"ACTION_HISTORICAL_DATA_HS" : ACTION_HISTORICAL_DATA_HS, + @"HISTORDATA_HS" :HISTORDATA_HS, + @"MEASUREMENT_DATE_HS" : MEASUREMENT_DATE_HS, + @"ACTION_HISTORICAL_DATA_COMPLETE_HS" :ACTION_HISTORICAL_DATA_COMPLETE_HS, + @"ACTION_NO_HISTORICALDATA" : ACTION_NO_HISTORICALDATA, + + @"ACTION_ERROR_HS" : ACTION_ERROR_HS, + @"ERROR_NUM_HS" : ERROR_NUM_HS, + @"ERROR_ID_ILLEGAL_ARGUMENT" : ERROR_ID_ILLEGAL_ARGUMENT, + @"ERROR_ID_WIFI_DISABLED" : ERROR_ID_WIFI_DISABLED, + @"ERROR_DESCRIPTION_HS" : ERROR_DESCRIPTION_HS, + + @"ACTION_GET_ALL_CONNECTED_DEVICES":ACTION_GET_ALL_CONNECTED_DEVICES, + + @"ACTION_BATTERY_HS":ACTION_BATTARY_HS, + @"BATTERY_HS":BATTERY_HS, + + + + @"MEMORY_COUNT":MEMORY_COUNT, + + + + @"MEMORY_DATA":MEMORY_DATA, + + + + @"ACTION_ONLINE_WEIGHTANDBody_INFO":ACTION_ONLINE_WEIGHTANDBody_INFO, + + @"ACTION_MEASURE_FINISH":ACTION_MEASURE_FINISH, + + @"ACTION_RESET_DEVICE":ACTION_RESET_DEVICE, + + @"ACTION_BroadCastType_DEVICE":ACTION_BroadCastType_DEVICE, + + + }; + +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.h new file mode 100644 index 0000000..029c17d --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.h @@ -0,0 +1,20 @@ +// +// NT13BModule.h +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/12. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +@interface NT13BModule : RCTEventEmitter + +@end + + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.m new file mode 100644 index 0000000..158de43 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BModule.m @@ -0,0 +1,103 @@ +// +// NT13BModule.m +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/12. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "NT13BModule.h" +#import "NT13BHeader.h" +#import "NT13BProfileModule.h" + +@implementation NT13BModule +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": NT13B_EVENT_NOTIFY , + + }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + + +-(NT13B*)getDeviceWithMac:(NSString*)mac{ + + NT13BController *controller = [NT13BController shareIHNT13BController]; + NSArray *nt13bDeviceArray = [controller getAllCurrentNT13BInstace]; + + for(NT13B *tempDevice in nt13bDeviceArray){ + if([mac isEqualToString:tempDevice.serialNumber]){ + + return tempDevice; + } + } + return nil; +} + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*nt13bDeviceArray= [[NT13BController shareIHNT13BController] getAllCurrentNT13BInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[nt13bDeviceArray count]; i++) { + + NT13B *nt13b = [nt13bDeviceArray objectAtIndex:i]; + + [deviceMacArray addObject:nt13b.serialNumber]; + + } + + NSDictionary* deviceInfo = @{NT13B_ACTION:kACTION_GET_ALL_CONNECTED_DEVICES,NT13B_DEVICE:deviceMacArray}; + + [self sendEventWithName:NT13B_EVENT_NOTIFY body:deviceInfo]; +} + +RCT_EXPORT_METHOD(measure:(nonnull NSString *)mac){ + + + if ([self getDeviceWithMac:mac] != nil) { + + [[self getDeviceWithMac:mac] commandStartMeasure:^(NSDictionary *result) { + + NSDictionary* deviceInfo = @{NT13B_ACTION:@"action_measurement_result",NT13B_THERMOMETER_TYPE:[result objectForKey:@"bodyFlag"],NT13B_UNIT_FLAG:[result objectForKey:@"unit"],NT13B_RESULT:[result objectForKey:@"result"]}; + + [self sendEventWithName:NT13B_EVENT_NOTIFY body:deviceInfo]; + + + + }]; + + } + +} + +//断开连接 +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + if ([self getDeviceWithMac:mac]!=nil) { + + [[self getDeviceWithMac:mac] commandDisconnect:^(BOOL result) { + + + }]; + }else{ + + } +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.h new file mode 100644 index 0000000..6680366 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.h @@ -0,0 +1,36 @@ +// +// NT13BProfileModule.h +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/14. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif + + +@interface NT13BProfileModule : NSObject + +#define NT13B_EVENT_NOTIFY @"event_notify_nt13b" + +#define NT13B_ACTION @"action" + +#define NT13B_DEVICE @"devices" + +#define NT13B_KEY_MAC @"mac" + +#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" + +#define NT13B_RESULT @"result" + +#define NT13B_UNIT_FLAG @"unit_flag" + +#define NT13B_THERMOMETER_TYPE @"thermometer_type" + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.m new file mode 100644 index 0000000..558d2dd --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/NT13BProfileModule.m @@ -0,0 +1,39 @@ +// +// NT13BProfileModule.m +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/14. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "NT13BProfileModule.h" + +@implementation NT13BProfileModule + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"ACTION_MEASUREMENT_RESULT":@"action_measurement_result", + NT13B_ACTION:@"action", + NT13B_DEVICE:@"device", + NT13B_KEY_MAC:@"mac", + kACTION_GET_ALL_CONNECTED_DEVICES:kACTION_GET_ALL_CONNECTED_DEVICES, + NT13B_RESULT:@"result", + NT13B_UNIT_FLAG:@"unit_flag", + NT13B_THERMOMETER_TYPE:@"thermometer_type" + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.h new file mode 100755 index 0000000..97a656d --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.h @@ -0,0 +1,19 @@ +// +// PO3Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface PO1Module : RCTEventEmitter + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.m new file mode 100644 index 0000000..1fb2b9c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1Module.m @@ -0,0 +1,167 @@ +// +// PO1Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "PO1Module.h" +#import "PO1.h" +#import "PO1Controller.h" +#import "PO1ProfileModule.h" + +@implementation PO1Module{ + + + NSMutableDictionary*resultDic; + +} + +#define EVENT_NOTIFY @"event_notify_po1" +#define kMAC_KEY @"mac" +#define kACTION_KEY @"action" + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +#pragma mark +#pragma mark - constantsToExport +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": EVENT_NOTIFY }; + +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(devicePO1Measure:) name:@"PO1NotificationMeasureData" object:nil]; + + } + + + return self; +} + + +-(void)devicePO1Measure:(NSNotification *)tempNoti{ + + NSDictionary*measureDataDic= [tempNoti userInfo]; + + NSLog(@"devicePO1Measure:%@",measureDataDic); + + NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_BO_MEASUREMENT",@"WAVE":[measureDataDic valueForKey:@"wave"],@"PI":[measureDataDic valueForKey:@"PI"],@"PULSE_FORCE":[measureDataDic valueForKey:@"height"],@"BLOOD_OXYGEN":[measureDataDic valueForKey:@"spo2"],@"PULSE":[measureDataDic valueForKey:@"bpm"]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +} + + +-(void)dealloc{ + [[NSNotificationCenter defaultCenter]removeObserver:self]; +} + +-(PO1*)getPO1WithMac:(NSString*)mac{ + + PO1Controller *controller = [PO1Controller shareIHPO1Controller]; + NSArray *poDeviceArray = [controller getAllCurrentPO1Instace]; + + for(PO1 *tempPO1 in poDeviceArray){ + if([mac isEqualToString:tempPO1.serialNumber]){ + + return tempPO1; + break; + } + } + + return nil; +} + +#pragma mark +#pragma mark - Method + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*po1array= [[PO1Controller shareIHPO1Controller] getAllCurrentPO1Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[po1array count]; i++) { + + PO1*po1=[po1array objectAtIndex:i]; + + [deviceMacArray addObject:po1.serialNumber]; + + } + + NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getPO1WithMac:mac]!=nil) { + + + [[self getPO1WithMac:mac] commandPO1GetDeviceBattery:^(NSNumber *battery) { + + NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_GET_BATTERY",@"BATTERY":battery}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(PO1ErrorID errorID) { + + }]; + }else{ + + NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_ERROR_PO1",@"ERROR_DESCRIPTION":@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + + +} + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + + if ([self getPO1WithMac:mac]!=nil) { + + [[self getPO1WithMac:mac] commandDisconnectDevice]; + + }else{ + + + + } + + + +} + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.h new file mode 100755 index 0000000..35fefd5 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.h @@ -0,0 +1,20 @@ +// +// POProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif +@interface PO1ProfileModule : NSObject + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.m new file mode 100755 index 0000000..fee17dc --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO1ProfileModule.m @@ -0,0 +1,58 @@ +// +// POProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "PO1ProfileModule.h" + +@implementation PO1ProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"ACTION_GET_BATTERY":@"ACTION_GET_BATTERY", + + @"ACTION_BO_MEASUREMENT":@"ACTION_BO_MEASUREMENT", + + @"ACTION_ERROR_PO1":@"ACTION_ERROR_PO1", + + @"ACTION_GET_ALL_CONNECTED_DEVICES":@"ACTION_GET_ALL_CONNECTED_DEVICES", + + @"BATTERY":@"BATTERY", + + @"ERROR_DESCRIPTION":@"ERROR_DESCRIPTION", + + @"ERROR_ID":@"ERROR_ID", + + @"STATUS":@"STATUS", + + @"BLOOD_OXYGEN":@"BLOOD_OXYGEN", + + @"PULSE":@"PULSE", + + @"PULSE_FORCE":@"PULSE_FORCE", + + @"PI":@"PI", + + @"WAVE":@"WAVE", + + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.h new file mode 100755 index 0000000..897d7b0 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.h @@ -0,0 +1,19 @@ +// +// PO3Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface PO3Module : RCTEventEmitter + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.m new file mode 100644 index 0000000..6c1ddec --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PO3Module.m @@ -0,0 +1,260 @@ +// +// PO3Module.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "PO3Module.h" +#import "PO3.h" +#import "PO3Controller.h" +#import "POProfileModule.h" +#import "ManageDeviceController.h" + +@implementation PO3Module{ + + + NSMutableDictionary*resultDic; + +} + +#define EVENT_NOTIFY @"event_notify_po3" + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +#pragma mark +#pragma mark - constantsToExport +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": EVENT_NOTIFY }; + +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + + + } + return self; +} + +-(PO3*)getPO3WithMac:(NSString*)mac{ + + PO3Controller *controller = [PO3Controller shareIHPO3Controller]; + NSArray *poDeviceArray = [controller getAllCurrentPO3Instace]; + + for(PO3 *tempPO3 in poDeviceArray){ + if([mac isEqualToString:tempPO3.serialNumber]){ + + return tempPO3; + break; + } + } + + return nil; +} + +#pragma mark +#pragma mark - Method + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*po3array= [[PO3Controller shareIHPO3Controller] getAllCurrentPO3Instace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[po3array count]; i++) { + + PO3*po3=[po3array objectAtIndex:i]; + + [deviceMacArray addObject:po3.serialNumber]; + + } + + NSDictionary* deviceInfo = @{@"action":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + + + +RCT_EXPORT_METHOD(getBattery:(nonnull NSString *)mac){ + + if ([self getPO3WithMac:mac]!=nil) { + + [[self getPO3WithMac:mac] commandPO3SyncTime:^(BOOL resetSuc) { + + } withErrorBlock:^(PO3ErrorID errorID) { + + }]; + + [[self getPO3WithMac:mac] commandPO3GetDeviceBattery:^(NSNumber *battery) { + + NSDictionary* deviceInfo = @{POACTION:@"ACTION_BATTERY_PO",PO_BATTERY:battery}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } withErrorBlock:^(PO3ErrorID errorID) { + + }]; + }else{ + + NSDictionary* deviceInfo = @{POACTION:@"ACTION_ERROR_PO",@"error_po":@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + + +} + + +RCT_EXPORT_METHOD(startMeasure:(nonnull NSString *)mac){ + + + if ([self getPO3WithMac:mac]!=nil) { + + [[self getPO3WithMac:mac] commandPO3StartMeasure:^(BOOL resetSuc) { + + } withMeasureData:^(NSDictionary *measureDataDic) { + + NSDictionary* deviceInfo = @{@"action":@"ACTION_LIVEDA_PO",@"pulseWave":[measureDataDic valueForKey:@"wave"],@"dataID":[measureDataDic valueForKey:@"dataID"],@"pi":[measureDataDic valueForKey:@"PI"],@"pulsestrength":[measureDataDic valueForKey:@"height"],@"bloodoxygen":[measureDataDic valueForKey:@"spo2"],@"heartrate":[measureDataDic valueForKey:@"bpm"]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + resultDic=[[NSMutableDictionary alloc] initWithDictionary:deviceInfo]; + + } withFinishMeasure:^(BOOL finishData) { + + [resultDic setValue:@"ACTION_RESULTDATA_PO" forKey:POACTION]; + + [self sendEventWithName:EVENT_NOTIFY body:resultDic]; + + } withErrorBlock:^(PO3ErrorID errorID) { + + }]; + + }else{ + + NSDictionary* deviceInfo = @{@"action":@"ACTION_ERROR_PO",@"error_po":@"disconnect"}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + } + +} + +RCT_EXPORT_METHOD(getHistoryData:(nonnull NSString *)mac){ + + + + if ([self getPO3WithMac:mac]!=nil) { + + + [[self getPO3WithMac:mac] commandPO3SyncTime:^(BOOL resetSuc) { + + } withErrorBlock:^(PO3ErrorID errorID) { + + }]; + + NSMutableArray *resultArray = [[NSMutableArray alloc]init]; + + [[self getPO3WithMac:mac] commandPO3OfflineDataCount:^(NSNumber *dataCount) { + + if(dataCount.intValue == 0){ + NSDictionary *dic = @{POACTION:@"ACTION_NO_OFFLINEDATA_PO"}; + [self sendEventWithName:EVENT_NOTIFY body:dic]; + } + + } withOfflineData:^(NSDictionary *OfflineData) { + + + NSDateFormatter *dateFormat = nil; + + if (dateFormat == nil) { + dateFormat = [[NSDateFormatter alloc] init]; + [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//设定时间格式,这里可以设置成自己需要的格式 + } + + NSString *locationString=[dateFormat stringFromDate:[OfflineData valueForKey:@"date"]]; + + + NSDictionary* deviceInfo = @{ + POACTION:@"ACTION_OFFLINEDATA_PO", + @"measureDate":locationString, + @"dataID":[OfflineData valueForKey:@"dataID"], + @"pulseWave":[OfflineData valueForKey:@"wave"], + @"heartrate":[OfflineData valueForKey:@"bpm"], + @"bloodoxygen":[OfflineData valueForKey:@"spo2"]}; + + + [resultArray addObject:deviceInfo]; + + + + } withOfflineWaveData:^(NSDictionary *offlineWaveDataDic) { + + } withFinishMeasure:^(BOOL resetSuc) { + + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:resultArray,@"offLineData",@"ACTION_OFFLINEDATA_PO",POACTION, nil]; + [self sendEventWithName:EVENT_NOTIFY body:dic]; + + + } withErrorBlock:^(PO3ErrorID errorID) { + + }]; + + }else{ + + + + } + + + + +} + + +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + + + + if ([self getPO3WithMac:mac]!=nil) { + + [[ManageDeviceController commandGetInstance] commandDisconnectSelectDevice:[self getPO3WithMac:mac].currentUUID]; + + }else{ + + + + } + + + +} + + + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.h new file mode 100755 index 0000000..e25456a --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.h @@ -0,0 +1,24 @@ +// +// POProfileModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif +@interface POProfileModule : NSObject + + + +#define POACTION @"action" +#define PO_BATTERY @"BATTERY_PO" + + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.m new file mode 100755 index 0000000..cc12195 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/POProfileModule.m @@ -0,0 +1,48 @@ +// +// POProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "POProfileModule.h" + +@implementation POProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"ACTION_BATTERY_PO":@"ACTION_BATTERY_PO", + @"BATTERY_PO":PO_BATTERY, + @"ACTION_LIVEDA_PO":@"ACTION_LIVEDA_PO", + @"PULSE_WAVE_PO":@"pulseWave", + @"PI_PO":@"pi", + @"PULSE_STRENGTH_PO":@"pulsestrength", + @"BLOOD_OXYGEN_PO":@"bloodoxygen", + @"PULSE_RATE_PO":@"heartrate", + @"ACTION_RESULTDATA_PO":@"ACTION_RESULTDATA_PO", + @"DATAID":@"dataID", + @"ACTION_OFFLINEDATA_PO":@"ACTION_OFFLINEDATA_PO", + @"OFFLINEDATA_PO":@"offLineData", + @"MEASURE_DATE_PO":@"MEASURE_DATE_PO", + @"ACTION_NO_OFFLINEDATA_PO":@"ACTION_NO_OFFLINEDATA_PO", + @"ACTION_ERROR_PO":@"ACTION_ERROR_PO", + @"ACTION_GET_ALL_CONNECTED_DEVICES":@"ACTION_GET_ALL_CONNECTED_DEVICES", + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.h new file mode 100755 index 0000000..ecad38b --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.h @@ -0,0 +1,19 @@ +// +// PO3Module.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif +@interface PT3SBTModule : RCTEventEmitter + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.m new file mode 100644 index 0000000..525bc70 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTModule.m @@ -0,0 +1,347 @@ +// +// PT3SBTModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "PT3SBTModule.h" +#import "PT3SBT.h" +#import "PT3SBTController.h" +#import "PT3SBTProfileModule.h" + +@implementation PT3SBTModule{ + + + NSMutableDictionary*resultDic; + +} + +#define EVENT_NOTIFY @"event_notify_pt3sbt" +#define kMAC_KEY @"mac" +#define kACTION_KEY @"action" + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + + +#pragma mark +#pragma mark - constantsToExport +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": EVENT_NOTIFY }; + +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} +#pragma mark +#pragma mark - Init +-(id)init +{ + if (self=[super init]) + { + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(devicePT3SBTMeasure:) name:@"PT3SBTNotificationGetResult" object:nil]; + + } + + + return self; +} + +//Content of measurement results: +//{ +// Distance = 1663; +// Tamb = 275; +// Tbody = 3521; +// Tex = 269; +// Tobj = 274; +// Vbat = 281; +//} + + +-(void)devicePT3SBTMeasure:(NSNotification *)tempNoti{ + + NSDictionary*measureDataDic= [tempNoti userInfo]; + + NSLog(@"devicePT3SBTMeasure:%@",measureDataDic); + + NSDictionary* deviceInfo = @{ + kACTION_KEY:kACTION_TEMPERATURE_MEASUREMENT,TEMPERATURE:[measureDataDic valueForKey:@"Tbody"]}; + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +} + + +-(void)dealloc{ + [[NSNotificationCenter defaultCenter]removeObserver:self]; +} + +-(PT3SBT*)getPT3SBTWithMac:(NSString*)mac{ + + PT3SBTController *controller = [PT3SBTController shareIHPT3SBTController]; + NSArray *poDeviceArray = [controller getAllCurrentPT3SBTInstace]; + + for(PT3SBT *tempPT3SBT in poDeviceArray){ + if([mac isEqualToString:tempPT3SBT.serialNumber]){ + + return tempPT3SBT; + break; + } + } + + return nil; +} + +#pragma mark +#pragma mark - Method + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + + NSArray*PT3SBTarray= [[PT3SBTController shareIHPT3SBTController] getAllCurrentPT3SBTInstace]; + + NSMutableArray*deviceMacArray=[NSMutableArray array]; + + for (int i=0; i<[PT3SBTarray count]; i++) { + + PT3SBT*PT3SBT=[PT3SBTarray objectAtIndex:i]; + + [deviceMacArray addObject:PT3SBT.serialNumber]; + + } + + NSDictionary* deviceInfo = @{kACTION_KEY:kACTION_GET_ALL_CONNECTED_DEVICES,@"devices":deviceMacArray}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; + + +} + +#pragma mark 设置时间 +RCT_EXPORT_METHOD(setTime:(nonnull NSString *)mac){ + + + if ([self getPT3SBTWithMac:mac]) { + __weak typeof(self) weakSelf = self; + + [[self getPT3SBTWithMac:mac] commandFunction:^(NSDictionary *functionDict) { + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_TIME, + }]; + + } DisposeErrorBlock:^(PT3SBTDeviceError error) { + + }]; + +} + +} + +#pragma mark 设置单位 +RCT_EXPORT_METHOD(setUnit:(nonnull NSString *)mac :(nonnull NSNumber *)unit){ + + if ([self getPT3SBTWithMac:mac]) { + + PT3SBTTemperatureUnit tempUnit = PT3SBTTemperatureUnit_C; + if ([unit isEqual:@(PT3SBTTemperatureUnit_C)]) { + tempUnit = PT3SBTTemperatureUnit_C; + } else if([unit isEqual:@(PT3SBTTemperatureUnit_F)]) { + tempUnit = PT3SBTTemperatureUnit_F; + } else { + tempUnit = PT3SBTTemperatureUnit_C; + return; + } + __weak typeof(self) weakSelf = self; + + [[self getPT3SBTWithMac:mac] commandPT3SBTSetUnit:tempUnit DisposeSetUnitResult:^(BOOL setResult) { + + [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + kACTION_KEY:kACTION_SET_UNIT, + }]; + + } DisposeErrorBlock:^(PT3SBTDeviceError error) { + + }]; + + + } +} + +#pragma mark 获取单位 +RCT_EXPORT_METHOD(getUnit:(nonnull NSString *)mac){ + + if ([self getPT3SBTWithMac:mac]) { + + [[self getPT3SBTWithMac:mac] commandPT3SBTGetUnit:^(PT3SBTTemperatureUnit unit) { + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + UNIT:[NSNumber numberWithInt:unit], + kACTION_KEY:kACTION_GET_UNIT, + }]; + + } DisposeErrorBlock:^(PT3SBTDeviceError error) { + + }]; + + } +} + +#pragma mark 获取数据条数 +RCT_EXPORT_METHOD(getHistoryCount:(nonnull NSString *)mac){ + + if ([self getPT3SBTWithMac:mac]) { + + [[self getPT3SBTWithMac:mac] commandPT3SBTGetMemoryCount:^(NSNumber *count) { + + [self sendEventWithName:EVENT_NOTIFY body:@{ + kMAC_KEY:mac, + COUNT:count, + kACTION_KEY:kACTION_GET_HISTORY_COUNT, + }]; + + } DisposeErrorBlock:^(PT3SBTDeviceError error) { + + }]; + + } +} + +#pragma mark 获取数据 +RCT_EXPORT_METHOD(getHistoryData:(nonnull NSString *)mac){ + + if ([self getPT3SBTWithMac:mac]) { + + [[self getPT3SBTWithMac:mac] commandGetMemorryData:^(NSMutableArray *memoryDataArray) { + + + if(memoryDataArray != nil){ + + if(memoryDataArray.count){ + + NSMutableArray*dataArray=[NSMutableArray array]; + + for (int i=0; i +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif +@interface PT3SBTProfileModule : NSObject + + +#define kACTION_SET_TIME @"ACTION_SET_TIME" + +#define kACTION_GET_BATTERY @"ACTION_GET_BATTERY" + +#define kACTION_SET_UNIT @"ACTION_SET_UNIT" + +#define kACTION_GET_UNIT @"ACTION_GET_UNIT" + +#define kACTION_GET_HISTORY_COUNT @"ACTION_GET_HISTORY_COUNT" + +#define kACTION_GET_HISTORY_DATA @"ACTION_GET_HISTORY_DATA" + +#define kACTION_DELETE_HISTORY_DATA @"ACTION_DELETE_HISTORY_DATA" + +#define kACTION_TEMPERATURE_MEASUREMENT @"ACTION_TEMPERATURE_MEASUREMENT" + +#define kACTION_PUB_UNIT @"ACTION_PUB_UNIT" + +#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" + +#define STATUS @"STATUS" + +#define BATTERY @"BATTERY" + +#define UNIT @"UNIT" + +#define TS @"TS" + +#define COUNT @"COUNT" + +#define TEMPERATURE @"TEMPERATURE" + +#define HISTORY @"HISTORY" + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTProfileModule.m new file mode 100755 index 0000000..f96b663 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/PT3SBTProfileModule.m @@ -0,0 +1,49 @@ +// +// POProfileModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/12/4. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "PT3SBTProfileModule.h" + +@implementation PT3SBTProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + kACTION_SET_TIME:@"ACTION_SET_TIME", + kACTION_GET_BATTERY:@"ACTION_GET_BATTERY", + kACTION_SET_UNIT:@"ACTION_SET_UNIT", + kACTION_GET_UNIT:@"ACTION_GET_UNIT", + kACTION_GET_HISTORY_COUNT:@"ACTION_GET_HISTORY_COUNT", + kACTION_GET_HISTORY_DATA:@"ACTION_GET_HISTORY_DATA", + kACTION_DELETE_HISTORY_DATA:@"ACTION_DELETE_HISTORY_DATA", + kACTION_TEMPERATURE_MEASUREMENT:@"ACTION_TEMPERATURE_MEASUREMENT", + kACTION_PUB_UNIT:@"ACTION_PUB_UNIT", + kACTION_GET_ALL_CONNECTED_DEVICES:@"ACTION_GET_ALL_CONNECTED_DEVICES", + STATUS:@"STATUS", + BATTERY:@"BATTERY", + UNIT:@"UNIT", + TS:@"TS", + COUNT:@"COUNT", + TEMPERATURE:@"TEMPERATURE", + HISTORY:@"HISTORY", + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/RNBGMacro.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/RNBGMacro.h new file mode 100644 index 0000000..6edea70 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/RNBGMacro.h @@ -0,0 +1,60 @@ +// +// RNBGMacro.h +// ReactNativeIOSLibrary +// +// Created by Lei Bao on 2017/5/25. +// Copyright © 2017年 daiqingquan. All rights reserved. +// + +#ifndef kRNBGMacro_h +#define kRNBGMacro_h + +// Commom in BG5Module.js & BG5LModule.js +#define kRN_ACTION_ERROR_BG @"ACTION_ERROR_BG" +#define kRN_ACTION_KEEP_LINK @"ACTION_KEEP_LINK" +#define kRN_ACTION_SET_TIME @"ACTION_SET_TIME" +#define kRN_ACTION_SET_UNIT @"ACTION_SET_UNIT" +#define kRN_ACTION_GET_BATTERY @"ACTION_GET_BATTERY" +#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" +#define kRN_ACTION_GET_BOTTLEID @"ACTION_GET_BOTTLEID" +#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_CODE_ANALYSIS @"ACTION_CODE_ANALYSIS" +#define kRN_ACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" + +#define kRN_ERROR_NUM_BG @"ERROR_NUM_BG" +#define kRN_ERROR_DESCRIPTION_BG @"ERROR_DESCRIPTION_BG" +#define kRN_GET_BATTERY @"GET_BATTERY" +#define kRN_GET_OFFLINEDATA_COUNT @"GET_OFFLINEDATA_COUNT" +#define kRN_GET_OFFLINEDATA @"GET_OFFLINEDATA" +#define kRN_SET_BOTTLEMESSAGE @"SET_BOTTLEMESSAGE" +#define kRN_START_MODE @"START_MODE" +#define kRN_GET_EXPIRECTIME @"GET_EXPIRECTIME" +#define kRN_GET_USENUM @"GET_USENUM" +#define kRN_GET_BOTTLEID @"GET_BOTTLEID" +#define kRN_ONLINE_RESULT_BG @"ONLINE_RESULT_BG" +#define kRN_DATA_ID @"DATA_ID" +#define kRN_STRIP_NUM_BG @"STRIP_NUM_BG" +#define kRN_STRIP_EXPIRETIME_BG @"STRIP_EXPIRETIME_BG" +#define kRN_BOTTLEID_BG @"BOTTLEID_BG" +#define kRN_ACTION_ADJUST_OFFLINE_DATA @"ADJUST_OFFLINE_DATA" +#define kRN_ACTION_DELETE_USED_STRIP @"ACTION_DELETE_USED_STRIP" + +// Only for BG5 + + +// Only for BG5L + + + +#endif /* RNBGMacro_h */ diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.h new file mode 100644 index 0000000..b2b8043 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.h @@ -0,0 +1,21 @@ +// +// TS28BModule.h +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/12. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + +#import "TS28BHeader.h" + +@interface TS28BModule : RCTEventEmitter + +@end + diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.m new file mode 100644 index 0000000..5e51e7c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BModule.m @@ -0,0 +1,116 @@ +// +// TS28BModule.m +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/12. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "TS28BModule.h" +#import "TS28BHeader.h" + +#define EVENT_NOTIFY @"event_notify_ts28b" +#define kMAC_KEY @"mac" +#define kACTION_KEY @"action" + +@interface TS28BModule() + +@property (strong, nonatomic) TS28BController *ts28bController; + + + +@end + +@implementation TS28BModule + + +RCT_EXPORT_MODULE() +- (NSArray *)supportedEvents { + return @[@"event_notify", @"event_scan_device", @"event_scan_finish", + @"event_device_connected", @"event_device_connect_failed", + @"event_device_disconnect", @"event_authenticate_result", + @"event_notify_ts28b", @"event_notify_bg1", + @"action_connect_result_for_bg1"]; +} + + +- (NSDictionary *)constantsToExport +{ + return @{ @"Event_Notify": EVENT_NOTIFY }; +} + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + + +RCT_EXPORT_METHOD(getAllConnectedDevices){ + + [[NSNotificationCenter defaultCenter] postNotificationName:@"getAllTS28BConnectedDevices" object:self]; +} + +RCT_EXPORT_METHOD(measure:(nonnull NSString *)mac){ + + + self.ts28bController = [TS28BController sharedController]; + + self.ts28bController.delegate = self; + +// if ([self getDeviceWithMac:mac] != nil) { +// +// [[self getDeviceWithMac:mac] commandStartMeasure:^(NSDictionary *result) { +// +// NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_GET_MEASURE",@"bodyFlag":[result objectForKey:@"bodyFlag"],@"unit":[result objectForKey:@"unit"],@"result":[result objectForKey:@"result"]}; +// +// [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +// +// +// +// }]; +// +// } + +} + +//断开连接 +RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ + + [[NSNotificationCenter defaultCenter] postNotificationName:@"disconnectTS28B" object:self]; +} + +#pragma mark - TS28B delegate + +- (void)controller:(TS28BController *)controller didDiscoverDevice:(TS28B *)device{ + NSLog(@"搜索到设备的代理"); + + + +} +- (void)controller:(TS28BController *)controller didConnectSuccessDevice:(TS28B *)device{ + NSLog(@"连接成功的代理"); +// self.connectedDevice = device; +// NSLog(@"%@",[NSString stringWithFormat:@"连接成功:%@ \nSerial Number:%@\nModel Number%@\nFirmware:%@\nHardware:%@\nSoftware:%@\nManufacture:%@\nSystemID:%@",device.peripheral.name,device.serialNumber,device.modelNumber,device.firmwareVersion,device.hardwareVersion,device.softwareVersion,device.manufacturerName,device.systemID]); + + +} +- (void)controller:(TS28BController *)controller didConnectFailDevice:(TS28B *)device{ + NSLog(@"连接失败的代理"); +// self.recordTextView.text = @"连接失败"; + +} +- (void)controller:(TS28BController *)controller didDisconnectDevice:(TS28B *)device{ + NSLog(@"断开连接的代理"); +// self.recordTextView.text = @"连接断开"; +} +- (void)controller:(TS28BController *)controller device:(TS28B *)device didUpdateTemperature:(float)value temperatureUnit:(TemperatureUnit)unit measureDate:(NSDate *)date measureLocation:(TemperatureType)type{ + +// self.valueLabel.text = [NSString stringWithFormat:@"%.1f %@",value,(unit == TemperatureUnit_C)?@"C":@"F"]; + + NSDictionary* deviceInfo = @{kACTION_KEY:@"ACTION_GET_MEASURE",@"bodyFlag":[NSNumber numberWithInt:type],@"unit":[NSNumber numberWithInt:unit],@"result":[NSNumber numberWithFloat:value]}; + + [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; +} + + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.h new file mode 100644 index 0000000..a4ac23c --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.h @@ -0,0 +1,38 @@ +// +// TS28BProfileModule.h +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/14. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import +#if __has_include() +#import +#else +#import "RCTBridgeModule.h" +#endif +NS_ASSUME_NONNULL_BEGIN + +@interface TS28BProfileModule : NSObject + + +#define TS28B_EVENT_NOTIFY @"event_notify_ts28b" + +#define TS28B_ACTION @"action" + +#define TS28B_DEVICE @"devices" + +#define TS28B_KEY_MAC @"mac" + +#define kACTION_GET_ALL_CONNECTED_DEVICES @"ACTION_GET_ALL_CONNECTED_DEVICES" + +#define TS28B_RESULT @"result" + +#define TS28B_UNIT_FLAG @"unit_flag" + +#define TS28B_THERMOMETER_TYPE @"thermometer_type" + +@end + +NS_ASSUME_NONNULL_END diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.m new file mode 100644 index 0000000..21d65b5 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/TS28BProfileModule.m @@ -0,0 +1,40 @@ +// +// TS28BProfileModule.m +// ReactNativeIOSLibrary +// +// Created by user on 2019/11/14. +// Copyright © 2019 daiqingquan. All rights reserved. +// + +#import "TS28BProfileModule.h" + +@implementation TS28BProfileModule + + +RCT_EXPORT_MODULE() + +#pragma mark +#pragma mark - constantsToExport + + +- (NSDictionary *)constantsToExport +{ + return @{ + @"ACTION_MEASUREMENT_RESULT":@"action_measurement_result", + TS28B_ACTION:@"action", + TS28B_DEVICE:@"device", + TS28B_KEY_MAC:@"mac", + kACTION_GET_ALL_CONNECTED_DEVICES:kACTION_GET_ALL_CONNECTED_DEVICES, + TS28B_RESULT:@"result", + TS28B_UNIT_FLAG:@"unit_flag", + TS28B_THERMOMETER_TYPE:@"thermometer_type" + }; +}; + + ++ (BOOL)requiresMainQueueSetup +{ + return YES; +} + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.h b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.h new file mode 100755 index 0000000..2719f9d --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.h @@ -0,0 +1,27 @@ +// +// iHealthDeviceManagerModule.h +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import + +#if __has_include() +#import +#else +#import "RCTEventEmitter.h" +#endif + + +@interface iHealthDeviceManagerModule : RCTEventEmitter +{ + NSDictionary *bg1IdpsDic; +} + ++ (NSString*)autherizedUserID; ++ (NSString*)autherizedClientID; ++ (NSString*)autherizedClientSecret; + +@end diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.m new file mode 100755 index 0000000..c402987 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/iHealthDeviceManagerModule.m @@ -0,0 +1,1338 @@ +// +// iHealthDeviceManagerModule.m +// ReactNativeIOSLibrary +// +// Created by daiqingquan on 2016/11/23. +// Copyright © 2016年 daiqingquan. All rights reserved. +// + +#import "iHealthDeviceManagerModule.h" +#import "AMHeader.h" +#import "BPHeader.h" +#import "HSHeader.h" +#import "BGHeader.h" +#import "POHeader.h" +#import "ECGHeader.h" +#import "TS28BHeader.h" +#import "NT13BHeader.h" +#import "BGMacroFile.h" +#import "ECGMacroFile.h" +#import "THV3Macro.h" +#import "NT13BMacroFile.h" +#import "IHSDKCloudUser.h" +#import "ManageDeviceController.h" +#import "ScanDeviceController.h" +#import "ConnectDeviceController.h" +#import + +#import "TS28BModule.h" + +#import "BG1S.h" + +#import "BG1SController.h" + +#import "PO1.h" + +#import "PO1Controller.h" + +#import "PO1ProfileModule.h" + +#import "PT3SBT.h" + +#import "PT3SBTController.h" + +#import "PT3SBTMacroFile.h" + +#define FetchUserInfo @"com.rn.ihealth.dm.userinfo" + +#define kEvent_Scan_Device @"event_scan_device" +#define kEvent_Scan_Finish @"event_scan_finish" +#define kEvent_Device_Connected @"event_device_connected" +#define kEvent_Device_Connect_Failed @"event_device_connect_failed" +#define kEvent_Device_Disconnect @"event_device_disconnect" +#define kEvent_Authenticate_Result @"event_authenticate_result" + +#define kType_AM3S @"AM3S" +#define kType_AM4 @"AM4" +#define kType_AM5 @"AM5" +#define kType_PO3 @"PO3" +#define kType_BP5 @"BP5" +#define kType_BP7 @"BP7" +#define kType_BP3L @"BP3L" +#define kType_BP5S @"BP5S" +#define kType_BP7S @"BP7S" +#define kType_KN550 @"KN550" +#define kType_HS4 @"HS4" +#define kType_HS4S @"HS4S" +#define kType_HS2 @"HS2" +#define kType_HS2S_PRO @"HS2S Pro" +#define kType_BG1 @"BG1" +#define kType_BG5 @"BG5" +#define kType_BG5S @"BG5S" +#define kType_ECG3 @"ECG3" +#define kType_ECG3USB @"ECG3USB" +#define kType_BTM @"FDIR_V3" +#define kType_TS28B @"TS28B" +#define kType_NT13B @"NT13B" +#define kType_BG1S @"BG1S" +#define kType_HS2S @"HS2S" +#define kType_PO1 @"PO1" +#define kType_PT3SBT @"PT3SBT" + + +@interface iHealthDeviceManagerModule() + + +@property (strong, nonatomic) TS28BController *ts28bController; + +@property (strong, nonatomic) TS28B *ts28b; + +@end + +@implementation iHealthDeviceManagerModule + +RCT_EXPORT_MODULE() + +- (NSArray *)supportedEvents { + return @[ + kEvent_Scan_Device, + kEvent_Scan_Finish, + kEvent_Device_Connected, + kEvent_Device_Connect_Failed, + kEvent_Device_Disconnect, + kEvent_Authenticate_Result, + @"event_notify_ts28b", + @"event_notify_bg1", + @"action_connect_result_for_bg1" + ]; +} + ++ (BOOL)requiresMainQueueSetup { + return YES; +} + +#pragma mark - constantsToExport + +- (NSDictionary *)constantsToExport{ + return @{ + @"AM3S" :kType_AM3S, + @"AM4" :kType_AM4, + @"AM5" :kType_AM5, + @"PO3":kType_PO3, + @"PO3M":kType_PO3, + @"BP5":kType_BP5, + @"BP7":kType_BP7, + @"BP3L" :kType_BP3L, + @"BP5S" : kType_BP5S, + @"BP7S" : kType_BP7S, + @"KN550":kType_KN550, + @"HS4S" :kType_HS4, + @"HS4" :kType_HS4, + @"HS2" :kType_HS2, + @"BG1":kType_BG1, + @"BG5":kType_BG5, + @"BG5S":kType_BG5S, + @"ECG3":kType_ECG3, + @"ECG3USB":kType_ECG3USB, + @"BTM":kType_BTM, + @"NT13B":kType_NT13B, + @"TS28B":kType_TS28B, + @"BG1S":kType_BG1S, + @"HS2S":kType_HS2S, + @"HS2S Pro":kType_HS2S_PRO, + @"PO1":kType_PO1, + @"PT3SBT":kType_PT3SBT, + @"Event_Scan_Device":kEvent_Scan_Device, + @"Event_Scan_Finish":kEvent_Scan_Finish, + @"Event_Device_Connected":kEvent_Device_Connected, + @"Event_Device_Connect_Failed":kEvent_Device_Connect_Failed, + @"Event_Device_Disconnect":kEvent_Device_Disconnect, + @"Event_Authenticate_Result":kEvent_Authenticate_Result, + }; +}; + +#pragma mark +#pragma mark - Init +-(id)init{ + NSLog(@"iHealthScanner: *** iHealthDeviceManagerModule init CALLED ***"); + if (self = [super init]){ + NSLog(@"iHealthScanner: *** Registering NSNotification observers ***"); + [ScanDeviceController commandGetInstance]; + // AM3S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:AM3SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:AM3SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:AM3SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:AM3SDisConnectNoti object:nil]; + // AM4 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:AM4Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:AM4ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:AM4ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:AM4DisConnectNoti object:nil]; + + //AM5 + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:AM5Discover object:nil]; + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:AM5ConnectFailed object:nil]; + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:AM5ConnectNoti object:nil]; + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:AM5DisConnectNoti object:nil]; + + // PO3 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:PO3Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:PO3ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:PO3ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:PO3DisConnectNoti object:nil]; + // BP5 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP5ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP5DisConnectNoti object:nil]; + // BP7 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP7ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP7DisConnectNoti object:nil]; + //BP3L + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BP3LDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BP3LConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP3LConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP3LDisConnectNoti object:nil]; + + //BP5S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BP5SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BP5SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP5SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP5SDisConnectNoti object:nil]; + + //BP7S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BP7SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP7SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP7SDisConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BP7SConnectFailed object:nil]; + + //KN550BT + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:KN550BTDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:KN550BTConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:KN550BTDisConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:KN550BTConnectFailed object:nil]; + // HS4S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:HS4Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:HS4ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:HS4ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:HS4DisConnectNoti object:nil]; + // HS2 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:HS2Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:HS2ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:HS2ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:HS2DisConnectNoti object:nil]; + + + // HS2S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:HS2SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:HS2SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:HS2SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:HS2SDisConnectNoti object:nil]; + + //BG1 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(bg1Discover:) name:kNotificationNameNeedAudioPermission object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(bg1Connect:) name:kNotificationNameAudioDeviceInsert object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceBG1Disconnect:) name:kNotificationNameBG1DidDisConnect object:nil]; + //BG5 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BG5ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BG5DisConnectNoti object:nil]; + + // BG5S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:kNotificationNameBG5SDidDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:kNotificationNameBG5SConnectFail object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:kNotificationNameBG5SConnectSuccess object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:kNotificationNameBG5SDidDisConnect object:nil]; + + //ECG3 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:ECG3Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:ECG3ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:ECG3ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:ECG3DisConnectNoti object:nil]; + + //ECG3USB + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:ECGUSBConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:ECGUSBDisConnectNoti object:nil]; + + //BTM(THV3) + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:THV3Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:THV3ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:THV3ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:THV3DisConnectNoti object:nil]; + //NT13B + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:NT13BDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:NT13BConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:NT13BConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:NT13BDisConnectNoti object:nil]; + + //TS28B + + + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(disconnectTS28B) name:@"disconnectTS28B" object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getAllTS28BConnectedDevices) name:@"getAllTS28BConnectedDevices" object:nil]; + + + //BG1S + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BG1SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BG1SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BG1SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BG1SDisConnectNoti object:nil]; + // PO1 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:PO1Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:PO1ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:PO1ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:PO1DisConnectNoti object:nil]; + // PT3SBT + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:PT3SBTDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:PT3SBTConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:PT3SBTConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:PT3SBTDisConnectNoti object:nil]; + + [AM3Controller shareIHAM3Controller]; + [AM3SController_V2 shareIHAM3SController]; + [AM4Controller shareIHAM4Controller]; + [AM5Controller shareAM5Controller]; + [BP3LController shareBP3LController]; + [BP5Controller shareBP5Controller]; + [BP7Controller shareBP7Controller]; + [BP5SController sharedController]; + [BG5Controller shareIHBg5Controller]; + [BG5SController sharedController]; + [ECG3Controller shareECG3Controller]; + [ECG3USBController shareECG3USBController]; + [HS4Controller shareIHHs4Controller]; + [HS2Controller shareIHHs2Controller]; + [HS2SController shareIHHS2SController]; + [THV3Controller sharedController]; + [NT13BController shareIHNT13BController]; + [BG1SController shareIHBG1SController]; + [PO1Controller shareIHPO1Controller]; + [PT3SBTController shareIHPT3SBTController]; + + } + return self; +} + +- (void)dealloc{ + [[NSNotificationCenter defaultCenter]removeObserver:self]; +} + +#pragma mark - + +-(void)disconnectTS28B{ + + [self.ts28bController disconnectDevice:self.ts28b]; + +} +-(void)getAllTS28BConnectedDevices{ + + if (self.ts28b==nil) { + return; + } + + NSDictionary* deviceInfo = @{@"event_notify_ts28b":@"ACTION_GET_ALL_CONNECTED_DEVICES",@"devices":self.ts28b.serialNumber}; + + [self sendEventWithName:@"event_notify_ts28b" body:deviceInfo]; +} + +- (NSString*)serialNumebr:(NSDictionary*)userInfo{ + if (!userInfo){ + return nil; + } + NSString* serialNumber = userInfo[@"SerialNumber"]; + NSString* deviceId = userInfo[@"ID"]; + if (serialNumber && serialNumber.length > 0){ + return serialNumber; + } else if (deviceId && deviceId.length > 0){ + return deviceId; + } + return nil; +} + +#pragma mark - Notification + +#pragma mark - BG1 +-(void)bg1Discover:(NSNotification*)info { + + + // NSDictionary* deviceInfo = @{@"mac":@"",@"type":@"BG1"}; + // [self sendEventWithName:kEvent_Scan_Device body:deviceInfo]; + +} + +-(void)bg1Connect:(NSNotification*)info { + + [[MPMusicPlayerController applicationMusicPlayer] setVolume:1.0f]; + NSDictionary* deviceInfo = @{@"mac":@"",@"type":@"BG1"}; + [self sendEventWithName:kEvent_Scan_Device body:deviceInfo]; + + + // NSDictionary* deviceInfo = @{@"mac":@"",@"type":@"BG1"}; + // [self sendEventWithName:kEvent_Device_Connected body:deviceInfo]; + + BG1*myBG1=[[BG1Controller shareBG1Controller] getCurrentBG1Instance]; + + [myBG1 commandBG1DeviceModel:@0 withDiscoverBlock:^{ + + } withDiscoverBlock:^(NSDictionary *idpsDic) { + + bg1IdpsDic = [NSDictionary dictionaryWithDictionary:idpsDic]; + + } withConnectBlock:^{ + + NSString *bg1Mac = @""; + if (bg1IdpsDic[@"SerialNumber"] != nil) { + bg1Mac = bg1IdpsDic[@"SerialNumber"]; + } + NSDictionary* deviceInfo = @{@"mac":bg1Mac,@"type":@"BG1"}; + [self sendEventWithName:kEvent_Device_Connected body:deviceInfo]; + + } withErrorBlock:^(BG1Error errorID) { + + NSDictionary* deviceInfo = @{@"mac":@"",@"action":@"action_measure_error_for_bg1",@"action_measure_error_for_bg1":[NSNumber numberWithInt:errorID]}; + [self sendEventWithName:@"event_notify_bg1" body:deviceInfo]; + + }]; + +} + +-(void)deviceBG1Disconnect:(NSNotification*)info { + + NSDictionary* deviceInfo = @{@"mac":@"",@"type":kType_BG1}; + [self sendEventWithName:kEvent_Device_Disconnect body:deviceInfo]; +} + +#pragma mark - 发现BLE设备 +-(void)deviceDiscover:(NSNotification*)info { + + NSLog(@"Native: device discover %@", info); + + NSDictionary* userInfo = [info userInfo]; + NSString* deviceName = userInfo[@"DeviceName"]; + + NSDictionary *deviceNameForType = @{ + @"AM3S" :kType_AM3S, + @"AM4" :kType_AM4, + @"AM5" :kType_AM5, + @"PO3":kType_PO3, + @"PO3M":kType_PO3, + @"BP3L" :kType_BP3L, + @"BP5S" : kType_BP5S, + @"BP7S" : kType_BP7S, + @"KN-550BT":kType_KN550, + @"KN550":kType_KN550, + @"HS4S" :kType_HS4, + @"HS4" :kType_HS4, + @"HS2" :kType_HS2, + @"ECG3":kType_ECG3, + @"FDTH":kType_BTM, + @"BG5S":kType_BG5S, + @"NT13B":kType_NT13B, + @"TS28B":kType_TS28B, + @"BG1S":kType_BG1S, + @"HS2S":kType_HS2S, + @"PO1":kType_PO1, + @"PT3SBT":kType_PT3SBT, + }; + + if (deviceNameForType[deviceName] && [self serialNumebr:userInfo]){ + NSString *sn = [self serialNumebr:userInfo]; + [self sendEventWithName:kEvent_Scan_Device body:@{@"mac":sn,@"type":deviceNameForType[deviceName]}]; + } +} + +#pragma mark 连接成功 BT\BLE都用这个通知 +- (BOOL)isIAPDevice:(NSString*)deviceName{ + NSArray *array = @[@"BP5",@"BP7",@"BG5",@"ECG"]; + if (deviceName && [array containsObject:deviceName]){ + return YES; + } else { + return NO; + } +} +-(void)deviceConnect:(NSNotification*)info { + + NSDictionary* userInfo = [info userInfo]; + NSLog(@"连接成功:%@",userInfo); + NSString* deviceName = userInfo[@"DeviceName"]; + + NSString* protocolString = userInfo[@"ProtocolString"]; + + if ([protocolString isEqualToString:@"NT13B_Protocol"]) { + deviceName=@"NT13B"; + } + + NSDictionary *deviceNameForType = @{ + @"AM3S" :kType_AM3S, + @"AM4" :kType_AM4, + @"AM5" :kType_AM5, + @"PO3":kType_PO3, + @"PO3M":kType_PO3, + @"BP3L" :kType_BP3L, + @"BP5S" : kType_BP5S, + @"BP7S" : kType_BP7S, + @"KN-550BT":kType_KN550, + @"KN550":kType_KN550, + @"HS4S" :kType_HS4, + @"HS4" :kType_HS4, + @"HS2" :kType_HS2, + @"FDTH":kType_BTM, + @"BP5":kType_BP5, + @"BP7":kType_BP7, + @"BG5":kType_BG5, + @"BG5S":kType_BG5S, + @"ECG3":kType_ECG3, + @"ECG":kType_ECG3USB,// ECG3USB的连接通知里使用的设备名称是ECG, + @"NT13B":kType_NT13B, + @"TS28B":kType_TS28B, + @"BG1S":kType_BG1S, + @"HS2S":kType_HS2S, + @"HS2S Pro":kType_HS2S_PRO, + @"PO1":kType_PO1, + @"PT3SBT":kType_PT3SBT, + }; + + if (deviceNameForType[deviceName] && [self serialNumebr:userInfo]){ + NSString *sn = [self serialNumebr:userInfo]; + if ([self isIAPDevice:deviceName]){ + [self sendEventWithName:kEvent_Scan_Device body:@{@"mac":sn,@"type":deviceNameForType[deviceName]}]; + } + [self sendEventWithName:kEvent_Device_Connected body:@{@"mac":sn,@"type":deviceNameForType[deviceName]}]; + } +} +#pragma mark 连接断开 BT\BLE都用这个通知 +-(void)deviceDisconnect:(NSNotification*)info { + NSDictionary* userInfo = [info userInfo]; + NSString* deviceName = userInfo[@"DeviceName"]; + + NSString* protocolString = userInfo[@"ProtocolString"]; + + if ([protocolString isEqualToString:@"NT13B_Protocol"]) { + deviceName=@"NT13B"; + } + + if ([protocolString isEqualToString:@"com.jiuan.PO1"]) { + deviceName=@"PO1"; + } + + NSDictionary *deviceNameForType = @{ + @"AM3S" :kType_AM3S, + @"AM4" :kType_AM4, + @"AM5" :kType_AM5, + @"PO3":kType_PO3, + @"PO3M":kType_PO3, + @"BP3L" :kType_BP3L, + @"BP5S" : kType_BP5S, + @"BP7S" : kType_BP7S, + @"KN-550BT":kType_KN550, + @"KN550":kType_KN550, + @"HS4S" :kType_HS4, + @"HS4" :kType_HS4, + @"HS2" :kType_HS2, + @"FDTH":kType_BTM, + @"BP5":kType_BP5, + @"BP7":kType_BP7, + @"BG5":kType_BG5, + @"BG5S":kType_BG5S, + @"ECG3":kType_ECG3, + @"ECG":kType_ECG3USB,// ECG3USB的连接通知里使用的设备名称是ECG, + @"NT13B":kType_NT13B, + @"TS28B":kType_TS28B, + @"BG1S":kType_BG1S, + @"HS2S":kType_HS2S, + @"HS2S Pro":kType_HS2S_PRO, + @"PO1":kType_PO1, + @"PT3SBT":kType_PT3SBT, + }; + + if (deviceNameForType[deviceName] && [self serialNumebr:userInfo]){ + NSString *sn = [self serialNumebr:userInfo]; + [self sendEventWithName:kEvent_Device_Disconnect body:@{@"mac":sn,@"type":deviceNameForType[deviceName]}]; + } +} +#pragma mark - 连接失败,BLE设备 +-(void)deviceConnectFailed:(NSNotification*)info { + NSDictionary* userInfo = [info userInfo]; + NSString* deviceName = userInfo[@"DeviceName"]; + + NSString* protocolString = userInfo[@"ProtocolString"]; + + if ([protocolString isEqualToString:@"NT13B_Protocol"]) { + deviceName=@"NT13B"; + } + + NSDictionary *deviceNameForType = @{ + @"AM3S" :kType_AM3S, + @"AM4" :kType_AM4, + @"AM5" :kType_AM5, + @"PO3":kType_PO3, + @"PO3M":kType_PO3, + @"BP3L" :kType_BP3L, + @"BP5S" : kType_BP5S, + @"BG5S" :kType_BG5S, + @"BP7S" : kType_BP7S, + @"KN-550BT":kType_KN550, + @"KN550":kType_KN550, + @"HS4S" :kType_HS4, + @"HS4" :kType_HS4, + @"HS2" :kType_HS2, + @"FDTH":kType_BTM, + @"ECG3":kType_ECG3, + @"NT13B":kType_NT13B, + @"TS28B":kType_TS28B, + @"BG1S":kType_BG1S, + @"HS2S":kType_HS2S, + @"HS2S Pro":kType_HS2S_PRO, + @"PO1":kType_PO1, + @"PT3SBT":kType_PT3SBT, + }; + + if (deviceNameForType[deviceName] && [self serialNumebr:userInfo]){ + NSString *sn = [self serialNumebr:userInfo]; + [self sendEventWithName:kEvent_Device_Connect_Failed body:@{@"mac":sn,@"type":deviceNameForType[deviceName]}]; + } +} + +#pragma mark - Method + +RCT_EXPORT_METHOD(sdkAuthWithLicense:(nonnull NSString *)license){ + + + NSArray * arr = [license componentsSeparatedByString:@"."]; + + + NSString*licenseName=[NSString stringWithFormat:@"%@",[arr objectAtIndex:0]]; + + + NSString *filePath = [[NSBundle mainBundle] pathForResource:licenseName ofType:@"pem"]; + + + NSData*data = [NSData dataWithContentsOfFile:filePath]; + + + + if (data!=nil) { + + [[IHSDKCloudUser commandGetSDKUserInstance] commandSDKUserValidationWithLicense:data UserDeviceAccess:^(NSArray *DeviceAccessArray) { + + NSLog(@"DeviceAccessArray :%@",DeviceAccessArray); + + } UserValidationSuccess:^(UserAuthenResult result) { + + if (result==UserAuthen_LoginSuccess || result==UserAuthen_RegisterSuccess|| result==UserAuthen_TrySuccess ) { + [self sendEventWithName:kEvent_Authenticate_Result body:@{@"access":@1}]; + }else{ + + [self sendEventWithName:kEvent_Authenticate_Result body:@{@"access":@0}]; + + } + + } DisposeErrorBlock:^(UserAuthenResult errorID) { + + [self sendEventWithName:kEvent_Authenticate_Result body:@{@"access":@0}]; + + + + + + }]; + + }else{ + + + [self sendEventWithName:kEvent_Authenticate_Result body:@{@"access":@0}]; + + } + + + + +} + +-(void)ensureInitialized { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSLog(@"iHealthScanner: *** ensureInitialized - registering observers ***"); + [ScanDeviceController commandGetInstance]; + + // AM3S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:AM3SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:AM3SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:AM3SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:AM3SDisConnectNoti object:nil]; + // AM4 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:AM4Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:AM4ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:AM4ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:AM4DisConnectNoti object:nil]; + // AM5 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:AM5Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:AM5ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:AM5ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:AM5DisConnectNoti object:nil]; + // PO3 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:PO3Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:PO3ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:PO3ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:PO3DisConnectNoti object:nil]; + // BP5 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP5ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP5DisConnectNoti object:nil]; + // BP7 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP7ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP7DisConnectNoti object:nil]; + // BP3L + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BP3LDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BP3LConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP3LConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP3LDisConnectNoti object:nil]; + // BP5S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BP5SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BP5SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP5SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP5SDisConnectNoti object:nil]; + // BP7S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BP7SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BP7SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BP7SDisConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BP7SConnectFailed object:nil]; + // KN550BT + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:KN550BTDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:KN550BTConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:KN550BTDisConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:KN550BTConnectFailed object:nil]; + // HS4S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:HS4Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:HS4ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:HS4ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:HS4DisConnectNoti object:nil]; + // HS2 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:HS2Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:HS2ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:HS2ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:HS2DisConnectNoti object:nil]; + // HS2S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:HS2SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:HS2SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:HS2SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:HS2SDisConnectNoti object:nil]; + // BG1 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(bg1Discover:) name:kNotificationNameNeedAudioPermission object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(bg1Connect:) name:kNotificationNameAudioDeviceInsert object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceBG1Disconnect:) name:kNotificationNameBG1DidDisConnect object:nil]; + // BG5 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BG5ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BG5DisConnectNoti object:nil]; + // BG5S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:kNotificationNameBG5SDidDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:kNotificationNameBG5SConnectFail object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:kNotificationNameBG5SConnectSuccess object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:kNotificationNameBG5SDidDisConnect object:nil]; + // ECG3 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:ECG3Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:ECG3ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:ECG3ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:ECG3DisConnectNoti object:nil]; + // ECG3USB + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:ECGUSBConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:ECGUSBDisConnectNoti object:nil]; + // BTM(THV3) + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:THV3Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:THV3ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:THV3ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:THV3DisConnectNoti object:nil]; + // NT13B + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:NT13BDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:NT13BConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:NT13BConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:NT13BDisConnectNoti object:nil]; + // TS28B + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(disconnectTS28B) name:@"disconnectTS28B" object:nil]; + // PO1 + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:PO1Discover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:PO1ConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:PO1ConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:PO1DisConnectNoti object:nil]; + // PT3SBT + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:PT3SBTDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:PT3SBTConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:PT3SBTConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:PT3SBTDisConnectNoti object:nil]; + // BG1S + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDiscover:) name:BG1SDiscover object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnectFailed:) name:BG1SConnectFailed object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceConnect:) name:BG1SConnectNoti object:nil]; + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(deviceDisconnect:) name:BG1SDisConnectNoti object:nil]; + + NSLog(@"iHealthScanner: *** ensureInitialized DONE ***"); + }); +} + +RCT_EXPORT_METHOD(startDiscovery:(nonnull NSString *)deviceType){ + [self ensureInitialized]; + NSLog(@"iHealthScanner: startDiscovery called with type=%@", deviceType); + if ([deviceType isEqualToString:kType_BP5]){ + + NSArray*bp5array = [[BP5Controller shareBP5Controller] getAllCurrentBP5Instace]; + if (bp5array.count) { + for (int i=0; i + * Range: [1, 2147483647(0x7FFFFFFF)] + */ + setUserId: function (mac, id) { + if (id < 1 || id > 0x7FFFFFFF) { + let result = { + "mac": mac, + "type": "AM3S", + "action": AMProfileModule.ACTION_ERROR_AM, + } + result[AMProfileModule.ERROR_NUM_AM] = AMProfileModule.ERROR_ID_ILLEGAL_ARGUMENT + result[AMProfileModule.ERROR_DESCRIPTION_AM] = 'setUserId() parameter id should be in the range [1, 2147483647(0x7FFFFFFF)]' + DeviceEventEmitter.emit(RCTModule.Event_Notify, result) + return + } + RCTModule.setUserId(mac, id) + }, + + /** + * Get user information + * @param {string} mac Device's mac address + */ + getUserInfo: function (mac) { + RCTModule.getUserInfo(mac) + }, + + /** + * Set user's BMR + * @param {string} mac Device's mac address + * @param {number} bmr User's BMR [1, 32767(0x7FFF)] + */ + setUserBmr: function (mac, bmr) { + RCTModule.setUserBmr(mac, bmr) + }, + + /** + * Get the activity data. + * @param {string} mac Device's mac address + */ + syncActivityData: function (mac) { + RCTModule.syncActivityData(mac) + }, + + /** + * Get the sleep data. + * @param {string} mac Device's mac address + */ + syncSleepData: function (mac) { + RCTModule.syncSleepData(mac) + }, + + /** + * Get current time activity data + * @param {string} mac Device's mac address + */ + syncRealData: function (mac) { + RCTModule.syncRealData(mac) + }, + + /** + * Set the system time to AM device. + * @param {string} mac Device's mac address + */ + syncRealTime: function (mac) { + RCTModule.syncRealTime(mac) + }, + + /** + * Set hour mode + * @param {string} mac Device's mac address + * @param {number} hourMode The value should be one of following: + *

            + *
          • {@link module:AMProfileModule.AM_SET_12_HOUR_MODE AMProfileModule.AM_SET_12_HOUR_MODE(0)}
          • + *
          • {@link module:AMProfileModule.AM_SET_24_HOUR_MODE AMProfileModule.AM_SET_24_HOUR_MODE(1)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE(2)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE(3)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE(4)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE(5)}
          • + *
          + */ + setHourMode: function (mac, hourMode) { + RCTModule.setHourMode(mac, hourMode) + }, + + /** + * Get hour mode + * @param {string} mac Device's mac address + */ + getHourMode: function (mac) { + RCTModule.getHourMode(mac) + }, + + /** + * Disconnect device + * @param {string} mac Device's mac address + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Set user information + * @param {string} mac Device's mac address + * @param {number} age User's age [1, 255] + * @param {number} height User's height(int in cm) [1, 255] + * @param {number} weight User's weight(float) [1.0, 255.0] + * @param {number} gender User's gender + * @param {number} unit Distance's unit type(kilometre or miles) + * @param {number} target The goal of maximum steps [4, 65535(0xFFFF)] + * @param {number} activityLevel The level of activity strength + */ + setUserInfo: function (mac, age, height, weight, gender, unit, target, activityLevel) { + RCTModule.setUserInfo(mac, age, height, weight, gender, unit, target, activityLevel) + }, + + /** + * Get stage report data + * @param {string} mac Device's mac address + */ + syncStageReportData: function (mac) { + RCTModule.syncStageReportData(mac) + }, + + /** + * Send random number to device to prepare for binding, the number will be displayed on the device. + * @param {string} mac Device's mac address + */ + sendRandom: function (mac) { + RCTModule.sendRandom(mac) + }, + + /** + * Get AM picture's index + * @param {string} mac Device's mac address + */ + getPicture: function (mac) { + RCTModule.getPicture(mac) + }, + + /** + * Set picture for AM + * @param {string} mac Device's mac address + * @param {number} index The index of picture + */ + setPicture: function (mac, index) { + RCTModule.setPicture(mac, index) + }, + + /** + * Get all connected AM3S device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, +} diff --git a/libs/ihealth-sdk/module/AM4Module.js b/libs/ihealth-sdk/module/AM4Module.js new file mode 100755 index 0000000..7cb44ff --- /dev/null +++ b/libs/ihealth-sdk/module/AM4Module.js @@ -0,0 +1,321 @@ +'use strict'; + + +var { + NativeModules, + DeviceEventEmitter +} = require('react-native'); + +var AMProfileModule = require('./AMProfileModule.js'); + +var RCTModule = NativeModules.AM4Module + +/** + * @module AM4Module + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get AM4 device's IDPS information. + * @param {string} mac Device's mac address + */ + getIdps: function (mac) { + RCTModule.getIdps(mac) + }, + + /** + * Reset AM4 device. + * @param {string} mac Device's mac address + */ + reset: function (mac) { + RCTModule.reset(mac) + }, + + /** + * Get user's ID + * @param {string} mac Device's mac address + */ + getUserId: function (mac) { + RCTModule.getUserId(mac) + }, + + /** + * Get alarms' count + * @param {string} mac Device's mac address + */ + getAlarmClockNum: function (mac) { + RCTModule.getAlarmClockNum(mac) + }, + + /** + * Get alarm information by id + * @param {string} mac Device's mac address + * @param {array} alarmIDArray Alarm id array to be query.
          + *
            + *
          • The parameters should be 1, 2, or 3
          • + *
          • The duplicate parameters will be IGNORED
          • + *
          • The query result will be in ascending order of id.
          • + *
          • If specified alarm not set yet, the result will not include the id.
          • + *
          + */ + getAlarmClockDetail: function (mac, alarmIDArray) { + RCTModule.getAlarmClockDetail(mac, alarmIDArray) + }, + + /** + * Set alarm + * @param {string} mac Device's mac address + * @param {number} id Alarm id
          + * Range: 1, 2 or 3 + * @param {number} hour Alarm hour part
          + * Range: [0, 23] + * @param {number} min Alarm minute part
          + * Range: [0, 59] + * @param {boolean} isRepeat Indicates whether it will repeat: + *
            + *
          • true indicates that it will repeat as the weeks parameter
          • + *
          • false indicates that it will only play one time and IGNORE the weeks parameter
          • + *
          + * @param {array} weekArray The days in a week to repeat the alarm, week[0~6] indicates Sun~Sat.
          + * And 1 indicates open, 0 indicates close.
          + * For example:
          + * {0, 1, 1, 1, 1, 1, 0} means the alarm will repeat on Mon, Tue, Wed, Thu, Fri. + * @param {boolean} isOn true if want to set the alarm, false to unset it. + */ + setAlarmClock: function (mac, id, hour, min, isRepeat, weekArray, isOn) { + RCTModule.setAlarmClock(mac, id, hour, min, isRepeat, weekArray, isOn) + }, + + /** + * Delete alarm by id + * @param {string} mac Device's mac address + * @param {number} id Alarm id(should be 1, 2 or 3) + */ + deleteAlarmClock: function (mac, id) { + RCTModule.deleteAlarmClock(mac, id) + }, + + /** + * Get activity remind setting. + * @param {string} mac Device's mac address + */ + getActivityRemind: function (mac) { + RCTModule.getActivityRemind(mac) + }, + + /** + * Set/Unset activity remind + * @param {string} mac Device's mac address + * @param {number} hour Activity remind hour part
          + * Range: [0, 23] + * @param {number} min Activity remind minute part
          + * Range:[0, 59] + * @param {boolean} isOn true if want to set activity remind, false to unset it. + */ + setActivityRemind: function (mac, hour, min, isOn) { + RCTModule.setActivityRemind(mac, hour, min, isOn) + }, + + /** + * Get device state and battery information + * @param {string} mac Device's mac address + */ + queryAMState: function (mac) { + RCTModule.queryAMState(mac) + }, + + /** + * Set user ID + * @param {string} mac Device's mac address + * @param {number} id new user id
          + * Range: [1, 2147483647(0x7FFFFFFF)] + */ + setUserId: function (mac, id) { + if (id < 1 || id > 0x7FFFFFFF) { + let result = { + "mac": mac, + "type": "AM4", + "action" : AMProfileModule.ACTION_ERROR_AM, + } + result[AMProfileModule.ERROR_NUM_AM] = AMProfileModule.ERROR_ID_ILLEGAL_ARGUMENT + result[AMProfileModule.ERROR_DESCRIPTION_AM] = 'setUserId() parameter id should be in the range [1, 2147483647(0x7FFFFFFF)]' + DeviceEventEmitter.emit(RCTModule.Event_Notify, result) + return + } + RCTModule.setUserId(mac, id) + }, + + /** + * Get user information + * @param {string} mac Device's mac address + */ + getUserInfo: function (mac) { + RCTModule.getUserInfo(mac) + }, + + /** + * Set user's BMR + * @param {string} mac Device's mac address + * @param {number} bmr User's BMR
          + * Range: [1, 32767(0x7FFF)] + */ + setUserBmr: function (mac, bmr) { + RCTModule.setUserBmr(mac, bmr) + }, + + /** + * Get the activity data. + * @param {string} mac Device's mac address + */ + syncActivityData: function (mac) { + RCTModule.syncActivityData(mac) + }, + + /** + * Get the sleep data. + * @param {string} mac Device's mac address + */ + syncSleepData: function (mac) { + RCTModule.syncSleepData(mac) + }, + + /** + * Get current time activity data. + * @param {string} mac Device's mac address + */ + syncRealData: function (mac) { + RCTModule.syncRealData(mac) + }, + + /** + * Set the system time to AM device. + * @param {string} mac Device's mac address + */ + syncRealTime: function (mac) { + RCTModule.syncRealTime(mac) + }, + + /** + * Set hour mode + * @param {string} mac Device's mac address + * @param {number} hourMode The value should be one of following: + *
            + *
          • {@link module:AMProfileModule.AM_SET_12_HOUR_MODE AMProfileModule.AM_SET_12_HOUR_MODE(0)}
          • + *
          • {@link module:AMProfileModule.AM_SET_24_HOUR_MODE AMProfileModule.AM_SET_24_HOUR_MODE(1)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE(2)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE(3)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE(4)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE(5)}
          • + *
          + */ + setHourMode: function (mac, hourMode) { + RCTModule.setHourMode(mac, hourMode) + }, + + /** + * Get hour mode + * @param {string} mac Device's mac address + */ + getHourMode: function (mac) { + RCTModule.getHourMode(mac) + }, + + /** + * Disconnect device + * @param {string} mac Device's mac address + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Set user information + * @param {string} mac Device's mac address + * @param {number} age User's age
          + * Range: [1, 255] + * @param {number} height User's height(int in cm)
          + * Range: [1, 255] + * @param {number} weight User's weight(float)
          + * Range: [1.0, 255.0] + * @param {number} gender User's gender
          + * Value: + *
            + *
          • {@link module:AMProfileModule.AM_SET_FEMALE AMProfileModule.AM_SET_FEMALE(0)}
          • + *
          • {@link module:AMProfileModule.AM_SET_MALE AMProfileModule.AM_SET_MALE(1)}
          • + *
          + * @param {number} unit Distance's unit type(kilometre or miles)
          + * Value: + *
            + *
          • {@link module:AMProfileModule.AM_SET_UNIT_IMPERIAL_STANDARD AMProfileModule.AM_SET_UNIT_IMPERIAL_STANDARD(0)} (miles)
          • + *
          • {@link module:AMProfileModule.AM_SET_UNIT_METRIC AMProfileModule.AM_SET_UNIT_METRIC(1)} (kilometre)
          • + *
          + * @param {number} target The goal of maximum steps
          + * Range: [4, 2147483647(0x7FFFFFFF)] + * @param {number} activityLevel The level of activity strength
          + *
            + *
          • 1 indicates sedentary
          • + *
          • 2 indicates active
          • + *
          • 3 indicates very active
          • + *
          + * @param {number} min swim target time(in minutes)
          + * Range: [1, 1439(23 * 60 + 59)] + */ + setUserInfo: function (mac, age, height, weight, gender, unit, target, activityLevel, min) { + RCTModule.setUserInfo(mac, age, height, weight, gender, unit, target, activityLevel, min) + }, + + /** + * Get stage report data + * @param {string} mac Device's mac address + */ + syncStageReportData: function (mac) { + RCTModule.syncStageReportData(mac) + }, + + /** + * Send random number to device to prepare for binding, the number will be displayed on the device. + * @param {string} mac Device's mac address + */ + sendRandom: function (mac) { + RCTModule.sendRandom(mac) + }, + + /** + * Get swim parameters + * @param {string} mac Device's mac address + */ + checkSwimPara: function (mac) { + RCTModule.checkSwimPara(mac) + }, + + /** + * Set swim parameters + * @param {string} mac Device's mac address + * @param {boolean} isOpen Set true to open swim function, set false to close it. + * @param {number} poolLength the swimming pool's length.
          + * Range: [1, 255] + * @param {number} hours The cut out time's hour part
          + * Range: [0, 23] + * @param {number} minutes The cut out time's minute part
          + * Range[0, 59] + * @param {number} unit The pool length's unit type(metre or yard). + *
            + *
          • {@link module:AMProfileModule.AM_SET_UNIT_IMPERIAL_STANDARD AMProfileModule.AM_SET_UNIT_IMPERIAL_STANDARD(0)} (yard)
          • + *
          • {@link module:AMProfileModule.AM_SET_UNIT_METRIC AMProfileModule.AM_SET_UNIT_METRIC(1)} (metre)
          • + *
          + */ + setSwimPara: function (mac, isOpen, poolLength, hours, minutes, unit) { + RCTModule.setSwimPara(mac, isOpen, poolLength, hours, minutes, unit) + }, + + /** + * Get all connected AM4 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, +} diff --git a/libs/ihealth-sdk/module/AM5Module.js b/libs/ihealth-sdk/module/AM5Module.js new file mode 100755 index 0000000..ab9f0ae --- /dev/null +++ b/libs/ihealth-sdk/module/AM5Module.js @@ -0,0 +1,150 @@ +'use strict'; + + +var { + NativeModules, + DeviceEventEmitter +} = require('react-native'); + +var AM5ProfileModule = require('./AM5ProfileModule.js'); + +var RCTModule = NativeModules.AM5Module + +/** + * @module AM5Module + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Binding apps and devices. + * AM5 devices must be bound one-to-one. If you want to use other devices, you must unbind them first and then bind them to other devices. + * @param {string} mac Device's mac address + */ + bindDevice: function (mac) { + RCTModule.bindDevice(mac) + }, + + /** + * UnBind apps and devices. + * @param {string} mac Device's mac address + */ + unBindDevice: function (mac) { + RCTModule.unBindDevice(mac) + }, + + /** + * Get information of the device + * @param {string} mac Device's mac address + */ + getBasicInfo: function (mac) { + RCTModule.getBasicInfo(mac) + }, + +// /** +// * Set time of the device +// * @param year year +// * @param month month +// * @param day day +// * @param hour hour +// * @param minute minute +// * @param second second +// * @param week What day is today? Effective Value 1-7 +// */ +// setTime: function (mac, year, month, day, minute, second, week) { +// RCTModule.setTime(mac, year, month, day, minute, second, week) +// }, + + /** + * Set current time of the device + */ + setTime: function (mac) { + RCTModule.setTime(mac) + }, + + /** + * Get the live data of the device + * @param {string} mac Device's mac address + * @param year Year of birth + * @param month Month of birth + * @param day Day of birth + * @param weight weight + * @param height height + * @param gander gender male: 1, female: 2 + */ + setUserInfo: function (mac, year, month, day, weight, height, gander) { + RCTModule.setUserInfo(mac, year, month, day, weight, height, gander) + }, + + /** + * Set unit + * When you never set them, treat them as defaults + * @param {string} mac Device's mac address + * @param type 0: Distance unit unit: 0 default ; 1 KM ; 2 MI + * @param type 1: Wight unit unit: 0 default ; 1 KG ; 2 LB ; 3 ST + * @param type 2: Temperature unit unit: 0 default ; 1 °C ; 2 °F + * @param type 3: Distance at each step unit: distance (cm) (default 0cm) + * @param type 4: Language unit: 0 default ; 1 zh ; 2 en ; 3 fr ; 4 de ; 5 it ; 6 es ; 7 ja ; 8 po ; 9 cz + * @param type 5: Time Mode unit: 0 default ; 1 24 hour system ; 2 12 hour system + * @param type 6: Distance at each step of run unit: distance (cm) (default 0cm) + * @param type 7: GPS calibration switch unit: 0 default ; 1 open ; 2 close + */ + setUnit: function (mac, type, unit) { + RCTModule.setUnit(mac, type, unit) + }, + + /** + * Reboot the device + * @param {string} mac Device's mac address + */ + reboot: function (mac) { + RCTModule.reboot(mac) + }, + + /** + * Set Hand Wear Mode + * @param {string} mac Device's mac address + * @param mode 0 left-hand 1 right-hand + */ + setHandWearMode: function (mac, mode) { + RCTModule.setHandWearMode(mac, mode) + }, + + /** + * Get the live data of the device + * @param {string} mac Device's mac address + */ + getLiveData: function (mac) { + RCTModule.getLiveData(mac) + }, + + /** + * Sync health data from device + * @param {string} mac Device's mac address + */ + syncHealthData: function (mac) { + RCTModule.syncHealthData(mac) + }, + + /** + * Stop sync health data from device + * @param {string} mac Device's mac address + */ + stopSyncHealthData: function (mac) { + RCTModule.stopSyncHealthData(mac) + }, + + /** + * Get all connected AM4 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, + + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, +} diff --git a/libs/ihealth-sdk/module/AM5ProfileModule.js b/libs/ihealth-sdk/module/AM5ProfileModule.js new file mode 100755 index 0000000..00621ea --- /dev/null +++ b/libs/ihealth-sdk/module/AM5ProfileModule.js @@ -0,0 +1,68 @@ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.AM5ProfileModule + +/** + * @module AM5ProfileModule + */ +module.exports = { + + ACTION_ERROR: RCTModule.ACTION_ERROR, + ERROR_NUM: RCTModule.ERROR_NUM, + ERROR_DESCRIPTION: RCTModule.ERROR_DESCRIPTION, + + ACTION_USER_BIND: RCTModule.ACTION_ERROR, + ACTION_USER_UNBIND: RCTModule.ACTION_ERROR, + ACTION_FUNCTION_SUPPORT: RCTModule.ACTION_ERROR, + ACTION_BASIC_INFO: RCTModule.ACTION_ERROR, + ACTION_MAC_ADDRESS: RCTModule.ACTION_ERROR, + + MAC_ADDRESS: RCTModule.MAC_ADDRESS, + BASIC_BATTSTATUS: RCTModule.BASIC_BATTSTATUS, + BASIC_DEIVCEID: RCTModule.BASIC_DEIVCEID, + BASIC_ENERGE: RCTModule.BASIC_ENERGE, + BASIC_FIRMWAREVERSION: RCTModule.BASIC_FIRMWAREVERSION, + BASIC_MODE: RCTModule.BASIC_MODE, + BASIC_PAIRFLAG: RCTModule.BASIC_PAIRFLAG, + BASIC_REBOOT: RCTModule.BASIC_REBOOT, + + ACTION_LIVE_DATA: RCTModule.ACTION_LIVE_DATA, + ACTION_ACTIVITY_COUNT: RCTModule.ACTION_ACTIVITY_COUNT, + ACTION_SET_TIME: RCTModule.ACTION_SET_TIME, + ACTION_SET_ALARM: RCTModule.ACTION_SET_ALARM, + ACTION_SET_GOAL: RCTModule.ACTION_SET_GOAL, + ACTION_SET_LONG_SIT: RCTModule.ACTION_SET_LONG_SIT, + ACTION_SET_USER_INFO: RCTModule.ACTION_SET_USER_INFO, + ACTION_SET_UNIT: RCTModule.ACTION_SET_UNIT, + ACTION_SET_HAND_WEAR_MODE: RCTModule.ACTION_SET_HAND_WEAR_MODE, + ACTION_SET_UP_HAND_GESTURE: RCTModule.ACTION_SET_UP_HAND_GESTURE, + ACTION_SET_HEART_RATE_INTERVAL: RCTModule.ACTION_SET_HEART_RATE_INTERVAL, + ACTION_SET_HEART_RATE_MEASURE_MODE: RCTModule.ACTION_SET_HEART_RATE_MEASURE_MODE, + ACTION_SET_ONE_KEY_RESET: RCTModule.ACTION_SET_ONE_KEY_RESET, + ACTION_SET_NOT_DISTURB: RCTModule.ACTION_SET_NOT_DISTURB, + ACTION_SET_SPORT_MODE: RCTModule.ACTION_SET_SPORT_MODE, + + OPERATION_RESULT: RCTModule.OPERATION_RESULT, + OPERATION_ACTION: RCTModule.OPERATION_ACTION, + + ACTION_NOTICE_COMMING_CALL: RCTModule.ACTION_NOTICE_COMMING_CALL, + ACTION_NOTICE_COMMING_CALL_STOP: RCTModule.ACTION_NOTICE_COMMING_CALL_STOP, + ACTION_NOTICE_NEW_MESSAGE: RCTModule.ACTION_NOTICE_NEW_MESSAGE, + + ACTION_SYNC_ACTIVITY: RCTModule.ACTION_SYNC_ACTIVITY, + ACTION_SYNC_ACTIVITY_DATA: RCTModule.ACTION_SYNC_ACTIVITY_DATA, + ACTION_SYNC_CONFIG: RCTModule.ACTION_SYNC_CONFIG, + ACTION_SYNC_HEALTH_DATA: RCTModule.ACTION_SYNC_HEALTH_DATA, + ACTION_SYNC_HEALTH_DATA_SPORT: RCTModule.ACTION_SYNC_HEALTH_DATA_SPORT, + ACTION_SYNC_HEALTH_DATA_SLEEP: RCTModule.ACTION_SYNC_HEALTH_DATA_SLEEP, + ACTION_SYNC_HEALTH_DATA_HEART_RATE: RCTModule.ACTION_SYNC_HEALTH_DATA_HEART_RATE, + ACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE: RCTModule.ACTION_SYNC_HEALTH_DATA_BLOOD_PRESSURE, + + OPERATION_STATUS: RCTModule.OPERATION_STATUS, + PROGRESS: RCTModule.PROGRESS, + + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/AMProfileModule.js b/libs/ihealth-sdk/module/AMProfileModule.js new file mode 100755 index 0000000..facb98b --- /dev/null +++ b/libs/ihealth-sdk/module/AMProfileModule.js @@ -0,0 +1,463 @@ +/** + * Created by Jeepend on 15/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.AMProfileModule + +/** + * @module AMProfileModule + */ +module.exports = { + + ACTION_ERROR_AM: RCTModule.ACTION_ERROR_AM, + ACTION_RESET_AM: RCTModule.ACTION_RESET_AM, + ACTION_USERID_AM: RCTModule.ACTION_USERID_AM, + ACTION_SET_USERID_SUCCESS_AM: RCTModule.ACTION_SET_USERID_SUCCESS_AM, + ACTION_SYNC_TIME_SUCCESS_AM: RCTModule.ACTION_SYNC_TIME_SUCCESS_AM, + ACTION_SET_USERINFO_SUCCESS_AM: RCTModule.ACTION_SET_USERINFO_SUCCESS_AM, + ACTION_GET_USERINFO_AM: RCTModule.ACTION_GET_USERINFO_AM, + ACTION_GET_ALARMNUM_AM: RCTModule.ACTION_GET_ALARMNUM_AM, + ACTION_GET_ALARMINFO_AM: RCTModule.ACTION_GET_ALARMINFO_AM, + ACTION_SET_ALARMINFO_SUCCESS_AM: RCTModule.ACTION_SET_ALARMINFO_SUCCESS_AM, + ACTION_DELETE_ALARM_SUCCESS_AM: RCTModule.ACTION_DELETE_ALARM_SUCCESS_AM, + ACTION_GET_ACTIVITY_REMIND_AM: RCTModule.ACTION_GET_ACTIVITY_REMIND_AM, + ACTION_SET_ACTIVITYREMIND_SUCCESS_AM: RCTModule.ACTION_SET_ACTIVITYREMIND_SUCCESS_AM, + ACTION_SYNC_ACTIVITY_DATA_AM: RCTModule.ACTION_SYNC_ACTIVITY_DATA_AM, + ACTION_SYNC_SLEEP_DATA_AM: RCTModule.ACTION_SYNC_SLEEP_DATA_AM, + ACTION_SYNC_STAGE_DATA_AM: RCTModule.ACTION_SYNC_STAGE_DATA_AM, + ACTION_QUERY_STATE_AM: RCTModule.ACTION_QUERY_STATE_AM, + ACTION_SYNC_REAL_DATA_AM: RCTModule.ACTION_SYNC_REAL_DATA_AM, + ACTION_SET_BMR_SUCCESS_AM: RCTModule.ACTION_SET_BMR_SUCCESS_AM, + ACTION_GET_SWIMINFO_AM: RCTModule.ACTION_GET_SWIMINFO_AM, + ACTION_SET_SWIMINFO_AM: RCTModule.ACTION_SET_SWIMINFO_AM, + ACTION_GET_RANDOM_AM: RCTModule.ACTION_GET_RANDOM_AM, + ACTION_SET_HOUR_MODE_SUCCESS_AM: RCTModule.ACTION_SET_HOUR_MODE_SUCCESS_AM, + ACTION_GET_HOUR_MODE_AM: RCTModule.ACTION_GET_HOUR_MODE_AM, + ACTION_SET_DEVICE_MODE_AM: RCTModule.ACTION_SET_DEVICE_MODE_AM, + ACTION_CLOUD_BINDING_AM_SUCCESS: RCTModule.ACTION_CLOUD_BINDING_AM_SUCCESS, + ACTION_CLOUD_BINDING_AM_FAIL: RCTModule.ACTION_CLOUD_BINDING_AM_FAIL, + ACTION_CLOUD_UNBINDING_AM_SUCCESS: RCTModule.ACTION_CLOUD_UNBINDING_AM_SUCCESS, + ACTION_CLOUD_UNBINDING_AM_FAIL: RCTModule.ACTION_CLOUD_UNBINDING_AM_FAIL, + ACTION_CLOUD_SEARCH_AM: RCTModule.ACTION_CLOUD_SEARCH_AM, + ACTION_CLOUD_SEARCH_FAIL_AM: RCTModule.ACTION_CLOUD_SEARCH_FAIL_AM, + ACTION_SET_PICTURE_SUCCESS_AM: RCTModule.ACTION_SET_PICTURE_SUCCESS_AM, + ACTION_GET_PICTURE_AM: RCTModule.ACTION_GET_PICTURE_AM, + + // Keys + ERROR_NUM_AM: RCTModule.ERROR_NUM_AM, + ERROR_ID_ILLEGAL_ARGUMENT: RCTModule.ERROR_ID_ILLEGAL_ARGUMENT, + ERROR_ID_VERSION_NOT_SUPPORT: RCTModule.ERROR_ID_VERSION_NOT_SUPPORT, + ERROR_DESCRIPTION_AM: RCTModule.ERROR_DESCRIPTION_AM, + RESET_AM: RCTModule.RESET_AM, + USERID_AM: RCTModule.USERID_AM, + GET_USER_AGE_AM: RCTModule.GET_USER_AGE_AM, + GET_USER_STEP_AM: RCTModule.GET_USER_STEP_AM, + GET_USER_HEIGHT_AM: RCTModule.GET_USER_HEIGHT_AM, + GET_USER_SEX_AM: RCTModule.GET_USER_SEX_AM, + GET_USER_WEIGHT_AM: RCTModule.GET_USER_WEIGHT_AM, + GET_USER_UNIT_AM: RCTModule.GET_USER_UNIT_AM, + GET_USER_TARGET1_AM: RCTModule.GET_USER_TARGET1_AM, + GET_USER_TARGET2_AM: RCTModule.GET_USER_TARGET2_AM, + GET_USER_TARGET3_AM: RCTModule.GET_USER_TARGET3_AM, + GET_USER_SWIMTARGET_AM: RCTModule.GET_USER_SWIMTARGET_AM, + GET_ALARMNUM_AM: RCTModule.GET_ALARMNUM_AM, + GET_ALARMNUM_ID_AM: RCTModule.GET_ALARMNUM_ID_AM, + GET_ALARM_CLOCK_DETAIL: RCTModule.GET_ALARM_CLOCK_DETAIL, + GET_ALARM_ID_AM: RCTModule.GET_ALARM_ID_AM, + GET_ALARM_TIME_AM: RCTModule.GET_ALARM_TIME_AM, + GET_ALARM_ISREPEAT_AM: RCTModule.GET_ALARM_ISREPEAT_AM, + GET_ALARM_WEEK_AM: RCTModule.GET_ALARM_WEEK_AM, + GET_ALARM_WEEK_SUNDAY_AM: RCTModule.GET_ALARM_WEEK_SUNDAY_AM, + GET_ALARM_WEEK_MONDAY_AM: RCTModule.GET_ALARM_WEEK_MONDAY_AM, + GET_ALARM_WEEK_TUESDAY_AM: RCTModule.GET_ALARM_WEEK_TUESDAY_AM, + GET_ALARM_WEEK_WEDNESDAY_AM: RCTModule.GET_ALARM_WEEK_WEDNESDAY_AM, + GET_ALARM_WEEK_THURSDAY_AM: RCTModule.GET_ALARM_WEEK_THURSDAY_AM, + GET_ALARM_WEEK_FRIDAY_AM: RCTModule.GET_ALARM_WEEK_FRIDAY_AM, + GET_ALARM_WEEK_SATURDAY_AM: RCTModule.GET_ALARM_WEEK_SATURDAY_AM, + GET_ALARM_ISON_AM: RCTModule.GET_ALARM_ISON_AM, + GET_ACTIVITY_REMIND_TIME_AM: RCTModule.GET_ACTIVITY_REMIND_TIME_AM, + GET_ACTIVITY_REMIND_ISON_AM: RCTModule.GET_ACTIVITY_REMIND_ISON_AM, + /** + * The key of the whole activity data.("activity") + */ + SYNC_ACTIVITY_DATA_AM: RCTModule.SYNC_ACTIVITY_DATA_AM, + /** + * The key of the time for every 5 min activity data.("time")
          + * Value format:
          + * yyyy-MM-dd HH:mm:ss
          + * Example:
          + * 2016-07-18 09:00:00 + */ + SYNC_ACTIVITY_DATA_TIME_AM: RCTModule.SYNC_ACTIVITY_DATA_TIME_AM, + /** + * The key of the step number for every 5 min activity data.("step")
          + * Value range:
          + * 0-4294967295(0xFFFFFFFF) + */ + SYNC_ACTIVITY_DATA_STEP_AM: RCTModule.SYNC_ACTIVITY_DATA_STEP_AM, + /** + * The key of the step length for every 5 min activity data.("stepsize")
          + * Value range:
          + * 0-255(0xFF) + */ + SYNC_ACTIVITY_DATA_STEP_LENGTH_AM: RCTModule.SYNC_ACTIVITY_DATA_STEP_LENGTH_AM, + /** + * The key of the calorie for every 5 min activity data.("calorie")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_ACTIVITY_DATA_CALORIE_AM: RCTModule.SYNC_ACTIVITY_DATA_CALORIE_AM, + /** + * The key of the whole data for every 5 min activity data.("activity_each_data") + */ + SYNC_ACTIVITY_EACH_DATA_AM: RCTModule.SYNC_ACTIVITY_EACH_DATA_AM, + /** + * The key of the whole sleep data.("sleep") + */ + SYNC_SLEEP_DATA_AM: RCTModule.SYNC_SLEEP_DATA_AM, + /** + * The key of the each 5 minute's sleep time.("time")
          + * Value format:
          + * yyyy-MM-dd HH:mm:ss + */ + SYNC_SLEEP_DATA_TIME_AM: RCTModule.SYNC_SLEEP_DATA_TIME_AM, + /** + * The key of the each 5 minute's sleep level.("level")
          + * Value:
          + *
            + *
          • 0 indicates awake
          • + *
          • 1 indicates light sleep
          • + *
          • 2 indicates deep sleep
          • + *
          + */ + SYNC_SLEEP_DATA_LEVEL_AM: RCTModule.SYNC_SLEEP_DATA_LEVEL_AM, + SYNC_SLEEP_EACH_DATA_AM: RCTModule.SYNC_SLEEP_EACH_DATA_AM, + /** + * The key of data array of the stage data.("stage_data") + */ + SYNC_STAGE_DATA_AM: RCTModule.SYNC_STAGE_DATA_AM, + SYNC_STAGE_DATA_TYPE_AM: RCTModule.SYNC_STAGE_DATA_TYPE_AM, + /** + * Type of work out.("stage_data_type_workout") + */ + SYNC_STAGE_DATA_TYPE_WORKOUT_AM: RCTModule.SYNC_STAGE_DATA_TYPE_WORKOUT_AM, + /** + * Type of sleep.("sleep") + */ + SYNC_STAGE_DATA_TYPE_SLEEP_AM: RCTModule.SYNC_STAGE_DATA_TYPE_SLEEP_AM, + /** + * Type of swim.("swim") + */ + SYNC_STAGE_DATA_TYPE_SWIM_AM: RCTModule.SYNC_STAGE_DATA_TYPE_SWIM_AM, + /** + * Type of page view summary.("page_view_summary") + */ + SYNC_STAGE_DATA_TYPE_PAGE_VIEW_SUMMARY: RCTModule.SYNC_STAGE_DATA_TYPE_PAGE_VIEW_SUMMARY, + /** + * The key of stage report stop time.("stoptime")
          + * Value format:
          + * yyyy-MM-dd HH:mm:ss + */ + SYNC_STAGE_DATA_STOP_TIME_AM: RCTModule.SYNC_STAGE_DATA_STOP_TIME_AM, + /** + * The key of stage report used time(in minutes).("usedtime")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_USED_TIME_AM: RCTModule.SYNC_STAGE_DATA_USED_TIME_AM, + /** + * The key of the step number of work out.("stage_data_workout_step")
          + * Value range:
          + * 0-4294967295(0xFFFFFFFF) + */ + SYNC_STAGE_DATA_WORKOUT_STEP_AM: RCTModule.SYNC_STAGE_DATA_WORKOUT_STEP_AM, + /** + * The key of the distance.("stage_data_distance")
          + * It's string type
          + * Value format&range:
          + * "123.456"("0.0"-"255.255"(0xFF.0xFF)) + */ + SYNC_STAGE_DATA_DISTANCE_AM: RCTModule.SYNC_STAGE_DATA_DISTANCE_AM, + /** + * The key of the calorie.("calorie")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_CALORIE_AM: RCTModule.SYNC_STAGE_DATA_CALORIE_AM, + /** + * The key of sleep efficiency.("sleepefficiency")
          + * Value range:
          + * 0.0-100.0 + */ + SYNC_STAGE_DATA_SLEEP_EFFICIENCY_AM: RCTModule.SYNC_STAGE_DATA_SLEEP_EFFICIENCY_AM, + /** + * The key of whether need to extend sleep 50 minutes or not.("is50min")
          + * Value:
          + *
            + *
          • 0 indicates not need to extend.
          • + *
          • 1 indicates need to extend.
          • + *
          + */ + SYNC_STAGE_DATA_SLEEP_IS50MIN_AM: RCTModule.SYNC_STAGE_DATA_SLEEP_IS50MIN_AM, + /** + * The key of swim stroke.("swimming stroke")
          + * Value:
          + *
            + *
          • 0 indicates freestyle.
          • + *
          • 1 indicates breaststroke.
          • + *
          • 2 indicates backstroke.
          • + *
          • 5 indicates unknown.
          • + *
          + */ + SYNC_STAGE_DATA_SWIM_STROKE_AM: RCTModule.SYNC_STAGE_DATA_SWIM_STROKE_AM, + /** + * The key of swim arm pulling time.("number of strokes")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_SWIM_PULL_TIMES_AM: RCTModule.SYNC_STAGE_DATA_SWIM_PULL_TIMES_AM, + /** + * The key of swim round number.("number of turns")
          + * Value range:
          + * 0-255(0xFF) + */ + SYNC_STAGE_DATA_SWIM_TURNS_AM: RCTModule.SYNC_STAGE_DATA_SWIM_TURNS_AM, + /** + * The key of the swimming pool length.("stage_data_swimpool_length")
          + * Value range:
          + * 0-255(0xFF) + */ + SYNC_STAGE_DATA_SWIMPOOL_LENGTH_AM: RCTModule.SYNC_STAGE_DATA_SWIMPOOL_LENGTH_AM, + /** + * The key of the time of cut in swim and begin swim(in minutes).("stage_data_cutindif")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_SWIM_CUTINDIF_AM: RCTModule.SYNC_STAGE_DATA_SWIM_CUTINDIF_AM, + /** + * The key of the time of cut out swim and end swim(in minutes).("stage_data_cutoutdif")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_SWIM_CUTOUTDIF_AM: RCTModule.SYNC_STAGE_DATA_SWIM_CUTOUTDIF_AM, + /** + * The key of the swim process flag.("stage_data_processflag")
          + * Value:
          + *
            + *
          • 0 indicates swim in process.
          • + *
          • 1 indicates start of swimming.
          • + *
          • 2 indicates end of swimming.
          • + *
          • 3 indicates the swim is only a single round.
          • + *
          + */ + SYNC_STAGE_DATA_SWIM_PROCESSFLAG_AM: RCTModule.SYNC_STAGE_DATA_SWIM_PROCESSFLAG_AM, + /** + * The key of the date of page view summary.("stage_data_view_summary_date")
          + * Value format:
          + * yyyy-MM-dd + */ + SYNC_STAGE_DATA_VIEW_SUMMARY_DATE_AM: RCTModule.SYNC_STAGE_DATA_VIEW_SUMMARY_DATE_AM, + /** + * The key of the count that user view the step page.("stage_data_view_summary_step")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_VIEW_SUMMARY_STEP_AM: RCTModule.SYNC_STAGE_DATA_VIEW_SUMMARY_STEP_AM, + /** + * The key of the count that user view the distance page.("stage_data_view_summary_distance")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_VIEW_SUMMARY_DISTANCE_AM: RCTModule.SYNC_STAGE_DATA_VIEW_SUMMARY_DISTANCE_AM, + /** + * The key of the count that user view the calorie page.("stage_data_view_summary_calorie")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_VIEW_SUMMARY_CALORIE_AM: RCTModule.SYNC_STAGE_DATA_VIEW_SUMMARY_CALORIE_AM, + /** + * The key of the count that user view the activity target page.("stage_data_view_summary_target")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_VIEW_SUMMARY_TARGET_AM: RCTModule.SYNC_STAGE_DATA_VIEW_SUMMARY_TARGET_AM, + /** + * The key of the count that user view the swim summary page.("stage_data_view_summary_swim")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_STAGE_DATA_VIEW_SUMMARY_SWIM_AM: RCTModule.SYNC_STAGE_DATA_VIEW_SUMMARY_SWIM_AM, + /** + * The key of state information.("query_state")
          + * Value:
          + *
            + *
          • 0 indicates waist
          • + *
          • 1 indicates wrist
          • + *
          • 2 indicates sleep
          • + *
          + */ + QUERY_STATE_AM: RCTModule.QUERY_STATE_AM, + /** + * The key of battery level.("battery")
          + * Value range:
          + * 0-10(10 indicates full) + */ + QUERY_BATTERY_AM: RCTModule.QUERY_BATTERY_AM, + /** + * The key of the real step count.("step")
          + * Value range:
          + * 0-4294967295(0xFFFFFFFF) + */ + SYNC_REAL_STEP_AM: RCTModule.SYNC_REAL_STEP_AM, + /** + * The key of the real calorie(not including BMR).("calorie")
          + * Value range:
          + * 0-65535(0xFFFF) + */ + SYNC_REAL_CALORIE_AM: RCTModule.SYNC_REAL_CALORIE_AM, + /** + * The key of the real summary calorie(including BMR).("totalcalories")
          + * Value range:
          + * 0-65535 + BMR(0xFFFF + BMR) + */ + SYNC_REAL_TOTALCALORIE_AM: RCTModule.SYNC_REAL_TOTALCALORIE_AM, + /** + * The key of swimming lane length.("get_swimlane_length")
          + * Value range:
          + * 0-255(0xFF) + */ + GET_SWIMLANE_LENGTH_AM: RCTModule.GET_SWIMLANE_LENGTH_AM, + /** + * The key of whether the swim function is open or not.("get_swim_switch_am")
          + * Value:
          + *
            + *
          • 0 indicates swim function closed
          • + *
          • 1/2 indicates swim function open
          • + *
          + */ + GET_SWIM_SWITCH_AM: RCTModule.GET_SWIM_SWITCH_AM, + /** + * The key of the hour part of cut out swim function.("get_swim_cutout_hour_am")
          + * Value range:
          + * 0-255(0xFF) + */ + GET_SWIM_CUTOUT_HOUR_AM: RCTModule.GET_SWIM_CUTOUT_HOUR_AM, + /** + * The key of the minute part of cut out swim function.("get_swim_cutout_min_am")
          + * Value range:
          + * 0-255(0xFF) + */ + GET_SWIM_CUTOUT_MINUTE_AM: RCTModule.GET_SWIM_CUTOUT_MINUTE_AM, + /** + * The key of swim unit type.("get_swim_unit_am")
          + * Value:
          + *
            + *
          • {@link module:AMProfileModule.AM_SET_UNIT_METRIC AMProfileModule.AM_SET_UNIT_METRIC(1)}
          • + *
          • {@link module:AMProfileModule.AM_SET_UNIT_IMPERIAL_STANDARD AMProfileModule.AM_SET_UNIT_IMPERIAL_STANDARD(0)}
          • + *
          + */ + GET_SWIM_UNIT_AM: RCTModule.GET_SWIM_UNIT_AM, + /** + * The key of the random number sent to device.("random")
          + * The value will be a 6-long number decimal string.
          + * Value range:
          + * "000000"-"999999" + */ + GET_RANDOM_AM: RCTModule.GET_RANDOM_AM, + AM_SWITCH_OPEN: RCTModule.AM_SWITCH_OPEN, + AM_SWITCH_CLOSE: RCTModule.AM_SWITCH_CLOSE, + AM_SWITCH_REPEAT: RCTModule.AM_SWITCH_REPEAT, + AM_SEITCH_NOT_REPEAT: RCTModule.AM_SEITCH_NOT_REPEAT, + /** + * The value indicates male.(1) + */ + AM_SET_MALE: RCTModule.AM_SET_MALE, + /** + * The value indicates female.(0) + */ + AM_SET_FEMALE: RCTModule.AM_SET_FEMALE, + /** + * The value indicates metric unit type(kilometre/metre).(1) + */ + AM_SET_UNIT_METRIC: RCTModule.AM_SET_UNIT_METRIC, + /** + * The value indicates imperial standard unit type(miles/yard).(0) + */ + AM_SET_UNIT_IMPERIAL_STANDARD: RCTModule.AM_SET_UNIT_IMPERIAL_STANDARD, + /** + * The value indicates whole world 12 hour mode(0) + */ + AM_SET_12_HOUR_MODE: RCTModule.AM_SET_12_HOUR_MODE, + /** + * The value indicates whole world 24 hour mode(1) + */ + AM_SET_24_HOUR_MODE: RCTModule.AM_SET_24_HOUR_MODE, + /** + * The value indicates Europe world 12 hour mode(3) + */ + AM_SET_EUROPE_12_HOUR_MODE: RCTModule.AM_SET_EUROPE_12_HOUR_MODE, + /** + * The value indicates Europe world 24 hour mode(5) + */ + AM_SET_EUROPE_24_HOUR_MODE: RCTModule.AM_SET_EUROPE_24_HOUR_MODE, + /** + * The value indicates except Europe world 12 hour mode(2) + */ + AM_SET_EXCEPT_EUROPE_12_HOUR_MODE: RCTModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE, + /** + * The value indicates except Europe world 24 hour mode(4) + */ + AM_SET_EXCEPT_EUROPE_24_HOUR_MODE: RCTModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE, + /** + * The key of the time mdoe.
          + * Value:
          + *
            + *
          • {@link module:AMProfileModule.AM_SET_12_HOUR_MODE AMProfileModule.AM_SET_12_HOUR_MODE(0)}
          • + *
          • {@link module:AMProfileModule.AM_SET_24_HOUR_MODE AMProfileModule.AM_SET_24_HOUR_MODE(1)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE(2)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE(3)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE(4)}
          • + *
          • {@link module:AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE(5)}
          • + *
          + */ + GET_HOUR_MODE_AM: RCTModule.GET_HOUR_MODE_AM, + /** + * Indicates device is sleep mode.(0) + */ + AM_DEVICE_MODE_SLEEP: RCTModule.AM_DEVICE_MODE_SLEEP, + /** + * Indicates device is activity mode.(1) + */ + AM_DEVICE_MODE_ACTIVITY: RCTModule.AM_DEVICE_MODE_ACTIVITY, + /** + * Indicates device is flight mode.(2) + */ + AM_DEVICE_MODE_FLIGHT: RCTModule.AM_DEVICE_MODE_FLIGHT, + /** + * Indicates device is driving mode.(3) + */ + AM_DEVICE_MODE_DRIVING: RCTModule.AM_DEVICE_MODE_DRIVING, + CLOUD_SEARCH_AM: RCTModule.CLOUD_SEARCH_AM, + /** + * The key of the MD5 hash of the data.("dataID") + */ + DATAID: RCTModule.DATAID, + /** + * The key of the picture index.("get_picture_am")
          + * Value:
          + *
            + *
          • 0 indicates the frog picture.
          • + *
          • 1 indicates the default picture.
          • + *
          + */ + GET_PICTURE_AM: RCTModule.GET_PICTURE_AM, + + /** + * Indicates get all connected devices. + */ + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/BG1Module.js b/libs/ihealth-sdk/module/BG1Module.js new file mode 100755 index 0000000..ed55f2c --- /dev/null +++ b/libs/ihealth-sdk/module/BG1Module.js @@ -0,0 +1,40 @@ +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BG1Module + +/** + * @module BG1Module + */ +module.exports = { + Event_Notify: RCTModule.Event_Notify, + + /** + * Send code to bg1 device + * @param {string} QRCode the result string of scanning strip bottle(ignore if use GDH strip) + * @param {int} stripType 1:GOD 2:GDH + * @param {int} measureType 1:Test with Blood 2:Test with control liquid (CTL) + */ + sendCode: function(QRCode, stripType, measureType) { + if (RCTModule != null) { + RCTModule.sendCode(QRCode, stripType, measureType); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Parse bottle info from QRCode, include strip expire time,strip number,bottle id + * @param {string} QRCode + */ + getBottleInfoFromQR: function(QRCode){ + if (RCTModule != null) { + RCTModule.getBottleInfoFromQR(QRCode); + }else { + console.log('~~~~~ RCTModule is null') + } + } + +} diff --git a/libs/ihealth-sdk/module/BG1ProfileModule.js b/libs/ihealth-sdk/module/BG1ProfileModule.js new file mode 100755 index 0000000..02f39dc --- /dev/null +++ b/libs/ihealth-sdk/module/BG1ProfileModule.js @@ -0,0 +1,90 @@ +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BG1ProfileModule + +/** + * @module BG1ProfileModule + */ +module.exports = { + + /** + * Callback indicating the send code result of bg1 device. + */ + ACTION_BG1_SENDCODE_RESULT:RCTModule.ACTION_BG1_SENDCODE_RESULT, + + /** + * The send code result of bg1 device. + * value : 0 success; other error + */ + BG1_SENDCODE_RESULT:RCTModule.BG1_SENDCODE_RESULT, + + /** + * Callback indicating the error of Bg1 device. + */ + ACTION_BG1_MEASURE_ERROR:RCTModule.ACTION_BG1_MEASURE_ERROR, + + /** + * Flag Error number of Bg1 device. + */ + BG1_MEASURE_ERROR:RCTModule.BG1_MEASURE_ERROR, + + /** + * Callback indicating the strip in action. + */ + ACTION_BG1_MEASURE_STRIP_IN:RCTModule.ACTION_BG1_MEASURE_STRIP_IN, + + /** + * Callback indicating the get blood action. + */ + ACTION_BG1_MEASURE_GET_BLOOD:RCTModule.ACTION_BG1_MEASURE_GET_BLOOD, + + /** + * Callback indicating the measure result. + */ + ACTION_BG1_MEASURE_RESULT:RCTModule.ACTION_BG1_MEASURE_RESULT, + + /** + * The measure result + * Range : 20-600 mg/dL + */ + BG1_MEASURE_RESULT:RCTModule.BG1_MEASURE_RESULT, + + /** + * Callback indicating the strip out action. + */ + ACTION_BG1_MEASURE_STRIP_OUT:RCTModule.ACTION_BG1_MEASURE_STRIP_OUT, + + /** + * Callback indicating the Bg1 device get in standby mode. + */ + ACTION_BG1_MEASURE_STANDBY:RCTModule.ACTION_BG1_MEASURE_STANDBY, + + /** + * the data id + */ + DATA_ID:RCTModule.DATA_ID, + + /** + * Callback indicating the code analysis result. + */ + 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 + +} diff --git a/libs/ihealth-sdk/module/BG1SModule.js b/libs/ihealth-sdk/module/BG1SModule.js new file mode 100644 index 0000000..e3b922b --- /dev/null +++ b/libs/ihealth-sdk/module/BG1SModule.js @@ -0,0 +1,48 @@ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.BG1SModule + + /** + * @module BG1SModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * listen getFunction + * @param {string} mac Device's mac address + */ + getFunction: function (mac) { + RCTModule.getFunction(mac) + }, + + + /** + * listen measurement + * @param {string} mac Device's mac address + */ + measure: function (mac, measureMode) { + RCTModule.measure(mac, measureMode) + }, + + /** + * Disconnect the BG1S + * @param mac The mac address for BG1S + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected BG1S device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} + diff --git a/libs/ihealth-sdk/module/BG1SProfileModule.js b/libs/ihealth-sdk/module/BG1SProfileModule.js new file mode 100644 index 0000000..c950330 --- /dev/null +++ b/libs/ihealth-sdk/module/BG1SProfileModule.js @@ -0,0 +1,30 @@ +'use strict'; + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BG1SProfileModule + +/** + * @module BG1SProfileModule + */ +module.exports = { + ACTION_GET_DEVICE_INFO: RCTModule.ACTION_GET_DEVICE_INFO, + INFO_BATTERY_BG1S: RCTModule.INFO_BATTERY_BG1S, + INFO_VERSION_CODE_BLOOD_BG1S: RCTModule.INFO_VERSION_CODE_BLOOD_BG1S, + INFO_VERSION_CODE_CTL_BG1S: RCTModule.INFO_VERSION_CODE_CTL_BG1S, + + ACTION_STRIP_INSERTION_STATUS: RCTModule.ACTION_STRIP_INSERTION_STATUS, + ACTION_GET_BLOOD: RCTModule.ACTION_GET_BLOOD, + + ACTION_SET_MEASURE_MODE: RCTModule.ACTION_SET_MEASURE_MODE, + + ACTION_MEASURE_RESULT: RCTModule.ACTION_SET_MEASURE_MODE, + 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/libs/ihealth-sdk/module/BG5Module.js b/libs/ihealth-sdk/module/BG5Module.js new file mode 100755 index 0000000..9e1f895 --- /dev/null +++ b/libs/ihealth-sdk/module/BG5Module.js @@ -0,0 +1,184 @@ +/** + * Created by gaoyuanlong on 16/11/17. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.BG5Module + +/** + * @module BG5Module + */ +module.exports = { + Event_Notify: RCTModule.Event_Notify, + + /** + * Keep BG5 connecting. + * @param {string} mac Device's mac address + */ + holdLink: function (mac){ + if (RCTModule != null) { + RCTModule.holdLink(mac); + } else { + console.log('~~~~~ BG5 holdLink RCTModule is null') + } + }, + + /** + * Get battery level of BG5 device. + * @param {string} mac Device's mac address + */ + getBattery: function (mac){ + if (RCTModule != null) { + RCTModule.getBattery(mac); + } else { + console.log('~~~~~ BG5 getBattery RCTModule is null') + } + }, + + /** + * Set time to BG5 device. + * @param {string} mac Device's mac address + */ + setTime: function (mac){ + if (RCTModule != null) { + RCTModule.setTime(mac); + } else { + console.log('~~~~~ BG5 setTime RCTModule is null') + } + }, + + /** + * Set unit to BG5 device. + * @param {string} mac Device's mac address + * @param {number} type 1:mmol/L 2:mg/dL + */ + setUnit: function (mac, type){ + if (RCTModule != null) { + RCTModule.setUnit(mac, type); + } else { + console.log('~~~~~ BG5 setUnit RCTModule is null') + } + }, + + /** + * Start measure with specific measure type. + * @param {string} mac Device's mac address + * @param {number} type Measure type, 1.Measure with blood measure, 2.Measure with control liquid + */ + startMeasure: function (mac, type){ + if (RCTModule != null) { + RCTModule.startMeasure(mac, type); + } else { + console.log('~~~~~ BG5 startMeasure RCTModule is null') + } + }, + + /** + * Get offline data of BG5 device. + * @param {string} mac Device's mac address + */ + getOfflineData: function (mac){ + if (RCTModule != null) { + RCTModule.getOfflineData(mac); + } else { + console.log('~~~~~ BG5 getOffineData RCTModule is null') + } + }, + + /** + * Delete the offline data in BG5 device. + * @param {string} mac Device's mac address + */ + deleteOfflineData: function (mac){ + if (RCTModule != null) { + RCTModule.deleteOfflineData(mac); + } else { + console.log('~~~~~ BG5 deleteOfflineData RCTModule is null') + } + }, + + /** + * Set bottle message to BG5 device. + * @param {string} mac Device's mac address + * @param {number} stripType GOD(value 1) or GDH(value 2) + * @param {number} measureType measure with blood(value 1) or measure with control liquid(value 2) + * @param {number} QRCode the QR code send to the deivce(GOD strip), GDH ignore + * @param {number} stripNum the left count of strip, range [1, 255] + * @param {string} overDate the expire time of the strip, format: yyyy-MM-dd, should be valid + */ + setBottleMessage: function (mac, stripType, measureType, QRCode, stripNum, overDate){ + if (RCTModule != null) { + RCTModule.setBottleMessageWithInfo(mac, stripType, measureType, QRCode, stripNum, overDate); + } else { + console.log('~~~~~ BG5 setBottleMessage RCTModule is null') + } + }, + + /** + * Get bottle message from BG5 device. + * @param {string} mac Device's mac address + */ + getBottleMessage: function (mac){ + if (RCTModule != null) { + RCTModule.getBottleMessage(mac); + } else { + console.log('~~~~~ BG5 getBottleMessage RCTModule is null') + } + }, + + /** + * Set bottleId to BG5 device. + * @param {string} mac Device's mac address + * @param {string} ID UserID set to device + */ + setBottleID: function (mac, ID){ + if (RCTModule != null) { + RCTModule.setBottleId(mac, ID); + } else { + console.log('~~~~~ BG5 setBottleID RCTModule is null') + } + }, + + /** + * Get bottleId from BG5 device. + * @param {string} mac Device's mac address + */ + getBottleID: function (mac){ + if (RCTModule != null) { + RCTModule.getBottleId(mac); + } else { + console.log('~~~~~ BG5 getBottleID RCTModule is null') + } + }, + + disConnect: function (mac){ + if (RCTModule != null) { + RCTModule.disConnect(mac); + } else { + console.log('~~~~~ BG5 getBottleID RCTModule is null') + } + }, + + /** + * Parse bottle info from QRCode, include strip expire time,strip number,bottle id + * @param {string} QRCode + */ + getBottleInfoFromQR: function(QRCode){ + if (RCTModule != null) { + RCTModule.getBottleInfoFromQR(QRCode); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + /** + * Get all connected BG5 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, +} diff --git a/libs/ihealth-sdk/module/BG5SModule.js b/libs/ihealth-sdk/module/BG5SModule.js new file mode 100644 index 0000000..28ee38d --- /dev/null +++ b/libs/ihealth-sdk/module/BG5SModule.js @@ -0,0 +1,145 @@ +/** + * @author chenxuewei + */ +'use strict'; + + +var { NativeModules, Platform } = require('react-native'); + +var RCTModule = NativeModules.BG5SModule; + +/** + * @module BG5SModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get status information of BG5 device. + * @param {string} mac Device's mac address + */ + getStatusInfo: function (mac){ + + if (RCTModule != null) { + RCTModule.getStatusInfo(mac); + } else { + console.log('~~~~~ BG5S getStatusInfo RCTModule is null') + } + }, + + /** + * Set time to BG5 device. + * @param {string} mac Device's mac address + */ + setTime: function (mac, date, timezone){ + if (RCTModule != null) { + RCTModule.setTime(mac, date, timezone); + } else { + console.log('~~~~~ BG5S setTime RCTModule is null') + } + }, + + /** + * Set unit to BG5 device. + * @param {string} mac Device's mac address + * @param {number} type 1:mmol/L 2:mg/dL + */ + setUnit: function (mac, type){ + if (RCTModule != null) { + RCTModule.setUnit(mac, type); + } else { + console.log('~~~~~ BG5S setUnit RCTModule is null') + } + }, + + /** + * Delete the offline data in BG5 device. + * @param {string} mac Device's mac address + */ + deleteUsedStrip: function (mac){ + if (RCTModule != null) { + RCTModule.deleteUsedStrip(mac); + } else { + console.log('~~~~~ BG5S deleteUsedStrip RCTModule is null') + } + }, + + /** + * Delete the offline data in BG5 device. + * @param {string} mac Device's mac address + */ + deleteOfflineData: function (mac){ + if (RCTModule != null) { + RCTModule.deleteOfflineData(mac); + } else { + console.log('~~~~~ BG5S deleteOfflineData RCTModule is null') + } + }, + + /** + * Delete the offline data in BG5 device. + * @param {string} mac Device's mac address + */ + getOfflineData: function (mac){ + if (RCTModule != null) { + RCTModule.getOfflineData(mac); + } else { + console.log('~~~~~ BG5S getOfflineData RCTModule is null') + } + }, + + /** + * Start measure with specific measure type. + * @param {string} mac Device's mac address + * @param {number} type Measure type, 1.Measure with blood measure, 2.Measure with control liquid + */ + startMeasure: function (mac, type){ + if (RCTModule != null) { + RCTModule.startMeasure(mac, type); + } else { + console.log('~~~~~ BG5S startMeasure RCTModule is null') + } + }, + + /** + * Get offline data of BG5 device. + * @param {string} mac Device's mac address + */ + adjustOfflineData: function (mac, timeString, originData){ + if (RCTModule != null) { + RCTModule.adjustOfflineData(mac, timeString, originData); + } else { + console.log('~~~~~ BG5S adjustOfflineData RCTModule is null') + } + }, + + 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'){ + RCTModule.disConnect(mac); + } else { + RCTModule.disconnect(mac); + } + } else { + console.log('~~~~~ BG5S disConnect RCTModule is null') + } + }, + + /** + * Get all connected BG5S device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, +} diff --git a/libs/ihealth-sdk/module/BG5SProfileModule.js b/libs/ihealth-sdk/module/BG5SProfileModule.js new file mode 100644 index 0000000..9e09542 --- /dev/null +++ b/libs/ihealth-sdk/module/BG5SProfileModule.js @@ -0,0 +1,401 @@ +/** + * Created by gaoyuanlong on 16/11/16. + */ +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BG5SProfileModule + +/** + * @module BG5SProfileModule + */ +module.exports = { + + /** + * The action value of event indicating the error of BG device.
          + */ + 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_GET_STATUS_INFO: RCTModule.ACTION_GET_STATUS_INFO, + + /** + * 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 +} 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 +} diff --git a/libs/ihealth-sdk/module/BP3LModule.js b/libs/ihealth-sdk/module/BP3LModule.js new file mode 100755 index 0000000..27bca9a --- /dev/null +++ b/libs/ihealth-sdk/module/BP3LModule.js @@ -0,0 +1,75 @@ +/** + * Created by zhangxu on 16/11/14. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.BP3LModule; + +/** + * @module BP3LModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Start measure blood pressure monitor + * @param {string} mac Device's mac address + */ + startMeasure: function (mac) { + if (RCTModule != null) { + RCTModule.startMeasure(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + + /** + * Cancel the measuring process immediately if device is in measuring state. + * @param {string} mac Device's mac address + */ + stopMeasure: function (mac) { + if (RCTModule != null) { + RCTModule.stopMeasure(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get the BP3L device's battery. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + if (RCTModule != null) { + RCTModule.getBattery(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Disconnect the BP3L + * @param {string} mac Device's mac address + */ + disconnect: function (mac) { + if (RCTModule != null) { + RCTModule.disconnect(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get all connected AM3S device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} diff --git a/libs/ihealth-sdk/module/BP550BTModule.js b/libs/ihealth-sdk/module/BP550BTModule.js new file mode 100755 index 0000000..126e245 --- /dev/null +++ b/libs/ihealth-sdk/module/BP550BTModule.js @@ -0,0 +1,90 @@ +/** + * Created by zhangxu on 16/11/20. + */ +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BP550BTModule; + +/** + * @module BP550BTModule + */ + +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get the BP550BT device's battery. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + if (RCTModule != null) { + RCTModule.getBattery(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + + }, + + /** + * get offline data number. + * @param {string} mac Device's mac address + */ + getOffLineNum: function (mac) { + if (RCTModule != null) { + RCTModule.getOffLineNum(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get offline data number. + * @param {string} mac Device's mac address + */ + getOffLineData: function (mac) { + if (RCTModule != null) { + RCTModule.getOffLineData(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get the KN-550BT device's functionInfo. + * @param {string} mac Device's mac address + */ + getFunctionInfo: function (mac) { + if (RCTModule != null) { + RCTModule.getFunctionInfo(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Disconnect the KN-550BT + * + * @param {string} mac Device's mac address + */ + disconnect: function (mac) { + if (RCTModule != null) { + RCTModule.disconnect(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get all connected BP550BT device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} + diff --git a/libs/ihealth-sdk/module/BP5Module.js b/libs/ihealth-sdk/module/BP5Module.js new file mode 100755 index 0000000..1dbc7ff --- /dev/null +++ b/libs/ihealth-sdk/module/BP5Module.js @@ -0,0 +1,125 @@ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.BP5Module + +/** + * @module BP5Module + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Start measure blood pressure monitor + * @param {string} mac Device's mac address + */ + + startMeasure: function (mac) { + RCTModule.startMeasure(mac) + }, + + /** + * Cancel the measuring process immediately if device is in measuring state. + * @param {string} mac Device's mac address + */ + stopMeasure: function (mac) { + RCTModule.stopMeasure(mac) + }, + + /** + * Get the BP5 device's battery. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + if (RCTModule != null) { + RCTModule.getBattery(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Enable device can measure offline . + * @param {string} mac Device's mac address + */ + enbleOffline: function (mac) { + if (RCTModule != null) { + RCTModule.enbleOffline(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Enable device can't measure offline . + * @param {string} mac Device's mac address + */ + disableOffline: function (mac) { + if (RCTModule != null) { + RCTModule.disableOffline(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Enable device can't measure offline. + * @param {string} mac Device's mac address + */ + isEnableOffline: function (mac) { + if (RCTModule != null) { + RCTModule.isEnableOffline(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get offline data number. (iOS not support) + * @param {string} mac Device's mac address + */ + getOfflineNum: function (mac) { + if (RCTModule != null) { + RCTModule.getOfflineNum(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get offline data. + * @param {string} mac Device's mac address + */ + getOfflineData: function (mac) { + if (RCTModule != null) { + RCTModule.getOfflineData(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Disconnect the BP5 (iOS not support) + * + * @param {string} mac Device's mac address + */ + disconnect: function (mac) { + if (RCTModule != null) { + RCTModule.disconnect(mac); + } else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get all connected BP5 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} diff --git a/libs/ihealth-sdk/module/BP5SModule.js b/libs/ihealth-sdk/module/BP5SModule.js new file mode 100755 index 0000000..9c115ea --- /dev/null +++ b/libs/ihealth-sdk/module/BP5SModule.js @@ -0,0 +1,139 @@ +/** + * Created by chenxuewei on 04/05/2019. + */ + +'use strict'; + + +var { NativeModules, Platform } = require('react-native'); + +var RCTModule = NativeModules.BP5SModule; + +/** + * @module BP5SModule + */ + +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + startMeasure: (mac) => { + if (RCTModule != null) { + RCTModule.startMeasure(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + stopMeasure: (mac) => { + if (RCTModule != null) { + RCTModule.stopMeasure(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + + }, + + deleteData: (mac) => { + if (RCTModule != null) { + RCTModule.deleteData(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + enbleOffline: (mac, mode) => { + if (RCTModule != null) { + RCTModule.enbleOffline(mac, mode); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + + /** + * Get the BP7S device's battery. + * @param {string} mac Device's mac address + */ + getBattery: (mac) => { + if (RCTModule != null) { + RCTModule.getBattery(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get offline data number. + * @param {string} mac Device's mac address + */ + getOffLineNum: (mac) => { + if (RCTModule != null) { + RCTModule.getOffLineNum(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get offline data number. + * @param {string} mac Device's mac address + */ + getOffLineData: (mac) => { + if (RCTModule != null) { + RCTModule.getOffLineData(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Set BP7S device unit. + * @param {string} mac Device's mac address + * @param {int} unit 0:mmHg,1:kPa + */ + setUnit: (mac, unit) => { + if (RCTModule != null) { + RCTModule.setUnit(mac, unit); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get the BP7S device's functionInfo. + * @param {string} mac Device's mac address + */ + + getFunctionInfo: (mac) => { + if (RCTModule != null) { + RCTModule.getFunctionInfo(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + + /** + * Disconnect the BP5S + * + * @param {string} mac Device's mac address + */ + + disconnect: (mac) => { + if (RCTModule != null) { + RCTModule.disconnect(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get all connected BP5S device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: () => { + RCTModule.getAllConnectedDevices() + } +}; diff --git a/libs/ihealth-sdk/module/BP7Module.js b/libs/ihealth-sdk/module/BP7Module.js new file mode 100755 index 0000000..bfd2852 --- /dev/null +++ b/libs/ihealth-sdk/module/BP7Module.js @@ -0,0 +1,149 @@ +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BP7Module; + +/** + * @module BP7Module + */ + +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get the BP7 device's battery. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + if (RCTModule != null) { + RCTModule.getBattery(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Start bp7 measurement. + * @param {string} mac Device's mac address + * @param {int} unit 0:mmHg,1:kPa + */ + startMeasure: function(mac){ + if (RCTModule != null) { + RCTModule.startMeasure(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Stop bp7 measurement. + * @param {string} mac Device's mac address + */ + stopMeasure: function (mac) { + if (RCTModule != null) { + RCTModule.stopMeasure(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Enable offline measurement mode. + * @param {string} mac Device's mac address + */ + enableOfflineMeasurement: function (mac) { + if (RCTModule != null) { + RCTModule.enableOfflineMeasurement(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Disable offline measurement mode. + * @param {string} mac Device's mac address + */ + disableOfflineMeasurement: function (mac) { + if (RCTModule != null) { + RCTModule.disableOfflineMeasurement(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get the count of offline data. + * @param {string} mac Device's mac address + */ + getOfflineNum: function (mac) { + if (RCTModule != null) { + RCTModule.getOfflineNum(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get offline data number. + * @param {string} mac Device's mac address + */ + getOfflineData: function (mac) { + if (RCTModule != null) { + RCTModule.getOfflineData(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Check offline measurement mode. + * @param {string} mac Device's mac address + * @param {int} unit 0:mmHg,1:kPa + */ + isEnableOffline: function(mac, unit){ + if (RCTModule != null) { + RCTModule.isEnableOffline(mac, unit); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Set BP7 device unit. + * @param {string} mac Device's mac address + * @param {int} unit 0:mmHg,1:kPa + */ + conformAngle: function(mac){ + if (RCTModule != null) { + RCTModule.conformAngle(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Disconnect the BP7 + * + * @param {string} mac Device's mac address + */ + + disconnect: function (mac) { + if (RCTModule != null) { + RCTModule.disconnect(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get all connected BP7 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +}; diff --git a/libs/ihealth-sdk/module/BP7SModule.js b/libs/ihealth-sdk/module/BP7SModule.js new file mode 100755 index 0000000..e2be830 --- /dev/null +++ b/libs/ihealth-sdk/module/BP7SModule.js @@ -0,0 +1,121 @@ +/** + * Created by zhangxu on 16/11/20. + */ + +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BP7SModule; + +/** + * @module BP7SModule + */ + +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get the BP7S device's battery. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + if (RCTModule != null) { + RCTModule.getBattery(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get offline data number. + * @param {string} mac Device's mac address + */ + getOffLineNum:function (mac) { + if (RCTModule != null) { + RCTModule.getOffLineNum(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * get offline data number. + * @param {string} mac Device's mac address + */ + getOffLineData:function (mac) { + if (RCTModule != null) { + RCTModule.getOffLineData(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Set BP7S device unit. + * @param {string} mac Device's mac address + * @param {int} unit 0:mmHg,1:kPa + */ + setUnit:function (mac, unit){ + if (RCTModule != null) { + RCTModule.setUnit(mac,unit); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Set BP7S device angle. + * @param {string} mac Device's mac address + * @param {int} leftUpper the maximum measure angle of left hand, the maximum value must less than 90. + * @param {int} leftLows the minimum measure angle of left hand, the minimum value must more than 0, and less than leftUpper. + * @param {int} rightUpper the maximum measure angle of right hand, the maximum value must less than 90. + * @param {int} rightLow the minimum measure angle of right hand, the minimum value must more than 0, and less than rightUpper. + * + */ + angleSet:function (mac, leftUpper, leftLows, rightUpper, rightLow) { + if (RCTModule != null) { + RCTModule.angleSet(mac,leftUpper,leftLows,rightUpper,rightLow); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get the BP7S device's functionInfo. + * @param {string} mac Device's mac address + */ + getFunctionInfo:function (mac) { + if (RCTModule != null) { + RCTModule.getFunctionInfo(mac); + }else { + sconsole.log('~~~~~ RCTModule is null') + } + }, + + /** + * Disconnect the BP7S + * + * @param {string} mac Device's mac address + */ + + disconnect: function (mac) { + + if (RCTModule != null) { + RCTModule.disconnect(mac); + }else { + console.log('~~~~~ RCTModule is null') + } + }, + + /** + * Get all connected BP7S device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +}; diff --git a/libs/ihealth-sdk/module/BPProfileModule.js b/libs/ihealth-sdk/module/BPProfileModule.js new file mode 100755 index 0000000..4cee41a --- /dev/null +++ b/libs/ihealth-sdk/module/BPProfileModule.js @@ -0,0 +1,69 @@ +/** + * Created by zhangxu on 16/11/16. + */ +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.BPProfileModule + +/** + * @module BPProfileModule + */ +module.exports = { + + ACTION_ERROR_BP:RCTModule.ACTION_ERROR_BP, + ERROR_NUM_BP:RCTModule.ERROR_NUM_BP, + ERROR_DESCRIPTION_BP:RCTModule.ERROR_DESCRIPTION_BP, + + ACTION_BATTERY_BP:RCTModule.ACTION_BATTERY_BP, + BATTERY_BP:RCTModule.BATTERY_BP, + + ACTION_ZOREING_BP:RCTModule.ACTION_ZOREING_BP, + ACTION_ZOREOVER_BP:RCTModule.ACTION_ZOREOVER_BP, + ACTION_ONLINE_PRESSURE_BP:RCTModule.ACTION_ONLINE_PRESSURE_BP, + BLOOD_PRESSURE_BP:RCTModule.BLOOD_PRESSURE_BP, + ACTION_ONLINE_PULSEWAVE_BP:RCTModule.ACTION_ONLINE_PULSEWAVE_BP, + FLAG_HEARTBEAT_BP:RCTModule.FLAG_HEARTBEAT_BP, + PULSEWAVE_BP:RCTModule.PULSEWAVE_BP, + ACTION_ONLINE_RESULT_BP:RCTModule.ACTION_ONLINE_RESULT_BP, + HIGH_BLOOD_PRESSURE_BP:RCTModule.HIGH_BLOOD_PRESSURE_BP, + LOW_BLOOD_PRESSURE_BP:RCTModule.LOW_BLOOD_PRESSURE_BP, + PULSE_BP:RCTModule.PULSE_BP, + MEASUREMENT_AHR_BP:RCTModule.MEASUREMENT_AHR_BP, + MEASUREMENT_HSD_BP:RCTModule.MEASUREMENT_HSD_BP, + DATAID:RCTModule.DATAID, + + ACTION_HISTORICAL_NUM_BP:RCTModule.ACTION_HISTORICAL_NUM_BP, + HISTORICAL_NUM_BP:RCTModule.HISTORICAL_NUM_BP, + + ACTION_HISTORICAL_DATA_BP:RCTModule.ACTION_HISTORICAL_DATA_BP, + HISTORICAL_DATA_BP:RCTModule.HISTORICAL_DATA_BP, + MEASUREMENT_DATE_BP:RCTModule.MEASUREMENT_DATE_BP, + MEASUREMENT_STRAT_ANGLE_BP:RCTModule.MEASUREMENT_STRAT_ANGLE_BP, + MEASUREMENT_ANGLE_CHANGE_BP:RCTModule.MEASUREMENT_ANGLE_CHANGE_BP, + MEASUREMENT_HAND_BP:RCTModule.MEASUREMENT_HAND_BP, + ACTION_HISTORICAL_OVER_BP:RCTModule.ACTION_HISTORICAL_OVER_BP, + + ACTION_FUNCTION_INFORMATION_BP:RCTModule.ACTION_FUNCTION_INFORMATION_BP, + FUNCTION_IS_UPAIR_MEASURE:RCTModule.FUNCTION_IS_UPAIR_MEASURE, + FUNCTION_IS_ARM_MEASURE:RCTModule.FUNCTION_IS_ARM_MEASURE, + FUNCTION_HAVE_ANGLE_SENSOR:RCTModule.FUNCTION_HAVE_ANGLE_SENSOR, + FUNCTION_HAVE_OFFLINE:RCTModule.FUNCTION_HAVE_OFFLINE, + FUNCTION_HAVE_HSD:RCTModule.FUNCTION_HAVE_HSD, + FUNCTION_HAVE_ANGLE_SETTING:RCTModule.FUNCTION_HAVE_ANGLE_SETTING, + FUNCTION_IS_MULTI_UPLOAD:RCTModule.FUNCTION_IS_MULTI_UPLOAD, + FUNCTION_HAVE_SELF_UPDATE:RCTModule.FUNCTION_HAVE_SELF_UPDATE, + + ACTION_SET_UNIT_SUCCESS_BP:RCTModule.ACTION_SET_UNIT_SUCCESS_BP, + ACTION_SET_ANGLE_SUCCESS_BP:RCTModule.ACTION_SET_ANGLE_SUCCESS_BP, + ACTION_ENABLE_OFFLINE_BP:RCTModule.ACTION_ENABLE_OFFLINE_BP, + ACTION_DISENABLE_OFFLINE_BP:RCTModule.ACTION_DISENABLE_OFFLINE_BP, + ACTION_IS_ENABLE_OFFLINE:RCTModule.ACTION_IS_ENABLE_OFFLINE, + + IS_ENABLE_OFFLINE:RCTModule.IS_ENABLE_OFFLINE, + + ACTION_INTERRUPTED_BP:RCTModule.ACTION_INTERRUPTED_BP, + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/BTMModule.js b/libs/ihealth-sdk/module/BTMModule.js new file mode 100755 index 0000000..d7601d5 --- /dev/null +++ b/libs/ihealth-sdk/module/BTMModule.js @@ -0,0 +1,88 @@ +/** + * Created by lixuesong on 11/11/2016. + */ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.BTMModule + + /** + * @module BTMModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get the BTM battery status. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + RCTModule.getBattery(mac) + }, + + /** + * Get the value of historical data in the BTM. + * @param {string} mac Device's mac address + */ + getMemoryData: function (mac) { + RCTModule.getMemoryData(mac) + }, + + /** + * Set the standby time + * @param {string} mac Device's mac address + * @param {number} hour Standby time hours [0, 23] + * @param {number} minute Standby time minute [0, 59] + * @param {number} second Standby time second [0, 59] + */ + setStandbyTime: function (mac, hour, minute, second) { + RCTModule.setStandbyTime(mac, hour, minute, second) + }, + + /** + * Set the temperature unit + * @param {string} mac Device's mac address + * @param {number} unit temperature unit
      + * The unit of: BtmControl.TEMPERATURE_UNIT_C or BtmControl.TEMPERATURE_UNIT_F + */ + setTemperatureUnit: function (mac, unit) { + RCTModule.setTemperatureUnit(mac, unit) + }, + + /** + * Set the measuring target + * @param {string} mac Device's mac address + * @param {number} measuring target + */ + setMeasuringTarget: function (mac, target) { + RCTModule.setMeasuringTarget(mac, target) + }, + + /** + * Set the offline target + * @param {string} mac Device's mac address + * @param {number} measuring target + */ + setOfflineTarget: function (mac, target) { + RCTModule.setOfflineTarget(mac, target) + }, + + /** + * Disconnect the BTM + * @param mac The mac address for BTM + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected BTM device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} diff --git a/libs/ihealth-sdk/module/BTMProfileModule.js b/libs/ihealth-sdk/module/BTMProfileModule.js new file mode 100755 index 0000000..5d88dc6 --- /dev/null +++ b/libs/ihealth-sdk/module/BTMProfileModule.js @@ -0,0 +1,33 @@ +/** + * Created by lixuesong on 15/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.BTMProfileModule + +/** + * @module BTMProfileModule + */ +module.exports = { + + ACTION_BTM_BATTERY: RCTModule.ACTION_BTM_BATTERY, + ACTION_BTM_MEMORY: RCTModule.ACTION_BTM_MEMORY, + ACTION_BTM_MEASURE: RCTModule.ACTION_BTM_MEASURE, + ACTION_BTM_CALLBACK: RCTModule.ACTION_BTM_CALLBACK, + ACTION_ERROR_BTM: RCTModule.ACTION_ERROR_BTM, + + //Keys + BTM_BATTERY: RCTModule.BTM_BATTERY, + MEMORY_COUNT: RCTModule.MEMORY_COUNT, + BTM_TEMPERATURE_ARRAY: RCTModule.BTM_TEMPERATURE_ARRAY, + BTM_TEMPERATURE_TARGET: RCTModule.BTM_TEMPERATURE_TARGET, + BTM_TEMPERATURE: RCTModule.BTM_TEMPERATURE, + BTM_MEASURE_TIME: RCTModule.BTM_MEASURE_TIME, + ERROR_NUM_BTM: RCTModule.ERROR_NUM_BTM, + ERROR_DESCRIPTION_BTM: RCTModule.ERROR_DESCRIPTION_BTM, + + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/ECGModule.js b/libs/ihealth-sdk/module/ECGModule.js new file mode 100755 index 0000000..439dd99 --- /dev/null +++ b/libs/ihealth-sdk/module/ECGModule.js @@ -0,0 +1,60 @@ +/** + * + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.ECGModule; + +/** + * @module ECGModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * SyncTime. + */ + sysTime: function (mac) { + RCTModule.sysTime(mac) + }, + + /** + * startMeasure + */ + startMeasure: function (mac) { + RCTModule.startMeasure(mac) + }, + /** + * getBattery + * @param {string} serialNumber the mac address of scale + */ + getBattery: function (mac) { + RCTModule.getBattery(mac) + }, + /** + * stopMeasure + */ + stopMeasure: function (mac) { + RCTModule.stopMeasure(mac) + }, + /** + * Get all connected ECG device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, + /** + * Disconnect the ECG3 + * @param mac The mac address + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + } +} diff --git a/libs/ihealth-sdk/module/ECGProfileModule.js b/libs/ihealth-sdk/module/ECGProfileModule.js new file mode 100755 index 0000000..4377e9c --- /dev/null +++ b/libs/ihealth-sdk/module/ECGProfileModule.js @@ -0,0 +1,208 @@ +/** + * + */ +'use strict'; + + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.ECGProfileModule; + +/** + * @module ECGProfileModule + */ +module.exports = { + + /** + * The action value of event indicates the error of ECG device. + */ + ACTION_ERROR_ECG:RCTModule.ACTION_ERROR_ECG, + + /** + * The Key of error number of ECG device. + */ + ERROR_NUM_ECG:RCTModule.ERROR_NUM_ECG, + + /** + * The Key of error description of ECG device. + */ + ERROR_DESCRIPTION_ECG:RCTModule.ERROR_DESCRIPTION_ECG, + + /** + * The action value of event indicates the battery of ECG device. + */ + ACTION_BATTERY_ECG:RCTModule.ACTION_BATTERY_ECG, + + /** + * The Key of BATTERY_ECG for ECG device. + */ + BATTERY_ECG:RCTModule.BATTERY_ECG, + + /** + * sync time. + */ + ACTION_SYSTIME:RCTModule.ACTION_SYSTIME, + + /** + * Stop Measure. + */ + ACTION_STOPMEASURE_ECG:RCTModule.ACTION_STOPMEASURE_ECG, + + /** + * ACTION_MEASURE_WAVEData.
      + * + * examples:
      + * {"MEASURE_WAVEData":[-2.2548201084136963,-2.531399965286255,-2.8357763290405273,-3.1377346515655518,-3.4188733100891113,-3.680877685546875],"mac":"FC86F8390F66","type":"ECG3","action":"ACTION_MEASURE_WAVEData"}
      + */ + ACTION_MEASURE_WAVEData:RCTModule.ACTION_MEASURE_WAVEData, + + MEASURE_WAVEData:RCTModule.MEASURE_WAVEData, + /** + * ACTION_MEASURE_ECGPulse.
      + * Value range:

      + * examples:
      + * {"MEASURE_ECGPulse":0,"action":"ACTION_MEASURE_ECGPulse","mac":"FC86F8390F66","type":"ECG3"} + */ + ACTION_MEASURE_ECGPulse:RCTModule.ACTION_MEASURE_ECGPulse, + + MEASURE_ECGPulse:RCTModule.MEASURE_ECGPulse, + /** + * ACTION_STARTSYNCDATA_ECGUSB.
      + * Value range:

      + * true: sufficiently
      + * false: insufficiently + */ + ACTION_STARTSYNCDATA_ECGUSB:RCTModule.ACTION_STARTSYNCDATA_ECGUSB, + /** + * ACTION_SYNCDATAINFO_ECGUSB.
      + * Value range:

      + * true: sufficiently
      + * false: insufficiently + */ + ACTION_SYNCDATAINFO_ECGUSB:RCTModule.ACTION_SYNCDATAINFO_ECGUSB, + /** + * DATAINFO.
      + * Value range:

      + * true: sufficiently
      + * false: insufficiently + */ + DATAINFO:RCTModule.DATAINFO, + /** + * ACTION_SYNCDATAPROGRESS_ECGUSB.
      + * Value range:

      + * true: sufficiently
      + * false: insufficiently + */ + ACTION_SYNCDATAPROGRESS_ECGUSB:RCTModule.ACTION_SYNCDATAPROGRESS_ECGUSB, + /** + * PROGRESS.
      + * Value range:

      + * true: sufficiently
      + * false: insufficiently + */ + PROGRESS:RCTModule.PROGRESS, + /** + * ACTION_DELETEDATA_ECGUSB.
      + * Value range:

      + * true: sufficiently
      + * false: insufficiently + */ + ACTION_DELETEDATA_ECGUSB:RCTModule.ACTION_DELETEDATA_ECGUSB, + /** + * Indicates get all connected devices. + */ + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES, + /** + * ECGUSB error action. + */ + ACTION_ERROR_ECGUSB:RCTModule.ACTION_ERROR_ECGUSB, + /** + * ECGUSB error number. + * + * Value range:
      + * + *

      0:Query command timeout

      + *

      1:Received SD card info is wrong.

      + *

      2:Receive devce's error log: SD card error.

      + *

      3:There is not enough space for ECG's offline data.

      + *

      4:Receive wrong data.

      + *

      5:Receive wrong data.

      + *

      6:Receive data timeout.

      + *

      7:Save file error.

      + *

      8:Device is disconnected.

      + *

      9:Format fail.

      + *

      13:Format command timeout.

      + *

      500:Command timeout.

      + */ + ERROR_NUM_ECGUSB:RCTModule.ERROR_NUM_ECGUSB, + /** + * ECGUSB error description. + * + * Value range:
      + * + *

      0:Query command timeout

      + *

      1:Received SD card info is wrong.

      + *

      2:Receive devce's error log: SD card error.

      + *

      3:There is not enough space for ECG's offline data.

      + *

      4:Receive wrong data.

      + *

      5:Receive wrong data.

      + *

      6:Receive data timeout.

      + *

      7:Save file error.

      + *

      8:Device is disconnected.

      + *

      9:Format fail.

      + *

      10:Splicing files fail.

      + *

      11:get ECG data from cache fail.

      + *

      12:get filter files fail by filename.

      + *

      500:Command timeout.

      + */ + + ERROR_DESCRIPTION_ECGUSB:RCTModule.ERROR_DESCRIPTION_ECGUSB, + /** + * Splice action. + */ + ACTION_SPLICE:RCTModule.ACTION_SPLICE, + /** + * The key of splice result. + */ + SPLICE_DATA:RCTModule.SPLICE_DATA, + /** + * The key of splice error description. + */ + SPLICE_ERROR_DESCRIPTION:RCTModule.SPLICE_ERROR_DESCRIPTION, + /** + * Electrode status action. + */ + ACTION_ELECTRODE_STATUS:RCTModule.ACTION_ELECTRODE_STATUS, + /** + * Electrode status. In fact, 2 and 3 will not send. Receive ACTION_MEASURE_WAVEData again means Electrode loss recovery.
      + * + * Value range:
      + *

      1:Electrode Loss.

      + *

      2:Electrode Loss Recovery.

      + *

      3:Electrode Loss Timeout.

      + */ + ELECTRODE_STATUS:RCTModule.ELECTRODE_STATUS, + /** + * Get cache. + * If app crashes during syncData, there may be some data not return to your callback (ACTION_SYNCDATAINFO_ECGUSB). Then you can call this api to get the unreturned data. + */ + ACTION_GET_CACHE:RCTModule.ACTION_GET_CACHE, + /** + * The key of getCache result. + */ + GET_CACHE_DATA:RCTModule.GET_CACHE_DATA, + /** + * Filter. + * To analyze the SPLICE_DATA returned by synthesize api. + */ + ACTION_FILTER:RCTModule.ACTION_FILTER, + /** + * The key of filter result. + */ + FILTER_DATA:RCTModule.FILTER_DATA, + /** + * The key of filter error description. only for iOS + */ + FILTER_ERROR_DESCRIPTION:RCTModule.FILTER_ERROR_DESCRIPTION + +} diff --git a/libs/ihealth-sdk/module/ECGUSBModule.js b/libs/ihealth-sdk/module/ECGUSBModule.js new file mode 100755 index 0000000..29e3a17 --- /dev/null +++ b/libs/ihealth-sdk/module/ECGUSBModule.js @@ -0,0 +1,119 @@ +/** + * + */ +'use strict'; + +var { NativeModules, Platform } = require('react-native'); + +var RCTModule = NativeModules.ECGUSBModule + +/** + * @module ECGUSBModule + */ +module.exports = { + /** + * Notify event type for ECG + */ + Event_Notify: RCTModule.Event_Notify, + + /** + * SyncTime. + */ + syncData: function () { + RCTModule.syncData() + }, + + /** + * deleteData. + */ + deleteData: function () { + RCTModule.deleteData() + }, + + /** + * Get all connected ECG device + * + * e.g. {"devices":"A4D5783FB00C"} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, + + /** + * Get device idps info (only for android) + * + * e.g. {"firmwareversion":"1.2.6","serialnumber":"F26265594E00","modenumber":"ECG3 11070","hardwareversion":"3.1.0","manufacture":"iHealth","accessoryname":"ECG recorder","protocolstring":"com.jiuan.ECGV10"} + */ + getIdps: function () { + RCTModule.getIdps() + }, + + /** + * Splicing original files + * + * You can add a listener for ECGProfileModule.ACTION_SPLICE; + * + * success example: + * + * {"action":ECGProfileModule.ACTION_SPLICE,ECGProfileModule.SPLICE_DATA:{"DataFileName":"ECG_Total_Data_yyyyMMddHHmmss.dat","MarkFileName":"ECG_Total_Mark_yyyyMMddHHmmss.txt","StartTime":"yyyyMMddHHmmss","EndTime":"yyyyMMddHHmmss","FilePath":"xxx"},"type":"ECG3USB","mac":"F26265594E00"} + * + * fail example: + * + * {"action":ECGProfileModule.ACTION_SPLICE,ECGProfileModule.SPLICE_ERROR_DESCRIPTION:"fileNames's length is less than 1.","type":"ECG3USB","mac":""} + * + * + */ + spliceData: function (filesNames){ + RCTModule.spliceData(filesNames) + }, + + + /** + * Get cache + * + * You can add a listener for ECGProfileModule.ACTION_GET_CACHE; + * + * result example: + * + * {"action":ECGProfileModule.ACTION_GET_CACHE,ECGProfileModule.GET_CACHE_DATA:[see ECGProfileModule.DATAINFO],"type":"ECG3USB","mac":"F26265594E00"} + * + */ + getCache: function () { + RCTModule.getCache() + }, + + /** + * Delete cache files + * only android + * if you get the cache files of ECG, you should clear the cache files + */ + deleteCacheData: function (){ + if (Platform.OS === 'ios'){ + console.log('deleteCacheData is not available in iOS.') + } else { + RCTModule.deleteCacheData() + } + }, + + /** + * get ECG filter files by filename + * + * you can edit "ECG_Data_20180930123000" and "ECG_Mark_20180930123000" + * or can edit "ECG_Total_Data_20180930123000" and "ECG_Mark_Data_20180930123000" + * + * You can add a listener for ECGProfileModule.ACTION_FILTER; + * + * success example: + * + * {"action":ECGProfileModule.ACTION_FILTER,ECGProfileModule.FILTER_DATA:[{"SampleRate":249.999999,"FileName":"ECG_SDK_yyyyMMddHHmmss","StartTime":"yyyyMMddHHmmss","EndTime":"yyyyMMddHHmmss","FilePath":"xxx"}],"type":"ECG3USB","mac":"F26265594E00"} + * + * fail example: + * + * {"action":ECGProfileModule.ACTION_FILTER,ECGProfileModule.FILTER_ERROR_DESCRIPTION:"input parameter is invalid.","type":"ECG3USB","mac":"F26265594E00"} + * + * + */ + getFilterDataByFileName: function (dataFileName ,markFileName){ + RCTModule.getFilterDataByFileName(dataFileName,markFileName) + } +} diff --git a/libs/ihealth-sdk/module/HS2Module.js b/libs/ihealth-sdk/module/HS2Module.js new file mode 100755 index 0000000..5430b20 --- /dev/null +++ b/libs/ihealth-sdk/module/HS2Module.js @@ -0,0 +1,63 @@ +/** + * Created by lixuesong on 11/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.HS2Module + +/** + * @module hs2Module + */ +module.exports = { + /** + * Notify event type for hs2 + */ + Event_Notify: RCTModule.Event_Notify, + + /** + * Start real-time measurement. + * @param {string} mac Device's mac address + * @param {string} unit Device's unit + * @param {string} userId user id + */ + measureOnline: function (mac, unit, userId) { + RCTModule.measureOnline(mac, unit, userId) + }, + + /** + * Get the value of historical data in the hs2. + * @param {string} mac Device's mac address + */ + getOfflineData: function (mac) { + RCTModule.getOfflineData(mac) + }, + + /** + * Disconnect the HS2 + * @param mac The mac address for blood pressure monitor + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected hs2 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, + + /** + * Get all connected hs2 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getBattery: function (mac) { + RCTModule.getBattery(mac) + } +} diff --git a/libs/ihealth-sdk/module/HS2SModule.js b/libs/ihealth-sdk/module/HS2SModule.js new file mode 100755 index 0000000..8c8b6e5 --- /dev/null +++ b/libs/ihealth-sdk/module/HS2SModule.js @@ -0,0 +1,110 @@ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.HS2SModule + +/** + * @module hs2sModule + */ +module.exports = { + /** + * Notify event type for hs2s + */ + Event_Notify: RCTModule.Event_Notify, + + + getDeviceInfo: function (mac) { + RCTModule.getDeviceInfo(mac) + }, + /** + * Get hs2s device battary + * + */ + getBattery: function (mac) { + RCTModule.getBattery(mac) + }, + + setUnit: function (mac,unit) { + RCTModule.setUnit(mac,unit) + }, + getUserInfo: function (mac) { + RCTModule.getUserInfo(mac) + }, + updateUserInfo: function (mac,userID,createTS,weight,age,height,sex,impedanceMark,fitnessMark) { + RCTModule.updateUserInfo(mac,userID,createTS,weight,age,height,sex,impedanceMark,fitnessMark); + }, + + deleteUser: function (mac,userID) { + RCTModule.deleteUser(mac,userID); + }, + + getMemoryDataCount: function (mac,userID) { + RCTModule.getMemoryDataCount(mac,userID); + }, + + getMemoryData: function (mac,userID) { + RCTModule.getMemoryData(mac,userID); + }, + + deleteMemoryData: function (mac,userID) { + RCTModule.deleteMemoryData(mac,userID); + }, + + getAnonymousMemoryDataCount: function (mac) { + RCTModule.getAnonymousMemoryDataCount(mac); + }, + + getAnonymousMemoryData: function (mac) { + RCTModule.getAnonymousMemoryData(mac); + }, + + deleteAnonymousMemoryData: function (mac) { + RCTModule.deleteAnonymousMemoryData(mac) + }, + + measure: function (mac,userType,userID,createTS,weight,age,height,sex,impedanceMark,fitnessMark) { + RCTModule.measure(mac,userType,userID,createTS,weight,age,height,sex,impedanceMark,fitnessMark) + }, + + resetDevice: function (mac) { + RCTModule.resetDevice(mac) + }, + + broadCastTypeDevice: function (mac) { + RCTModule.broadCastTypeDevice(mac) + }, + + setDeviceLightUp: function (mac) { + RCTModule.setDeviceLightUp(mac) + }, + + enterHS2SHeartRateMeasurementMode: function (mac) { + RCTModule.enterHS2SHeartRateMeasurementMode(mac) + }, + + exitHS2SHeartRateMeasurementMode: function (mac) { + RCTModule.exitHS2SHeartRateMeasurementMode(mac) + }, + + + /** + * Disconnect the HS2S + * @param mac The mac address for blood pressure monitor + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected hs2s device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } + + +} diff --git a/libs/ihealth-sdk/module/HS2SProfileModule.js b/libs/ihealth-sdk/module/HS2SProfileModule.js new file mode 100644 index 0000000..7c0368b --- /dev/null +++ b/libs/ihealth-sdk/module/HS2SProfileModule.js @@ -0,0 +1,103 @@ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.HS2SProfileModule + +/** + * @module HS2SProfileModule + */ +module.exports = { + + ACTION_ERROR_HS: RCTModule.ACTION_ERROR_HS, + ERROR_NUM_HS: RCTModule.ERROR_NUM_HS, + ERROR_DESCRIPTION_HS: RCTModule.ERROR_DESCRIPTION_HS, + + ACTION_GET_DEVICE_INFO: RCTModule.ACTION_GET_DEVICE_INFO, + HS_USER_COUNT: RCTModule.HS_USER_COUNT, + HS_UNIT_CURRENT: RCTModule.HS_UNIT_CURRENT, + + ACTION_BATTERY_HS: RCTModule.ACTION_BATTERY_HS, + BATTERY_HS: RCTModule.BATTERY_HS, + + ACTION_SET_UNIT_SUCCESS: RCTModule.ACTION_SET_UNIT_SUCCESS, + + ACTION_GET_USER_INFO: RCTModule.ACTION_GET_USER_INFO, + USER_INFO_COUNT: RCTModule.USER_INFO_COUNT, + USER_INFO_ARRAY: RCTModule.USER_INFO_ARRAY, + USER_INFO_USER_ID: RCTModule.USER_INFO_USER_ID, + USER_INFO_CREATE_TIME: RCTModule.USER_INFO_CREATE_TIME, + USER_INFO_WEIGHT: RCTModule.USER_INFO_WEIGHT, + USER_INFO_GENDER: RCTModule.USER_INFO_GENDER, + USER_INFO_AGE: RCTModule.USER_INFO_AGE, + USER_INFO_HEIGHT: RCTModule.USER_INFO_HEIGHT, + USER_INFO_IMPEDANCE: RCTModule.USER_INFO_IMPEDANCE, + USER_INFO_BODYBUILDING: RCTModule.USER_INFO_BODYBUILDING, + + ACTION_CREATE_OR_UPDATE_USER_INFO: RCTModule.ACTION_CREATE_OR_UPDATE_USER_INFO, + OPERATION_STATUS: RCTModule.OPERATION_STATUS, + OPERATION_DESCRIBE: RCTModule.OPERATION_DESCRIBE, + + ACTION_DELETE_USER_INFO: RCTModule.ACTION_DELETE_USER_INFO, + + ACTION_SPECIFY_USERS: RCTModule.ACTION_SPECIFY_USERS, + + ACTION_MEASURE_FINISH_AT_CRITICAL: RCTModule.ACTION_MEASURE_FINISH_AT_CRITICAL, + + ACTION_HISTORY_DATA_NUM: RCTModule.ACTION_HISTORY_DATA_NUM, + HISTORY_DATA_USER_COUNT: RCTModule.HISTORY_DATA_USER_COUNT, + HISTORY_DATA_COUNT_ARRAY: RCTModule.HISTORY_DATA_COUNT_ARRAY, + HISTORY_DATA_COUNT: RCTModule.HISTORY_DATA_COUNT, + + ACTION_HISTORY_DATA: RCTModule.ACTION_HISTORY_DATA, + DATA_ID: RCTModule.DATA_ID, + DATA_WEIGHT: RCTModule.DATA_WEIGHT, + DATA_IMPEDANCE: RCTModule.DATA_IMPEDANCE, + DATA_USER_NUM: RCTModule.DATA_USER_NUM, + DATA_GENDER: RCTModule.DATA_GENDER, + DATA_AGE: RCTModule.DATA_AGE, + DATA_HEIGHT: RCTModule.DATA_HEIGHT, + DATA_MEASURE_TIME: RCTModule.DATA_MEASURE_TIME, + DATA_RIGHT_TIME: RCTModule.DATA_RIGHT_TIME, + DATA_BODYBUILDING: RCTModule.DATA_BODYBUILDING, + DATA_INSTRUCTION_TYPE: RCTModule.DATA_INSTRUCTION_TYPE, + DATA_BODY_FIT_PERCENTAGE: RCTModule.DATA_BODY_FIT_PERCENTAGE, + DATA_MUSCLE_MASS: RCTModule.DATA_MUSCLE_MASS, + DATA_BONE_SALT_CONTENT: RCTModule.DATA_BONE_SALT_CONTENT, + DATA_BODY_WATER_RATE: RCTModule.DATA_BODY_WATER_RATE, + DATA_PROTEIN_RATE: RCTModule.DATA_PROTEIN_RATE, + DATA_SKELETAL_MUSCLE_MASS: RCTModule.DATA_SKELETAL_MUSCLE_MASS, + DATA_BASAL_METABOLIC_RATE: RCTModule.DATA_BASAL_METABOLIC_RATE, + DATA_VISCERAL_FAT_GRADE: RCTModule.DATA_VISCERAL_FAT_GRADE, + DATA_PHYSICAL_AGE: RCTModule.DATA_PHYSICAL_AGE, + DATA_BODY_MASS_INDEX: RCTModule.DATA_BODY_MASS_INDEX, + + DATA_STANDARD_WEIGHT: RCTModule.DATA_STANDARD_WEIGHT, + DATA_WEIGHT_CONTROL: RCTModule.DATA_WEIGHT_CONTROL, + DATA_MUSCLE_CONTROL: RCTModule.DATA_MUSCLE_CONTROL, + DATA_FAT_CONTROL: RCTModule.DATA_FAT_CONTROL, + DATA_FAT_WEIGHT: RCTModule.DATA_FAT_WEIGHT, + DATA_DE_FAT_WEIGHT: RCTModule.DATA_DE_FAT_WEIGHT, + + ACTION_ONLINE_RESULT: RCTModule.ACTION_ONLINE_RESULT, + ACTION_DELETE_HISTORY_DATA: RCTModule.ACTION_DELETE_HISTORY_DATA, + + ACTION_ANONYMOUS_DATA_NUM: RCTModule.ACTION_ANONYMOUS_DATA_NUM, + ANONYMOUS_DATA_COUNT: RCTModule.ANONYMOUS_DATA_COUNT, + + ACTION_DELETE_ANONYMOUS_DATA: RCTModule.ACTION_DELETE_ANONYMOUS_DATA, + ACTION_ONLINE_REAL_TIME_WEIGHT: RCTModule.ACTION_ONLINE_REAL_TIME_WEIGHT, + ACTION_BODY_FAT_RESULT: RCTModule.ACTION_BODY_FAT_RESULT, + DATA_BODY_FAT_RESULT: RCTModule.DATA_BODY_FAT_RESULT, + + ACTION_HS2S_LightUp_DEVICE: RCTModule.ACTION_HS2S_LightUp_DEVICE, + HS2S_DEVICE_STATUS: RCTModule.HS2S_DEVICE_STATUS, + + ACTION_HS2S_MEASURE_HEARTRATE: RCTModule.ACTION_HS2S_MEASURE_HEARTRATE, + HS2S_MEASURE_HEARTRATE_RESULT: RCTModule.HS2S_MEASURE_HEARTRATE_RESULT, + ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS: RCTModule.ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS, + + ACTION_RESTORE_FACTORY_SETTINGS: RCTModule.ACTION_RESTORE_FACTORY_SETTINGS, + + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/HS4SModule.js b/libs/ihealth-sdk/module/HS4SModule.js new file mode 100755 index 0000000..5bba0c3 --- /dev/null +++ b/libs/ihealth-sdk/module/HS4SModule.js @@ -0,0 +1,53 @@ +/** + * Created by lixuesong on 11/11/2016. + */ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.HS4SModule + +/** + * @module HS4SModule + */ +module.exports = { + /** + * Notify event type for HS4S + */ + Event_Notify: RCTModule.Event_Notify, + + /** + * Start real-time measurement. + * @param {string} mac Device's mac address + * @param {string} unit Device's unit + * @param {string} userId user id + */ + measureOnline: function (mac, unit, userId) { + RCTModule.measureOnline(mac, unit, userId) + }, + + /** + * Get the value of historical data in the HS4S. + * @param {string} mac Device's mac address + */ + getOfflineData: function (mac) { + RCTModule.getOfflineData(mac) + }, + + /** + * Disconnect the HS4S + * @param mac The mac address for blood pressure monitor + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected HS4S device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + }, +} diff --git a/libs/ihealth-sdk/module/HS6Module.js b/libs/ihealth-sdk/module/HS6Module.js new file mode 100755 index 0000000..06356cd --- /dev/null +++ b/libs/ihealth-sdk/module/HS6Module.js @@ -0,0 +1,94 @@ +/** + * Created by lixuesong on 11/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.HS6Module + +/** + * @module HS6Module + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Initializes method. + * @param {string} userName the name of user + */ + init: function (userName) { + RCTModule.init(userName) + }, + + /** + * Set wifi to the scale. + * @param {string} ssid the name of net + * @param {string} password the password of the net + */ + setWifi: function (ssid, password) { + RCTModule.setWifi(ssid, password) + }, + + /** + * Bind the user and scale together,after bind success user's weight datas can be transmitted to the cloud. + * And this method is a time consuming operation that cannot be called in the main thread. + * @param {string} birthday format like yyyy-MM-dd HH:mm:ss + * @param {float} weight the unit is kg + * @param {int} height the unit is cm + * @param {int} isSporter is sporter; 2 is not ;3 unknown + * @param {int} gender 0 is male ;1 is female + * @param {string} serialNumber the mac address of the scale + */ + bindDeviceHS6: function (birthday, weight, height, isSporter, gender, serialNumber) { + RCTModule.bindDeviceHS6(birthday, weight, height, isSporter, gender, serialNumber) + }, + + /** + * Unbind the user and scale,and this method is a time consuming operation that cannot be called in the main thread. + * @param {string} serialNumber the mac address of scale + */ + unBindDeviceHS6: function (serialNumber) { + RCTModule.unBindDeviceHS6(serialNumber) + }, + + /** + * Get AccessToken of HS6 user,and this method is a time consuming operation that cannot be called + * in the main thread. + * After get AccessToken, you can call openApi(http://developer.ihealthlabs.com) to pull data form iHealth cloud. + * @param {string} clientId the identification of the SDK + * @param {string} clientSecret the identification of the SDK + * @param {string} username the identification of the user + * @param {string} clientPara a random string,return back without change + */ + getToken: function (clientId, clientSecret, username, clientPara) { + RCTModule.getToken(clientId, clientSecret, username, clientPara) + }, + + /** + * Set unit of HS6,and this method is a time consuming operation that cannot be called + * in the main thread. + * @param {string} username the identification of the user + * @param {int} unitType the unit type + *

      0 Kg + *

      1 lbs + *

      2 st + */ + setUnit: function (username, unitType) { + RCTModule.setUnit(username, unitType) + }, + + /** + * DownloadHS6 CloudData + * @param {string} clientId the identification of the SDK + * @param {string} clientSecret the identification of the SDK + * @param {string} username the identification of the user + * @param {long} ts time stamp of HS6 measure data. UTC time, unit in milliseconds. + * @param {long} pageSize the specific size of data in one download progress + */ + getCloudData: function (clientId, clientSecret, username, ts, pageSize) { + RCTModule.getCloudData(clientId, clientSecret, username, ts, pageSize) + }, +} diff --git a/libs/ihealth-sdk/module/HS6ProfileModule.js b/libs/ihealth-sdk/module/HS6ProfileModule.js new file mode 100755 index 0000000..d461b5c --- /dev/null +++ b/libs/ihealth-sdk/module/HS6ProfileModule.js @@ -0,0 +1,50 @@ +/** + * Created by lixuesong on 15/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.HS6ProfileModule + +/** + * @module HS6ProfileModule + */ +module.exports = { + + ACTION_HS6_SETWIFI: RCTModule.ACTION_HS6_SETWIFI, + ACTION_HS6_BIND: RCTModule.ACTION_HS6_BIND, + ACTION_HS6_UNBIND: RCTModule.ACTION_HS6_UNBIND, + ACTION_HS6_GET_TOKEN: RCTModule.ACTION_HS6_GET_TOKEN, + ACTION_HS6_SET_UNIT: RCTModule.ACTION_HS6_SET_UNIT, + + ACTION_HS6_GET_CLOUDDATA:RCTModule.ACTION_HS6_GET_CLOUDDATA, + HS6_CLOUDDATA:RCTModule.HS6_CLOUDDATA, + + ACTION_HS6_GET_CLOUDDATA_LASTTS:RCTModule.ACTION_HS6_GET_CLOUDDATA_LASTTS, + HS6_CLOUDDATA_LASTTS:RCTModule.HS6_CLOUDDATA_LASTTS, + + ACTION_HS6_GET_CLOUDDATA_LEFTNUM:RCTModule.ACTION_HS6_GET_CLOUDDATA_LEFTNUM, + HS6_CLOUDDATA_LEFTNUM:RCTModule.HS6_CLOUDDATA_LEFTNUM, + + ACTION_HS6_ERROR: RCTModule.ACTION_HS6_ERROR, + ACTION_HS6_GET_DATA: RCTModule.ACTION_HS6_GET_DATA, + + //Keys + SETWIFI_RESULT: RCTModule.SETWIFI_RESULT, + HS6_BIND_EXTRA: RCTModule.HS6_BIND_EXTRA, + BIND_HS6_RESULT: RCTModule.BIND_HS6_RESULT, + HS6_MODEL: RCTModule.HS6_MODEL, + HS6_POSITION: RCTModule.HS6_POSITION, + HS6_SETTED_WIFI: RCTModule.HS6_SETTED_WIFI, + HS6_UNBIND_RESULT: RCTModule.HS6_UNBIND_RESULT, + GET_TOKEN_RESULT: RCTModule.GET_TOKEN_RESULT, + SET_UNIT_RESULT: RCTModule.SET_UNIT_RESULT, + HS6_ERROR: RCTModule.HS6_ERROR, + + DATA_RESULT: RCTModule.DATA_RESULT, + DATA_DOWNLOAD_TS: RCTModule.DATA_DOWNLOAD_TS, + + DATA_LEFTNUMBER: RCTModule.DATA_LEFTNUMBER +} diff --git a/libs/ihealth-sdk/module/HSProfileModule.js b/libs/ihealth-sdk/module/HSProfileModule.js new file mode 100755 index 0000000..0c63c27 --- /dev/null +++ b/libs/ihealth-sdk/module/HSProfileModule.js @@ -0,0 +1,42 @@ +/** + * Created by lixuesong on 15/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.HSProfileModule + +/** + * @module HSProfileModule + */ +module.exports = { + + ACTION_LIVEDATA_HS: RCTModule.ACTION_LIVEDATA_HS, + ACTION_ONLINE_RESULT_HS: RCTModule.ACTION_ONLINE_RESULT_HS, + ACTION_HISTORICAL_DATA_HS: RCTModule.ACTION_HISTORICAL_DATA_HS, + ACTION_HISTORICAL_DATA_COMPLETE_HS: RCTModule.ACTION_HISTORICAL_DATA_COMPLETE_HS, + ACTION_NO_HISTORICALDATA: RCTModule.ACTION_NO_HISTORICALDATA, + ACTION_ERROR_HS: RCTModule.ACTION_ERROR_HS, + + //Keys + LIVEDATA_HS: RCTModule.LIVEDATA_HS, + DATAID: RCTModule.DATAID, + WEIGHT_HS: RCTModule.WEIGHT_HS, + FAT_HS: RCTModule.FAT_HS, + WATER_HS: RCTModule.WATER_HS, + MUSCLE_HS: RCTModule.MUSCLE_HS, + SKELETON_HS: RCTModule.SKELETON_HS, + FATELEVEL_HS: RCTModule.FATELEVEL_HS, + DCI_HS: RCTModule.DCI_HS, + HISTORDATA__HS: RCTModule.HISTORDATA__HS, + MEASUREMENT_DATE_HS: RCTModule.MEASUREMENT_DATE_HS, + + ERROR_NUM_HS: RCTModule.ERROR_NUM_HS, + ERROR_ID_ILLEGAL_ARGUMENT: RCTModule.ERROR_ID_ILLEGAL_ARGUMENT, + ERROR_ID_WIFI_DISABLED: RCTModule.ERROR_ID_WIFI_DISABLED, + ERROR_DESCRIPTION_HS: RCTModule.ERROR_DESCRIPTION_HS, + + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/NT13BModule.js b/libs/ihealth-sdk/module/NT13BModule.js new file mode 100644 index 0000000..81392fc --- /dev/null +++ b/libs/ihealth-sdk/module/NT13BModule.js @@ -0,0 +1,39 @@ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.NT13BModule + + /** + * @module NT13BModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * listen measurement + * @param {string} mac Device's mac address + */ + measure: function (mac) { + RCTModule.measure(mac) + }, + + /** + * Disconnect the nt13b + * @param mac The mac address for BTM + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected BTM device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} + diff --git a/libs/ihealth-sdk/module/NT13BProfileModule.js b/libs/ihealth-sdk/module/NT13BProfileModule.js new file mode 100644 index 0000000..93e6604 --- /dev/null +++ b/libs/ihealth-sdk/module/NT13BProfileModule.js @@ -0,0 +1,20 @@ +'use strict'; + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.NT13BProfileModule + +/** + * @module NT13BProfileModule + */ +module.exports = { + ACTION_MEASUREMENT_RESULT: RCTModule.ACTION_MEASUREMENT_RESULT, + UNIT_FLAG: RCTModule.UNIT_FLAG, + RESULT: RCTModule.RESULT, + TS_FLAG: RCTModule.TS_FLAG, + TS: RCTModule.TS, + THERMOMETER_TYPE_FLAG: RCTModule.THERMOMETER_TYPE_FLAG, + THERMOMETER_TYPE: RCTModule.THERMOMETER_TYPE, + + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/PO1Module.js b/libs/ihealth-sdk/module/PO1Module.js new file mode 100644 index 0000000..2b877bd --- /dev/null +++ b/libs/ihealth-sdk/module/PO1Module.js @@ -0,0 +1,38 @@ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.PO1Module + +/** + * @module PO1Module + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get the PO1 battery status. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + RCTModule.getBattery(mac) + }, + + /** + * Disconnect the PO1 + * @param mac The mac address + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected PO1 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} diff --git a/libs/ihealth-sdk/module/PO1ProfileModule.js b/libs/ihealth-sdk/module/PO1ProfileModule.js new file mode 100644 index 0000000..329b72a --- /dev/null +++ b/libs/ihealth-sdk/module/PO1ProfileModule.js @@ -0,0 +1,33 @@ +/** + * Created by lixuesong on 15/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.PO1ProfileModule + +/** + * @module POProfileModule + */ +module.exports = { + + //Actions + ACTION_BO_MEASUREMENT: RCTModule.ACTION_BO_MEASUREMENT, + ACTION_GET_BATTERY: RCTModule.ACTION_GET_BATTERY, + ACTION_ERROR_PO1: RCTModule.ACTION_ERROR_PO1, + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES, + + //Keys + ERROR_ID: RCTModule.ERROR_ID, + ERROR_DESCRIPTION: RCTModule.ERROR_DESCRIPTION, + BATTERY: RCTModule.BATTERY, + STATUS: RCTModule.STATUS, + BLOOD_OXYGEN: RCTModule.BLOOD_OXYGEN, + PULSE: RCTModule.PULSE, + PULSE_FORCE: RCTModule.PULSE_FORCE, + PI: RCTModule.PI, + WAVE: RCTModule.WAVE, + +} diff --git a/libs/ihealth-sdk/module/PO3Module.js b/libs/ihealth-sdk/module/PO3Module.js new file mode 100755 index 0000000..2185bcf --- /dev/null +++ b/libs/ihealth-sdk/module/PO3Module.js @@ -0,0 +1,58 @@ +/** + * Created by lixuesong on 11/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.PO3Module + +/** + * @module PO3Module + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * Get the PO3 battery status. + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + RCTModule.getBattery(mac) + }, + + /** + * Start real-time measurement. + * @param {string} mac Device's mac address + */ + startMeasure: function (mac) { + RCTModule.startMeasure(mac) + }, + + /** + * Get the value of historical data in the PO3. + * @param {string} mac Device's mac address + */ + getHistoryData: function (mac) { + RCTModule.getHistoryData(mac) + }, + + /** + * Disconnect the PO3 + * @param mac The mac address + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected PO3 device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} diff --git a/libs/ihealth-sdk/module/POProfileModule.js b/libs/ihealth-sdk/module/POProfileModule.js new file mode 100755 index 0000000..1e50159 --- /dev/null +++ b/libs/ihealth-sdk/module/POProfileModule.js @@ -0,0 +1,34 @@ +/** + * Created by lixuesong on 15/11/2016. + */ +'use strict'; + + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.POProfileModule + +/** + * @module POProfileModule + */ +module.exports = { + + ACTION_BATTERY_PO: RCTModule.ACTION_BATTERY_PO, + ACTION_LIVEDA_PO: RCTModule.ACTION_LIVEDA_PO, + ACTION_RESULTDATA_PO: RCTModule.ACTION_RESULTDATA_PO, + ACTION_OFFLINEDATA_PO: RCTModule.ACTION_OFFLINEDATA_PO, + ACTION_NO_OFFLINEDATA_PO: RCTModule.ACTION_NO_OFFLINEDATA_PO, + ACTION_ERROR_PO: RCTModule.ACTION_ERROR_PO, + + //Keys + BATTERY_PO: RCTModule.BATTERY_PO, + PULSE_WAVE_PO: RCTModule.PULSE_WAVE_PO, + PI_PO: RCTModule.PI_PO, + PULSE_STRENGTH_PO: RCTModule.PULSE_STRENGTH_PO, + BLOOD_OXYGEN_PO: RCTModule.BLOOD_OXYGEN_PO, + PULSE_RATE_PO: RCTModule.PULSE_RATE_PO, + DATAID: RCTModule.DATAID, + OFFLINEDATA_PO: RCTModule.OFFLINEDATA_PO, + MEASURE_DATE_PO: RCTModule.MEASURE_DATE_PO, + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/PT3SBTModule.js b/libs/ihealth-sdk/module/PT3SBTModule.js new file mode 100644 index 0000000..0cfa516 --- /dev/null +++ b/libs/ihealth-sdk/module/PT3SBTModule.js @@ -0,0 +1,87 @@ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.PT3SBTModule + + /** + * @module PT3SBTModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * set time + * @param {string} mac Device's mac address + */ + setTime: function (mac) { + RCTModule.setTime(mac) + }, + + /** + * get battery + * @param {string} mac Device's mac address + */ + getBattery: function (mac) { + RCTModule.getBattery(mac) + }, + + /** + * set unit + * @param {string} mac Device's mac address + */ + setUnit: function (mac, unit) { + RCTModule.setUnit(mac, unit) + }, + + /** + * get unit + * @param {string} mac Device's mac address + */ + getUnit: function (mac) { + RCTModule.getUnit(mac) + }, + + /** + * get history data count + * @param {string} mac Device's mac address + */ + getHistoryCount: function (mac) { + RCTModule.getHistoryCount(mac) + }, + + /** + * get history data + * @param {string} mac Device's mac address + */ + getHistoryData: function (mac) { + RCTModule.getHistoryData(mac) + }, + + /** + * delete history data + * @param {string} mac Device's mac address + */ + deleteHistory: function (mac) { + RCTModule.deleteHistory(mac) + }, + + /** + * Disconnect the pt3sbt + * @param mac The mac address for PT3SBT + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected BTM device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} + diff --git a/libs/ihealth-sdk/module/PT3SBTProfileModule.js b/libs/ihealth-sdk/module/PT3SBTProfileModule.js new file mode 100644 index 0000000..ee1cdfe --- /dev/null +++ b/libs/ihealth-sdk/module/PT3SBTProfileModule.js @@ -0,0 +1,31 @@ +'use strict'; + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.PT3SBTProfileModule + +/** + * @module PT3SBTProfileModule + */ +module.exports = { + // actions + ACTION_SET_TIME: RCTModule.ACTION_SET_TIME, + ACTION_GET_BATTERY: RCTModule.ACTION_GET_BATTERY, + ACTION_SET_UNIT: RCTModule.ACTION_SET_UNIT, + ACTION_GET_UNIT: RCTModule.ACTION_GET_UNIT, + ACTION_GET_HISTORY_COUNT: RCTModule.ACTION_GET_HISTORY_COUNT, + ACTION_GET_HISTORY_DATA: RCTModule.ACTION_GET_HISTORY_DATA, + ACTION_DELETE_HISTORY_DATA: RCTModule.ACTION_DELETE_HISTORY_DATA, + ACTION_TEMPERATURE_MEASUREMENT: RCTModule.ACTION_TEMPERATURE_MEASUREMENT, + ACTION_PUB_UNIT: RCTModule.ACTION_PUB_UNIT, + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES, + + // keys + STATUS: RCTModule.STATUS, + BATTERY: RCTModule.BATTERY, + UNIT: RCTModule.UNIT, + TS: RCTModule.TS, + COUNT: RCTModule.COUNT, + TEMPERATURE: RCTModule.TEMPERATURE, + HISTORY: RCTModule.HISTORY +} diff --git a/libs/ihealth-sdk/module/TS28BModule.js b/libs/ihealth-sdk/module/TS28BModule.js new file mode 100644 index 0000000..bda03db --- /dev/null +++ b/libs/ihealth-sdk/module/TS28BModule.js @@ -0,0 +1,39 @@ +'use strict'; + +var {NativeModules} = require('react-native'); + +var RCTModule = NativeModules.TS28BModule + + /** + * @module TS28BModule + */ +module.exports = { + + Event_Notify: RCTModule.Event_Notify, + + /** + * listen measurement + * @param {string} mac Device's mac address + */ + measure: function (mac) { + RCTModule.measure(mac) + }, + + /** + * Disconnect the nt13b + * @param mac The mac address for BTM + */ + disconnect: function (mac) { + RCTModule.disconnect(mac) + }, + + /** + * Get all connected BTM device + * + * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} + */ + getAllConnectedDevices: function () { + RCTModule.getAllConnectedDevices() + } +} + diff --git a/libs/ihealth-sdk/module/TS28BProfileModule.js b/libs/ihealth-sdk/module/TS28BProfileModule.js new file mode 100644 index 0000000..ff16184 --- /dev/null +++ b/libs/ihealth-sdk/module/TS28BProfileModule.js @@ -0,0 +1,20 @@ +'use strict'; + +var { NativeModules } = require('react-native'); + +var RCTModule = NativeModules.TS28BProfileModule + +/** + * @module TS28BProfileModule + */ +module.exports = { + ACTION_MEASUREMENT_RESULT: RCTModule.ACTION_MEASUREMENT_RESULT, + UNIT_FLAG: RCTModule.UNIT_FLAG, + RESULT: RCTModule.RESULT, + TS_FLAG: RCTModule.TS_FLAG, + TS: RCTModule.TS, + THERMOMETER_TYPE_FLAG: RCTModule.THERMOMETER_TYPE_FLAG, + THERMOMETER_TYPE: RCTModule.THERMOMETER_TYPE, + + ACTION_GET_ALL_CONNECTED_DEVICES: RCTModule.ACTION_GET_ALL_CONNECTED_DEVICES +} diff --git a/libs/ihealth-sdk/module/iHealthDeviceManagerModule.js b/libs/ihealth-sdk/module/iHealthDeviceManagerModule.js new file mode 100644 index 0000000..cee7b03 --- /dev/null +++ b/libs/ihealth-sdk/module/iHealthDeviceManagerModule.js @@ -0,0 +1,277 @@ +'use strict'; + + +var {NativeModules,Platform} = require('react-native'); + +var RCTModule = NativeModules.iHealthDeviceManagerModule + +/** + * @module iHealthDeviceManagerModule + */ +module.exports = { + //Device Type + AM3S: RCTModule.AM3S, + /** + * Device type number for AM4(4) 1 << 2 + */ + AM4: RCTModule.AM4, + /** + * Device type number for PO3(8) 1 << 3 + */ + PO3: RCTModule.PO3, + /** + * Device type number for BP5(33554432) 1 << 25 + */ + BP5: RCTModule.BP5, + BP5S: RCTModule.BP5S, + /** + * Device type number for BP3L(32) 1 << 5 + */ + BP3L: RCTModule.BP3L, + /** + * Device type number for BP7S(16777216) 1 << 24 + */ + BP7: RCTModule.BP7, + BP7S: RCTModule.BP7S, + /** + * Device type number for Bp550BT(128) 1 << 7 + */ + KN550: RCTModule.KN550, + /** + * Device type number for HS2(131072) 1 << 17 + */ + HS2: RCTModule.HS2, + /** + * Device type number for HS4S(268435456) 1 << 28 + */ + HS4S: RCTModule.HS4S, + HS6: 10086, + /** + * Device type number for BG1(110) + */ + BG1: RCTModule.BG1, + /** + * Device type number for BG5(4294967296) 1 << 32 + */ + BG5: RCTModule.BG5, + + BG5S: RCTModule.BG5S, + + ECG3: RCTModule.ECG3, + + ECG3USB: RCTModule.ECG3USB, + + BTM: RCTModule.BTM, + + TS28B: RCTModule.TS28B, + + NT13B: RCTModule.NT13B, + + HS2S: RCTModule.HS2S, + + BG1S: RCTModule.BG1S, + + /** + * Notify event type for scan device result.("event_scan_device") + */ + Event_Scan_Device: RCTModule.Event_Scan_Device, + /** + * Notify event type for scan action finish.("event_scan_finish") + */ + Event_Scan_Finish: RCTModule.Event_Scan_Finish, + /** + * Notify event type for connect device successfully.("event_device_connected") + */ + Event_Device_Connected: RCTModule.Event_Device_Connected, + /** + * Notify event type for connect device failed.("event_device_connect_failed") + */ + Event_Device_Connect_Failed: RCTModule.Event_Device_Connect_Failed, + /** + * Notify event type for device disconnect.("event_device_disconnect") + */ + Event_Device_Disconnect: RCTModule.Event_Device_Disconnect, + /** + * Notify event type for authenticate result.("event_authenticate_result") + */ + Event_Authenticate_Result: RCTModule.Event_Authenticate_Result, + + + /** + * Authentication the configure information. + * Attentation: Please register to receive event(iHealthDeviceManagerModel.Event_Authenticate_Result) before call the api. + * @param {string} userName User's user name you use when you sign up + * @param {string} clientID User's client id. + * @param {string} clientSecret User's client secret. + * @return {callback} Callback with a json object. Eg.{"authen":2} + *

    • The measurement via SDK will be operated in the case of 1-3, and there is 10-day tryout if SDK Verification failed in case of SDK cannot connect Internet or Userid/clientID/clientSecret verification failed or SDK has not been authorized or User has not been authorized. + * SDK is fully functional during tryout period, but will be terminated without verification through Internet after 10 days.The interface needs to be re-called after analyzing the return parameters. SDK application requires Internet connection. + * If you encounter user status 4 with full internet access, please send Userid/clientID/clientSecret to this email sdk@ihealthlabs.com.cn to get help. + *

      + * The result value and description will be as below: + * + * + * + * + * + * + * + * + * + * + * + * + *
      ValueDescription
      1New-user registration succeeded.
      2User login succeeded.
      3The user is iHealth user as well, measurement via SDK has been activated, and the data from the measurement belongs to the user.
      4Testing without Internet connection succeeded.
      5Userid/clientID/clientSecret verification failed.
      6SDK has not been authorized.
      7User has not been authorized.
      8Internet error, verification failed.
      + */ + authenConfigureInfo: function (userName, clientID, clientSecret) { + RCTModule.authenConfigureInfo(userName, clientID, clientSecret) + }, + /** + * Authencation the appSecret + * @param {string} appSecret + * @return {callback} Callback with a boolen object. true:authencation success false:authencation failed .
      + */ + + authenAppSecret: function (appSecret, callback) { + RCTModule.authenAppSecret(appSecret, callback) + }, + + /** + * Start discovery iHealth device with type + * Attentation: Please register to receive event(iHealthDeviceManagerModel.Event_Scan_Device) before call the api. + * + * @param {number} type The type to be discovered.
      + * e.g. startDiscovery(iHealthDeviceManagerModule.AM4) will discover AM4 devices.
      + */ + startDiscovery: function (type) { + RCTModule.startDiscovery(type) + }, + + + /** + * Stop discovery iHealth device + * Attentation: Please register to receive event(iHealthDeviceManagerModel.Event_Scan_Finish) before call the api. + */ + stopDiscovery: function () { + RCTModule.stopDiscovery() + }, + + /** + * Connect iHealth device + * Attentation: Please register to receive event(iHealthDeviceManagerModel.Event_Device_Connected or iHealthDeviceManagerModel.Event_Device_Connect_Failed) before call the api. + * @param {string} mac The mac address of device to be connected.
      + * e.g. "004D3208D5D4" + * @param {string} type Device type string. + * @return {callback} Callback with events {@link module:iHealthDeviceManagerModule.Event_Device_Connected Event_Device_Connected} + * or {@link module:iHealthDeviceManagerModule.Event_Device_Connect_Failed Event_Device_Connect_Failed}. + * And the mesage is format as {"errorid":0,"type":"BP5","mac":"8CDE52B62521"} + *

      The key and value in the message will be as below: + * + * + * + * + * + * + * + *
      Keyvalue
      erroridThis value is to reflect the state of the system when the connection fails. Normally, it's 0. + Please note, this field is different from the ErrorId of the DeviceProfileModule.
      typeThe device type. Eg.BP5
      macThe mac address.
      + */ + connectDevice: function (mac, type) { + RCTModule.connectDevice(mac, type) + }, + + /** + * Connect BTM device + * Attentation: Please register to receive event(iHealthDeviceManagerModel.Event_Device_Connected or iHealthDeviceManagerModel.Event_Device_Connect_Failed) before call the api. + * @param {string} mac The mac address of device to be connected.
      + * e.g. "004D3208D5D4" + * @param {string} type Device type string. + * @return {callback} Callback with events {@link module:iHealthDeviceManagerModule.Event_Device_Connected Event_Device_Connected} + * or {@link module:iHealthDeviceManagerModule.Event_Device_Connect_Failed Event_Device_Connect_Failed}. + * And the mesage is format as {"errorid":0,"type":"BP5","mac":"8CDE52B62521"} + *

      The key and value in the message will be as below: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
      Keyvalue
      erroridThis value is to reflect the state of the system when the connection fails. Normally, it's 0. + Please note, this field is different from the ErrorId of the DeviceProfileModule.
      usernamethe identification of the user, could be the form of email address or mobile phone
      maca valid FDIR-V3 mac.
      typeTYPE_FDIR_V3
      unitTemperature unit.1: c 2: f
      measureTargetMeasuring target.1: body 2: object
      functionTargetOffline target.1: offline 2: online
      hourStandby time hours. eg. 24
      minuteStandby time minutes. eg.60
      secondStandby time seconds. eg.60
      + */ + connectTherm: function (username, mac, type, unit, measureTarget, functionTarget, hour, minute, second) { + RCTModule.connectTherm(username, mac, type, unit, measureTarget, functionTarget, hour, minute, second) + }, + + + /** + * Get information for iHealth device + * + * @param {string} mac The mac address of device.
      + * e.g. "004D3208D5D4" + * @return {callback} Callback with a map object.
      + * e.g. {"protocolstring":"com.jiuan.AMV12","accessoryname":"AM4","firmwareversion":"138","hardwareversion":"100","manufacture":"iHealth","serialnumber":"004D32079148","modenumber":"AM4 11070"} + */ + getDevicesIDPS: function (mac, callback) { + RCTModule.getDevicesIDPS(mac, callback) + }, + + /** + * [Only for android] Disconnect an iHealth device that has been connected or in connecting status. + * Attentation: Please register to receive event(iHealthDeviceManagerModel.Event_Device_Disconnect or iHealthDeviceManagerModel.Event_Device_Connect_Failed) before call the api. + * @param {string} mac The mac address of device to be connected or in connecting.
      + * e.g. "004D3208D5D4" + * @param {string} type Device type string. + * @return {callback} Callback with events {@link module:iHealthDeviceManagerModule.Event_Device_Disconnect Event_Device_Disconnect} + * or {@link module:iHealthDeviceManagerModule.Event_Device_Connect_Failed Event_Device_Connect_Failed}. + * And the mesage is format as {"errorid":0,"type":"BP5","mac":"8CDE52B62521"} + *

      The key and value in the message will be as below: + * + * + * + * + * + * + * + *
      Keyvalue
      erroridThis value is to reflect the state of the system when the connection fails. Normally, it's 0. + Please note, this field is different from the ErrorId of the DeviceProfileModule.
      typeThe device type. Eg.BP5
      macThe mac address.
      + */ + disconnectDevice: function (mac, type) { + RCTModule.disconnectDevice(mac, type) + }, + + /** + * If you want to use the iHealth Device, you must first call authentication method before connect a device. + * To get a license, please refer to [iHealth Developer](https://dev.ihealthlabs.com). + * @param license The license file name is like 'com_example_android.pem'. Download the license file from the website, integrate to your native project. + * For android: should save the license file to the /assets/ folder. + * @return {callback} Callback with a map object.
      + * e.g. {"access": true} + */ + sdkAuthWithLicense: function (license) { + RCTModule.sdkAuthWithLicense(license) + }, + + /** + * get the phone is support OTG or not + * @return true or false + */ + + isSupportOTG: function (callback){ + if (Platform.OS === 'ios'){ + callback(true); + } else { + RCTModule.isSupportOTG(callback); + } + + }, + +} diff --git a/libs/ihealth-sdk/package-lock.json b/libs/ihealth-sdk/package-lock.json new file mode 100644 index 0000000..e58c8b1 --- /dev/null +++ b/libs/ihealth-sdk/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "@ihealth/ihealthlibrary-react-native", + "version": "1.4.9", + "lockfileVersion": 1 +} diff --git a/libs/ihealth-sdk/package.json b/libs/ihealth-sdk/package.json new file mode 100755 index 0000000..4ac2dba --- /dev/null +++ b/libs/ihealth-sdk/package.json @@ -0,0 +1,19 @@ +{ + "name": "@ihealth/ihealthlibrary-react-native", + "version": "1.5.0", + "description": "React Native Model for iHealth Library", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://iHealthLabs@github.com/iHealthLab/ReactNativeLibrary.git" + }, + "author": "iHealthLabs", + "license": "ISC", + "bugs": { + "url": "https://github.com/iHealthDeviceLabs/iHealthLibrary_ReactNative/issues" + }, + "homepage": "https://github.com/iHealthDeviceLabs/iHealthLibrary_ReactNative#readme" +} diff --git a/libs/ihealth-sdk/react-native.config.js b/libs/ihealth-sdk/react-native.config.js new file mode 100644 index 0000000..ab27434 --- /dev/null +++ b/libs/ihealth-sdk/react-native.config.js @@ -0,0 +1,10 @@ +module.exports = { + dependency: { + platforms: { + ios: { + podspecPath: require('path').resolve(__dirname, 'ReactNativeIOSLibrary.podspec'), + }, + android: null, // manually linked in settings.gradle + }, + }, +}; diff --git a/libs/ihealth-sdk/yarn.lock b/libs/ihealth-sdk/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/libs/ihealth-sdk/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + -- cgit