|
|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/andesfit_devices/all_in_one_monitor/check_me_info_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/andesfit_devices/bt_constants.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/andesfit_devices/weight_data_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/ble_devices_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/checkmepro_all_in_one_models/checkme_user_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';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_models/viatom_devices/ecg_rt_model.dart';
|
|
|
|
|
@ -14,6 +16,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/ble_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
@ -21,6 +24,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/ble_helpers/ble_connect_helper.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
enum TrackerTypeEnum { OxymeterTracker, BloodPressureTracker, BloodSugarTracker, ECGTracker, WeightScale, Temperature, Spirometer, AllInOneTracker }
|
|
|
|
|
|
|
|
|
|
@ -31,7 +35,7 @@ String kRealTimeDataBPResult = "RealTimeDataBPResult";
|
|
|
|
|
String kOxyRtParam = "OxyRtParam";
|
|
|
|
|
String kDevicesList = "DevicesList";
|
|
|
|
|
String kDevicesListCheckMe = "DevicesListCheckMe";
|
|
|
|
|
String kInfoDataCheckMe = "infoDataCheckMe";
|
|
|
|
|
String kCheckMeUsersList = "CheckMeUsersList";
|
|
|
|
|
String kRealTimeDataECGMeasuring = "RealTimeDataECGMeasuring"; // This is for the device that measures BP and ECG also Like BP2 0567
|
|
|
|
|
String kRealTimeDataECGResult = "RealTimeDataECGResult";
|
|
|
|
|
String kRealTimeDataECG = "RealTimeDataECG";
|
|
|
|
|
@ -103,6 +107,13 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
List<String> ecgEnabledDevices = ["BP2 0567", "DuoEK", "ER1", "PM101897"];
|
|
|
|
|
List<TrackerTypeEnum> checkMeProTrackers = [
|
|
|
|
|
TrackerTypeEnum.Temperature,
|
|
|
|
|
TrackerTypeEnum.BloodPressureTracker,
|
|
|
|
|
TrackerTypeEnum.OxymeterTracker,
|
|
|
|
|
TrackerTypeEnum.BloodSugarTracker,
|
|
|
|
|
TrackerTypeEnum.ECGTracker,
|
|
|
|
|
];
|
|
|
|
|
List<String> andesFitDevices = [
|
|
|
|
|
"BPM",
|
|
|
|
|
"PM101897",
|
|
|
|
|
@ -211,13 +222,102 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String checkMeInfo;
|
|
|
|
|
List<CheckMeUserInfoModel> checkMeProUsersList;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeUserInfoModel(List returnData) {
|
|
|
|
|
if (checkMeProUsersList != null) {
|
|
|
|
|
checkMeProUsersList.clear();
|
|
|
|
|
}
|
|
|
|
|
checkMeProUsersList = List.generate(returnData.length, (index) => CheckMeUserInfoModel.fromJson(jsonDecode(returnData[index])));
|
|
|
|
|
|
|
|
|
|
void updateCheckMeInfoModel(String mapData) {
|
|
|
|
|
checkMeInfo = mapData;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCheckMeUsersListDialog(BuildContext context) {
|
|
|
|
|
return showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) => Container(
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(15)), color: Colors.white),
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
margin: const EdgeInsets.symmetric(vertical: 35, horizontal: 30),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Material(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
"Users List",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.8,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.3,
|
|
|
|
|
height: 13 / 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (myTrackersVm.filesLoader) ...[
|
|
|
|
|
Center(child: CircularProgressIndicator())
|
|
|
|
|
] else if (myTrackersVm.checkMeProUsersList != null && myTrackersVm.checkMeProUsersList.isNotEmpty) ...[
|
|
|
|
|
Material(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.7,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemCount: checkMeProUsersList.length,
|
|
|
|
|
separatorBuilder: (context, index) => SizedBox(height: 14),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
reverse: false,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
CheckMeUserInfoModel userModel = checkMeProUsersList[index];
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: cardRadius(12),
|
|
|
|
|
padding: EdgeInsets.all(12.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text("${userModel.id}. ${userModel.name}"),
|
|
|
|
|
mHeight(4.0),
|
|
|
|
|
Text("Gender: ${userModel.sex == 1 ? "Female" : "Male"}"),
|
|
|
|
|
mHeight(4.0),
|
|
|
|
|
Text("Height: ${userModel.height}"),
|
|
|
|
|
mHeight(4.0),
|
|
|
|
|
Text("Weight: ${userModel.height}"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
] else ...[
|
|
|
|
|
Material(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
"No Users to show",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.6,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.3,
|
|
|
|
|
height: 13 / 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getFilesListWidget(List<ECGFileDetailModel> filesList, BuildContext context) {
|
|
|
|
|
return Material(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
@ -323,8 +423,8 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
parsesDevicesList(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event['type'] == kInfoDataCheckMe) {
|
|
|
|
|
updateCheckMeInfoModel(event['data'].toString());
|
|
|
|
|
if (event['type'] == kCheckMeUsersList) {
|
|
|
|
|
updateCheckMeUserInfoModel(event['data']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -651,8 +751,6 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
String resultSet1 = "";
|
|
|
|
|
String resultSet2 = "";
|
|
|
|
|
|
|
|
|
|
String resultSetCheckMeProUsers = "";
|
|
|
|
|
|
|
|
|
|
Future<void> connectAndesfitWeightDevice(BluetoothDevice device) async {
|
|
|
|
|
log("deviceToConnect: ${device.toString()}");
|
|
|
|
|
|
|
|
|
|
@ -1093,16 +1191,10 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
bool isDeviceSelected = false;
|
|
|
|
|
|
|
|
|
|
List<int> listOutput = [];
|
|
|
|
|
|
|
|
|
|
int cmdState = 0;
|
|
|
|
|
String currentFileName = "usr.dat";
|
|
|
|
|
var currentFileSize = 0;
|
|
|
|
|
int pkgTotal = 0;
|
|
|
|
|
int result = 0;
|
|
|
|
|
int currentPkg = 0;
|
|
|
|
|
|
|
|
|
|
Future<void> connectAndesfitAllInOneDevice(BluetoothDevice device) async {
|
|
|
|
|
log("deviceToConnect: ${device.toString()}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//// --> CHECK ME PRO
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|