Warning Objects

In addition to method responses and data samples, Cortex can send a third type of message, called warnings.

These warnings inform your application about important events, like when the user logs in or out. or when a training profile is loaded or unloaded for a headset.

Description

A warning object contain these fields:

Name

Type

Description

jsonrpc

string

Always has the value "2.0".

warning

object

An object with the fields "code" and "message".

The warning object has 2 fields:

Name

Type

Description

code

number

The code of this warning. The possible codes are documented below.

message

any

The type and value of this field depends on the code. For most of the warnings it is just a string, but it can also be an object. See the examples below.

Warning Codes

The possible codes are:

Code

Description

0

All the data streams you subscribed to have been automatically canceled by Cortex. This can happen if the headset was disconnected.

1

Your session was automatically closed by Cortex. This can happen if the headset was disconnected.

2

The user has logged in with EMOTIV App.

3

The user has logged out with EMOTIV App.

9

The user approved your application in EMOTIV App.

10

The user declined your application in EMOTIV App.

13

A training profile was loaded for a headset using setupProfile‚Äč

14

A training profile was unloaded for a headset using setupProfile.

15

A training profile was automatically unloaded by Cortex. This can happen if the headset was disconnected, or if the application that loaded this profile was disconnected from Cortex.

17

The user accepted the EULA in EMOTIV App.

19

The available disk space is low. Cortex send this warning when there is less then 1 GB available of the hard drive.

This warning was added in Cortex 2.2.1

20

The available disk space is critically low. Cortex send this warning when there is less then 300 MB available of the hard drive. When this happens Cortex automatically disconnect all the headsets. You cannot connect a headset until the user free up some space.

This warning was added in Cortex 2.2.1

21

The user has changed the opt-out configuration.

This warning was added in Cortex 2.2.1

22

Cortex has changed the opt-out configuration. This can happen when the license of the user is updated.

This warning was added in Cortex 2.2.1

Examples

Data stream unsubscribed

{
"jsonrpc": "2.0",
"warning": {
"code": 0,
"message": {
"behavior": "Cortex has stopped all the subscriptions of session 866b8437-2380-4392-9a35-3d5957eaf95d.",
"sessionId": "866b8437-2380-4392-9a35-3d5957eaf95d"
}
}
}

Session closed

{
"jsonrpc": "2.0",
"warning": {
"code": 1,
"message": {
"behavior": "Cortex has closed the session 866b8437-2380-4392-9a35-3d5957eaf95d.",
"sessionId": "866b8437-2380-4392-9a35-3d5957eaf95d"
}
}
}

User login

{
"jsonrpc": "2.0",
"warning": {
"code": 2,
"message": "User jon.snow has already logged in to Cortex."
}
}

User logout

{
"jsonrpc": "2.0",
"warning": {
"code": 3,
"message": "User jon.snow has already logged out from Cortex."
}
}

App access granted

{
"jsonrpc": "2.0",
"warning": {
"code": 9,
"message": "The access right to the cortex-examples has been granted"
}
}

App access declined

{
"jsonrpc": "2.0",
"warning": {
"code": 10,
"message": "The access right to the cortex-examples has been rejected"
}
}

Profile loaded

{
"jsonrpc": "2.0",
"warning": {
"code": 13,
"message": {
"behavior": "Profile is loaded",
"headset": "INSIGHT-12341234",
"profile": "foo"
}
}
}

Profile unloaded

{
"jsonrpc": "2.0",
"warning": {
"code": 14,
"message": {
"behavior": "Profile is unloaded",
"headset": "INSIGHT-12341234",
"profile": "foo"
}
}
}
{
"jsonrpc": "2.0",
"warning": {
"code": 15,
"message": {
"behavior": "Cortex has unloaded the profile",
"headset": "INSIGHT-12341234",
"profile": "foo"
}
}
}

EULA accepted

{
"jsonrpc": "2.0",
"warning": {
"code": 17,
"message": "User jon.snow has accepted the EULA via EMOTIV App"
}
}

Disk space

{
"jsonrpc": "2.0",
"warning": {
"code": 19,
"message": {
"behavior": "The available disk space is low.",
"rootPath": "/",
"volumeName": "MAC"
}
}
}
{
"jsonrpc": "2.0",
"warning": {
"code": 20,
"message": {
"behavior": "The available disk space is critically low. Cortex will disconnect all the headsets.",
"rootPath": "C",
"volumeName": "Windows"
}
}
}

Opt-out configuration changed

{
"jsonrpc": "2.0",
"warning": {
"code": 21,
"message": {
"currOptOut": true,
"forceOptOut": false,
"message": "User has changed the Opt-out configuration.",
"optOutAvail": true
}
}
}
{
"jsonrpc": "2.0",
"warning": {
"code": 22,
"message": {
"currOptOut": true,
"forceOptOut": false,
"message": "The Opt-out configuration has been automatically changed due to change in license.",
"optOutAvail": true
}
}
}