SC5506A Operating & Programming Manual
Rev 2.1.1
24
Function:
sc5506a_CloseDevice
Definition:
int
sc5506a_CloseDevice(
deviceHandle
*
devHandle)
Input:
deviceHandle
*devHandle
(handle to the device to be closed)
Description:
sc5506a_CloseDevice
closes the device associated with the device handle and turns off
the
“active” LED on
the front panel if it is successful.
Example:
Code to exercise the functions that open and and close the PXIe device:
// Declaring
#define
MAXDEVICES 50
devicehandle *devHandle;
//device handle
// HANDLE devHandle; // API >= 2.0
int
numOfDevices;
// the number of device types found
char
**deviceList;
// 2D to hold serial numbers of the devices found
int
status;
// status reporting of functions
deviceList = (
char
**)malloc(
sizeof
(
char
*)*MAXDEVICES);
// MAXDEVICES serial numbers to
search
for
(i=0;i<MAXDEVICES; i++)
deviceList[i] = (
char
*)malloc(
sizeof
(
char
)*SCI_SN_LENGTH);
// SCI SN has 8 char
numOfDevices = sc5506a_SearchDevices(deviceList);
//searches for SCI for device type
if
(numOfDevices == 0)
{
printf(
"No signal core devices found or cannot not obtain serial numbers\n"
);
for
(i = 0; i<MAXDEVICES;i++) free(deviceList[i]);
free(deviceList);
return
1;
}
printf(
"\n There are %d SignalCore %s USB devices found. \n \n"
, numOfDevices,
SCI_PRODUCT_NAME);
i = 0;
while
( i < numOfDevices)
{
printf(
"
Device %d has Serial Number: %s \n"
, i+1, deviceList[i]);
i++;
}
//** sc5506a_OpenDevice, open device 0
devHandle = sc5506a_OpenDevice(deviceList[0]);
// status = sc5506a_OpenDevice(deviceList[0], &devHandle); //API >= 2.0
// Free memory
for
(i = 0; i<MAXDEVICES;i++) free(deviceList[i]);
free(deviceList);
// Done with the deviceList
//
// Do something with the device
// Close the device
status = sc5506a_CloseDevice(devHandle);