typedef std::string DeviceId;
typedef std::string InterfaceId;
typedef std::vector<std::pair<InterfaceId, std::string>> InterfaceList;
typedef std::vector<std::pair<DeviceId, std::string>> DeviceList;
InterfaceList getInterfaces(GenTL::TL_HANDLE hTL)
{
bool8_t changed = false;
// Timeout in milliseconds
uint64_t timeout = 100;
CR(mTl->TLUpdateInterfaceList(hTL, &changed, timeout));
uint32_t numCandidates = 0;
CR(mTl->TLGetNumInterfaces(hTL, &numCandidates));
InterfaceList interfaceList;
for (uint32_t i = 0; i < numCandidates; ++i)
{
char interfaceId[1024];
size_t interfaceIdSize = sizeof(interfaceId);
CR(mTl->TLGetInterfaceID(hTL, i, interfaceId, &interfaceIdSize));
GenTL::INFO_DATATYPE dataType;
char displayName[1024];
size_t displayNameSize = sizeof(displayName);
CR(mTl->TLGetInterfaceInfo(hTL,
interfaceId,
GenTL::INTERFACE_INFO_DISPLAYNAME,
&dataType,
displayName,
&displayNameSize));
interfaceList.push_back(std::make_pair(interfaceId, displayName));
}
return interfaceList;
}