cortex 0.1.0
cortex: ^0.1.0 copied to clipboard
Flutter plugin to access Cortex library and work with Emotiv EEG headset.
cortex #
A Flutter plugin to access Cortex library and work with Emotiv EEG headset
Platform Support #
| Android | iOS | MacOS | Web | Linux | Windows |
|---|---|---|---|---|---|
| ✔️ | ✔️ |
Usage #
To use this plugin, add cortex as a dependency in your pubspec.yaml.
This will expose three classes of Cortex events through 3 different streams:
ResponseEventdescribes the response from Cortex for each request.WarningEventdescribes the warning message from Cortex.DataStreamEventdescribes the data stream event when subscribing data (eeg, motion, ...) from Cortex.
Each of these is exposed through BroadcastStream:responseEvents, warningEvents, and dataStreamEvents,
respectively.
It also provides 4 functions to work with Cortex:
startCortexwill launch Cortex.authenticateWithCortex(clientId)will open a webview for user login and get authentication code from Emotiv backend server.sendRequestToCortexwill send request to Cortex with json format.stopCortexis implemented in Java layer when application terminates, we don't export it to dart layer.
Example #
import 'package:cortex/cortex.dart';
responseEvents.listen((event) {
print(event);
});
warningEvents.listen((event) {
print(event);
});
dataStreamEvents.listen((event) {
print(event);
});
sendRequestToCortex('{ "id": 1, "jsonrpc": "2.0", "method": "queryHeadsets"}');
Also see the example subdirectory for the example application that uses to work with real device.
Remember to add
EmotivCortexLib.aarto your main project with Android buildEmotivCortexLib.xcframeworkto folderFrameworksof iOS plugin with iOS build
Attention #
The embedded Cortex library (EmotivCortexLib.aar for Android and EmotivCortexLib.xcframework for iOS) is in private beta only, and will be published in the future.