diff --git a/lib/datacollection/storage.dart b/lib/datacollection/storage.dart index 49a2ede..b8f0402 100644 --- a/lib/datacollection/storage.dart +++ b/lib/datacollection/storage.dart @@ -218,6 +218,7 @@ class SensorMeasurements { 'device_name': deviceName, 'device_id': deviceId, 'word': word, + 'measurements_amount': values.length, 'values': values, 'timestamps': timestamps }; diff --git a/lib/edgeimpulse/api_client.dart b/lib/edgeimpulse/api_client.dart index 0899d62..9499111 100644 --- a/lib/edgeimpulse/api_client.dart +++ b/lib/edgeimpulse/api_client.dart @@ -34,7 +34,7 @@ class EdgeImpulseApiClient { deviceType: "ESP32", // exact model of the device //the frequency of the data in this file (in milliseconds). E.g. for 100Hz fill in 10 (new data every 10 ms.) - intervalMs: averageIntervalInMilliseconds.toInt(), + intervalMs: 16, //mpu6050 Default Internal 8MHz oscillator (register 0x6B = 0) equals to 1.25 milliseconds sensors: EdgeImpulseApiClient.sensorMeasurementNames, values: sensorMeasurements.values); diff --git a/lib/pages/ble_data_collection_page.dart b/lib/pages/ble_data_collection_page.dart index 8f15ecc..60bda63 100644 --- a/lib/pages/ble_data_collection_page.dart +++ b/lib/pages/ble_data_collection_page.dart @@ -161,7 +161,6 @@ class _BleDataCollectionState extends State void _stopRecording(BluetoothBackend bluetoothBackend) async { developer.log('stopRecording'); bluetoothBackend.sendStopCommand(); - _isRecording = false; showDialog( context: context, @@ -198,10 +197,13 @@ class _BleDataCollectionState extends State } static List getCategoryList() { - return ["Números", "Letras", "Saludo"]; + return ["Test", "Números", "Letras", "Saludo"]; } static List getGestureList(String category) { + if (category == "Test") { + return ["pointing-up", "pointing-front", "pointing-down", "up-down", "right-left", "idle"]; + } if (category == "Números") { return ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; } diff --git a/lib/pages/interpretation_page.dart b/lib/pages/interpretation_page.dart index b2c7ee7..8ab7d92 100644 --- a/lib/pages/interpretation_page.dart +++ b/lib/pages/interpretation_page.dart @@ -72,6 +72,8 @@ class _InterpretationsPanelState extends State { key: Key(entry.key.id.id), device: entry.key, interpretationCharacteristic: entry.value, + measurementsCharacteristic: + backend.dataCollectionCharacteristics[entry.key]!, )); } return Column( @@ -87,24 +89,28 @@ class _InterpretationsPanelState extends State { class InterpretationWidget extends StatefulWidget { final BluetoothDevice device; final BluetoothCharacteristic interpretationCharacteristic; + final BluetoothCharacteristic measurementsCharacteristic; const InterpretationWidget( {Key? key, required this.device, - required this.interpretationCharacteristic}) + required this.interpretationCharacteristic, + required this.measurementsCharacteristic}) : super(key: key); @override - _InterpretationWidgetState createState() => - _InterpretationWidgetState(device, interpretationCharacteristic); + _InterpretationWidgetState createState() => _InterpretationWidgetState( + device, interpretationCharacteristic, measurementsCharacteristic); } class _InterpretationWidgetState extends State { static final String TAG = "InterpretationWidget"; final BluetoothDevice device; final BluetoothCharacteristic interpretationCharacteristic; + final BluetoothCharacteristic dcCharacteristic; - _InterpretationWidgetState(this.device, this.interpretationCharacteristic); + _InterpretationWidgetState( + this.device, this.interpretationCharacteristic, this.dcCharacteristic); @override void dispose() { @@ -130,7 +136,22 @@ class _InterpretationWidgetState extends State { alignment: Alignment.topCenter, color: Theme.of(context).backgroundColor, child: Text("Mac addr: ${device.id.id}")), - displayStats() + displayStats(), + StreamBuilder>( + stream: dcCharacteristic.value, + initialData: [], + builder: (c, measurements) { + String msg = ""; + if (measurements.hasData) { + msg = new String.fromCharCodes(measurements.data!); + } + return Container( + width: double.infinity, + height: 80, + alignment: Alignment.center, + color: Theme.of(c).backgroundColor, + child: Text(msg)); + }) ], )); }