VideoCaptureDeviceItem::getSerialNumber Method

Returns the serial number of the device.
Syntax:
bool     getSerialNumber( int64_t& id ) const;
int64_t  getSerialNumber() const;

Parameter Description
id

A int64_t variable that is to receive the copied device id.

Return value:

true, if the serial number has been retrieved successfully. false, if the device does not provide access to its serial number or has no serial number.

!= 0, if the serial number has been retrieved successfully. 0, if the device does not provide access to its serial number or has no serial number.

Remarks:

Please note that this method returns the serial number that is returned by the firmware of the device. For most devices, this serial number differs from the one printed on the label that can be found on the device's housing. Even if it possible to find a transformation between the serial number on the label and the serial number returned by this method, the probability is high that the schema for one of them changes, thus causing the transformation to become invalid. The only safe way of identifying devices is to connect them to a system, using a tool that prints the return value of this method (like the code fragment below) and use this number to identify the device in your own software.

Sample:

This example demonstrates how to retrieve and interpret the serial number of the currently selected video capture device.

LARGE_INTEGER iResult ;
iResult.QuadPart = 0;
if( m_Grabber.getDev().getSerialNumber( iResult.QuadPart ) == true )
{
    TRACE("Serial number is %I64X\n", iResult.QuadPart);
    TRACE("Serial number high part : %d, low part %d\n", iResult.HighPart, iResult.LowPart);
}
else
{
    TRACE("Serial number could not be retrieved.\n");
}

See also: VideoCaptureDeviceItem

<< VideoCaptureDeviceItem