PG_Extra.doc

(33 KB) Pobierz
FT_GetDeviceInfo

FT_GetDeviceInfo

 

Description              Get device information.

 

Syntax              FT_STATUS  FT_GetDeviceInfo ( FT_HANDLE ftHandle, FT_DEVICE *pftType, LPDWORD lpdwID, PCHAR pcSerialNumber, PCHAR pcDescription, PVOID pvDummy )

 

Parameters

 

ftHandle              FT_HANDLE: handle returned from FT_Open or FT_OpenEx.

pftType              Pointer to unsigned long to store device type.

lpdwId              Pointer to unsigned long to store device ID.

pcSerialNumber              Pointer to buffer to store device serial number as a null-terminated string.

pcDescription              Pointer to buffer to store device description as a null-terminated string.

pvDummy              Reserved for future use - should be set to NULL.

 

Return Value              FT_STATUS: FT_OK if successful, otherwise the return value is an FT error code.             

Remarks

This function is used to return the device type,  device ID, device description and serial number.

 

The device ID is encoded in a DWORD - the most significant word contains the vendor ID, and the least significant word contains the product ID.  So the returned ID 0x04036001 corresponds to the device ID VID_0403&PID_6001.

 

Example

 

                            This example shows how to get information about a device.

 

FT_HANDLE ftHandle;              // valid handle returned from FT_OpenEx

FT_DEVICE ftDevice;

FT_STATUS ftStatus;

DWORD deviceID;

char SerialNumber[16];

char Description[64];

 

ftStatus = FT_GetDeviceInfo(

                            ftHandle,

                            &ftDevice,

                            &deviceID,

                            SerialNumber,

                            Description,

                            NULL

                            );
if (ftStatus == FT_OK) {

              if (ftDevice == FT_DEVICE_BM)

                            ; // device is FT232BM or FT245BM

              else if (ftDevice == FT_DEVICE_AM)

                            ; // device is FT8U232AM or FT8U245AM

              else if (ftDevice == FT_DEVICE_100AX)

                            ; // device is FT8U100AX

              else

                            ; // unknown device (this should not happen!)

              // deviceID contains encoded device ID

              // SerialNumber, Description contain 0-terminated strings

}
else {
              // FT_GetDeviceType FAILED!
}

 

 

Zgłoś jeśli naruszono regulamin