C API: Specs & Features
C API - gtec's Application Programming Interface
|
|
The Application Programming Interface (API) allows you to access the amplifier from many programming environments. The API has functions to fully control the amplifier from C, C++, Visual Basic, LabWindows and many more programming languages. The API is available for Windows and Linux operating systems. It enables you to program your own sophisticated biosignal acquisition and data processing applications. Sample programs and the well documented source code in the electronic manual serve as a template for your programs.The device driver package contains demo programs that show you the usage of all functions and help to get started with the API. The device driver for g.USBamp and g.HIamp gives access to the data which is sent over USB to the computer. Bandpass and Notch filter settings can be performed, the sampling frequency can be selected, a test signal can be applied and the amplifier can be calibrated by your own program. Bipolar derivations can be calculated between two electrodes. The g.MOBIlab+ API allows you to set up the communication with the g.MOBIlab+ amplifier, to initialize the amplifier, to start and stop the data acquisition, to set and reset digital I/O lines and to store data on the device. |
Product Highlights
- Acquire EEG, ECoG, ECG, EMG, EOG data in your own programs
- Available for Windows and Linux
- Include your own sophisticated data processing algorithms
- Develop stand-alone programs for biosignal analysis
Examples: g.MOBIlab+
Example 1 under Windows: Acquiring biosignal data with g.MOBIlab
|
In the first example, the data for one biosignal channel are acquired. The values are stored in a file called demo.txt. A thread called ThreadProc is created and started. This thread reads data from the serial port and stores it in the file demo.txt in ASCII format. The data can then be viewed using g.BSanalyze or simply e.g. in Microsoft Excel. In this example ECG, data from channel 5 were acquired and stored on the Pocket PC. |
![]()
|
void CTestapplDlg::OnbStartRead()
{
// Starts the acquisition on g.MOBIlab // the worker thread is created // file demo.txt is created to hold acquired data
BOOL ret = FALSE; GetDlgItem( IDC_Read )->EnableWindow(FALSE);
if(hDev == NULL)
{
MessageBox (L"No valid Handle",L"WARNING" ,MB_OK |
MB_ICONWARNING);
GetDlgItem( IDC_Read )->EnableWindow(TRUE);
return;
}
// create worker thread
hThread=CreateThread (NULL, 0,ThreadProc , this ,
CREATE_SUSPENDED,&_tid);
if (hThread == NULL)
{
MessageBox(L"Could not create thread",L"ERROR",MB_OK |
MB_ICONERROR);
GetDlgItem( IDC_Read )->EnableWindow(TRUE);
return;
}
// create storage file demo.txt
fid = fopen("demo.txt", "w" );
_isrunning = TRUE;
StartAcquisition(hDev); // start g.MOBIlab
ResumeThread(hThread); // start worker thread
return;}
Example 2 under Windows: Setting the Digital I/O
|
In the following example a red and green light is switched on and off via 2 digital lines. If you press the button "Red_Led" in the g.MOBIlab+ demo example then the following code sequence is processed: |
![]()
|
void CTestapplDlg::OnbSetGreenLed()
{// Set the green led on and the red led off
// on the paradigma led box
BOOL ret = FALSE;
ret = SetDigitalOut(hDev,1,1); // set green led on
if(!ret)
{
ErrorHandling();
return;
} ret = SetDigitalOut(hDev,2,0); // set red led off
if(!ret)
{
ErrorHandling();
return;
}}
Example code segment under Linux of the internal API function WriteFile
|
The following simple code segment displays an example for accessing g.MOBIlab+ . After getting the device handle the specific channel properties are read from the device including SD card properties. The data acquisition is started and at the end data streaming is stopped and the device is closed. |
|
int main()
{
int nRetCode = 0;
__CHANNEL tst;
__DEVICESTATE mystate;
__CFG mycfg;const char* devicelocation = "/dev/rfcomm0";
_AIN myain;
_DIO mydio;
mydio.dio1_enable = true;
myain.ain1 = true;
HANDLE hdev = 0;
bool retval = false;
hdev = GT_OpenDevice(devicelocation);
if ( hdev == 0 )
{
cout<< "could not open com port" << endl;
continue;
}
else
cout << "Device handle = " << hdev; cout << endl;
retval = GT_GetConfig(hdev,&mycfg);
retval = GT_InitChannels(hdev,myain,mydio);
retval = GT_EnableSDcard(hdev,true);
retval = GT_StartAcquisition(hdev);
% read here data from the device [...]
retval = GT_StopAcquisition(hdev);
retval = GT_CloseDevice(hdev);
return nRetCode;
}
Available configurations
Software
read more
g.USBamp C API — sophisticated data acquisition and processing software almost under any programming language
read more
g.HIamp C API — driver software package for g.HIamp; full access to recording buffer; for user specific applications on the PC; sophisticated data acquisition and processing software almost under any programming language
read more
g.MOBIlab+ C API — driver software package for g.MOBIlab+; full access to recording buffer; for user specific applications on the PC
read more
g.USBamp C API & BCI2000 — application programming interface (API) for the user specific application (eg. developed in C/C++); BCI2000 driver; BCI2000 software package
read more
g.MOBIlab+ C API & BCI2000 — driver software package for g.MOBIlab+; full access to recording buffer; BCI2000 driver, BCI2000 software package
read more
Linux API for g.MOBIlab+ — driver software package for g.MOBIlab+; full access to recording buffer; for user specific applications on the PC
read more
Linux API for g.USBamp — driver software package for g.USBamp; full access to recording buffer; for user specific applications on the PC; single place license.
