> For the complete documentation index, see [llms.txt](https://bonspiel-games.gitbook.io/cortex-unity-plugin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bonspiel-games.gitbook.io/cortex-unity-plugin/cortex/events.md).

# Events

List of events available in the base Cortex class

## Authorized

Called when the plugin has been connected and successfully authorized. Can be used to wait for functionality to be available. The license is entirely irrelevant

```csharp
Authorized(License license);
```

## Connection State Changed

Indicates a change in the connection or authorization status of the communication link with the Emotiv launcher

```csharp
ConnectionStateChanged(ConnectToCortexStates state)

public enum ConnectToCortexStates
{
    Service_connecting,
    EmotivApp_NotFound,
    // Connected, awaiting login in Emotiv launcher
    Login_waiting,
    Login_notYet,
    // Attempting authorization,
    // user need to open Emotiv launcher to authorize
    Authorizing,
    Authorize_failed,
    // connected and authorized, good to go!
    Authorized,
    LicenseExpried,
    License_HardLimited
}
```

## Headset Query Result

Provides a list of headsets currently available to the Emotiv Launcher. Fired in response to [QueryHeadsets](/cortex-unity-plugin/cortex/methods.md#query-headsets)

```csharp
HeadsetQueryResult(List<Headset> availableHeadsets)

public class Headset
{
    public string headsetID;
    public string status;
    public string serialId;
    public string firmwareVersion;
    public string dongleSerial;
    public ArrayList sensors;
    public ArrayList motionSensors;
    public JObject settings;
    public ConnectionType connectedBy;
    public HeadsetTypes headsetType;
    public string mode;
}
```

## Device Connected

Called when a headset has been connected

```csharp
DeviceConnected(HeadsetConnectEventArgs args)

public class HeadsetConnectEventArgs
{
    public bool IsSuccess
    public string Message
    public string HeadsetId
}
```

## Data Stream Started

Called when the first object has been received by a new data stream. Effectively equivalent to the start of a session

```csharp
DataStreamStarted(string headsetId)
```

## Data Stream Ended

A data stream has been closed

```csharp
DataStreamEnded(string headsetId)
```

## Error Received

Throws errors sent by the underlying Cortex API

```csharp
ErrorReceived(ErrorMsgEventArgs args)

public class ErrorMsgEventArgs
{
    public int Code;
    public string MessageError;
    public string MethodName;
}
```
