arrow-left

All pages
gitbookPowered by GitBook
1 of 2

Loading...

Loading...

Overview of API flow

There are a few steps to prepare before you can get the data streaming out from Cortex web socket server:

  1. First you have to login to the EMOTIV Launcher with your EmotivID.

  2. Make sure that you are using the correct application ID, client ID and client secret that you generated from the Account dashboard on Emotiv website in your application (see here).

  3. Call the API from your app to Cortex, and accept via the EMOTIV Launcher.

  4. After access is granted, connect your EMOTIV brainwear headset via the USB dongle or Bluetooth.

  5. Call the API with "refresh" command to start the headset scanning.

  6. Call the API to list the available headsets.

  7. Call the API with "connect" command to connect to the desire headset.

  8. Call the API to get a Cortex token for subsequence requests.

  9. Call the API to open up a new session and be ready for BCI data streaming.

requestAccess
controlDevice
queryHeadsets
controlDevice
authorize
createSession

Offline support

Once the app authenticates with the Cortex successfully, it can use the Cortex token to stay offline while working with Cortex for a period of time (see soft limit, hard limit below).

Here is the recommended flow to work offline with Cortex:

Step 1: Follow this API flow to get Cortex token the first time. This flow requires the Internet connection. A Cortex token will be available for 48 hours.

Step 2: When the Cortex token is expired, call generateNewToken API to generate another token. This API doesn't require the Internet connection.

Step 3: Check soft limit, hard limit of the current license via getLicenseInfo API and warn the users to be online.

In the license information, there are 2 fields "softLimitTime" and "hardLimitTime".

hashtag
softLimitTime

This is the reasonable time to warn users that the app will not be able to use offline soon. The app can still work offline until hardLimitTime.

hashtag
hardLimitTime

This is the time that the app will be no longer to use offline. The app must call API with the Internet connection to be able to continue working with Cortex.

circle-info

The softLimitTime will be at least 1 month later from the time the app calls API. The hardLimitTime is 7 days after softLimitTime.

authorize
authorize