Returns details about a device handle, which is simply a connection ID to an active device.
LJM_ERROR_RETURN LJM_GetHandleInfo(
int Handle,
int * DeviceType,
int * ConnectionType,
int * SerialNumber,
int * IPAddress,
int * Port,
int * MaxBytesPerMB)
LJM errorcodes or 0 for no error.
This function is useful to quickly see information about a device handle, such as the serial number, or maximum packet size. In the event that "ANY"-type parameters were used in opening, this function can be used to see which device was actually opened.
This function does not perform device I/O.
[C/C++] Retrieve information about a handle and print it.
int LJMError; int portOrPipe, ipAddress, serialNumber, packetMaxBytes; int deviceType = LJM_dtANY; int connectionType = LJM_ctANY; char string[LJM_STRING_ALLOCATION_SIZE]; char ipAddressString[LJM_IPv4_STRING_SIZE]; LJMError = LJM_GetHandleInfo(handle, &deviceType, &connectionType, &serialNumber, &ipAddress, &portOrPipe, &packetMaxBytes); if (LJMError) { LJM_ErrorToString(LJMError, string); printf("LJM_GetHandleInfo error: %s (%d)\n", string, LJMError); } else { printf("deviceType: %d\n", deviceType); printf("connectionType: %d\n", connectionType); printf("serialNumber: %d\n", serialNumber); if (connectionType == LJM_ctETHERNET || connectionType == LJM_ctWIFI) { LJM_NumberToIP(ipAddress, ipAddressString); printf("IP address: %s\n", ipAddressString); } if (connectionType == LJM_ctUSB) { printf("pipe: %d\n", portOrPipe); } else { printf("port: %d\n", portOrPipe); } printf("The maximum number of bytes you can send to or receive from this device in one packet is %d bytes.\n", packetMaxBytes); }