capacitor-plugin-ihealth 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/android/build.gradle +23 -2
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/assets/libiHealth.so +0 -0
- package/android/src/main/assets/libs/arm64-v8a/libBodyfat_SDK.so +0 -0
- package/android/src/main/assets/libs/arm64-v8a/libECGOffline.so +0 -0
- package/android/src/main/assets/libs/arm64-v8a/libECGOnline.so +0 -0
- package/android/src/main/assets/libs/arm64-v8a/libVeryFitMulti.so +0 -0
- package/android/src/main/assets/libs/arm64-v8a/libiHealth.so +0 -0
- package/android/src/main/java/com/managemyhealth/plugins/ihealth/BaseApplication.java +51 -0
- package/android/src/main/java/com/managemyhealth/plugins/ihealth/DeviceCharacteristic.java +49 -0
- package/android/src/main/java/com/managemyhealth/plugins/ihealth/ihealthPlugin.java +1966 -3
- package/android/src/main/libiHealth.so +0 -0
- package/dist/docs.json +3 -3
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Plugin/ihealthPlugin.swift +50 -18
- package/package.json +1 -1
Binary file
|
package/dist/docs.json
CHANGED
@@ -131,12 +131,12 @@
|
|
131
131
|
},
|
132
132
|
{
|
133
133
|
"name": "addListener",
|
134
|
-
"signature": "(...args: [eventName: \"OnlineDeviceData\", listenerFunc: (info: any) => void] | [eventName: \"error\", listenerFunc: (info: any) => void] | [eventName: \"deviceDatafound\", listenerFunc: (info: any) => void] | [eventName: \"dataNotFound\", listenerFunc: (info: any) => void] | [eventName: \"deviceConnectFail\", listenerFunc: (info: any) => void] | [eventName: \"deviceDisconnect\", listenerFunc: (info: any) => void] | [eventName: \"deviceDiscover\", listenerFunc: (info: any) => void] | [eventName: \"deviceConnect\", listenerFunc: (info: any) => void]) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
134
|
+
"signature": "(...args: [eventName: \"OnlineDeviceData\", listenerFunc: (info: any) => void] | [eventName: \"toast\", listenerFunc: (info: any) => void] | [eventName: \"error\", listenerFunc: (info: any) => void] | [eventName: \"deviceDatafound\", listenerFunc: (info: any) => void] | [eventName: \"StartMeasurementFinished\", listenerFunc: (info: any) => void] | [eventName: \"dataNotFound\", listenerFunc: (info: any) => void] | [eventName: \"deviceConnectFail\", listenerFunc: (info: any) => void] | [eventName: \"deviceDisconnect\", listenerFunc: (info: any) => void] | [eventName: \"deviceDiscover\", listenerFunc: (info: any) => void] | [eventName: \"deviceConnect\", listenerFunc: (info: any) => void]) => Promise<PluginListenerHandle> & PluginListenerHandle",
|
135
135
|
"parameters": [
|
136
136
|
{
|
137
137
|
"name": "args",
|
138
138
|
"docs": "",
|
139
|
-
"type": "[eventName: 'OnlineDeviceData', listenerFunc: (info: any) => void] | [eventName: 'error', listenerFunc: (info: any) => void] | [eventName: 'deviceDatafound', listenerFunc: (info: any) => void] | [eventName: 'dataNotFound', listenerFunc: (info: any) => void] | [eventName: 'deviceConnectFail', listenerFunc: (info: any) => void] | [eventName: 'deviceDisconnect', listenerFunc: (info: any) => void] | [eventName: 'deviceDiscover', listenerFunc: (info: any) => void] | [eventName: 'deviceConnect', listenerFunc: (info: any) => void]"
|
139
|
+
"type": "[eventName: 'OnlineDeviceData', listenerFunc: (info: any) => void] | [eventName: 'toast', listenerFunc: (info: any) => void] | [eventName: 'error', listenerFunc: (info: any) => void] | [eventName: 'deviceDatafound', listenerFunc: (info: any) => void] | [eventName: 'StartMeasurementFinished', listenerFunc: (info: any) => void] | [eventName: 'dataNotFound', listenerFunc: (info: any) => void] | [eventName: 'deviceConnectFail', listenerFunc: (info: any) => void] | [eventName: 'deviceDisconnect', listenerFunc: (info: any) => void] | [eventName: 'deviceDiscover', listenerFunc: (info: any) => void] | [eventName: 'deviceConnect', listenerFunc: (info: any) => void]"
|
140
140
|
}
|
141
141
|
],
|
142
142
|
"returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
|
@@ -145,7 +145,7 @@
|
|
145
145
|
"complexTypes": [
|
146
146
|
"PluginListenerHandle"
|
147
147
|
],
|
148
|
-
"slug": "addlistenereventname-onlinedevicedata-listenerfunc-info-any--void--eventname-error-listenerfunc-info-any--void--eventname-devicedatafound-listenerfunc-info-any--void--eventname-datanotfound-listenerfunc-info-any--void--eventname-deviceconnectfail-listenerfunc-info-any--void--eventname-devicedisconnect-listenerfunc-info-any--void--eventname-devicediscover-listenerfunc-info-any--void--eventname-deviceconnect-listenerfunc-info-any--void"
|
148
|
+
"slug": "addlistenereventname-onlinedevicedata-listenerfunc-info-any--void--eventname-toast-listenerfunc-info-any--void--eventname-error-listenerfunc-info-any--void--eventname-devicedatafound-listenerfunc-info-any--void--eventname-startmeasurementfinished-listenerfunc-info-any--void--eventname-datanotfound-listenerfunc-info-any--void--eventname-deviceconnectfail-listenerfunc-info-any--void--eventname-devicedisconnect-listenerfunc-info-any--void--eventname-devicediscover-listenerfunc-info-any--void--eventname-deviceconnect-listenerfunc-info-any--void"
|
149
149
|
}
|
150
150
|
],
|
151
151
|
"properties": []
|
@@ -28,5 +28,5 @@ export interface ihealthPlugin {
|
|
28
28
|
startBP5SMeasurement(): Promise<{
|
29
29
|
value: any;
|
30
30
|
}>;
|
31
|
-
addListener(...args: [eventName: 'OnlineDeviceData', listenerFunc: (info: any) => void] | [eventName: 'error', listenerFunc: (info: any) => void] | [eventName: 'deviceDatafound', listenerFunc: (info: any) => void] | [eventName: 'dataNotFound', listenerFunc: (info: any) => void] | [eventName: 'deviceConnectFail', listenerFunc: (info: any) => void] | [eventName: 'deviceDisconnect', listenerFunc: (info: any) => void] | [eventName: 'deviceDiscover', listenerFunc: (info: any) => void] | [eventName: 'deviceConnect', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;
|
31
|
+
addListener(...args: [eventName: 'OnlineDeviceData', listenerFunc: (info: any) => void] | [eventName: 'toast', listenerFunc: (info: any) => void] | [eventName: 'error', listenerFunc: (info: any) => void] | [eventName: 'deviceDatafound', listenerFunc: (info: any) => void] | [eventName: 'StartMeasurementFinished', listenerFunc: (info: any) => void] | [eventName: 'dataNotFound', listenerFunc: (info: any) => void] | [eventName: 'deviceConnectFail', listenerFunc: (info: any) => void] | [eventName: 'deviceDisconnect', listenerFunc: (info: any) => void] | [eventName: 'deviceDiscover', listenerFunc: (info: any) => void] | [eventName: 'deviceConnect', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;
|
32
32
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface ihealthPlugin {\n authoriseiHealthSdk(): Promise<{ value: any }>;\n isBluetoothEnabled(): Promise<{ value: any }>;\n\tinitialiseCentralManager(): Promise<{ value: any }>;\n scanDiscover(options: Object): Promise<{ value: any }>;\n\tconnectDevice(options: Object): Promise<any>;\n getConnectedDeviceInstance(options: Object): Promise<{ value: any }>;\n\tdisconnectDevice(): Promise<{ value: any }>;\n deleteDeviceData(): Promise<{ value: any }>;\n getDeviceOfflineData(): Promise<{ value: any }>;\n startBP5SMeasurement(): Promise<{ value: any }>;\n addListener(...args: [eventName: 'OnlineDeviceData', listenerFunc: (info: any) => void] |[eventName: 'error', listenerFunc: (info: any) => void] | [eventName: 'deviceDatafound', listenerFunc: (info: any) => void] | [eventName: 'dataNotFound', listenerFunc: (info: any) => void]|[eventName: 'deviceConnectFail', listenerFunc: (info: any) => void] | [eventName: 'deviceDisconnect', listenerFunc: (info: any) => void] | [eventName: 'deviceDiscover', listenerFunc: (info: any) => void] | [eventName: 'deviceConnect', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;\n}\n"]}
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface ihealthPlugin {\n authoriseiHealthSdk(): Promise<{ value: any }>;\n isBluetoothEnabled(): Promise<{ value: any }>;\n\tinitialiseCentralManager(): Promise<{ value: any }>;\n scanDiscover(options: Object): Promise<{ value: any }>;\n\tconnectDevice(options: Object): Promise<any>;\n getConnectedDeviceInstance(options: Object): Promise<{ value: any }>;\n\tdisconnectDevice(): Promise<{ value: any }>;\n deleteDeviceData(): Promise<{ value: any }>;\n getDeviceOfflineData(): Promise<{ value: any }>;\n startBP5SMeasurement(): Promise<{ value: any }>;\n addListener(...args: [eventName: 'OnlineDeviceData', listenerFunc: (info: any) => void] | [eventName: 'toast', listenerFunc: (info: any) => void] |[eventName: 'error', listenerFunc: (info: any) => void] | [eventName: 'deviceDatafound', listenerFunc: (info: any) => void] | [eventName: 'StartMeasurementFinished', listenerFunc: (info: any) => void] | [eventName: 'dataNotFound', listenerFunc: (info: any) => void]|[eventName: 'deviceConnectFail', listenerFunc: (info: any) => void] | [eventName: 'deviceDisconnect', listenerFunc: (info: any) => void] | [eventName: 'deviceDiscover', listenerFunc: (info: any) => void] | [eventName: 'deviceConnect', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;\n}\n"]}
|
@@ -355,6 +355,11 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
355
355
|
selector: #selector(self.deviceConnectFail),
|
356
356
|
name: Notification.Name(connectfail),
|
357
357
|
object: nil)
|
358
|
+
NotificationCenter.default.addObserver(
|
359
|
+
self,
|
360
|
+
selector: #selector(self.onlineMeasurementForPT3SBT),
|
361
|
+
name: Notification.Name("PT3SBTNotificationGetResult"),
|
362
|
+
object: nil)
|
358
363
|
}
|
359
364
|
|
360
365
|
@objc func deviceDiscover(notification:NSNotification) {
|
@@ -452,6 +457,9 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
452
457
|
default:
|
453
458
|
break
|
454
459
|
}
|
460
|
+
call.resolve([
|
461
|
+
"success": "success"
|
462
|
+
])
|
455
463
|
}
|
456
464
|
@objc func getDeviceOfflineData(_ call: CAPPluginCall) {
|
457
465
|
|
@@ -636,6 +644,7 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
636
644
|
}, errorBlock: { error in
|
637
645
|
|
638
646
|
})
|
647
|
+
self.notifyListeners("StartMeasurementFinished", data: nil)
|
639
648
|
}
|
640
649
|
func getBP5SDeviceInstances() {
|
641
650
|
|
@@ -652,9 +661,10 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
652
661
|
}, errorBlock: { err in
|
653
662
|
|
654
663
|
})
|
655
|
-
|
656
|
-
|
657
|
-
|
664
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
665
|
+
// self.startBP5SMeasurement()
|
666
|
+
self.getBP5SOfflineData()
|
667
|
+
}
|
658
668
|
}
|
659
669
|
func getBG5SInstances() {
|
660
670
|
|
@@ -674,7 +684,13 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
674
684
|
|
675
685
|
})
|
676
686
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
677
|
-
self.
|
687
|
+
self.myBBG5SDevice?.setUnit(BGUnit.mmolPL, successBlock: {
|
688
|
+
self.startBG5SMeasurement()
|
689
|
+
}, errorBlock: { Error, msg in
|
690
|
+
self.startBG5SMeasurement()
|
691
|
+
})
|
692
|
+
|
693
|
+
|
678
694
|
}
|
679
695
|
}
|
680
696
|
|
@@ -701,7 +717,7 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
701
717
|
}
|
702
718
|
|
703
719
|
func getPT3SBTInstances() {
|
704
|
-
|
720
|
+
|
705
721
|
if let devices = PT3SBTController.shareIHPT().getAllCurrentPT3SBTInstace() as? [PT3SBT] {
|
706
722
|
for device in devices {
|
707
723
|
|
@@ -715,10 +731,13 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
715
731
|
}
|
716
732
|
}
|
717
733
|
myPT3SBTDevice?.commandFunction({ data in
|
734
|
+
//self.getPT3SBSOfflineData()
|
718
735
|
}, disposeErrorBlock: { error in
|
736
|
+
//self.getPT3SBSOfflineData()
|
719
737
|
})
|
720
738
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
721
|
-
self.startPT3SBTMeasurement()
|
739
|
+
//self.startPT3SBTMeasurement()
|
740
|
+
self.getPT3SBSOfflineData()
|
722
741
|
}
|
723
742
|
|
724
743
|
}
|
@@ -733,7 +752,8 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
733
752
|
}
|
734
753
|
}
|
735
754
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
736
|
-
|
755
|
+
|
756
|
+
self.getHS4SOfflineData()
|
737
757
|
}
|
738
758
|
}
|
739
759
|
func getHS2SInstances() {
|
@@ -963,7 +983,6 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
963
983
|
|
964
984
|
if(count == 0) {
|
965
985
|
let userData = ["count": count] as [String : Any]
|
966
|
-
|
967
986
|
self.notifyListeners("dataNotFound", data: userData)
|
968
987
|
} else {
|
969
988
|
self.myPT3SBTDevice?.commandGetMemorryData({ data in
|
@@ -973,7 +992,7 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
973
992
|
}
|
974
993
|
let userData = ["result": deviceDataArr, "deviceModel": "PT3SBT", "deviceMacAddress": self.deviceMacAddress,"isFromLive":false] as [String : Any]
|
975
994
|
self.notifyListeners("deviceDatafound", data: userData)
|
976
|
-
|
995
|
+
self.deleteDataFromPT3SBT()
|
977
996
|
}, disposeErrorBlock: { error in
|
978
997
|
|
979
998
|
let userData = ["error": error] as [String : Any]
|
@@ -1007,11 +1026,12 @@ public class ihealthPlugin: CAPPlugin,CBCentralManagerDelegate,BG5SDelegate {
|
|
1007
1026
|
let userData = ["result": deviceDataArr, "deviceModel": "HS4S", "deviceMacAddress": self.deviceMacAddress,"isFromLive":false] as [String : Any]
|
1008
1027
|
print(" deviceDatafound >> \(userData)")
|
1009
1028
|
self.notifyListeners("deviceDatafound", data: userData)
|
1010
|
-
|
1029
|
+
self.startHS4SMeasurement()
|
1011
1030
|
}, finishTransmission: {
|
1012
1031
|
print(" finished")
|
1013
1032
|
}, disposeErrorBlock: { error in
|
1014
1033
|
print(" disposeErrorBlock >> \(error)")
|
1034
|
+
self.startHS4SMeasurement()
|
1015
1035
|
self.HS4SError(errorID: error)
|
1016
1036
|
})
|
1017
1037
|
}
|
@@ -1193,12 +1213,13 @@ timerCount = timerCount+1
|
|
1193
1213
|
let userData = ["result": bp5sData, "deviceModel": "BP5S", "deviceMacAddress": self.deviceMacAddress,"isFromLive":true] as [String : Any]
|
1194
1214
|
self.notifyListeners("deviceDatafound", data: userData)
|
1195
1215
|
}, errorBlock: { err in
|
1196
|
-
|
1216
|
+
let userData = ["error": "BP5S measurement stopped."] as [String : Any]
|
1217
|
+
self.notifyListeners("error", data: userData)
|
1197
1218
|
})
|
1198
1219
|
}, errorBlock: { error in
|
1199
1220
|
|
1200
1221
|
})
|
1201
|
-
|
1222
|
+
// self.notifyListeners("StartMeasurementFinished", data: nil)
|
1202
1223
|
}
|
1203
1224
|
|
1204
1225
|
func startPT3SBTMeasurement(){
|
@@ -1208,9 +1229,12 @@ timerCount = timerCount+1
|
|
1208
1229
|
selector: #selector(self.onlineMeasurementForPT3SBT),
|
1209
1230
|
name: Notification.Name("PT3SBTNotificationGetResult"),
|
1210
1231
|
object: nil)
|
1232
|
+
//DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
1233
|
+
// self.notifyListeners("StartMeasurementFinished", data: nil)
|
1234
|
+
//}
|
1235
|
+
|
1211
1236
|
}
|
1212
1237
|
@objc func onlineMeasurementForPT3SBT(notification:NSNotification){
|
1213
|
-
let notifyObject = notification.userInfo
|
1214
1238
|
guard let userInfo = notification.userInfo as NSDictionary? as? [String: Any] else {return}
|
1215
1239
|
// self.bridge?.viewController?.showToast(message: "PT3SBT \(userInfo)")
|
1216
1240
|
let userData = ["result": [userInfo], "deviceModel": "PT3SBT", "deviceMacAddress": self.deviceMacAddress,"isFromLive":true] as [String : Any]
|
@@ -1240,8 +1264,9 @@ timerCount = timerCount+1
|
|
1240
1264
|
}
|
1241
1265
|
|
1242
1266
|
}, withErrorBlock: { err in
|
1243
|
-
|
1267
|
+
// self.bridge?.viewController?.showToast(message: "PO3 start error else:\(err)")
|
1244
1268
|
})
|
1269
|
+
self.notifyListeners("StartMeasurementFinished", data: nil)
|
1245
1270
|
}
|
1246
1271
|
func startBG5SMeasurement(){
|
1247
1272
|
self.myBBG5SDevice?.startMeasure(BGMeasureMode.noBlood, withSuccessBlock: {
|
@@ -1249,6 +1274,7 @@ timerCount = timerCount+1
|
|
1249
1274
|
}, errorBlock: { err, msg in
|
1250
1275
|
|
1251
1276
|
})
|
1277
|
+
self.notifyListeners("StartMeasurementFinished", data: nil)
|
1252
1278
|
}
|
1253
1279
|
func startHS2SMeasurement(){
|
1254
1280
|
if let user = self.healthUser{
|
@@ -1268,7 +1294,7 @@ timerCount = timerCount+1
|
|
1268
1294
|
|
1269
1295
|
})
|
1270
1296
|
}
|
1271
|
-
|
1297
|
+
self.notifyListeners("StartMeasurementFinished", data: nil)
|
1272
1298
|
|
1273
1299
|
}
|
1274
1300
|
func startHS4SMeasurement(){
|
@@ -1285,9 +1311,9 @@ timerCount = timerCount+1
|
|
1285
1311
|
self.notifyListeners("deviceDatafound", data: userData)
|
1286
1312
|
//self.bridge?.viewController?.showToast(message: "stable weight:\(hs4sData)")
|
1287
1313
|
}, disposeErrorBlock: { err in
|
1288
|
-
|
1314
|
+
// self.bridge?.viewController?.showToast(message: "error in hs4s start\(err)")
|
1289
1315
|
})
|
1290
|
-
|
1316
|
+
self.notifyListeners("StartMeasurementFinished", data: nil)
|
1291
1317
|
}
|
1292
1318
|
|
1293
1319
|
// MARK: Error CallBack Methods
|
@@ -1460,11 +1486,17 @@ timerCount = timerCount+1
|
|
1460
1486
|
}
|
1461
1487
|
|
1462
1488
|
public func device(_ device: BG5S!, stripStateDidUpdate state: BG5SStripState) {
|
1463
|
-
print(" BG5S >> stripStateDidUpdate")
|
1489
|
+
print(" BG5S >> stripStateDidUpdate \(state.rawValue)")
|
1490
|
+
if(state.rawValue == 0){
|
1491
|
+
self.notifyListeners("toast", data: ["message":"strip inserted"])
|
1492
|
+
}else if(state.rawValue == 1){
|
1493
|
+
self.notifyListeners("toast", data: ["message":"strip removed"])
|
1494
|
+
}
|
1464
1495
|
}
|
1465
1496
|
|
1466
1497
|
public func deviceDropBlood(_ device: BG5S!) {
|
1467
1498
|
print(" BG5S >> deviceDropBlood")
|
1499
|
+
self.notifyListeners("toast", data: ["message":"blood drop received"])
|
1468
1500
|
}
|
1469
1501
|
|
1470
1502
|
public func device(_ device: BG5S!, dataID: String!, measureReult result: Int) {
|