cortex 0.0.1
cortex: ^0.0.1 copied to clipboard
Flutter plugin for Cortex library.
cortex #
A Flutter plugin to work with Cortex library
Platform Support #
| Android | iOS | MacOS | Web | Linux | Windows |
|---|---|---|---|---|---|
| ✔️ |
Usage #
To use this plugin, add cortex as a dependency in your pubspec.yaml
file.
This will expose three classes of Cortex events through four different streams.
ResponseEvents describe the response from Cortex for each request.WarningEvents describe the warning message from Cortex.DataStreamEvents describe the data stream event when subsribe data (eeg, motion, ...) from Cortex.
Each of these is exposed through a BroadcastStream: responseEvents,
warningEvents, and dataStreamEvents,
respectively.
It also provides 3 functions to work with Cortex.
startCortextell Cortex to start working.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.- function
stop cortexis implemented in Java layer when application terminates, we don't export it to dart layer.
Example #
import 'package:cortex/cortex_plugin.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 an example application that uses to work with real device.