From 242744aaa7fcdf281a5bd68eb6ce63055d4500c4 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 8 Oct 2020 14:58:49 -0400 Subject: [PATCH 1/3] Remove wallets --- mobile/lib/src/app.dart | 2 - .../application/wallets/wallets_cubit.dart | 63 ------------------- .../application/wallets/wallets_state.dart | 25 -------- mobile/lib/src/domain/wallet/constants.dart | 1 - .../domain/wallet/i_wallet_repository.dart | 6 -- mobile/lib/src/domain/wallet/money.dart | 57 ----------------- mobile/lib/src/domain/wallet/owner.dart | 32 ---------- mobile/lib/src/domain/wallet/wallet.dart | 35 ----------- .../mock_wallet_repository.dart | 22 ------- mobile/lib/src/locator.dart | 10 --- .../presentation/wallets/wallet_widget.dart | 23 ------- .../presentation/wallets/wallets_route.dart | 62 ------------------ .../presentation/wallets/wallets_widget.dart | 32 ---------- 13 files changed, 370 deletions(-) delete mode 100644 mobile/lib/src/application/wallets/wallets_cubit.dart delete mode 100644 mobile/lib/src/application/wallets/wallets_state.dart delete mode 100644 mobile/lib/src/domain/wallet/constants.dart delete mode 100644 mobile/lib/src/domain/wallet/i_wallet_repository.dart delete mode 100644 mobile/lib/src/domain/wallet/money.dart delete mode 100644 mobile/lib/src/domain/wallet/owner.dart delete mode 100644 mobile/lib/src/domain/wallet/wallet.dart delete mode 100644 mobile/lib/src/infrastructure/mock_wallet_repository.dart delete mode 100644 mobile/lib/src/presentation/wallets/wallet_widget.dart delete mode 100644 mobile/lib/src/presentation/wallets/wallets_route.dart delete mode 100644 mobile/lib/src/presentation/wallets/wallets_widget.dart diff --git a/mobile/lib/src/app.dart b/mobile/lib/src/app.dart index f8056bce..ccc477e3 100644 --- a/mobile/lib/src/app.dart +++ b/mobile/lib/src/app.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:polydodo/src/presentation/bluetooth_route/bluetoothSelector_route.dart'; -import 'package:polydodo/src/presentation/wallets/wallets_route.dart'; import 'locator.dart'; import 'theme.dart'; @@ -21,7 +20,6 @@ class App extends StatelessWidget { theme: theme, initialRoute: BluetoothSelectorRoute.name, routes: { - WalletsRoute.name: (context) => WalletsRoute(), BluetoothSelectorRoute.name: (context) => BluetoothSelectorRoute(), }, ), diff --git a/mobile/lib/src/application/wallets/wallets_cubit.dart b/mobile/lib/src/application/wallets/wallets_cubit.dart deleted file mode 100644 index 6ab7d3e3..00000000 --- a/mobile/lib/src/application/wallets/wallets_cubit.dart +++ /dev/null @@ -1,63 +0,0 @@ -import 'dart:math'; - -import 'package:bloc/bloc.dart'; - -import 'package:polydodo/src/application/wallets/wallets_state.dart'; -import 'package:polydodo/src/domain/unique_id.dart'; -import 'package:polydodo/src/domain/wallet/i_wallet_repository.dart'; -import 'package:polydodo/src/domain/wallet/money.dart'; -import 'package:polydodo/src/domain/wallet/owner.dart'; -import 'package:polydodo/src/domain/wallet/wallet.dart'; - -class WalletsCubit extends Cubit { - final IWalletRepository _walletRepository; - - WalletsCubit(this._walletRepository) : super(WalletsInitial()) { - createNewWallets(); - emit(WalletsLoadInProgress()); - _walletRepository - .watch() - .listen((wallets) => emit(WalletsLoadSuccess(wallets))) - .onError((e) => emit(WalletsLoadFailure(e))); - } - - // Does not yield another state - void transfer(Wallet sender, Wallet receiver, Money amount) async { - try { - sender.transfer(amount, receiver); - } catch (e) { - emit(WalletsTransferFailure(e)); - } - await Future.wait([ - _walletRepository.store(sender), - _walletRepository.store(receiver), - ]).catchError((e) => emit(WalletsTransferFailure(e))); - } - - Future> createNewWallets() => Future.wait([ - _walletRepository.store( - Wallet( - UniqueId(), - Owner( - id: UniqueId.from('1'), - firstName: 'Bob', - lastName: 'Skiridovsky', - age: 25, - ), - Money(Random().nextDouble() * 10, Currency.cad), - ), - ), - _walletRepository.store( - Wallet( - UniqueId(), - Owner( - id: UniqueId.from('2'), - firstName: 'Alice', - lastName: 'Pogo', - age: 35, - ), - Money(Random().nextDouble() * 1000, Currency.cad), - ), - ) - ]); -} diff --git a/mobile/lib/src/application/wallets/wallets_state.dart b/mobile/lib/src/application/wallets/wallets_state.dart deleted file mode 100644 index 01788a39..00000000 --- a/mobile/lib/src/application/wallets/wallets_state.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:polydodo/src/domain/wallet/wallet.dart'; - -abstract class WalletsState {} - -class WalletsInitial extends WalletsState {} - -class WalletsLoadInProgress extends WalletsState {} - -class WalletsLoadSuccess extends WalletsState { - final List wallets; - - WalletsLoadSuccess(this.wallets); -} - -class WalletsLoadFailure extends WalletsState { - final Exception cause; - - WalletsLoadFailure(this.cause); -} - -class WalletsTransferFailure extends WalletsState { - final Exception cause; - - WalletsTransferFailure(this.cause); -} diff --git a/mobile/lib/src/domain/wallet/constants.dart b/mobile/lib/src/domain/wallet/constants.dart deleted file mode 100644 index 595ccd29..00000000 --- a/mobile/lib/src/domain/wallet/constants.dart +++ /dev/null @@ -1 +0,0 @@ -const cadToUsdRate = 1.32; diff --git a/mobile/lib/src/domain/wallet/i_wallet_repository.dart b/mobile/lib/src/domain/wallet/i_wallet_repository.dart deleted file mode 100644 index d1f87cff..00000000 --- a/mobile/lib/src/domain/wallet/i_wallet_repository.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'wallet.dart'; - -abstract class IWalletRepository { - Future store(Wallet wallet); - Stream> watch(); -} diff --git a/mobile/lib/src/domain/wallet/money.dart b/mobile/lib/src/domain/wallet/money.dart deleted file mode 100644 index 1f760cea..00000000 --- a/mobile/lib/src/domain/wallet/money.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:equatable/equatable.dart'; - -import 'constants.dart'; - -enum Currency { usd, cad } - -Map currencyToString = { - Currency.usd: 'USD', - Currency.cad: 'CAD', -}; - -// Value object usually extends equatable -class Money extends Equatable { - static const _min = 0; - - final double value; - final Currency currency; - - Money(this.value, this.currency) - : assert(value != null), - assert(currency != null) { - // Validation that money cannot be in an impossible state - if (value <= _min) { - Exception('Money amount cannot be inferior to $_min'); - } - } - - double get usd { - if (currency == Currency.cad) { - return value / cadToUsdRate; - } - return value; - } - - double get cad { - if (currency == Currency.usd) { - return value * cadToUsdRate; - } - return value; - } - - Money convertTo(Currency currency) { - if (currency == Currency.usd) { - return Money(usd, currency); - } - return Money(cad, currency); - } - - /// Gives back result into left operand's currency - Money operator +(Money other) => - Money(this.usd + other.usd, Currency.usd).convertTo(this.currency); - Money operator -(Money other) => - Money(this.usd - other.usd, Currency.usd).convertTo(this.currency); - - @override - List get props => [usd]; -} diff --git a/mobile/lib/src/domain/wallet/owner.dart b/mobile/lib/src/domain/wallet/owner.dart deleted file mode 100644 index a1360dbf..00000000 --- a/mobile/lib/src/domain/wallet/owner.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:meta/meta.dart'; - -import 'package:polydodo/src/domain/unique_id.dart'; - -class Owner { - static const _legalAge = 16; - - final UniqueId id; - final String firstName; - final String lastName; - final int age; - - Owner({ - @required this.id, - @required this.firstName, - @required this.lastName, - @required this.age, - }) : assert(id != null), - assert(firstName != null), - assert(lastName != null) { - if (firstName.length <= 0 || lastName.length <= 0) { - throw Exception('First and last name cannot be empty'); - } - if (!_hasLegalAge()) { - throw Exception('This owner does not have the legal age'); - } - } - - bool _hasLegalAge() => age >= _legalAge; - - // In a good model entity, we should have behavorial method... -} diff --git a/mobile/lib/src/domain/wallet/wallet.dart b/mobile/lib/src/domain/wallet/wallet.dart deleted file mode 100644 index 0c1dffcf..00000000 --- a/mobile/lib/src/domain/wallet/wallet.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:polydodo/src/domain/unique_id.dart'; - -import 'money.dart'; -import 'owner.dart'; - -// We call Wallet an aggregate root because it own other entities -class Wallet { - final UniqueId id; - final Owner owner; - Money money; - - Wallet(this.id, this.owner, this.money); - - // Wallet is an entity and therefore it must have a behavior. It is here that - // business logic appears. - void transfer(Money amount, Wallet receiver) { - if (money.usd - amount.usd < 0) { - throw Exception( - 'Not enough money in this wallet to perform this transaction', - ); - } - money -= amount; - receiver._receive(amount); - } - - void _receive(Money amount) { - money += amount; - } - - @override - bool operator ==(other) => this.id == other.id; - - @override - int get hashCode => super.hashCode; -} diff --git a/mobile/lib/src/infrastructure/mock_wallet_repository.dart b/mobile/lib/src/infrastructure/mock_wallet_repository.dart deleted file mode 100644 index 3e8cc516..00000000 --- a/mobile/lib/src/infrastructure/mock_wallet_repository.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'dart:async'; - -import 'package:polydodo/src/domain/wallet/i_wallet_repository.dart'; -import 'package:polydodo/src/domain/wallet/wallet.dart'; - -class MockWalletRepository implements IWalletRepository { - static List walletsMockPersistency = []; - final streamController = StreamController>(); - - @override - Future store(Wallet wallet) async { - await Future.delayed(Duration(milliseconds: 400)); - final idx = walletsMockPersistency.indexOf(wallet); - idx == -1 - ? walletsMockPersistency.add(wallet) - : walletsMockPersistency[idx] = wallet; - streamController.add(walletsMockPersistency); - } - - @override - Stream> watch() => streamController.stream; -} diff --git a/mobile/lib/src/locator.dart b/mobile/lib/src/locator.dart index 560237f3..8d521dae 100644 --- a/mobile/lib/src/locator.dart +++ b/mobile/lib/src/locator.dart @@ -1,14 +1,10 @@ import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_blue/flutter_blue.dart'; import 'package:get_it/get_it.dart'; import 'package:polydodo/src/application/device/device_selector_cubit.dart'; import 'package:polydodo/src/application/eeg_data/data_cubit.dart'; import 'package:polydodo/src/domain/acquisition_device/i_acquisition_device_repository.dart'; -import 'package:polydodo/src/infrastructure/mock_wallet_repository.dart'; -import 'application/wallets/wallets_cubit.dart'; import 'domain/eeg_data/i_eeg_data_repository.dart'; -import 'domain/wallet/i_wallet_repository.dart'; import 'infrastructure/bluetooth_repository.dart'; import 'infrastructure/eeg_data_repository.dart'; @@ -16,7 +12,6 @@ import 'infrastructure/eeg_data_repository.dart'; final _serviceLocator = GetIt.asNewInstance(); void registerServices() { - _serviceLocator.registerSingleton(MockWalletRepository()); _serviceLocator .registerSingleton(BluetoothRepository()); _serviceLocator.registerSingleton(EEGDataRepository()); @@ -24,11 +19,6 @@ void registerServices() { /// This function creates all the BlocProviders used in this app List createBlocProviders() => [ - BlocProvider( - create: (context) => WalletsCubit( - _serviceLocator.get(), - ), - ), BlocProvider( create: (context) => DeviceSelectorCubit( _serviceLocator.get(), diff --git a/mobile/lib/src/presentation/wallets/wallet_widget.dart b/mobile/lib/src/presentation/wallets/wallet_widget.dart deleted file mode 100644 index 426e3dc6..00000000 --- a/mobile/lib/src/presentation/wallets/wallet_widget.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:polydodo/src/domain/wallet/money.dart'; -import 'package:polydodo/src/domain/wallet/wallet.dart'; - -class WalletWidget extends StatelessWidget { - final Wallet wallet; - - const WalletWidget({Key key, @required this.wallet}) : super(key: key); - - @override - Widget build(BuildContext context) { - final currency = currencyToString[wallet.money.currency]; - return Container( - child: Column( - children: [ - Text('${wallet.owner.firstName} ${wallet.owner.lastName}'), - Text('ID: ${wallet.owner.id.get()}'), - Text('${wallet.money.value.toStringAsFixed(2)} $currency'), - ], - ), - ); - } -} diff --git a/mobile/lib/src/presentation/wallets/wallets_route.dart b/mobile/lib/src/presentation/wallets/wallets_route.dart deleted file mode 100644 index 842784d5..00000000 --- a/mobile/lib/src/presentation/wallets/wallets_route.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:polydodo/src/application/wallets/wallets_cubit.dart'; -import 'package:polydodo/src/application/wallets/wallets_state.dart'; -import 'package:polydodo/src/domain/wallet/constants.dart'; -import 'package:polydodo/src/domain/wallet/money.dart'; - -import 'wallets_widget.dart'; - -class WalletsRoute extends StatelessWidget { - static const name = 'walletsRoute'; - - WalletsRoute({Key key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: Text('Polydodo')), - body: BlocConsumer( - listener: (context, state) { - print(state.runtimeType); - if (state is WalletsLoadFailure) { - Scaffold.of(context).showSnackBar(SnackBar( - content: Text('Unable to load Wallets because ${state.cause}'), - )); - } else if (state is WalletsTransferFailure) { - Scaffold.of(context).showSnackBar(SnackBar( - content: Text('Unable to transfer money because ${state.cause}'), - )); - } - }, - builder: (context, state) { - return Center( - child: Column( - children: [ - Text('CAD to USD Rate: $cadToUsdRate'), - WalletsWidget(state: state), - if (state is WalletsLoadSuccess) - _buildTransferButton(context, state), - ], - ), - ); - }, - ), - ); - } - - Widget _buildTransferButton(BuildContext context, WalletsLoadSuccess state) { - final sender = state.wallets[0]; - final receiver = state.wallets[1]; - return RaisedButton( - child: Text( - 'Send 1 USD from ${sender.owner.firstName} to ${receiver.owner.firstName}', - ), - onPressed: () => BlocProvider.of(context).transfer( - sender, - receiver, - Money(1, Currency.usd), - ), - ); - } -} diff --git a/mobile/lib/src/presentation/wallets/wallets_widget.dart b/mobile/lib/src/presentation/wallets/wallets_widget.dart deleted file mode 100644 index 3e8b643d..00000000 --- a/mobile/lib/src/presentation/wallets/wallets_widget.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:polydodo/src/application/wallets/wallets_state.dart'; - -import 'wallet_widget.dart'; - -class WalletsWidget extends StatelessWidget { - final WalletsState state; - - const WalletsWidget({Key key, @required this.state}) : super(key: key); - - @override - Widget build(BuildContext context) { - if (state is WalletsLoadSuccess) { - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: (state as WalletsLoadSuccess) - .wallets - .map((wallet) => Container( - child: WalletWidget(wallet: wallet), - margin: EdgeInsets.all(24), - )) - .toList(), - ); - } - - return SizedBox( - child: CircularProgressIndicator(), - height: 50, - width: 50, - ); - } -} From 0d135c2e5890a7fdd7551399fad4ff2b511bff91 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 8 Oct 2020 15:12:46 -0400 Subject: [PATCH 2/3] inherit from entity --- .../domain/acquisition_device/acquisition_device.dart | 3 --- mobile/lib/src/domain/eeg_data/eeg_data.dart | 11 +++++------ mobile/lib/src/domain/entity.dart | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/mobile/lib/src/domain/acquisition_device/acquisition_device.dart b/mobile/lib/src/domain/acquisition_device/acquisition_device.dart index f15efc14..9721ec3b 100644 --- a/mobile/lib/src/domain/acquisition_device/acquisition_device.dart +++ b/mobile/lib/src/domain/acquisition_device/acquisition_device.dart @@ -1,8 +1,5 @@ -import 'package:equatable/equatable.dart'; import 'package:polydodo/src/domain/entity.dart'; -import '../unique_id.dart'; - class AcquisitionDevice extends Entity { final String name; diff --git a/mobile/lib/src/domain/eeg_data/eeg_data.dart b/mobile/lib/src/domain/eeg_data/eeg_data.dart index 4f6b38ab..6ba58bbf 100644 --- a/mobile/lib/src/domain/eeg_data/eeg_data.dart +++ b/mobile/lib/src/domain/eeg_data/eeg_data.dart @@ -1,14 +1,13 @@ // EEGData can be extended later to add our metrics -import '../unique_id.dart'; +import 'package:polydodo/src/domain/entity.dart'; -class EEGData { - UniqueId id; +class EEGData extends Entity { List _values; int sampleCounter = 0; - EEGData(this.id, this._values) - : assert(id != null), - assert(_values != null); + EEGData(id, this._values) + : assert(_values != null), + super(id); List get values => _values; diff --git a/mobile/lib/src/domain/entity.dart b/mobile/lib/src/domain/entity.dart index 844514b4..6b250817 100644 --- a/mobile/lib/src/domain/entity.dart +++ b/mobile/lib/src/domain/entity.dart @@ -4,7 +4,7 @@ import 'package:polydodo/src/domain/unique_id.dart'; abstract class Entity extends Equatable { final UniqueId id; - Entity(this.id); + Entity(this.id) : assert(id != null); @override List get props => [id]; From 1a3036dedc7eb4c518be8e2bea4654299b6b9831 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Thu, 8 Oct 2020 16:14:07 -0400 Subject: [PATCH 3/3] Normalize await usage --- .../device/device_selector_cubit.dart | 16 +++--- .../src/application/eeg_data/data_cubit.dart | 7 ++- .../infrastructure/bluetooth_repository.dart | 50 +++++++++---------- .../infrastructure/eeg_data_repository.dart | 4 +- .../src/infrastructure/serial_repository.dart | 1 + 5 files changed, 38 insertions(+), 40 deletions(-) diff --git a/mobile/lib/src/application/device/device_selector_cubit.dart b/mobile/lib/src/application/device/device_selector_cubit.dart index 6d876880..02a657c2 100644 --- a/mobile/lib/src/application/device/device_selector_cubit.dart +++ b/mobile/lib/src/application/device/device_selector_cubit.dart @@ -27,15 +27,17 @@ class DeviceSelectorCubit extends Cubit { } } - void connect(AcquisitionDevice device) async { + Future connect(AcquisitionDevice device) async { emit(DeviceConnectionInProgress()); - _deviceRepository.connect(device).then( - (value) => { - _acquisitionDeviceStream.cancel(), - emit(DeviceConnectionSuccess()) - }, - onError: (e) => {emit(DeviceConnectionFailure(e)), resetSearch()}); + try { + await _deviceRepository.connect(device); + _acquisitionDeviceStream.cancel(); + emit(DeviceConnectionSuccess()); + } catch (e) { + emit(DeviceConnectionFailure(e)); + resetSearch(); + } } void resetSearch() { diff --git a/mobile/lib/src/application/eeg_data/data_cubit.dart b/mobile/lib/src/application/eeg_data/data_cubit.dart index 5f06fa8f..3f69dbce 100644 --- a/mobile/lib/src/application/eeg_data/data_cubit.dart +++ b/mobile/lib/src/application/eeg_data/data_cubit.dart @@ -12,11 +12,10 @@ class DataCubit extends Cubit { DataCubit(this._deviceRepository, this._eegDataRepository) : super(DataStateInitial()); - void startStreaming() { + Future startStreaming() async { emit(DataStateRecording()); - _deviceRepository - .startDataStream() - .then((stream) => _eegDataRepository.createRecordingFromStream(stream)); + _eegDataRepository + .createRecordingFromStream(await _deviceRepository.startDataStream()); } void stopStreaming() { diff --git a/mobile/lib/src/infrastructure/bluetooth_repository.dart b/mobile/lib/src/infrastructure/bluetooth_repository.dart index cc087ab3..371a2670 100644 --- a/mobile/lib/src/infrastructure/bluetooth_repository.dart +++ b/mobile/lib/src/infrastructure/bluetooth_repository.dart @@ -76,46 +76,42 @@ class BluetoothRepository implements IAcquisitionDeviceRepository { flutterBlue.stopScan(); try { - await _selectedDevice - .connect() - .then((value) => findRelevantCharacteristics()) - .timeout(Duration(seconds: 6), - onTimeout: () => - {disconnect(), throw Exception("Connection Timed out")}); + await _selectedDevice.connect().timeout(Duration(seconds: 6), + onTimeout: () => + {disconnect(), throw Exception("Connection Timed out")}); + + await findRelevantCharacteristics(); } catch (e) { if (e is PlatformException) { if (e.code != "already_connected") throw Exception(e.details); } else throw e; } - - return; } - void disconnect() async { + Future disconnect() async { if (_selectedDevice != null) { await _selectedDevice.disconnect(); _selectedDevice = null; } } - void findRelevantCharacteristics() { - _selectedDevice.discoverServices().then((services) => { - for (BluetoothCharacteristic characteristic in (services.where( - (service) => service.uuid.toString().contains(BLE_SERVICE))) - .first - .characteristics) - { - if (characteristic.uuid.toString().contains(BLE_RECEIVE)) - {_receiveCharacteristic = characteristic} - else if (characteristic.uuid.toString().contains(BLE_SEND)) - {_sendCharacteristic = characteristic} - }, - if (_receiveCharacteristic == null) - throw Exception('Device is missing receive Characteristic'), - if (_sendCharacteristic == null) - throw Exception('Device is missing send Characteristic') - }); + Future findRelevantCharacteristics() async { + var characteristics = (await _selectedDevice.discoverServices()) + .firstWhere((service) => service.uuid.toString().contains(BLE_SERVICE)) + .characteristics; + for (BluetoothCharacteristic characteristic in characteristics) { + if (characteristic.uuid.toString().contains(BLE_RECEIVE)) { + _receiveCharacteristic = characteristic; + } else if (characteristic.uuid.toString().contains(BLE_SEND)) { + _sendCharacteristic = characteristic; + } + } + + if (_receiveCharacteristic == null) + throw Exception('Device is missing receive Characteristic'); + if (_sendCharacteristic == null) + throw Exception('Device is missing send Characteristic'); } Future>> startDataStream() async { @@ -125,7 +121,7 @@ class BluetoothRepository implements IAcquisitionDeviceRepository { return _receiveCharacteristic.value; } - void stopDataStream() async { + Future stopDataStream() async { await _receiveCharacteristic.setNotifyValue(false); await _sendCharacteristic.write(stopStreamChar.codeUnits); } diff --git a/mobile/lib/src/infrastructure/eeg_data_repository.dart b/mobile/lib/src/infrastructure/eeg_data_repository.dart index 0eabb1bd..7e29ca01 100644 --- a/mobile/lib/src/infrastructure/eeg_data_repository.dart +++ b/mobile/lib/src/infrastructure/eeg_data_repository.dart @@ -28,7 +28,7 @@ class EEGDataRepository implements IEEGDataRepository { } } - void stopRecordingFromStream() async { + Future stopRecordingFromStream() async { // todo: move save future to another file final directory = await getExternalStorageDirectory(); final pathOfTheFileToWrite = @@ -45,7 +45,7 @@ class EEGDataRepository implements IEEGDataRepository { void importData() {} void exportData() {} - void addData(List event) async { + Future addData(List event) async { //print("Lost packets: " + packetLoss.toString()); //print("Total packets: " + totalPackets.toString()); //print("Lost percentage: " + diff --git a/mobile/lib/src/infrastructure/serial_repository.dart b/mobile/lib/src/infrastructure/serial_repository.dart index e69de29b..8b137891 100644 --- a/mobile/lib/src/infrastructure/serial_repository.dart +++ b/mobile/lib/src/infrastructure/serial_repository.dart @@ -0,0 +1 @@ +