Return the serial number of the device
Description:
This is a USBm.dll function that returns the Serial number string from a USB device.
Command Syntax:
true⁄false USBm_DeviceSer( device, string )
The USBm_DeviceSer function syntax has these parts:
Part | Description |
device | Valid device from 0 to the maximum number of devices found (minus 1). Any other number results in a FALSE return. |
string | Any valid string expression. |
Remarks:
In VB the string passed as an argument must be large enough to hold all the characters that the function places in the string. The best way to achieve this is to set the string to a large size with the String function as in this code:
strStrng = String(250, ” “) |
Note: USBm_DeviceSer returns TRUE for a valid device.
VB Declaration (USBmAPI.bas)
Public Declare Function USBm_DeviceSer _ Lib “USBm.dll” _ (ByVal device As Byte, _ ByVal serial As String) _ As Integer |
VB Example
Dim strng As String * 255 USBm_DeviceSer 3, strng frmStatus.lstDevices.AddItem “Serial: ” & strng |
This code fragment shows that string is loaded with the “serial” text of device three. Assuming that the form called “Main” exists with a text box called “Info”, the “serial” information will be made visible to the user.
C Prototype
int USBm_DeviceSer( unsigned char device, char *product ); |
C Example
RobotBASIC
DID, PID, VID, Mfr, Prod, Serial Number, and Firmware Version are all handled by the RobotBASIC function usbm_DeviceSpecs(ne_DeviceNumber).
usbm_DeviceSpecs(ne_DeviceNumber)
Returns a string that contains information about the device. There are 7 sections separated by the | character. You can use the Extract() function to extract each section separately if desired. The sections are:
DID
PID
VID
Mfr
Prod
Serial Number
Firmware Version