Jump to content

Technical Reference:BCI2000Remote Library: Difference between revisions

From BCI2000 Wiki
Mellinger (talk | contribs)
No edit summary
Mellinger (talk | contribs)
Line 25: Line 25:
When a function returns a C string, the caller is responsible for releasing that string
When a function returns a C string, the caller is responsible for releasing that string
once it is done with it. This is done by calling BCI2000Release() on the string.
once it is done with it. This is done by calling BCI2000Release() on the string.
Function that return a C string may return NULL to indicate failure.
Functions that return a C string may return NULL to indicate failure.


===double BCI2000Remote_GetTimeout( void* )===
===double BCI2000Remote_GetTimeout( void* )===

Revision as of 14:55, 18 August 2021

The BCI2000Remote Library provides a C interface to the BCI2000Remote C++ class. It may be used to control the BCI2000 Operator module from external applications. The BCI2000Remote library can be used from any programming language that allows using a shared library (DLL). Although the BCI2000Remote library is written in C++, its DLL interface is plain C, and can be used with compiled languages such as C, C++, C#, Pascal, but also with interpreted languages that can call functions in a DLL, such as Python, Matlab, VisualBasic, etc. Interfacing with Java requires a JNI (Java Native Interface) wrapper, which is currently not provided by BCI2000.

Functions specific to the Library

int BCI2000Release( void* )

purpose: Releases a string buffer, or other object allocated by the library. arguments: String pointer, or handle to object allocated by one of the library functions. returns: 1 if successful, 0 otherwise.

void* BCI2000Remote_New( void )

purpose: Creates a new BCI2000Remote object. arguments: None. returns: A handle to the newly created object.

int BCI2000Remote_Delete( void* )

purpose: Deletes a BCI2000Remote object. arguments: Handle to an existing BCI2000Remote object. returns: 1 if successful, 0 otherwise.

BCI2000Remote Member Functions

The following functions are property accessors, and member functions of BCI2000Remote objects. For documentation, see "Programming Reference:BCI2000Remote Class" on the BCI2000 wiki. In the C-style interface, each function takes a handle to an existing BCI2000Remote object as its first argument. Use BCI2000Remote_New() to create such objects. When a function returns a C string, the caller is responsible for releasing that string once it is done with it. This is done by calling BCI2000Release() on the string. Functions that return a C string may return NULL to indicate failure.

double BCI2000Remote_GetTimeout( void* )

void BCI2000Remote_SetTimeout( void*, double timeout )

const char* BCI2000Remote_GetOperatorPath( void* )

void BCI2000Remote_SetOperatorPath( void*, const char* )

int BCI2000Remote_GetWindowVisible( void* )

void BCI2000Remote_SetWindowVisible( void*, int visible )

enum
{
  BCI2000Remote_Invisible = 0,
  BCI2000Remote_Visible = 1,
  BCI2000Remote_NoChange = 2,
};

const char* BCI2000Remote_GetWindowTitle( void* )

void BCI2000Remote_SetWindowTitle( void*, const char* )

const char* BCI2000Remote_GetTelnetAddress( void* )

void BCI2000Remote_SetTelnetAddress( void*, const char* )

int BCI2000Remote_GetConnected( void* )

const char* BCI2000Remote_GetResult( void* )

const char* BCI2000Remote_GetSubjectID( void* )

void BCI2000Remote_SetSubjectID( void*, const char* )

const char* BCI2000Remote_GetSessionID( void* )

void BCI2000Remote_SetSessionID( void*, const char* )

const char* BCI2000Remote_GetDataDirectory( void* )

void BCI2000Remote_SetDataDirectory( void*, const char* )

int BCI2000Remote_Connect( void* )

int BCI2000Remote_Disconnect( void* )

int BCI2000Remote_Execute( void*, const char* )

NB: This function returns the last command's execution status, which is a true integer, with a value of 0 indicating success in most cases. All other int-returning functions return a boolean integer which is 1 on success, and 0 on failure.

int BCI2000Remote_StartupModules( void*, const char* )

Provide a zero-delimited list of C strings, containing module names with command line arguments in the form

const char* list = "module1 -arg1 -arg2\0module2 -arg1\0module3 -arg1\0\0";

int BCI2000Remote_LoadParametersLocal( void*, const char* )

int BCI2000Remote_LoadParametersRemote( void*, const char* )

int BCI2000Remote_SetConfig( void* )

int BCI2000Remote_Start( void* )

int BCI2000Remote_Stop( void* )

int BCI2000Remote_Quit( void* )

const char* BCI2000Remote_GetSystemState( void* )

int BCI2000Remote_GetControlSignal( void*, int, int, double* )

int BCI2000Remote_SetParameter( void*, const char* name, const char* value )

const char* BCI2000Remote_GetParameter( void*, const char* name )

int BCI2000Remote_AddStateVariable( void*, const char* name, unsigned int bitWidth, double initialValue )

int BCI2000Remote_SetStateVariable( void*, const char*, double )

int BCI2000Remote_GetStateVariable( void*, const char*, double* )

int BCI2000Remote_SetScript( void*, const char*, const char* )

const char* BCI2000Remote_GetScript( const char* )

See also

Programming Reference:BCI2000Remote Class, Contributions:BCI2000Command, Contributions:BCI2000PresentationLink, Contributions:BCI2000Automation Contributions:Applications