Methods

List of methods available in the base Cortex class

Start

Initialize connection to the Emotiv launcher, enabling use of the API. It is best to delay other functionality until the connection has been authorized, or until the connection state has been updated to authorized.

void Start(string clientId, string clientSecret, string appURL = "wss://localhost:6868", string emotivAppsPath = "C:\\Program Files\\EmotivApps", bool logs = false, bool streamPrint = false, string license = "");
Parameter
Description

clientId

client id of your cortex application

clientSecret

client secret of your cortex application

appURL

url through which to connect to the emotiv launcher

emotivAppsPath

filepath where the emotiv launcher is installed, used to check if the launcher is installed

logs

print logs to the debug console

streamPrint

print all incoming stream data to the debug console

license

cortex api license, required for EEG access, which the plugin does not currently support

Example:

using UnityEngine;
using CortexPlugin;

public class ConnectToCortex : MonoBehaviour
{
    [Header("credentials")]
    public string clientId;
    public string clientSecret;

    [Header("settings")]
    public bool printLogs;
    public bool printDataStreams;

    void Awake()
    {
        Cortex.Start(clientId, clientSecret, logs: printLogs, streamPrint: printDataStreams);
    }

    private void OnApplicationQuit()
    {
        Cortex.Stop();
    }
}

Query Headsets

Queries a list of available headsets, triggering Headset Query Result.

-> Headset Query Result

Start Session

Opens a session and starts data streams with the headset, provided it has been connected. If successful, will trigger Data Stream Started.

->-> Data Stream Started

Example:

Connect Device

Pairs a device with the Emotiv launcher, needed to start a session. Devices may already be connected, which will result in an error event.

-> Device Connected

Example:

End Session

Ends a headset session.

-> Data Stream Ended

End Session By Headset

End a headset session with a headset id rather than a session id.

-> Data Stream Ended

Get Session By Headset

Gets the session id associated with the given headset if it exists.

End Most Recent Session

Ends the session that was started most recently, regardless of activity.

-> Data Stream Ended

Stop

Closes the Cortex connection.

Last updated