Opening and Closing the Device¶
Initializing the library¶
Initialize the library to use PUCLIB functions.
PUCRESULT result;
result = PUC_Initialize();
if (PUC_CHK_FAILED(result))
{
return 0;
}
Note
Execute initialization only once within a process. It is not necessary to perform initialization multiple times..
It is not necessary to explicitly perform termination. All termination operations are automatically performed when a process is terminated.
Initialization is required even for functions that do not require a connection to the device (decode processing, etc.).
Searching for the device¶
Search for the device before opening it.
result = PUC_DetectDevice(&detectInfo);
if (PUC_CHK_FAILED(result))
{
return 0;
}
if (detectInfo.nDeviceCount == 0)
{
return 0;
}
Opening the device¶
Once the device is found, specify the device ID to open it.
The device handle will be returned when the device is successfully opened.
The device handle will be required when using functions.
PUC_HANDLE hDevice = NULL;
result = PUC_OpenDevice(detectInfo.nDeviceNoList[0], &hDevice);
if (PUC_CHK_FAILED(result))
{
return;
}
Closing the device¶
An opened device must always be closed.
result = PUC_CloseDevice(hDevice);
if (PUC_CHK_FAILED(result))
{
return;
}