Skip to content

Events

ConnectorDataEvent dataclass

ConnectorDataEvent(data: dict, timestamp: datetime = None)

Bases: Event

ThinkGear Connector Data Event.

Attributes:

Name Type Description
data dict

Json formatted data received from the ThinkGear Connector.

timestamp datetime

The timestamp when the Data was received.

Source code in mindwave/connector.py
def __init__(self, data: dict, timestamp: datetime = None):
    """Initialize the ConnectorDataEvent.

    Args:
        data (dict): The data received from the ThinkGear Connector.
        timestamp (datetime, optional): The timestamp when the event was created.
        if not provided, the current time is used.
    """
    super().__init__(event_type=EventType.ConnectorData, timestamp=timestamp)
    self.data = data

HeadsetStatusEvent dataclass

HeadsetStatusEvent(status: ConnectionStatus, timestamp: datetime = None)

Bases: Event

Headset connection status change event.

Attributes:

Name Type Description
status ConnectionStatus

Current ConnectionStatus of the headset.

timestamp datetime

The timestamp when the status changed.

Source code in mindwave/headset.py
def __init__(self, status: ConnectionStatus, timestamp: datetime = None):
    """Initialize a HeadsetStatusEvent.

    Args:
        status (ConnectionStatus): New ConnectionStatus of the headset.
        timestamp (datetime, optional): The timestamp when the status changed.
        if not provided, the current time is used.
    """
    super().__init__(event_type=EventType.HeadsetStatus, timestamp=timestamp)
    self.status = status

HeadsetDataEvent dataclass

HeadsetDataEvent(data: Data, timestamp: datetime = None)

Bases: Event

Headset Data Event.

Attributes:

Name Type Description
data Data

The parsed data from the stream.

timestamp datetime

The timestamp of the event.

Source code in mindwave/utils/stream_parser.py
def __init__(self, data: Data, timestamp: datetime = None) -> None:
    """Initializes a new HeadsetDataEvent instance.

    Args:
        data (Data): The parsed data from the stream.
        timestamp (datetime, optional): The timestamp of the event.
    """
    super().__init__(event_type=EventType.HeadsetData, timestamp=timestamp)
    self.data = data

BlinkEvent dataclass

BlinkEvent(blink_strength: int, timestamp: datetime = None)

Bases: Event

Blink detection event.

Attributes:

Name Type Description
blink_strength int

The strength of the detected blink.

timestamp datetime

The timestamp when the blink was detected.

Source code in mindwave/headset.py
def __init__(self, blink_strength: int, timestamp: datetime = None):
    """Initialize a BlinkEvent.

    Args:
        blink_strength (int): Strength of the detected blink [0-255].
        timestamp (datetime, optional): Timestamp of the event.
        if not provided, the current time is used.

    """
    super().__init__(event_type=EventType.Blink, timestamp=timestamp)
    self.blink_strength = blink_strength

SignalQualityEvent dataclass

SignalQualityEvent(signal_quality: int, timestamp: datetime = None)

Bases: Event

Signal quality change event.

Attributes:

Name Type Description
signal_quality int

Integer representing signal quality value (0-100%).

timestamp datetime

The timestamp when the signal quality changed.

Source code in mindwave/headset.py
def __init__(self, signal_quality: int, timestamp: datetime = None):
    """Initialize a SignalQualityEvent.

    Args:
        signal_quality (int): Integer Signal quality value in the range of 0-100.
        timestamp (datetime, optional): Timestamp of the event.
        if not provided, the current time is used.
    """
    super().__init__(event_type=EventType.SignalQuality, timestamp=timestamp)
    self.signal_quality = signal_quality

TimeoutEvent dataclass

TimeoutEvent(timestamp: datetime = None)

Bases: Event

Timeout event.

Attributes:

Name Type Description
timestamp datetime

The timestamp when the timeout occurred.

Source code in mindwave/headset.py
def __init__(self, timestamp: datetime = None):
    """Initialize a TimeoutEvent.

    Args:
        timestamp (datetime, optional): Timestamp of the event.
        if not provided, the current time is used.
    """
    super().__init__(event_type=EventType.Timeout, timestamp=timestamp)

SessionEvent dataclass

SessionEvent(signal: SessionSignal, class_name: str = None, timestamp: datetime = None)

Bases: Event

Session Event.

Attributes:

Name Type Description
signal SessionSignal

The signal emitted during the session.

class_name str

The class name associated with the event.

timestamp datetime

The timestamp of the event.

Source code in mindwave/session.py
def __init__(self, signal: SessionSignal, class_name: str = None, timestamp: datetime = None) -> None:
    """Initializes a new SessionEvent instance.

    Args:
        signal (SessionSignal): The signal emitted during the session.
        class_name (str, optional): The class name associated with the event.
        (e.g., the class being imagined during a motor imagery task).
        timestamp (datetime, optional): The timestamp of the event.
    """
    super().__init__(event_type=EventType.SessionEvent, timestamp=timestamp)
    self.signal = signal
    self.class_name = class_name