ProductsApplicationsSupportNewsEventsCompanyContact Us

C API - g.MOBIlab


The Application Programming Interface for Pocket PC + Notebook/PC

Available for Windows and Linux

What is Programming API for g.MOBIlab+ ?
The Application Programming Interface (API) for g.MOBIlab+ enables you to program your own sophisticated biosignal acquisition and data processing applications based on the g.MOBIlab+ amplifier on a Pocket PC and Windows based PC/Notebook.
Sample programs and the well documented source code in the electronic manual serve as a template for your programs. The Application Programming Interface for g.MOBIlab+ optimally supports your own development of mobile biosignal data processing programs. Debugging the programs directly on the Pocket PC or using the built-in emulator enables you to accelerate the development process.
The g.MOBIlab+ API allows you to setup 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 Pocket PC.
C API for g.MOBIlabUsing eMbedded Visual C++ or eMbedded Visual Basic development environment you can create and program Windows Mobile applications relaying on user friendly graphical user interfaces.
Using Visual C++ (Borland Compiler/Microsoft Compiler supported) PC based environment you can create and program laboratory applications relying on your preferred development tools.

Highlights

  • program your own EEG, ECG, EMG, EOG data recording system on a Pocket PC and Notebook/desktop PC
  • C API is available for the following operating systems: Windows and for Linux 
  • include your own sophisticated data processing algorithms and add your customized functionality to g.MOBIlab+
  • send the acquired raw data or preprocessed biosignals with GSM or WLAN
  • debug your application directly on the Pocket PC and Notebook/desktop PC connected to g.MOBIlab+ amplifier 

Example 1 under Windows:

C API g.MOBIlab startread functionAcquiring 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 to 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)
C API demo for g.MOBIlab {
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;

C API for g.MOBIlab - digital IOExample 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;
C API for g.MOBIlab - digital IO 2ret = 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

C API for g.MOBIlab under Linux
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;
}

Package for Windows includes

  • device driver API for g.MOBIlab+
  • electronic handbook 
  • sample code and tutorial 

Package for Linux includes

  • device driver API for g.MOBIlab+
  • electronic handbook 
  • sample code and tutorial 

Prerequisites

  • g.MOBIlab+ mobile biosignal data acquisition package
  • Windows: Microsoft eMbedded Visual C++ / Visual C++ development environment for PC
  • Linux Ubuntu: Debian package support, for other platforms the library is provided; Runs under x86 32 bit architecture