ThinkGear Connector
ThinkGearConnector
ThinkGearConnector(host: str = 'localhost', port: int = 13854, enable_raw_output: bool = True, output_format: str = 'Json')
Manage connection and communication with the ThinkGear Connector service.
This class provides methods to establish, maintain, and close connections with the ThinkGear Connector service, as well as read and write data to/from the device.
The host and port for the ThinkGear Connector service are configured with default values of "localhost" and 13854, respectively. In most cases, you will not need to modify these settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host
|
str
|
The hostname of the ThinkGear Connector service. |
'localhost'
|
port
|
int
|
The port number of the ThinkGear Connector service. |
13854
|
enable_raw_output
|
bool
|
Whether to enable raw EEG output. |
True
|
output_format
|
str
|
The format of the output data. Can be either "Json" or "BinaryPacket". |
'Json'
|
Source code in mindwave/connector.py
write
write(data: bytes) -> None
Write data to the ThinkGear Connector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
bytes
|
The data to be sent to the ThinkGear Connector. |
required |
Raises:
Type | Description |
---|---|
ConnectionError
|
If the ThinkGear Connector is not connected |
Source code in mindwave/connector.py
read
async
read() -> bytes
Read data from the ThinkGear Connector.
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
The data received from the ThinkGear Connector. |
Raises:
Type | Description |
---|---|
ConnectionError
|
If the ThinkGear Connector is not connected. |
Source code in mindwave/connector.py
connect
async
connect() -> bool
Establish connection with the ThinkGear Connector service.
Attempts to connect to the ThinkGear Connector service using the specified host and port. If successful, configures the connection with the specified settings.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if connection is successful or already connected, False otherwise. |
Source code in mindwave/connector.py
disconnect
disconnect() -> bool
Disconnect from the ThinkGear Connector service.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if disconnection is successful or already disconnected. |