|
|
|
|
@ -70,7 +70,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
List<BleDeviceModel> devicesList = [];
|
|
|
|
|
|
|
|
|
|
var devicesInfoJsonViatom = {
|
|
|
|
|
Map<String, List<Map<String, String>>> devicesInfoJsonViatom = {
|
|
|
|
|
"OxymeterTracker": [
|
|
|
|
|
{"model": "SP-20"}, // DONE
|
|
|
|
|
{"model": "POD-1"}, // DONE
|
|
|
|
|
@ -106,7 +106,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var devicesInfoJsonAndesfit = {
|
|
|
|
|
Map<String, List<Map<String, String>>> devicesInfoJsonAndesfit = {
|
|
|
|
|
"OxymeterTracker": [
|
|
|
|
|
{"model": ""}
|
|
|
|
|
],
|
|
|
|
|
@ -164,11 +164,11 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
"BLE-MSA",
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
StreamSubscription bleDevicesStream;
|
|
|
|
|
StreamSubscription? bleDevicesStream;
|
|
|
|
|
|
|
|
|
|
//************************************* OXYMETER *************************************
|
|
|
|
|
|
|
|
|
|
OxyRtModel oxyRtModel;
|
|
|
|
|
OxyRtModel? oxyRtModel;
|
|
|
|
|
|
|
|
|
|
void updateOxyRtModel(Map<String, dynamic> mapData) {
|
|
|
|
|
oxyRtModel = OxyRtModel.fromJson(mapData);
|
|
|
|
|
@ -177,21 +177,21 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
// ************************************* BLOOD PRESSURE *************************************
|
|
|
|
|
|
|
|
|
|
BpRtMeasuringModel bpRtMeasuringModel;
|
|
|
|
|
BpRtMeasuringModel? bpRtMeasuringModel;
|
|
|
|
|
|
|
|
|
|
void updateBpRtMeasuringModel(Map<String, dynamic> mapData) {
|
|
|
|
|
bpRtMeasuringModel = BpRtMeasuringModel.fromJson(mapData);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BpRtResultModel bpRtResultModel;
|
|
|
|
|
BpRtResultModel? bpRtResultModel;
|
|
|
|
|
|
|
|
|
|
void updateBpRtResultModel(Map<String, dynamic> mapData) {
|
|
|
|
|
bpRtResultModel = BpRtResultModel.fromJson(mapData);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String bpCurrentStatus;
|
|
|
|
|
String? bpCurrentStatus;
|
|
|
|
|
|
|
|
|
|
updateBpCurrentStatus(var value) {
|
|
|
|
|
bpCurrentStatus = value;
|
|
|
|
|
@ -213,7 +213,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
filesLoader = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ECGRtModel ecgRtModel;
|
|
|
|
|
ECGRtModel? ecgRtModel;
|
|
|
|
|
|
|
|
|
|
void updateEcgRtModel(Map<String, dynamic> mapData) {
|
|
|
|
|
ecgRtModel = ECGRtModel.fromJson(mapData);
|
|
|
|
|
@ -242,21 +242,21 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String ecgCurrentStatus;
|
|
|
|
|
String? ecgCurrentStatus;
|
|
|
|
|
|
|
|
|
|
updateEcgCurrentStatus(var value) {
|
|
|
|
|
ecgCurrentStatus = value;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ECGRtMeasuringModelFromBP ecgRtMeasuringModelFromBP;
|
|
|
|
|
ECGRtMeasuringModelFromBP? ecgRtMeasuringModelFromBP;
|
|
|
|
|
|
|
|
|
|
void updateEcgRtMeasuringModelFromBP(Map<String, dynamic> mapData) {
|
|
|
|
|
ecgRtMeasuringModelFromBP = ECGRtMeasuringModelFromBP.fromJson(mapData);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ECGRtResultModelFromBP ecgRtResultModelFromBP;
|
|
|
|
|
ECGRtResultModelFromBP? ecgRtResultModelFromBP;
|
|
|
|
|
|
|
|
|
|
void updateEcgRtResultModelFromBP(Map<String, dynamic> mapData) {
|
|
|
|
|
ecgRtResultModelFromBP = ECGRtResultModelFromBP.fromJson(mapData);
|
|
|
|
|
@ -282,11 +282,11 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(ecgFileDetailModel.fileName),
|
|
|
|
|
Text(ecgFileDetailModel.fileName!),
|
|
|
|
|
mHeight(6.0),
|
|
|
|
|
Text("Duration: ${ecgFileDetailModel.duration} seconds"),
|
|
|
|
|
mHeight(6.0),
|
|
|
|
|
Text("Date: ${DateUtil.getDayMonthYearHourMinuteDateFormatted(DateTime.fromMillisecondsSinceEpoch((ecgFileDetailModel.startTime * 1000)))}"),
|
|
|
|
|
Text("Date: ${DateUtil.getDayMonthYearHourMinuteDateFormatted(DateTime.fromMillisecondsSinceEpoch((ecgFileDetailModel.startTime! * 1000)))}"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -303,12 +303,12 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (devicesInfoJsonViatom.containsKey(currentSelectedTrackerType.name)) {
|
|
|
|
|
allDevices.forEach(
|
|
|
|
|
(foundDevice) {
|
|
|
|
|
List devicesInSelectedType = devicesInfoJsonViatom[currentSelectedTrackerType.name];
|
|
|
|
|
for (var device in devicesInSelectedType) {
|
|
|
|
|
List<Map<String, String>>? devicesInSelectedType = devicesInfoJsonViatom[currentSelectedTrackerType.name];
|
|
|
|
|
for (var device in devicesInSelectedType!) {
|
|
|
|
|
// log("foundDevice.name: ${foundDevice.name.toString()}");
|
|
|
|
|
foundDevice.deviceType = currentSelectedTrackerType;
|
|
|
|
|
// log("device['model']: ${device['model']}");
|
|
|
|
|
if (device['model'] != "" && foundDevice.name.contains(device['model'])) {
|
|
|
|
|
if (device['model'] != "" && foundDevice.name!.contains((device['model'])!)) {
|
|
|
|
|
devicesList.add(foundDevice);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -320,7 +320,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
void filterOutTheSearchedDevicesFlutter(List<BleDeviceModel> allDevices) {
|
|
|
|
|
if (devicesInfoJsonAndesfit.containsKey(currentSelectedTrackerType.name)) {
|
|
|
|
|
List devicesInSelectedType = devicesInfoJsonAndesfit[currentSelectedTrackerType.name];
|
|
|
|
|
List<Map<String, String>> devicesInSelectedType = (devicesInfoJsonAndesfit[currentSelectedTrackerType.name])!;
|
|
|
|
|
for (var foundDevice in allDevices) {
|
|
|
|
|
for (var device in devicesInSelectedType) {
|
|
|
|
|
if (isDeviceSelected) {
|
|
|
|
|
@ -330,7 +330,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
foundDevice.deviceType = currentSelectedTrackerType;
|
|
|
|
|
log("here1: ${device['model']}");
|
|
|
|
|
log("here2: ${foundDevice.name}");
|
|
|
|
|
if (device['model'] != "" && foundDevice.name.contains(device['model'])) {
|
|
|
|
|
if (device['model'] != "" && foundDevice.name!.contains(device['model'] as String)) {
|
|
|
|
|
if (!ifDeviceAlreadyThere(devicesList, foundDevice)) {
|
|
|
|
|
devicesList.add(foundDevice);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -427,27 +427,27 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
void resetList() {
|
|
|
|
|
devicesList.clear();
|
|
|
|
|
if (bleDevicesStream != null) {
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
}
|
|
|
|
|
FlutterBluePlus.stopScan();
|
|
|
|
|
secondsToWaitForNativeScan = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> getEcgFilesList(BleDeviceModel device) async {
|
|
|
|
|
await BleChannel.getECGFilesList([device.name, device.model.toString()]);
|
|
|
|
|
await BleChannel.getECGFilesList([device.name!, device.model.toString()]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> factoryResetECG(BleDeviceModel device) async {
|
|
|
|
|
await BleChannel.factoryResetECG([device.name, device.model.toString()]);
|
|
|
|
|
await BleChannel.factoryResetECG([device.name!, device.model.toString()]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> connectDevice(BleDeviceModel device) async {
|
|
|
|
|
if (currentSelectedTrackerType == TrackerTypeEnum.AllInOneTracker) {
|
|
|
|
|
await BleChannel.connectDeviceCheckMe([device.name, device.model.toString(), currentSelectedTrackerType.name]);
|
|
|
|
|
await BleChannel.connectDeviceCheckMe([device.name!, device.model.toString(), currentSelectedTrackerType.name]);
|
|
|
|
|
} else if (currentSelectedTrackerType == TrackerTypeEnum.SmartRing) {
|
|
|
|
|
await BleChannel.connectDeviceSmartRing(device.macAddr);
|
|
|
|
|
await BleChannel.connectDeviceSmartRing(device.macAddr!);
|
|
|
|
|
} else {
|
|
|
|
|
await BleChannel.connectDevice([device.name, device.model.toString(), currentSelectedTrackerType.name]);
|
|
|
|
|
await BleChannel.connectDevice([device.name!, device.model.toString(), currentSelectedTrackerType.name]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -474,8 +474,8 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
bleDevicesStream = FlutterBluePlus.scanResults.listen((results) {
|
|
|
|
|
List<ScanResult> blueToothDevices = results;
|
|
|
|
|
List<BleDeviceModel> bleDevices = [];
|
|
|
|
|
if (isAndesfitDeviceConnected != null && isAndesfitDeviceConnected) {
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
if (isAndesfitDeviceConnected != null && isAndesfitDeviceConnected!) {
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
FlutterBluePlus.stopScan();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -499,7 +499,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ifDeviceAlreadyThere(List<BleDeviceModel> devicesList, BleDeviceModel device) {
|
|
|
|
|
int index = devicesList.indexWhere((element) => element.name.toLowerCase() == device.name.toLowerCase());
|
|
|
|
|
int index = devicesList.indexWhere((element) => element.name!.toLowerCase() == device.name!.toLowerCase());
|
|
|
|
|
return index != -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -547,7 +547,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
// *********************** ANDESFIT ************************
|
|
|
|
|
|
|
|
|
|
bool isAndesfitDeviceConnected;
|
|
|
|
|
bool? isAndesfitDeviceConnected;
|
|
|
|
|
|
|
|
|
|
Future<void> connectAndesfitBloodPressureDevice(BluetoothDevice device) async {
|
|
|
|
|
device.connectionState.listen((BluetoothConnectionState state) async {
|
|
|
|
|
@ -558,7 +558,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (state == BluetoothConnectionState.connected) {
|
|
|
|
|
isAndesfitDeviceConnected = true;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
List<BluetoothService> services = await device.discoverServices();
|
|
|
|
|
services.forEach((service) {
|
|
|
|
|
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.BLOOD_PRESSURE_SERVICE) {
|
|
|
|
|
@ -588,28 +588,28 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
device.disconnect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScanResult selectedAndesFitScanResult;
|
|
|
|
|
ScanResult? selectedAndesFitScanResult;
|
|
|
|
|
|
|
|
|
|
updateSelectedAndesFitScanResult(var value) {
|
|
|
|
|
selectedAndesFitScanResult = value;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BpRtMeasuringModel andesfitBpRtMeasuringModel;
|
|
|
|
|
BpRtMeasuringModel? andesfitBpRtMeasuringModel;
|
|
|
|
|
|
|
|
|
|
void updateAndesfitBpRtMeasuringModel(BpRtMeasuringModel model) {
|
|
|
|
|
andesfitBpRtMeasuringModel = model;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BpRtResultModel andesfitBpRtResultModel;
|
|
|
|
|
BpRtResultModel? andesfitBpRtResultModel;
|
|
|
|
|
|
|
|
|
|
void updateAndesfitBpRtResultModel(BpRtResultModel model) {
|
|
|
|
|
andesfitBpRtResultModel = model;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String andesfitBpCurrentStatus;
|
|
|
|
|
String? andesfitBpCurrentStatus;
|
|
|
|
|
|
|
|
|
|
updateAndesfitBpCurrentStatus(var value) {
|
|
|
|
|
andesfitBpCurrentStatus = value;
|
|
|
|
|
@ -668,7 +668,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WeightScaleData andesfitWeightScaleData;
|
|
|
|
|
WeightScaleData? andesfitWeightScaleData;
|
|
|
|
|
|
|
|
|
|
void updateAndesfitWeightScaleData(WeightScaleData model) {
|
|
|
|
|
andesfitWeightScaleData = model;
|
|
|
|
|
@ -689,7 +689,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (state == BluetoothConnectionState.connected) {
|
|
|
|
|
isAndesfitDeviceConnected = true;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
List<BluetoothService> services = await device.discoverServices();
|
|
|
|
|
services.forEach((service) {
|
|
|
|
|
log("services in weightscale: ${service.serviceUuid}");
|
|
|
|
|
@ -733,7 +733,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
});
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 500)).then((value) async {
|
|
|
|
|
print("Delayed fff1 done");
|
|
|
|
|
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true).catchError((err) {});
|
|
|
|
|
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -747,7 +747,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
|
|
|
|
|
print("Delayed fff2 done");
|
|
|
|
|
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true).catchError((err) {});
|
|
|
|
|
if (!characteristic.isNotifying) await characteristic.setNotifyValue(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Write user data to fff2
|
|
|
|
|
@ -846,7 +846,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
return resSet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String currentTempInCelsius;
|
|
|
|
|
String? currentTempInCelsius;
|
|
|
|
|
|
|
|
|
|
updateCurrentTempInCelsius(var value) {
|
|
|
|
|
currentTempInCelsius = value;
|
|
|
|
|
@ -862,7 +862,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (state == BluetoothConnectionState.connected) {
|
|
|
|
|
isAndesfitDeviceConnected = true;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
List<BluetoothService> services = await device.discoverServices();
|
|
|
|
|
services.forEach((service) {
|
|
|
|
|
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.TEMPERATURE_SERVICE) {
|
|
|
|
|
@ -874,14 +874,14 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
print("onValueReceived Stream");
|
|
|
|
|
print(event);
|
|
|
|
|
updateCurrentTempInCelsius(convertIntListToHexTemp(event));
|
|
|
|
|
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius) * 1.8) + 32).toStringAsFixed(1);
|
|
|
|
|
String tempCurrentTempInCelsius = currentTempInCelsius + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
|
|
|
|
|
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius!) * 1.8) + 32).toStringAsFixed(1);
|
|
|
|
|
String tempCurrentTempInCelsius = currentTempInCelsius! + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
|
|
|
|
|
updateCurrentTempInCelsius(tempCurrentTempInCelsius);
|
|
|
|
|
});
|
|
|
|
|
await characteristic.setNotifyValue(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -917,9 +917,9 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
// return (number * 0.1).toStringAsFixed(1);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
StreamSubscription bloodSugarValuesStream;
|
|
|
|
|
StreamSubscription? bloodSugarValuesStream;
|
|
|
|
|
|
|
|
|
|
String currentBloodGlucose;
|
|
|
|
|
String? currentBloodGlucose;
|
|
|
|
|
|
|
|
|
|
updateCurrentBloodGlucose(var value) {
|
|
|
|
|
currentBloodGlucose = value;
|
|
|
|
|
@ -937,7 +937,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (state == BluetoothConnectionState.connected) {
|
|
|
|
|
isAndesfitDeviceConnected = true;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
List<BluetoothService> services = await device.discoverServices();
|
|
|
|
|
services.forEach((service) {
|
|
|
|
|
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.BLOOD_GLUCOSE_SERVICE) {
|
|
|
|
|
@ -954,7 +954,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
await characteristic.setNotifyValue(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -976,20 +976,20 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
num measuredValue = byteArray[9];
|
|
|
|
|
results.add("Measured: $measuredValue");
|
|
|
|
|
isDataMeasured = true;
|
|
|
|
|
bloodSugarValuesStream.cancel();
|
|
|
|
|
bloodSugarValuesStream!.cancel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BluetoothCharacteristic spirometerReadCharacteristicFf0a;
|
|
|
|
|
BluetoothCharacteristic spirometerWriteCharacteristicFf0b;
|
|
|
|
|
BluetoothCharacteristic? spirometerReadCharacteristicFf0a;
|
|
|
|
|
BluetoothCharacteristic? spirometerWriteCharacteristicFf0b;
|
|
|
|
|
|
|
|
|
|
String valuePEF;
|
|
|
|
|
String? valuePEF;
|
|
|
|
|
|
|
|
|
|
String valueFEV;
|
|
|
|
|
String? valueFEV;
|
|
|
|
|
|
|
|
|
|
Timer timerForSpirometer;
|
|
|
|
|
Timer? timerForSpirometer;
|
|
|
|
|
|
|
|
|
|
bool isHistoryCommandWritten = false;
|
|
|
|
|
|
|
|
|
|
@ -1002,7 +1002,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (state == BluetoothConnectionState.connected) {
|
|
|
|
|
isAndesfitDeviceConnected = true;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
List<BluetoothService> services = await device.discoverServices(timeout: 5);
|
|
|
|
|
services.forEach(
|
|
|
|
|
(service) {
|
|
|
|
|
@ -1012,9 +1012,9 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
(characteristic) async {
|
|
|
|
|
if (characteristic.characteristicUuid.toString().toLowerCase() == BLEUtils.BLE_TO_MSA100_READ_CHARACTERISTIC) {
|
|
|
|
|
spirometerReadCharacteristicFf0a = characteristic;
|
|
|
|
|
print(spirometerReadCharacteristicFf0a.characteristicUuid);
|
|
|
|
|
print(spirometerReadCharacteristicFf0a.properties.toString());
|
|
|
|
|
spirometerReadCharacteristicFf0a.onValueReceived.listen((event) async {
|
|
|
|
|
print(spirometerReadCharacteristicFf0a!.characteristicUuid);
|
|
|
|
|
print(spirometerReadCharacteristicFf0a!.properties.toString());
|
|
|
|
|
spirometerReadCharacteristicFf0a!.onValueReceived.listen((event) async {
|
|
|
|
|
print("onValueReceived ff0a Stream");
|
|
|
|
|
print(event);
|
|
|
|
|
|
|
|
|
|
@ -1024,12 +1024,12 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event[0] == 170) {
|
|
|
|
|
timerForSpirometer.cancel();
|
|
|
|
|
timerForSpirometer!.cancel();
|
|
|
|
|
|
|
|
|
|
// Write get history command to ff0b
|
|
|
|
|
if (!isHistoryCommandWritten) {
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
|
|
|
|
|
spirometerWriteCharacteristicFf0b.write([0x55, 0x01], withoutResponse: false).then((value) {
|
|
|
|
|
spirometerWriteCharacteristicFf0b!.write([0x55, 0x01], withoutResponse: false).then((value) {
|
|
|
|
|
print("----ff0b get history command data written----");
|
|
|
|
|
isHistoryCommandWritten = true;
|
|
|
|
|
});
|
|
|
|
|
@ -1037,13 +1037,13 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
// Write get 1st history command to ff0b
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
|
|
|
|
|
spirometerWriteCharacteristicFf0b.write([0x55, 0x02, 0x01, 0x00], withoutResponse: false).then((value) async {
|
|
|
|
|
spirometerWriteCharacteristicFf0b!.write([0x55, 0x02, 0x01, 0x00], withoutResponse: false).then((value) async {
|
|
|
|
|
print("----ff0b get 1st history command data written----");
|
|
|
|
|
isHistoryCommandWritten = true;
|
|
|
|
|
|
|
|
|
|
// Write delete history command to ff0b
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
|
|
|
|
|
spirometerWriteCharacteristicFf0b.write([0x55, 0x03], withoutResponse: false).then((value) async {
|
|
|
|
|
spirometerWriteCharacteristicFf0b!.write([0x55, 0x03], withoutResponse: false).then((value) async {
|
|
|
|
|
print("----ff0b delete history command data written----");
|
|
|
|
|
isHistoryCommandWritten = true;
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 500)).then((value) async {
|
|
|
|
|
@ -1061,14 +1061,14 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
|
|
|
|
|
print("Delayed ff0a done");
|
|
|
|
|
if (!spirometerReadCharacteristicFf0a.isNotifying) await spirometerReadCharacteristicFf0a.setNotifyValue(true).catchError((err) {});
|
|
|
|
|
if (!spirometerReadCharacteristicFf0a!.isNotifying) await spirometerReadCharacteristicFf0a!.setNotifyValue(true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (characteristic.characteristicUuid.toString().toLowerCase() == BLEUtils.BLE_TO_MSA100_WRITE_CHARACTERISTIC) {
|
|
|
|
|
spirometerWriteCharacteristicFf0b = characteristic;
|
|
|
|
|
print(spirometerWriteCharacteristicFf0b.characteristicUuid);
|
|
|
|
|
print(spirometerWriteCharacteristicFf0b.properties.toString());
|
|
|
|
|
print(spirometerWriteCharacteristicFf0b!.characteristicUuid);
|
|
|
|
|
print(spirometerWriteCharacteristicFf0b!.properties.toString());
|
|
|
|
|
|
|
|
|
|
// Write ACK command to ff0b every 500 ms
|
|
|
|
|
startACKCommandToMSA100();
|
|
|
|
|
@ -1109,7 +1109,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
// Write ACK command to ff0b every 500 ms
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1000)).then((value) async {
|
|
|
|
|
timerForSpirometer = Timer.periodic(Duration(milliseconds: 500), (Timer t) {
|
|
|
|
|
spirometerWriteCharacteristicFf0b.write([0x55, 0x06], withoutResponse: false).then((value) {
|
|
|
|
|
spirometerWriteCharacteristicFf0b!.write([0x55, 0x06], withoutResponse: false).then((value) {
|
|
|
|
|
print("----ff0b ACK command data written----");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
@ -1172,11 +1172,11 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
await scanForCheckMe();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckMeUserInfoModel> checkMeProUsersList;
|
|
|
|
|
List<CheckMeUserInfoModel>? checkMeProUsersList;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeUserInfoModel(List returnData) {
|
|
|
|
|
if (checkMeProUsersList != null) {
|
|
|
|
|
checkMeProUsersList.clear();
|
|
|
|
|
checkMeProUsersList!.clear();
|
|
|
|
|
}
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
checkMeProUsersList = List.generate(returnData.length, (index) => CheckMeUserInfoModel.fromJson(returnData[index]));
|
|
|
|
|
@ -1195,7 +1195,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
margin: const EdgeInsets.symmetric(vertical: 35, horizontal: 30),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget child) {
|
|
|
|
|
child: Consumer(builder: (BuildContext context, MyTrackersViewModel myTrackersVm, Widget? child) {
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
@ -1205,7 +1205,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
child: Text(
|
|
|
|
|
"Users List",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.8,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.8,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.3,
|
|
|
|
|
height: 13 / 10,
|
|
|
|
|
@ -1215,23 +1215,23 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
),
|
|
|
|
|
if (myTrackersVm.filesLoader) ...[
|
|
|
|
|
Center(child: CircularProgressIndicator())
|
|
|
|
|
] else if (myTrackersVm.checkMeProUsersList != null && myTrackersVm.checkMeProUsersList.isNotEmpty) ...[
|
|
|
|
|
] 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,
|
|
|
|
|
itemCount: checkMeProUsersList!.length,
|
|
|
|
|
separatorBuilder: (context, index) => SizedBox(height: 14),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
reverse: false,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
CheckMeUserInfoModel userModel = checkMeProUsersList[index];
|
|
|
|
|
CheckMeUserInfoModel userModel = checkMeProUsersList![index];
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (trackerTypeEnum == TrackerTypeEnum.BloodSugarTracker) {
|
|
|
|
|
myTrackersVm.getGlucoseDataFromCheckMePro(userModel.id);
|
|
|
|
|
myTrackersVm.getGlucoseDataFromCheckMePro(userModel.id!);
|
|
|
|
|
} else if (trackerTypeEnum == TrackerTypeEnum.BloodPressureTracker) {
|
|
|
|
|
myTrackersVm.getBPDataFromCheckMePro(userModel.id);
|
|
|
|
|
myTrackersVm.getBPDataFromCheckMePro(userModel.id!);
|
|
|
|
|
}
|
|
|
|
|
Navigator.of(context).pushReplacement(FadePage(page: CheckMeAllInOneInfoScreen(trackerTypeEnum)));
|
|
|
|
|
},
|
|
|
|
|
@ -1269,16 +1269,16 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
Future<void> getTempDataFromCheckMePro() async {
|
|
|
|
|
if (checkMeTemperatures != null) {
|
|
|
|
|
checkMeTemperatures.clear();
|
|
|
|
|
checkMeTemperatures!.clear();
|
|
|
|
|
}
|
|
|
|
|
await BleChannel.getTempDataFromCheckMePro();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckMeTemperatureModel> checkMeTemperatures;
|
|
|
|
|
List<CheckMeTemperatureModel>? checkMeTemperatures;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeTemperatureInfoModel(List returnData) {
|
|
|
|
|
if (checkMeTemperatures != null) {
|
|
|
|
|
checkMeTemperatures.clear();
|
|
|
|
|
checkMeTemperatures!.clear();
|
|
|
|
|
}
|
|
|
|
|
checkMeTemperatures = List.generate(returnData.length, (index) => CheckMeTemperatureModel.fromJson(returnData[index]));
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -1286,16 +1286,16 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
Future<void> getOxiDataFromCheckMePro() async {
|
|
|
|
|
if (checkMeOxi != null) {
|
|
|
|
|
checkMeOxi.clear();
|
|
|
|
|
checkMeOxi!.clear();
|
|
|
|
|
}
|
|
|
|
|
await BleChannel.getOxiDataFromCheckMePro();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckMeOxiModel> checkMeOxi;
|
|
|
|
|
List<CheckMeOxiModel>? checkMeOxi;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeOxiInfoModel(List returnData) {
|
|
|
|
|
if (checkMeOxi != null) {
|
|
|
|
|
checkMeOxi.clear();
|
|
|
|
|
checkMeOxi!.clear();
|
|
|
|
|
}
|
|
|
|
|
checkMeOxi = List.generate(returnData.length, (index) => CheckMeOxiModel.fromJson(returnData[index]));
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -1303,16 +1303,16 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
Future<void> getECGDataFromCheckMePro() async {
|
|
|
|
|
if (checkMeEcg != null) {
|
|
|
|
|
checkMeEcg.clear();
|
|
|
|
|
checkMeEcg!.clear();
|
|
|
|
|
}
|
|
|
|
|
await BleChannel.getEcgDataFromCheckMePro();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckMeECGModel> checkMeEcg;
|
|
|
|
|
List<CheckMeECGModel>? checkMeEcg;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeEcgInfoModel(List returnData) {
|
|
|
|
|
if (checkMeEcg != null) {
|
|
|
|
|
checkMeEcg.clear();
|
|
|
|
|
checkMeEcg!.clear();
|
|
|
|
|
}
|
|
|
|
|
checkMeEcg = List.generate(returnData.length, (index) => CheckMeECGModel.fromJson(returnData[index]));
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -1325,7 +1325,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
await BleChannel.getEcgWaveDataFromCheckMePro(timeString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CheckMeECGWaveModel checkMeECGWave;
|
|
|
|
|
CheckMeECGWaveModel? checkMeECGWave;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeEcgWaveInfoModel(returnData) {
|
|
|
|
|
if (checkMeECGWave != null) {
|
|
|
|
|
@ -1337,16 +1337,16 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
Future<void> getBPDataFromCheckMePro(String userId) async {
|
|
|
|
|
if (checkMeBP != null) {
|
|
|
|
|
checkMeBP.clear();
|
|
|
|
|
checkMeBP!.clear();
|
|
|
|
|
}
|
|
|
|
|
await BleChannel.getBPDataFromCheckMePro(userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckMeBPModel> checkMeBP;
|
|
|
|
|
List<CheckMeBPModel>? checkMeBP;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeBPInfoModel(List returnData) {
|
|
|
|
|
if (checkMeBP != null) {
|
|
|
|
|
checkMeBP.clear();
|
|
|
|
|
checkMeBP!.clear();
|
|
|
|
|
}
|
|
|
|
|
checkMeBP = List.generate(returnData.length, (index) => CheckMeBPModel.fromJson(returnData[index]));
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -1354,16 +1354,16 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
Future<void> getGlucoseDataFromCheckMePro(String userId) async {
|
|
|
|
|
if (checkMeGlucose != null) {
|
|
|
|
|
checkMeGlucose.clear();
|
|
|
|
|
checkMeGlucose!.clear();
|
|
|
|
|
}
|
|
|
|
|
await BleChannel.getGlucoseDataFromCheckMePro(userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckMeGlucoseModel> checkMeGlucose;
|
|
|
|
|
List<CheckMeGlucoseModel>? checkMeGlucose;
|
|
|
|
|
|
|
|
|
|
void updateCheckMeGlucoseInfoModel(List returnData) {
|
|
|
|
|
if (checkMeGlucose != null) {
|
|
|
|
|
checkMeGlucose.clear();
|
|
|
|
|
checkMeGlucose!.clear();
|
|
|
|
|
}
|
|
|
|
|
checkMeGlucose = List.generate(returnData.length, (index) => CheckMeGlucoseModel.fromJson(returnData[index]));
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -1440,7 +1440,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (state == BluetoothConnectionState.connected) {
|
|
|
|
|
isAndesfitDeviceConnected = true;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
bleDevicesStream.cancel();
|
|
|
|
|
bleDevicesStream!.cancel();
|
|
|
|
|
List<BluetoothService> services = await device.discoverServices();
|
|
|
|
|
services.forEach((service) {
|
|
|
|
|
if (service.serviceUuid.toString().toLowerCase() == BLEUtils.TEMPERATURE_SERVICE) {
|
|
|
|
|
@ -1452,14 +1452,14 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
print("onValueReceived Stream");
|
|
|
|
|
print(event);
|
|
|
|
|
updateCurrentTempInCelsius(convertIntListToHexTemp(event));
|
|
|
|
|
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius) * 1.8) + 32).toStringAsFixed(1);
|
|
|
|
|
String tempCurrentTempInCelsius = currentTempInCelsius + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
|
|
|
|
|
String currentTempInFahrenheit = ((num.parse(currentTempInCelsius!) * 1.8) + 32).toStringAsFixed(1);
|
|
|
|
|
String tempCurrentTempInCelsius = currentTempInCelsius! + "\u2103" + " / " + currentTempInFahrenheit + "\u2109";
|
|
|
|
|
updateCurrentTempInCelsius(tempCurrentTempInCelsius);
|
|
|
|
|
});
|
|
|
|
|
await characteristic.setNotifyValue(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -1469,7 +1469,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
Future<void> getTemperatureSmartRing() async {
|
|
|
|
|
if (smartRingTemperatureHistory != null) {
|
|
|
|
|
smartRingTemperatureHistory.clear();
|
|
|
|
|
smartRingTemperatureHistory!.clear();
|
|
|
|
|
smartRingTemperatureHistory = null;
|
|
|
|
|
}
|
|
|
|
|
String data = await BleChannel.getTemperatureSmartRing();
|
|
|
|
|
@ -1516,7 +1516,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
logger.i(jsonEncode(data.toString()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String smartRingBatteryLevel;
|
|
|
|
|
String? smartRingBatteryLevel;
|
|
|
|
|
|
|
|
|
|
void updateSmartRingBatteryLevelModel(dynamic returnData) {
|
|
|
|
|
if (smartRingBatteryLevel != null) {
|
|
|
|
|
@ -1529,7 +1529,7 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
//TEMPERATURE
|
|
|
|
|
|
|
|
|
|
List<SmartRingGenericModel> smartRingTemperatureHistory;
|
|
|
|
|
List<SmartRingGenericModel>? smartRingTemperatureHistory;
|
|
|
|
|
|
|
|
|
|
void updateSmartRingTemperatureHistory(dynamic returnData) {
|
|
|
|
|
Map<dynamic, dynamic> data = returnData;
|
|
|
|
|
@ -1539,14 +1539,14 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (smartRingTemperatureHistory == null) {
|
|
|
|
|
smartRingTemperatureHistory = list;
|
|
|
|
|
} else {
|
|
|
|
|
smartRingTemperatureHistory.addAll(list);
|
|
|
|
|
smartRingTemperatureHistory!.addAll(list);
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//BLOOD OXYGEN
|
|
|
|
|
|
|
|
|
|
List<SmartRingGenericModel> smartRingBloodOxygenHistory;
|
|
|
|
|
List<SmartRingGenericModel>? smartRingBloodOxygenHistory;
|
|
|
|
|
|
|
|
|
|
void updateSmartRingBloodOxygenHistory(dynamic returnData) {
|
|
|
|
|
Map<dynamic, dynamic> data = returnData;
|
|
|
|
|
@ -1556,14 +1556,14 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (smartRingBloodOxygenHistory == null) {
|
|
|
|
|
smartRingBloodOxygenHistory = list;
|
|
|
|
|
} else {
|
|
|
|
|
smartRingBloodOxygenHistory.addAll(list);
|
|
|
|
|
smartRingBloodOxygenHistory!.addAll(list);
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//HEART RATE DYNAMIC
|
|
|
|
|
|
|
|
|
|
List<SmartRingGenericModel> smartRingHeartRateDynamicHistory;
|
|
|
|
|
List<SmartRingGenericModel>? smartRingHeartRateDynamicHistory;
|
|
|
|
|
|
|
|
|
|
void updateSmartRingHeartRateDynamicHistory(dynamic returnData) {
|
|
|
|
|
Map<dynamic, dynamic> data = returnData;
|
|
|
|
|
@ -1573,13 +1573,13 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (smartRingHeartRateDynamicHistory == null) {
|
|
|
|
|
smartRingHeartRateDynamicHistory = list;
|
|
|
|
|
} else {
|
|
|
|
|
smartRingHeartRateDynamicHistory.addAll(list);
|
|
|
|
|
smartRingHeartRateDynamicHistory!.addAll(list);
|
|
|
|
|
}
|
|
|
|
|
log("smartRingHeartRateDynamicHistory: ${smartRingHeartRateDynamicHistory.length}");
|
|
|
|
|
log("smartRingHeartRateDynamicHistory: ${smartRingHeartRateDynamicHistory!.length}");
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SmartRingGenericModel> smartRingHeartRateStaticHistory;
|
|
|
|
|
List<SmartRingGenericModel>? smartRingHeartRateStaticHistory;
|
|
|
|
|
|
|
|
|
|
void updateSmartRingHeartRateStaticHistory(dynamic returnData) {
|
|
|
|
|
Map<dynamic, dynamic> data = returnData;
|
|
|
|
|
@ -1589,13 +1589,13 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (smartRingHeartRateStaticHistory == null) {
|
|
|
|
|
smartRingHeartRateStaticHistory = list;
|
|
|
|
|
} else {
|
|
|
|
|
smartRingHeartRateStaticHistory.addAll(list);
|
|
|
|
|
smartRingHeartRateStaticHistory!.addAll(list);
|
|
|
|
|
}
|
|
|
|
|
log("smartRingHeartRateStaticHistory: ${smartRingHeartRateStaticHistory.length}");
|
|
|
|
|
log("smartRingHeartRateStaticHistory: ${smartRingHeartRateStaticHistory!.length}");
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SmartRingHrvModel> smartRingHrvHistory;
|
|
|
|
|
List<SmartRingHrvModel>? smartRingHrvHistory;
|
|
|
|
|
|
|
|
|
|
void updateSmartRingHrvHistory(dynamic returnData) {
|
|
|
|
|
Map<dynamic, dynamic> data = returnData;
|
|
|
|
|
@ -1605,13 +1605,13 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (smartRingHrvHistory == null) {
|
|
|
|
|
smartRingHrvHistory = list;
|
|
|
|
|
} else {
|
|
|
|
|
smartRingHrvHistory.addAll(list);
|
|
|
|
|
smartRingHrvHistory!.addAll(list);
|
|
|
|
|
}
|
|
|
|
|
log("smartRingHrvHistory: ${smartRingHrvHistory.length}");
|
|
|
|
|
log("smartRingHrvHistory: ${smartRingHrvHistory!.length}");
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SmartRingStepCountModel> smartRingStepCountHistory;
|
|
|
|
|
List<SmartRingStepCountModel>? smartRingStepCountHistory;
|
|
|
|
|
|
|
|
|
|
void updateSmartRingStepCountHistory(dynamic returnData) {
|
|
|
|
|
Map<dynamic, dynamic> data = returnData;
|
|
|
|
|
@ -1621,17 +1621,17 @@ class MyTrackersViewModel extends ChangeNotifier {
|
|
|
|
|
if (smartRingStepCountHistory == null) {
|
|
|
|
|
smartRingStepCountHistory = list;
|
|
|
|
|
} else {
|
|
|
|
|
smartRingStepCountHistory.addAll(list);
|
|
|
|
|
smartRingStepCountHistory!.addAll(list);
|
|
|
|
|
}
|
|
|
|
|
log("smartRingStepCountHistory: ${smartRingStepCountHistory.length}");
|
|
|
|
|
log("smartRingStepCountHistory: ${smartRingStepCountHistory!.length}");
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RtSportDataSmartRingModel rtSportDataSmartRingModel;
|
|
|
|
|
RtSportDataSmartRingModel? rtSportDataSmartRingModel;
|
|
|
|
|
|
|
|
|
|
void updateRtSportDataSmartRingModel(dynamic returnData) {
|
|
|
|
|
Map<dynamic, dynamic> data = returnData;
|
|
|
|
|
rtSportDataSmartRingModel = RtSportDataSmartRingModel.fromJson(data["dicData"] as Map);
|
|
|
|
|
rtSportDataSmartRingModel = RtSportDataSmartRingModel.fromJson(data["dicData"] as Map<String, dynamic>);
|
|
|
|
|
log("rtSportDataSmartRingModel: ${data.toString()}");
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|