Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This method lets you synchronize the monotonic clock of your application with the monotonic clock of Cortex. It is an important step if you want to inject markers with a high precision.
Cortex uses a different clock for each headset and it initializes this clock when the headset is connected by Bluetooth or USB dongle. This means that:
You must call “syncWithHeadsetClock” after the headset is connected, not before.
You must provide a headset id.
If the headset is disconnected and connected again, then you must call this method again.
The simplest solution is to call this method just before creating a record.
Cortex sets the timestamps of each EEG sample using the monotonic clock of the computer. It is more reliable than using the system clock, because the system clock is subject to unpredictable variations, notably because of the NTP synchronization.
When you add a marker to a record, Cortex uses the parameter "time" of your request to associate the marker with the EEG sample that has the closest timestamp. So if you want to have accurate markers, you should set the time of your markers using the monotonic clock, not the system clock.
Most programing languages provide a function to get a monotonic time. But in general, the point of origin of this time is undefined. So you need to synchronize the monotonic clock of your application with the monotonic clock used by Cortex. This is the purpose of this Cortex API method.
This method takes 3 parameters:
Name | Type | Required | Description |
---|---|---|---|
The result is a JSON object with these fields:
To synchronize your clock, you must add the “adjustment” to your monotonic times. If the “adjustment” is positive, then it means your clock is late compared to the Cortex clock. If the “adjustment” is negative, then your clock is ahead of the Cortex clock.
This method is to connect or disconnect a headset. It can also refresh the list of available Bluetooth headsets returned by .
Please note that connecting and disconnecting a headset can take a few seconds.
Before you call on a headset, make sure that Cortex is connected to this headset. You can use to check the connection status of the headset.
This method is not available on iOS. On iOS the user must connect and disconnect the headset in EMOTIV App.
The app must call controlDevice with "refresh" command to start headset scanning. The timeout of scanning is around 20s. When the scanning finishes, Cortex will send a to the app. When received this warning, if the app still want to scan for headsets, simply call controlDevice with "refresh" command again.
Please note that headset scanning can affect to data stream quality if headset scanning is running at the same time with data stream subscription, so we recommend app developers to design the app so that we only run headset scanning when necessary.
The mappings parameter is only to connect an EPOC Flex headset. Use this parameter to tell Cortex how you setup the EEG sensors of your EPOC Flex headset.
The keys for this object must be chosen from this list: "CMS", "DRL", "LA", "LB", "LC", "LD", "LE", "LF", "LG", "LH", "LJ", "LK", "LL", "LM", "LN", "LO", "LP", "LQ", "RA", "RB", "RC", "RD", "RE", "RF", "RG", "RH", "RJ", "RK", "RL", "RM", "RN", "RO", "RP", "RQ".
The keys "CMS" and "DRL" are required.
The values are sensor locations from the international 10-20 system: "Cz", "FCz", "Fz", "Afz", "Fpz", "Fp1", "AF3", "AF7", "F9", "F7", "F5", "F3", "F1", "FC1", "C1", "C3", "FC3", "FC5", "FT7", "FT9", "T7", "C5", "TP9", "TP7", "CP5", "CP3", "CP1", "P1", "P3", "P5", "P7", "P9", "PO9", "PO7", "PO3", "O1", "O9", "CPz", "Pz", "POz", "Oz", "Iz", "O10", "O2", "PO4", "PO8", "PO10", "P10", "P8", "P6", "P4", "P2", "CP2", "CP4", "CP6", "TP8", "TP10", "C6", "T8", "FT10", "FT8", "FC6", "FC4", "C4", "C2", "FC2", "F2", "F4", "F6", "F8", "F10", "AF8", "AF4", "Fp2".
You can use this parameter together with the command "connect", to force Cortex to use the specified connection type. For example, an EPOC+ headset can be connected by dongle or by Bluetooth. If both connections are available on your computer then you may want to set connectionType to "dongle" so you don't accidentally connect the headset with Bluetooth.
The result is an object containing these fields:
Use the refresh command to start searching for new Bluetooth headsets.
Then you will receive a warning with code 104 if the connection is successful:
After you finish the process, your application should start headset scanning to search for EMOTIV headsets, using the method with "refresh" command, then use the method to get the discovered headsets.
If the headset is not connected to Cortex yet, then you must call with "connect" command.
See also for details.
This method lets you set the headband position of an EPOC X headset.
The headband position is important to interpret the motion data coming from the headset. The motion sensor is located in the headband. So Cortex uses the headband position to know the orientation of the motion sensor.
When you Cortex saves the current headband position into the record. So you should set the position before starting the record.
This method was added in Cortex 2.4
The result is an object containing these fields:
Some methods of the API return one or more headset objects, for example . A also includes a headset object.
A headset object include these fields:
When you want to work with a headset, it is important to check its status.
The settings object include these fields:
A motion rate of zero means that the motion sensors are disabled.
Currently, the flexMappings object contains a single field. It may include more fields in the future.
Name | Type | Description |
---|---|---|
When the command is "connect", then the result of this method just tells you that the connection is in progress. You must wait for a warning object with to know that the connection is successful. If the connection fails then you will receive a warning with .
Another way to check if the headset is connected or not is to call and then check the status of the headset.
Then you will receive a when scanning is finished.
For an Epoc+ headset, the mode can be "EPOC" or "EPOCPLUS", depending on its configuration. See for details. For an Insight or Epoc headset, the mode is always "EPOC". For an Epoc Flex headset, the mode is always "EPOCFLEX".
headset
string
yes
The headset id.
Use queryHeadset to list available headsets.
monotonicTime
number
yes
The monotonic time of your application. The unit is in seconds. The origin can be anything.
You should get this time right before you call this API.
systemTime
number
yes
The system time of your application. It must be the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970 UTC.
You should get this time right before you call this API.
headset
string
The headset id.
adjustment
number
The difference between the monotonic clock of your application and the monotonic clock of the headset.
The unit is in seconds.
Name | Type | Description |
command |
| The command that you set in the request |
message |
| A success message |
Name | Type | Description |
mode |
| Can be "EPOC", "EPOCPLUS", or "EPOCFLEX" |
eegRate |
| The EEG sample rate, in hertz. |
eegRes |
| The EEG resolution, in bits. |
memsRate |
| The motion data sample rate, in hertz. |
memsRes |
| The motion data resolution, in bits. |
Name | Type | Description |
mappings |
| Describe which EEG channel is mapped to which physical connector of EPOC Flex device. The keys are the names of the connectors, the values are the names of the EEG channels. Example: { "CMS": "TP8", "DRL": "P6", "RM": "TP10", "RN": "P4", "RO": "P8" } |
Name | Type | Required | Description |
command |
| yes | The command must be "connect", "disconnect" or "refresh". |
headset |
| no | If the command is "refresh", then you should omit this parameter. |
mappings |
| no | The EEG sensor mapping of the EPOC Flex headset that you want to connect. If the command is not "connect", or if the headset is not an EPOC Flex, then you should omit this parameter. |
connectionType |
| no | If the command is "connect" or "disconnect" then this parameter can be "dongle", "bluetooth" or "usb cable", or you can omit it. If the command is "refresh" then you should omit this parameter. This parameter was added in Cortex 2.2.1 |
Name | Type | Required | Description |
cortexToken |
| yes |
headsetId |
| yes |
headbandPosition |
| yes | Must be "back" or "top". |
Name | Type | Description |
headsetId |
| The headset id used in the request. |
customName |
| The custom name of the headset. |
headbandPosition |
| The position of the headband. Can be "back" or "top". |
Name | Type | Description |
id |
| The id of this headset. |
status |
| Can be "discovered", "connecting", or "connected". |
connectedBy |
| Can be "bluetooth", "dongle", "usb cable", or "extender". |
dongle |
| The version of the dongle firmware. |
firmware |
| The version of the headset firmware. |
motionSensors |
| The names of the motion sensors of this headset. |
sensors |
| The names of the EEG sensors of this headset. Use the international 10-20 system. |
settings |
| An object containing the configuration of the EEG and motion data of this headset. |
flexMappings |
| If the headset is an EPOC Flex, then this field is an object containing information about the mapping of the EEG channels. |
headbandPosition |
| This field was added in Cortex 2.4 |
customName |
| The custom name of the headset. The user can set it in EMOTIV App. This field was added in Cortex 2.4 |
Status | Description |
discovered |
connecting | Cortex is trying to connect to this headset. This can take a few seconds. |
connected |
Shows details of any headsets connected to the device via USB dongle, USB cable, or Bluetooth. You can query a specific headset by its id, or you can specify a wildcard for partial matching.
For the parameter id, you can use these wildcards:
The result is an array of headset objects, or an empty array if no headset matches the request.
If no headset matches your request, then the result is an empty array.
This method lets you change the settings of an EPOC+ or EPOC X headset.
You can configure the EEG sample rate, EEG resolution, motion data sample rate, and motion data resolution. You can check the current settings of a headset using the method queryHeadsets.
This method is for EPOC+ and EPOC X headsets only. There are no configuration settings for other EMOTIV headsets.
Please note that updating the configuration of a headset can take a few seconds.
The user must connect the headset to the computer by using a USB cable before calling this method. You can't configure the headset through a wireless connection. You can use queryHeadsets to check how the headset is connected.
The setting parameter must be an object with these fields:
A motion rate of zero means that the motion sensors are disabled.
The result is an object containing these fields:
In Cortex 2.3.0 and earlier, you just need to check the result of the method. If the method doesn't return any error, then it means that the update is successful.
However, since Cortex 2.4.0, the result of the method just tells you that the update is in progress. You must wait for a warning object with code 110 or 111 to know if the update is successful or not.
If your configuration is not compatible with a Bluetooth connection then you will receive a warning with code 112. Your configuration will work fine with a USB dongle. To use the headset with a Bluetooth connection, you must set the EEG rate to 128Hz and disable the motion sensors.
Set the EEG rate to 256 hertz (16 bits) and the motion rate to 64 hertz (16bits)
Set the EPOC+ headset in EPOC mode, EEG rate at 128 hertz (14 bits) and disable the motion sensors.
The id of the headset that you want to connect or disconnect. The headset id is returned by .
A token returned by .
A headset id returned by .
If the headset is an EPOC X, then this field tells you the position of the headband of this headset. Can be "back" or "top". If the headset is not an EPOC X, then this field is null. See for details.
Cortex has detected the headset, but it is not connected. You cannot create a session for a discovered headset. You can call to connect the headset.
Cortex is connected to and receives data from this headset. You can call and start working with this headset.
You can call to disconnect the headset.
Name
Type
Required
Description
id
string
No
A headset id or a wildcard
includeFlexMappings
boolean
No
Set this parameter to true to include the mapping of each EPOC FLEX headset in the result headset object.
Wildcard
Filter
INSIGHT-*
All Insight headsets
EPOC-*
All Epoc headsets
EPOCPLUS-*
All Epoc Plus headsets
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
headset
string
yes
A headset id returned by queryHeadsets.
setting
object
yes
An object containing the setting to apply. See below.
Name
Type
Required
Description
mode
string
yes
Must be "EPOC" or "EPOCPLUS".
In "EPOC" mode, the EEG resolution is 14 bits.
In "EPOCPLUS" mode, the EEG and motion resolutions are 16 bits.
eegRate
number
yes
The EEG sample rate, in hertz. If the mode is "EPOC", then the EEG rate must be 128.
If the mode is "EPOCPLUS", then the EEG rate can be 128 or 256.
memsRate
number
yes
The motion sample rate, in hertz.
If the mode is "EPOC", then the motion rate must be 0.
If the mode is "EPOCPLUS", then the motion rate can be 0, 32, 64 or 128.
Name
Type
Description
headsetId
string
The headset id you set in the parameters.
message
string
A success message.