diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
new file mode 100644
index 0000000..90d525b
--- /dev/null
+++ b/.idea/libraries/Dart_SDK.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
new file mode 100644
index 0000000..b0f6971
--- /dev/null
+++ b/.idea/libraries/Flutter_Plugins.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..f8c5fc9
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..f7e80c3
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/protocentral_openview2.iml b/.idea/protocentral_openview2.iml
new file mode 100644
index 0000000..90642e6
--- /dev/null
+++ b/.idea/protocentral_openview2.iml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..8135823
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1716532637041
+
+
+ 1716532637041
+
+
+
+
\ No newline at end of file
diff --git a/android/akw-newkey b/android/akw-newkey
new file mode 100644
index 0000000..30e49c4
Binary files /dev/null and b/android/akw-newkey differ
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 7793224..7643ccb 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -407,7 +407,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 65;
+ CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = M86YWF3243;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -424,7 +424,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 1.0.10;
+ MARKETING_VERSION = 2.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.protocentral.openview;
PRODUCT_NAME = Runner;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
@@ -548,7 +548,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 65;
+ CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = M86YWF3243;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -565,7 +565,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 1.0.10;
+ MARKETING_VERSION = 2.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.protocentral.openview;
PRODUCT_NAME = Runner;
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -583,7 +583,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 65;
+ CURRENT_PROJECT_VERSION = 71;
DEVELOPMENT_TEAM = M86YWF3243;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -600,7 +600,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 1.0.10;
+ MARKETING_VERSION = 2.0.2;
PRODUCT_BUNDLE_IDENTIFIER = com.protocentral.openview;
PRODUCT_NAME = OpenView;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
diff --git a/lib/home.dart b/lib/home.dart
index b563c94..dd35d27 100644
--- a/lib/home.dart
+++ b/lib/home.dart
@@ -33,9 +33,11 @@ bool connectedToDevice = false;
String pcCurrentDeviceID = "";
String pcCurrentDeviceName = "";
-String _selectedBoard = 'Select Board';
-String _selectedPort = 'Board';
+String _selectedBoard = 'Healthypi';
+
+String _selectedPort = 'Port';
+String selectedPortBoard = 'Healthypi';
late SerialPort _serialPort;
@@ -71,6 +73,9 @@ var ces_pkt_ch1_buffer = new List.filled(4, 0, growable: false);
var ces_pkt_ch2_buffer = new List.filled(4, 0, growable: false);
var ces_pkt_ch3_buffer = new List.filled(4, 0, growable: false);
+int computed_val1 = 0;
+int computed_val2 = 0;
+
class HomePage extends StatefulWidget {
HomePage({Key? key, required this.title}) : super(key: key);
@@ -632,6 +637,51 @@ class _HomePageState extends State {
SizedBox(
width:20.0,
),
+ DropdownButton(
+ underline: SizedBox(),
+ dropdownColor: hPi4Global.hpi4Color,
+ hint: selectedPortBoard == null
+ ? Text('Select Board')
+ : Text(selectedPortBoard,
+ style: TextStyle(color: hPi4Global.hpi4Color, fontSize: 16.0),
+ ),
+ //isExpanded: true,
+ iconSize: 50.0,
+ style: TextStyle(color: Colors.white, fontSize: 16.0),
+ items: [
+ 'Healthypi',
+ 'ADS1292R Breakout/Shield',
+ 'ADS1293 Breakout/Shield',
+ 'AFE4490 Breakout/Shield',
+ 'MAX86150 Breakout',
+ 'Pulse Express (MAX30102/MAX32664D)',
+ 'tinyGSR Breakout',
+ 'MAX30003 ECG Breakout',
+ 'MAX30001 ECG & BioZ Breakout'
+ ].map(
+ (val) {
+ return DropdownMenuItem(
+ value: val,
+ child: Text(val),
+ );
+ },
+ ).toList(),
+ onChanged: (value) {
+ setState(
+ () {
+ selectedPortBoard = value as String;
+ },
+ );
+ },
+ ),
+ SizedBox(
+ width:50.0,
+ ),
+ Text("Select Port:",style:
+ TextStyle(color: Colors.black, fontSize: 16.0) ),
+ SizedBox(
+ width:20.0,
+ ),
DropdownButton(
underline: SizedBox(),
dropdownColor: hPi4Global.hpi4Color,
@@ -696,6 +746,7 @@ class _HomePageState extends State {
=> PlotSerialPage(
selectedPort:_serialPort,
selectedSerialPort: _selectedPort,
+ selectedPortBoard: selectedPortBoard,
)));
},
diff --git a/lib/plotSerial.dart b/lib/plotSerial.dart
index f1a71aa..91f88a2 100644
--- a/lib/plotSerial.dart
+++ b/lib/plotSerial.dart
@@ -23,10 +23,12 @@ class PlotSerialPage extends StatefulWidget {
PlotSerialPage({Key? key,
required this.selectedPort,
required this.selectedSerialPort,
+ required this.selectedPortBoard,
}) : super();
final SerialPort selectedPort;
final String selectedSerialPort;
+ final String selectedPortBoard;
@override
_PlotSerialPageState createState() => _PlotSerialPageState();
@@ -48,9 +50,6 @@ class _PlotSerialPageState extends State {
double ppgDataCounter = 0;
double respDataCounter = 0;
- bool ecgCheckBoxValue = true;
- bool ppgCheckBoxValue = true;
- bool respCheckBoxValue = true;
bool startDataLogging = false;
int globalHeartRate = 0;
@@ -67,7 +66,6 @@ class _PlotSerialPageState extends State {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
- displayWaveforms();
_startSerialListening();
}
@@ -151,54 +149,343 @@ class _PlotSerialPageState extends State {
{
if (rxch == CES_CMDIF_PKT_STOP) {
//print("data assigned : "+ CES_Pkt_Data_Counter.toString());
- ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
- ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
- ces_pkt_ch1_buffer[2] = CES_Pkt_Data_Counter[2];
- ces_pkt_ch1_buffer[3] = CES_Pkt_Data_Counter[3];
-
- ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[4];
- ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[5];
- ces_pkt_ch2_buffer[2] = CES_Pkt_Data_Counter[6];
- ces_pkt_ch2_buffer[3] = CES_Pkt_Data_Counter[7];
-
- ces_pkt_ch3_buffer[0] = CES_Pkt_Data_Counter[9]; //ir
- ces_pkt_ch3_buffer[1] = CES_Pkt_Data_Counter[10];
- ces_pkt_ch3_buffer[2] = CES_Pkt_Data_Counter[11];
- ces_pkt_ch3_buffer[3] = CES_Pkt_Data_Counter[12];
-
- int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1] << 8 | ces_pkt_ch1_buffer[2] << 16 | ces_pkt_ch1_buffer[3] << 24;
- int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8 | ces_pkt_ch2_buffer[2]<<16 | ces_pkt_ch2_buffer[3] <<24;
- int data3 = ces_pkt_ch3_buffer[0] | ces_pkt_ch3_buffer[1]<<8 | ces_pkt_ch3_buffer[2]<<16 | ces_pkt_ch3_buffer[3] <<24;
-
- setStateIfMounted(() {
- ecgLineData.add(FlSpot(ecgDataCounter++, ((data1.toSigned(32)/1000.00).toDouble())));
- respLineData.add(FlSpot(respDataCounter++, (data2.toDouble())));
- ppgLineData.add(FlSpot(ppgDataCounter++, (data3.toDouble())));
-
- if(startDataLogging == true){
- ecgDataLog.add((data1.toSigned(32)/1000.00).toDouble());
- ppgDataLog.add(data3.toDouble());
- respDataLog.add(data2.toDouble());
+ if(widget.selectedPortBoard == "Healthypi"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+ ces_pkt_ch1_buffer[2] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch1_buffer[3] = CES_Pkt_Data_Counter[3];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[4];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[5];
+ ces_pkt_ch2_buffer[2] = CES_Pkt_Data_Counter[6];
+ ces_pkt_ch2_buffer[3] = CES_Pkt_Data_Counter[7];
+
+ ces_pkt_ch3_buffer[0] = CES_Pkt_Data_Counter[9]; //ir
+ ces_pkt_ch3_buffer[1] = CES_Pkt_Data_Counter[10];
+ ces_pkt_ch3_buffer[2] = CES_Pkt_Data_Counter[11];
+ ces_pkt_ch3_buffer[3] = CES_Pkt_Data_Counter[12];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1] << 8 | ces_pkt_ch1_buffer[2] << 16 | ces_pkt_ch1_buffer[3] << 24;
+ int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8 | ces_pkt_ch2_buffer[2]<<16 | ces_pkt_ch2_buffer[3] <<24;
+ int data3 = ces_pkt_ch3_buffer[0] | ces_pkt_ch3_buffer[1]<<8 | ces_pkt_ch3_buffer[2]<<16 | ces_pkt_ch3_buffer[3] <<24;
+
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, ((data1.toSigned(32)/1000.00).toDouble())));
+ respLineData.add(FlSpot(respDataCounter++, (data2.toDouble())));
+ ppgLineData.add(FlSpot(ppgDataCounter++, (data3.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add((data1.toSigned(32)/1000.00).toDouble());
+ ppgDataLog.add(data3.toDouble());
+ respDataLog.add(data2.toDouble());
+ }
+
+ globalSpO2 = (CES_Pkt_Data_Counter[19]).toInt();
+ if(globalSpO2 == 25){
+ displaySpO2 = "--";
+ }else{
+ displaySpO2 = globalSpO2.toString() +" %";
+ }
+ globalHeartRate = (CES_Pkt_Data_Counter[20]).toInt();
+ globalRespRate = (CES_Pkt_Data_Counter[21]).toInt();
+ globalTemp = (((CES_Pkt_Data_Counter[17]| CES_Pkt_Data_Counter[18]<<8).toInt())/100.00).toDouble();
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ ppgLineData.removeAt(0);
+ }
+ if (respDataCounter >= 128 * 6) {
+ respLineData.removeAt(0);
}
+ pc_rx_state = CESState_Init;
+ }
+ else if(widget.selectedPortBoard == "ADS1292R Breakout/Shield"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[3];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ data1 <<= 16;
+ data1 >>= 16;
+
+ int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ data2 <<= 16;
+ data2 >>= 16;
+
+ computed_val1 = CES_Pkt_Data_Counter[4] | CES_Pkt_Data_Counter[5]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ computed_val1 <<= 16;
+ computed_val1 >>= 16;
+
+ computed_val2 = CES_Pkt_Data_Counter[6] | CES_Pkt_Data_Counter[7]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ computed_val2 <<= 16;
+ computed_val2 >>= 16;
- globalSpO2 = (CES_Pkt_Data_Counter[19]).toInt();
- if(globalSpO2 == 25){
- displaySpO2 = "--";
- }else{
- displaySpO2 = globalSpO2.toString() +" %";
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, (data1.toDouble())));
+ respLineData.add(FlSpot(respDataCounter++, (data2.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add(data1.toDouble());
+ respDataLog.add(data2.toDouble());
+ }
+
+ globalHeartRate = (computed_val1).toInt();
+ globalRespRate = (computed_val2).toInt();
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ }
+ if (respDataCounter >= 128 * 6) {
+ respLineData.removeAt(0);
}
- globalHeartRate = (CES_Pkt_Data_Counter[20]).toInt();
- globalRespRate = (CES_Pkt_Data_Counter[21]).toInt();
- globalTemp = (((CES_Pkt_Data_Counter[17]| CES_Pkt_Data_Counter[18]<<8).toInt())/100.00).toDouble();
- });
- if (ppgDataCounter >= 64 * 6) {
- ecgLineData.removeAt(0);
- ppgLineData.removeAt(0);
+ pc_rx_state = CESState_Init;
+
}
- if (respDataCounter >= 128 * 6) {
- respLineData.removeAt(0);
+ else if(widget.selectedPortBoard == "ADS1293 Breakout/Shield"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+ ces_pkt_ch1_buffer[2] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch1_buffer[3] = CES_Pkt_Data_Counter[3];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[4];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[5];
+ ces_pkt_ch2_buffer[2] = CES_Pkt_Data_Counter[6];
+ ces_pkt_ch2_buffer[3] = CES_Pkt_Data_Counter[7];
+
+ ces_pkt_ch3_buffer[0] = CES_Pkt_Data_Counter[8];
+ ces_pkt_ch3_buffer[1] = CES_Pkt_Data_Counter[9];
+ ces_pkt_ch3_buffer[2] = CES_Pkt_Data_Counter[10];
+ ces_pkt_ch3_buffer[3] = CES_Pkt_Data_Counter[11];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8 | ces_pkt_ch1_buffer[2]<<16 | ces_pkt_ch1_buffer[3] <<24;
+
+ int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8 | ces_pkt_ch2_buffer[2]<<16 | ces_pkt_ch2_buffer[3] <<24;
+
+ int data3 = ces_pkt_ch3_buffer[0] | ces_pkt_ch3_buffer[1]<<8 | ces_pkt_ch3_buffer[2]<<16 | ces_pkt_ch3_buffer[3] <<24;
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, ((data1.toSigned(32)/1000.00).toDouble())));
+ respLineData.add(FlSpot(respDataCounter++, (data2.toDouble())));
+ ppgLineData.add(FlSpot(ppgDataCounter++, (data3.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add((data1.toSigned(32)/1000.00).toDouble());
+ ppgDataLog.add(data3.toDouble());
+ respDataLog.add(data2.toDouble());
+ }
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ ppgLineData.removeAt(0);
+ }
+ if (respDataCounter >= 128 * 6) {
+ respLineData.removeAt(0);
+ }
+ pc_rx_state = CESState_Init;
+
}
- pc_rx_state = CESState_Init;
+ else if(widget.selectedPortBoard == "AFE4490 Breakout/Shield"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+ ces_pkt_ch1_buffer[2] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch1_buffer[3] = CES_Pkt_Data_Counter[3];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[4];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[5];
+ ces_pkt_ch2_buffer[2] = CES_Pkt_Data_Counter[6];
+ ces_pkt_ch2_buffer[3] = CES_Pkt_Data_Counter[7];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8 | ces_pkt_ch1_buffer[2]<<16 | ces_pkt_ch1_buffer[3] <<24;
+
+ int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8 | ces_pkt_ch2_buffer[2]<<16 | ces_pkt_ch2_buffer[3] <<24;
+
+ computed_val1= CES_Pkt_Data_Counter[8];
+ computed_val2= CES_Pkt_Data_Counter[9];
+
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, (data1.toDouble())));
+ ppgLineData.add(FlSpot(ppgDataCounter++, (data2.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add(data1.toDouble());
+ ppgDataLog.add(data2.toDouble());
+ }
+
+ globalHeartRate = (computed_val2).toInt();
+ globalSpO2 = (computed_val1).toInt();
+ if(globalSpO2 == 25){
+ displaySpO2 = "--";
+ }else{
+ displaySpO2 = globalSpO2.toString() +" %";
+ }
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ ppgLineData.removeAt(0);
+ }
+ pc_rx_state = CESState_Init;
+ }
+ else if(widget.selectedPortBoard == "MAX86150 Breakout"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[3];
+
+ ces_pkt_ch3_buffer[0] = CES_Pkt_Data_Counter[4];
+ ces_pkt_ch3_buffer[1] = CES_Pkt_Data_Counter[5];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ data1 <<= 16;
+ data1 >>= 16;
+
+ int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ data2 <<= 16;
+ data2 >>= 16;
+
+ int data3 = ces_pkt_ch3_buffer[0] | ces_pkt_ch3_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ data3 <<= 16;
+ data3 >>= 16;
+
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, (data1.toDouble())));
+ respLineData.add(FlSpot(respDataCounter++, (data2.toDouble())));
+ ppgLineData.add(FlSpot(ppgDataCounter++, (data3.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add(data1.toDouble());
+ ppgDataLog.add(data3.toDouble());
+ respDataLog.add(data2.toDouble());
+ }
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ ppgLineData.removeAt(0);
+ respLineData.removeAt(0);
+ }
+
+ pc_rx_state = CESState_Init;
+ }
+ else if(widget.selectedPortBoard == "Pulse Express (MAX30102/MAX32664D)"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[3];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+ int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, (data1.toDouble())));
+ respLineData.add(FlSpot(respDataCounter++, (data2.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add(data1.toDouble());
+ respDataLog.add(data2.toDouble());
+ }
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ respLineData.removeAt(0);
+ }
+ pc_rx_state = CESState_Init;
+
+ }
+ else if(widget.selectedPortBoard == "tinyGSR Breakout"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8; //reversePacket(CES_Pkt_ECG_Counter, CES_Pkt_ECG_Counter.length-1);
+
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, (data1.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add(data1.toDouble());
+ }
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ }
+
+ pc_rx_state = CESState_Init;
+ }
+ else if(widget.selectedPortBoard == "MAX30003 ECG Breakout"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+ ces_pkt_ch1_buffer[2] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch1_buffer[3] = CES_Pkt_Data_Counter[3];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[4];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[5];
+ ces_pkt_ch2_buffer[2] = CES_Pkt_Data_Counter[6];
+ ces_pkt_ch2_buffer[3] = CES_Pkt_Data_Counter[7];
+
+ ces_pkt_ch3_buffer[0] = CES_Pkt_Data_Counter[8];
+ ces_pkt_ch3_buffer[1] = CES_Pkt_Data_Counter[9];
+ ces_pkt_ch3_buffer[2] = CES_Pkt_Data_Counter[10];
+ ces_pkt_ch3_buffer[3] = CES_Pkt_Data_Counter[11];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8 | ces_pkt_ch1_buffer[2]<<16 | ces_pkt_ch1_buffer[3] <<24;
+
+ int computed_val1 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8 | ces_pkt_ch2_buffer[2]<<16 | ces_pkt_ch2_buffer[3] <<24;
+ int computed_val2 = ces_pkt_ch3_buffer[0] | ces_pkt_ch3_buffer[1]<<8 | ces_pkt_ch3_buffer[2]<<16 | ces_pkt_ch3_buffer[3] <<24;
+
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, ((data1.toSigned(32)/1000.00).toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add((data1.toSigned(32)/1000.00).toDouble());
+ }
+ globalHeartRate = (computed_val2).toInt();
+ globalRespRate = (computed_val1).toInt();
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ }
+ pc_rx_state = CESState_Init;
+
+ }
+ else if(widget.selectedPortBoard == "MAX30001 ECG & BioZ Breakout"){
+ ces_pkt_ch1_buffer[0] = CES_Pkt_Data_Counter[0];
+ ces_pkt_ch1_buffer[1] = CES_Pkt_Data_Counter[1];
+ ces_pkt_ch1_buffer[2] = CES_Pkt_Data_Counter[2];
+ ces_pkt_ch1_buffer[3] = CES_Pkt_Data_Counter[3];
+
+ ces_pkt_ch2_buffer[0] = CES_Pkt_Data_Counter[4];
+ ces_pkt_ch2_buffer[1] = CES_Pkt_Data_Counter[5];
+ ces_pkt_ch2_buffer[2] = CES_Pkt_Data_Counter[6];
+ ces_pkt_ch2_buffer[3] = CES_Pkt_Data_Counter[7];
+
+ int data1 = ces_pkt_ch1_buffer[0] | ces_pkt_ch1_buffer[1]<<8 | ces_pkt_ch1_buffer[2]<<16 | ces_pkt_ch1_buffer[3] <<24;
+ int data2 = ces_pkt_ch2_buffer[0] | ces_pkt_ch2_buffer[1]<<8 | ces_pkt_ch2_buffer[2]<<16 | ces_pkt_ch2_buffer[3] <<24;
+
+ setStateIfMounted(() {
+ ecgLineData.add(FlSpot(ecgDataCounter++, (data1.toDouble())));
+ ppgLineData.add(FlSpot(ppgDataCounter++, (data2.toDouble())));
+
+ if(startDataLogging == true){
+ ecgDataLog.add(data1.toDouble());
+ ppgDataLog.add(data2.toDouble());
+ }
+
+ });
+ if (ecgDataCounter >= 64 * 6) {
+ ecgLineData.removeAt(0);
+ ppgLineData.removeAt(0);
+ }
+ pc_rx_state = CESState_Init;
+ }
+
}else{
pc_rx_state = CESState_Init;
}
@@ -209,14 +496,6 @@ class _PlotSerialPageState extends State {
}
}
- void displayWaveforms() {
- setState(() {
- ecgCheckBoxValue = true;
- ppgCheckBoxValue = true;
- respCheckBoxValue = true;
- });
- }
-
LineChartBarData currentLine(List points, Color plotcolor) {
return LineChartBarData(
spots: points,
@@ -265,49 +544,7 @@ class _PlotSerialPageState extends State {
}
Widget displayCharts() {
- if (ecgCheckBoxValue == true &&
- ppgCheckBoxValue == false &&
- respCheckBoxValue == false) {
- return buildChart(54, 95, ecgLineData, Colors.green);
- } else if (ecgCheckBoxValue == false &&
- ppgCheckBoxValue == true &&
- respCheckBoxValue == false) {
- return buildChart(54, 95, ppgLineData, Colors.yellow);
- } else if (ecgCheckBoxValue == false &&
- ppgCheckBoxValue == false &&
- respCheckBoxValue == true) {
- return buildChart(54, 95, respLineData, Colors.blue);
- } else if (ecgCheckBoxValue == true &&
- ppgCheckBoxValue == true &&
- respCheckBoxValue == false) {
- return Column(children: [
- buildChart(27, 95, ecgLineData, Colors.green),
- SizedBox(
- height: SizeConfig.blockSizeVertical * 1,
- ),
- buildChart(27, 95, ppgLineData, Colors.yellow),
- ]);
- } else if (ecgCheckBoxValue == false &&
- ppgCheckBoxValue == true &&
- respCheckBoxValue == true) {
- return Column(children: [
- buildChart(27, 95, ppgLineData, Colors.yellow),
- SizedBox(
- height: SizeConfig.blockSizeVertical * 1,
- ),
- buildChart(27, 95, respLineData, Colors.blue),
- ]);
- } else if (ecgCheckBoxValue == true &&
- ppgCheckBoxValue == false &&
- respCheckBoxValue == true) {
- return Column(children: [
- buildChart(27, 95, ecgLineData, Colors.green),
- SizedBox(
- height: SizeConfig.blockSizeVertical * 1,
- ),
- buildChart(27, 95, respLineData, Colors.blue),
- ]);
- } else {
+ if(widget.selectedPortBoard == "Healthypi"){
return Column(
children: [
Column(
@@ -438,10 +675,292 @@ class _PlotSerialPageState extends State {
),
]
),
-
],
);
}
+ else if(widget.selectedPortBoard == "ADS1292R Breakout/Shield"){
+ return Column(
+ children: [
+ Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text(
+ "HEART RATE ",
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text( globalHeartRate.toString() + " bpm",
+ style: TextStyle(
+ fontSize: 20,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ ]
+ ),
+ buildChart(29, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text(
+ "RESPIRATION RATE ",
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text( globalRespRate.toString() + " rpm",
+ style: TextStyle(
+ fontSize: 20,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ ]
+ ),
+ buildChart(28, 95, respLineData, Colors.blue),
+ ],
+ );
+ }
+ else if(widget.selectedPortBoard == "ADS1293 Breakout/Shield"){
+ return Column(
+ children: [
+ buildChart(23, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ buildChart(23, 95, ppgLineData, Colors.yellow),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ buildChart(23, 95, respLineData, Colors.blue),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ ],
+ );
+ }
+ else if(widget.selectedPortBoard == "AFE4490 Breakout/Shield"){
+ return Column(
+ children: [
+ Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text(
+ "HEART RATE ",
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text( globalHeartRate.toString() + " bpm",
+ style: TextStyle(
+ fontSize: 20,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ ]
+ ),
+ buildChart(30, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text(
+ "SPO2 ",
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text(displaySpO2,
+ style: TextStyle(
+ fontSize: 20,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ ]
+ ),
+ buildChart(30, 95, ppgLineData, Colors.yellow),
+ ],
+ );
+ }
+ else if(widget.selectedPortBoard == "MAX86150 Breakout"){
+ return Column(
+ children: [
+ buildChart(23, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 2,
+ ),
+ buildChart(23, 95, ppgLineData, Colors.yellow),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 2,
+ ),
+ buildChart(23, 95, respLineData, Colors.blue),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 2,
+ ),
+ ],
+ );
+ }
+ else if(widget.selectedPortBoard == "Pulse Express (MAX30102/MAX32664D)"){
+ return Column(
+ children: [
+ buildChart(32, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 2,
+ ),
+ buildChart(32, 95, respLineData, Colors.blue),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 2,
+ ),
+ ],
+ );
+ }
+ else if(widget.selectedPortBoard == "tinyGSR Breakout"){
+ return Column(
+ children: [
+ buildChart(65, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ ],
+ );
+ }
+ else if(widget.selectedPortBoard == "MAX30003 ECG Breakout"){
+ return Column(
+ children: [
+ Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text(
+ "HEART RATE ",
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text( globalHeartRate.toString() + " bpm",
+ style: TextStyle(
+ fontSize: 20,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ ]
+ ),
+ buildChart(54, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ Column(
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text(
+ "RESPIRATION RATE ",
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ Align(
+ alignment: Alignment.centerRight,
+ child: Container(
+ color: Colors.transparent,
+ child: Text( globalRespRate.toString() + " rpm",
+ style: TextStyle(
+ fontSize: 20,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ ]
+ ),
+ ],
+ );
+ }
+ else if(widget.selectedPortBoard == "MAX30001 ECG & BioZ Breakout"){
+ return Column(
+ children: [
+ buildChart(32, 95, ecgLineData, Colors.green),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ buildChart(32, 95, ppgLineData, Colors.blue),
+ SizedBox(
+ height: SizeConfig.blockSizeVertical * 1,
+ ),
+ ],
+ );
+ }
+ else{
+ return Container();
+ }
}
Widget displayDeviceName() {
@@ -451,7 +970,7 @@ class _PlotSerialPageState extends State {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
- "Connected To: "+ widget.selectedSerialPort,
+ "Connected To: "+ widget.selectedSerialPort+"/ "+widget.selectedPortBoard,
style: TextStyle(
fontSize: 12,
color: Colors.white,
@@ -507,66 +1026,6 @@ class _PlotSerialPageState extends State {
String debugText = "Console Inited...";
- Widget displayECGCheckBoxes() {
- return Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- children: [
- Text("ECG: "),
- Checkbox(
- value: ecgCheckBoxValue,
- activeColor: Colors.green,
- onChanged: (newValue) {
- setState(() {
- ecgCheckBoxValue = newValue!;
- });
- // print("ecgCheckBoxValue........"+ ecgCheckBoxValue.toString());
- }),
- ],
- ),
- );
- }
-
- Widget displayPPGCheckBoxes() {
- return Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- children: [
- Text("PPG: "),
- Checkbox(
- value: ppgCheckBoxValue,
- activeColor: Colors.green,
- onChanged: (newValue) {
- setState(() {
- ppgCheckBoxValue = newValue!;
- });
- // print("ppgCheckBoxValue........"+ ppgCheckBoxValue.toString());
- }),
- ],
- ),
- );
- }
-
- Widget displayRESPCheckBoxes() {
- return Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- children: [
- Text("Resp: "),
- Checkbox(
- value: respCheckBoxValue,
- activeColor: Colors.green,
- onChanged: (newValue) {
- setState(() {
- respCheckBoxValue = newValue!;
- });
- // print("respCheckBoxValue........"+ respCheckBoxValue.toString());
- }),
- ],
- ),
- );
- }
-
Widget displayDisconnectButton() {
return Consumer3(
builder: (context, bleScannerState, bleScanner, wiserBle, child) {
diff --git a/lib/plots.dart b/lib/plots.dart
index 80b4c3b..d05dffe 100644
--- a/lib/plots.dart
+++ b/lib/plots.dart
@@ -104,6 +104,8 @@ class _WaveFormsPageState extends State {
double globalTemp = 0;
int _globalBatteryLevel = 50;
+ String displaySpO2 = "--" ;
+
void logConsole(String logString) {
print("AKW - " + logString);
@@ -331,6 +333,11 @@ class _WaveFormsPageState extends State {
//print("AKW: Rx SPO2: " + event.toString());
setStateIfMounted(() {
globalSpO2 = event[1];
+ if(globalSpO2 == 25){
+ displaySpO2 = "--";
+ }else{
+ displaySpO2 = globalSpO2.toString() +" %";
+ }
//print("AKW: Rx SPO2: " + event[1].toString());
});
});
@@ -373,7 +380,7 @@ class _WaveFormsPageState extends State {
streamHRVRespSubscription = _streamHRVResp.listen((event) {
//print("AKW: Rx Respiration Rate: " + event.toString());
setStateIfMounted(() {
- globalRespRate = event[10];
+ globalRespRate = event[0];
//print("AKW: Rx Respiration Rate: " + event[10].toString());
});
});
@@ -719,7 +726,7 @@ class _WaveFormsPageState extends State {
width: 15,
),
Text(
- "SPO2: " + globalSpO2.toString() + " %",
+ "SPO2: " + displaySpO2,
style: TextStyle(
fontSize: 16,
color: Colors.white,
@@ -769,7 +776,7 @@ class _WaveFormsPageState extends State {
width: 15,
),
Text(
- "SPO2: " + globalSpO2.toString() + " %",
+ "SPO2: " + displaySpO2,
style: TextStyle(
fontSize: 16,
color: Colors.white,
@@ -885,7 +892,7 @@ class _WaveFormsPageState extends State {
alignment: Alignment.centerRight,
child: Container(
color: Colors.transparent,
- child: Text(globalSpO2.toString() +" %",
+ child: Text(displaySpO2,
style: TextStyle(
fontSize: 18,
color: Colors.white,
@@ -951,7 +958,7 @@ class _WaveFormsPageState extends State {
alignment: Alignment.centerRight,
child: Container(
color: Colors.transparent,
- child: Text( globalTemp.toString() + " C",
+ child: Text( globalTemp.toStringAsPrecision(3) + "\u00b0 C",
style: TextStyle(
fontSize: 18,
color: Colors.white,
diff --git a/pubspec.yaml b/pubspec.yaml
index 43411c8..b48d79d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: OpenView2
description: BLE companion app for use with ProtoCentral breakout boards and modules
-version: 2.0.1+70
+version: 2.0.2+71
environment:
#sdk: ">=2.12.0 <3.0.0"