EasyManua.ls Logo

XITRON XT2640 - Page 135

Default Icon
187 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XT2640OperatingManual 13July2016 Page135of187
' Uses a 2 second timeout to receive a complete line (far longer than needed)
Dim Timer As Stopwatch = Stopwatch.StartNew()
Dim rx_lf As Boolean = False
ReceiveString = “”
While (Not (rx_lf))
Dim rx_data(1024) As Byte
Dim rx_index As Integer = 0
Dim bytes As Integer = 0
HidUart_Read(usbdevice, rx_data, 1024, bytes)
' Because we configured a 0 read timeout this will return immediately if there’s no
' characters
While (bytes)
If (rx_data(rx_index) = 10) Then
rx_lf = True
Exit While
End If
rx_index += 1
bytes -= 1
End While
ReceiveString += System.Text.Encoding.ASCII.GetString(rx_data, 0, rx_index)
If (Timer.ElapsedMilliseconds > 2000) Then
' Timeout occurred – need to take some action here
Timer.Stop()
Exit Function
End If
End While
24.1.3.3 SUMMARYOFPR OVIDEDDLLFUNCTIONS
InallfunctioncallsrequiringaPIDand/orVID,youmustusethevaluesnotedabovefortheXT2640.
ThedefinitionsforthefunctionshownbelowuseaClanguageformforclarity;donotusethecallsexactlyasshowninsteadusethe
headerprovidedforthespecificlanguagebeingused.
CAUTION–theprovidedDLLfilesalsocontainotherfunctions,youmustnotcalltheseotherfunctionsotherwiseitmayrenderthe
XT2640permanentlyinoperative.
HidUart_GetNumDevices
ThisfunctionreturnsthenumberofdevicesconnectedtothehostwithmatchingvendorandproductID(VID,PID).
HID_UART_STATUS HidUart_GetNumDevices (DWORD* numDevices, WORD vid, WORD pid)
numDevices
—Returnsthenumberofdevicesconnectedonreturn.
vid—FilterdeviceresultsbyvendorID.
pid—FilterdeviceresultsbyproductID.
ReturnValue:HID_UART_STATUS=HID_UART_SUCCESS,HID_UART_INVALID_PARAMETER
HidUart_GetString
Thisfunctionreturnsanull‐terminatedvendorIDstring,productIDstring,serialstring,devicepathstring,manufacturer
string,orproductstringforthedevicespecifiedbyanindexpassedin
deviceNum.Theindexforthefirstdeviceis0andthe
lastdeviceisthevaluereturnedby
HidUart_GetNumDevices()–1.
HID_UART_STATUS HidUart_GetString (DWORD deviceNum, WORD vid, WORD pid, char*
deviceString, DWORD options)
deviceNum
—Indexofthedeviceforwhichthestringisdesired.
vid—FilterdeviceresultsbyvendorID.
pid—FilterdeviceresultsbyproductID.
deviceString—VariableoftypeHID_UART_DEVICE_STRING whichwillcontainaNULLterminatedASCIIdevicestringon
return.Thestringis260bytes.
options—DeterminesifdeviceStringcontainsavendorIDstring,productIDstring,serialstring,devicepathstring,
manufacturerstring,orproductstring.
ReturnValue:HID_UART_STATUS=HID_UART_SUCCESS,HID_UART_DEVICE_NOT_FOUND,
HID_UART_INVALID_PARAMETER,HID_UART_DEVICE_ACCESS_ERROR
HidUart_GetOpenedString
Thisfunctionreturnsanull‐terminatedvendorIDstring,productIDstring,serialstring,devicepathstring,manufacturer
string,orproductstringforthedevicespecifiedby
device.
HID_UART_STATUS HidUart_GetOpenedString (HID_UART_DEVICE device, char* deviceString,
DWORD options)
device
—DeviceobjectpointerasreturnedbyHidUart_Open().
deviceString—VariableoftypeHID_UART_DEVICE_STRINGwhichwillcontainaNULLterminatedASCIIdevicestringon
return.Thestringis260bytes.
options—DeterminesifdeviceStringcontainsavendorIDstring,productIDstring,serialstring,devicepathstring,
manufacturerstring,orproductstring.
ReturnValue:HID_UART_STATUS=HID_UART_SUCCESS,HID_UART_INVALID_DEVICE_OBJECT,
HID_UART_INVALID_PARAMETER,HID_UART_DEVICE_ACCESS_ERROR

Table of Contents