From c73333d1647b02af2a21407ebfee8202d39b6035 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 16 Jan 2024 12:03:05 +0300 Subject: [PATCH 1/2] BP Device implemented --- ios/Runner.xcodeproj/project.pbxproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5992f749..b7f4c082 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -23,6 +23,8 @@ 765948202B4EC54400D96E03 /* EKGFileDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7659481F2B4EC54400D96E03 /* EKGFileDetail.swift */; }; 765948222B4FD1B500D96E03 /* SP20RTParamModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948212B4FD1B500D96E03 /* SP20RTParamModel.swift */; }; 765948242B4FE12B00D96E03 /* DoubleExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948232B4FE12B00D96E03 /* DoubleExtension.swift */; }; + 765948262B566F2000D96E03 /* BpRtDataResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948252B566F2000D96E03 /* BpRtDataResultModel.swift */; }; + 765948282B56783900D96E03 /* BpRtDataMeasuringModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948272B56783900D96E03 /* BpRtDataMeasuringModel.swift */; }; 76801ACA2AD7F7DA00126C2D /* CRAP20Lib.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76801AC92AD7F7D900126C2D /* CRAP20Lib.xcframework */; }; 76815B27275F381C00E66E94 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76815B26275F381C00E66E94 /* HealthKit.framework */; }; 76962ECE28AE5C10004EAE09 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 76962ECD28AE5C10004EAE09 /* GoogleService-Info.plist */; }; @@ -72,6 +74,8 @@ 7659481F2B4EC54400D96E03 /* EKGFileDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EKGFileDetail.swift; sourceTree = ""; }; 765948212B4FD1B500D96E03 /* SP20RTParamModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SP20RTParamModel.swift; sourceTree = ""; }; 765948232B4FE12B00D96E03 /* DoubleExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleExtension.swift; sourceTree = ""; }; + 765948252B566F2000D96E03 /* BpRtDataResultModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BpRtDataResultModel.swift; sourceTree = ""; }; + 765948272B56783900D96E03 /* BpRtDataMeasuringModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BpRtDataMeasuringModel.swift; sourceTree = ""; }; 76801AC92AD7F7D900126C2D /* CRAP20Lib.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = CRAP20Lib.xcframework; path = Runner/BLE_SDKs/CRAP20Lib.xcframework; sourceTree = ""; }; 76815B26275F381C00E66E94 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; }; 76962ECD28AE5C10004EAE09 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; @@ -178,6 +182,8 @@ 7659481F2B4EC54400D96E03 /* EKGFileDetail.swift */, 765948212B4FD1B500D96E03 /* SP20RTParamModel.swift */, 765948232B4FE12B00D96E03 /* DoubleExtension.swift */, + 765948252B566F2000D96E03 /* BpRtDataResultModel.swift */, + 765948272B56783900D96E03 /* BpRtDataMeasuringModel.swift */, ); path = Utils; sourceTree = ""; @@ -452,6 +458,7 @@ E91B539A256AAA6500E96549 /* MainFlutterVC.swift in Sources */, E91B539C256AAA6500E96549 /* HMG_GUEST_bkp.swift in Sources */, E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */, + 765948282B56783900D96E03 /* BpRtDataMeasuringModel.swift in Sources */, 7659481E2B4EBEB600D96E03 /* VTBLEUtils.m in Sources */, E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */, E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */, @@ -467,6 +474,7 @@ E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */, 7659481B2B4E899200D96E03 /* VTECGParser.swift in Sources */, 765948192B4E72A100D96E03 /* TupleToArray.swift in Sources */, + 765948262B566F2000D96E03 /* BpRtDataResultModel.swift in Sources */, 765948222B4FD1B500D96E03 /* SP20RTParamModel.swift in Sources */, E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */, 765948202B4EC54400D96E03 /* EKGFileDetail.swift in Sources */, From 5dc0f571c81fdc48c5cf4d79740565ec7d851b70 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 17 Jan 2024 17:22:16 +0300 Subject: [PATCH 2/2] Updates --- ios/Runner.xcodeproj/project.pbxproj | 16 ++++++++++++++++ .../ble_helpers/ble_connect_helper.dart | 2 +- .../my_trackers_view_model.dart | 15 ++++++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index b7f4c082..0bddac4a 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -25,6 +25,8 @@ 765948242B4FE12B00D96E03 /* DoubleExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948232B4FE12B00D96E03 /* DoubleExtension.swift */; }; 765948262B566F2000D96E03 /* BpRtDataResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948252B566F2000D96E03 /* BpRtDataResultModel.swift */; }; 765948282B56783900D96E03 /* BpRtDataMeasuringModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948272B56783900D96E03 /* BpRtDataMeasuringModel.swift */; }; + 7659482A2B57FE5D00D96E03 /* BleDeviceModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765948292B57FE5D00D96E03 /* BleDeviceModel.swift */; }; + 7659482F2B5813F200D96E03 /* ECGRtModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7659482E2B5813F200D96E03 /* ECGRtModel.swift */; }; 76801ACA2AD7F7DA00126C2D /* CRAP20Lib.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76801AC92AD7F7D900126C2D /* CRAP20Lib.xcframework */; }; 76815B27275F381C00E66E94 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76815B26275F381C00E66E94 /* HealthKit.framework */; }; 76962ECE28AE5C10004EAE09 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 76962ECD28AE5C10004EAE09 /* GoogleService-Info.plist */; }; @@ -76,6 +78,8 @@ 765948232B4FE12B00D96E03 /* DoubleExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleExtension.swift; sourceTree = ""; }; 765948252B566F2000D96E03 /* BpRtDataResultModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BpRtDataResultModel.swift; sourceTree = ""; }; 765948272B56783900D96E03 /* BpRtDataMeasuringModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BpRtDataMeasuringModel.swift; sourceTree = ""; }; + 765948292B57FE5D00D96E03 /* BleDeviceModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BleDeviceModel.swift; sourceTree = ""; }; + 7659482E2B5813F200D96E03 /* ECGRtModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ECGRtModel.swift; sourceTree = ""; }; 76801AC92AD7F7D900126C2D /* CRAP20Lib.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = CRAP20Lib.xcframework; path = Runner/BLE_SDKs/CRAP20Lib.xcframework; sourceTree = ""; }; 76815B26275F381C00E66E94 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; }; 76962ECD28AE5C10004EAE09 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; @@ -161,6 +165,14 @@ path = Pods; sourceTree = ""; }; + 7659482D2B5813E300D96E03 /* ECGRTModels */ = { + isa = PBXGroup; + children = ( + 7659482E2B5813F200D96E03 /* ECGRtModel.swift */, + ); + path = ECGRTModels; + sourceTree = ""; + }; 76A8B2752ACD5DB80073357D /* Ble */ = { isa = PBXGroup; children = ( @@ -173,6 +185,7 @@ 76F3B95C2ACEBE2800D7A698 /* Utils */ = { isa = PBXGroup; children = ( + 7659482D2B5813E300D96E03 /* ECGRTModels */, 7659481C2B4EBEB600D96E03 /* VTBLEUtils.h */, 7659481D2B4EBEB600D96E03 /* VTBLEUtils.m */, 7659481A2B4E899200D96E03 /* VTECGParser.swift */, @@ -184,6 +197,7 @@ 765948232B4FE12B00D96E03 /* DoubleExtension.swift */, 765948252B566F2000D96E03 /* BpRtDataResultModel.swift */, 765948272B56783900D96E03 /* BpRtDataMeasuringModel.swift */, + 765948292B57FE5D00D96E03 /* BleDeviceModel.swift */, ); path = Utils; sourceTree = ""; @@ -476,9 +490,11 @@ 765948192B4E72A100D96E03 /* TupleToArray.swift in Sources */, 765948262B566F2000D96E03 /* BpRtDataResultModel.swift in Sources */, 765948222B4FD1B500D96E03 /* SP20RTParamModel.swift in Sources */, + 7659482F2B5813F200D96E03 /* ECGRtModel.swift in Sources */, E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */, 765948202B4EC54400D96E03 /* EKGFileDetail.swift in Sources */, 765948242B4FE12B00D96E03 /* DoubleExtension.swift in Sources */, + 7659482A2B57FE5D00D96E03 /* BleDeviceModel.swift in Sources */, E91B5397256AAA6500E96549 /* Extensions.swift in Sources */, E91B5398256AAA6500E96549 /* API.swift in Sources */, ); diff --git a/lib/pages/medical/my_trackers/ble_helpers/ble_connect_helper.dart b/lib/pages/medical/my_trackers/ble_helpers/ble_connect_helper.dart index 7d0783de..7c4289d5 100644 --- a/lib/pages/medical/my_trackers/ble_helpers/ble_connect_helper.dart +++ b/lib/pages/medical/my_trackers/ble_helpers/ble_connect_helper.dart @@ -17,7 +17,7 @@ class BleChannel { // if (Platform.isIOS && deviceType[0] == "ekg") { // result = await platform_ios_ekg.invokeMethod('scanEKG', deviceType); // } else { - result = await platform.invokeMethod('scanDevices'); + result = await platform.invokeMethod('scanDevices', deviceType); // } print("----------Flutter Result -------"); print(result); diff --git a/lib/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart b/lib/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart index af692392..61055338 100644 --- a/lib/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart +++ b/lib/pages/medical/my_trackers/my_trackers_view_model/my_trackers_view_model.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'dart:developer'; +import 'dart:io'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/ble_devices_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/viatom_devices/bp_rt_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/viatom_devices/ecg_file_detail_model.dart'; @@ -241,7 +242,11 @@ class MyTrackersViewModel extends ChangeNotifier { // Get Devices List if (event['type'] == kDevicesList) { - parsesDevicesList(json.decode(event['data']) as List); + // if(Platform.isIOS) { + // parsesDevicesList(json.decode(event['data'])); + // } else if(Platform.isAndroid) { + parsesDevicesList(json.decode(event['data']) as List); + // } } // Get Oxymeter Readings @@ -285,7 +290,7 @@ class MyTrackersViewModel extends ChangeNotifier { } }); - await scanDevices(); + await scanDevices(currentSelectedTrackerType); } void parsesDevicesList(List returnData) { @@ -306,14 +311,14 @@ class MyTrackersViewModel extends ChangeNotifier { } Future connectDevice(BleDeviceModel device) async { - await BleChannel.connectDevice([device.name, device.model.toString()]); + await BleChannel.connectDevice([device.name, device.model.toString(), currentSelectedTrackerType.name]); } Future disConnectDevice() async { await BleChannel.disconnect(); } - Future scanDevices() async { - await BleChannel.scanResults([]); + Future scanDevices(TrackerTypeEnum currentSelectedTrackerType) async { + await BleChannel.scanResults([currentSelectedTrackerType.name]); } }