A Flutter plugin to access Cortex library and work with Emotiv EEG headset
Android | iOS | MacOS | Web | Linux | Windows |
---|---|---|---|---|---|
✔️ | ✔️ |
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:
ResponseEvent
describes the response from Cortex for each request.WarningEvent
describes the warning message from Cortex.DataStreamEvent
describes 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:
startCortex
will launch Cortex.authenticateWithCortex(clientId)
will open a webview for user login and get authentication code from Emotiv backend server.sendRequestToCortex
will send request to Cortex with json format.stopCortex
is implemented in Java layer when application terminates, we don't export it to dart layer.
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.aar
to your main project with Android buildEmotivCortexLib.xcframework
to folderFrameworks
of iOS plugin with iOS build
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.