User Manual

Table Of Contents
A-30 EK-5209-5 Evaluation Kit User’s Guide
/***************************************************************************/
void ListDevices(ibApi_APIHANDLE api_hdl) {
#define DEVICEIDS_MAX 100
ibApi_GROUPID groupid;
ibApi_DEVICEID deviceids[DEVICEIDS_MAX];
int deviceids_count;
char deviceid_text[256];
int sampling_interval;
int i;
ibApi_DEVICEINFO deviceinfo;
ibApi_DEVICESTATUS devicestatus;
/*
* The ibApi_GetNetworkList() function returns a list of the groups
* currently managed by the network. If the gateway is not properly
* connected to the monitor, then this list will be empty.
*/
if (CheckResult(ibApi_GetNetworkList(api_hdl,&groupid,1) < 1)) {
printf("The network is empty\r\n");
return;
}
/*
* List the gateways in the group, which typically should be
* only one.
*/
printf("\r\nGATEWAYS\r\n");
deviceids_count = CheckResult(ibApi_GetDeviceList(api_hdl, groupid,
ibApi_DEVICETYPE_GATEWAY, deviceids,DEVICEIDS_MAX));
/*
* If the buffer limit was exceeded, then display partial results
*/
if (deviceids_count > DEVICEIDS_MAX)
deviceids_count = DEVICEIDS_MAX;
for (i=0; i<deviceids_count; ++i) {
/*
* Note that the struct_size must be assigned BEFORE calling
* ibApi_GetDeviceInfo(). This allows compatibility with future API
* versions that implement additional fields.
*/
deviceinfo.struct_size = sizeof(deviceinfo);