LXDeviceAPI

Definition

 

int OpenDevice_LXDeviceAPI(int LXDeviceID, ST_STREAMDATA_LXDAPI * p_streamdata,int numsample_return,int mode);

Parameters

Parameter Available Value Description
 int LXDeviceID
  • 1~65535
Uinque ID of the device to communicate.
 ST_STREAMDATA_LXDAPI * p_streamdata
  • Address struct type of ST_STREAMDATA_LXDAPI
example.

ST_STREAMDATA_LXDAPI stStreamData; 
OpenDevice_LXDeviceAPI( , &stStreamData, , );

 

int numsample_return
  •  1~128
The number of sampling point  per one stream message.
int mode
  •  0: (default)
reserved

Return Values

Return  meaning Description
  > 0  Success. Device Handling ID. Application program must save the return value to call the other functions which has a parameter int device_handling_id
 -1  Fail. Not supporting device.
 -2  Fail. Duplicated Call Already succefully called OpenApi.
 -3  Fail. No device found matching LXDeviceID.
 -5  Fail. Need to update the device firmware. Try again after completing the device firmware update.
 -10  Fail. Wrong Calling order  OpenDevice should be called after OpenApi.
 -20  Fail. Wrong paramter  int numsample_return should be range of 1~128.

Code Example 1

/*
 Device to open : QEEG-64FX max 64ch option, LXDeviceID = 16464
*/

void CLXDeviceAPI_Sample1View::OnMenuOpendevice()
{
  int retv = OpenDevice_LXDeviceAPI(16464, &stStreamData, NumSampleReturn, 0);

  if(retv > 0) // if success
  {
    m_iDeviceHandlingID = retv; 
  }
  else
  {
    AfxMessageBox(_T("Fail to OpenDevice"));
  }
}

Result.

After calling the function OpenDevice, the Device Control Panel appears on bottom right side.

Device Control Panel

Device Control Panel

Code Example 2

/*
OpenAPI-> OpenDevice -> StartStream at the same time 
Device to open : QEEG-64FX max 64ch option, LXDeviceID = 16464
*/

void CLXDeviceAPI_Sample1View::OnMenuOneclickstart()
{
  int retv_openapi, retv_opendevice; 

  retv_openapi = OpenApi_LXDeviceAPI(1, 0, 0); // API Open.

  if (retv_openapi > 0)
  {
    retv_opendevice = OpenDevice_LXDeviceAPI(16464, &stStreamData, NumSampleReturn, 0); 
    if (retv_opendevice > 0)
    {
      m_iDeviceHandlingID = retv_opendevice; 
      SetMessageDevice_LXDeviceAPI(m_iDeviceHandlingID, 0, this->m_hWnd, WM_LXDAPI_MSGTYPEID_0, 1);

      StartStream_LXDeviceAPI(m_iDeviceHandlingID);
    }
  }
}