Tyco Electronics 1525l Car Video System User Manual


 
Section 5. Example Applications
117
MSComm1.Output = "/read card" & Chr$(10)
' If the device has check reading capability, then the
' following command would be used to read only the check
' data
' MSComm1.Output = "/read check" & Chr$(10)
' If the device can read only one media type (e.g. a
' card reader) then the read command "/read" command can
' be is issued by itself.
' MSComm1.Output = "/read" & Chr$(10)
' If the device is capable of reading more than one
' media type and the application is capable of accepting
' data from any of the media, then the read command can
' be issued by itself or with the "any" parameter. (They
' are equivalent.)
' MSComm1.Output = "/read" & Chr$(10)
'or
' MSComm1.Output = "/read any" & Chr$(10)
' Ask the user to do the read
txtInfo.Text = "Please swipe a card or click on Exit to quit"
' Wait until the card is read.
' In real life, the program can do other things while
' waiting for the data
Do
DoEvents
Loop Until Len(RcvdData$) > 0
' Display the received data
txtInfo.Text = RcvdData$
' Reenable the read button
btnRead.Enabled = True
End Sub
'+----------------+
'| btnStart_Click |
'+----------------+---------------------------------------------------+
'| This function does the following: |
'| 1) Set up the buttons and display |
'| 2) Open the device under its "friendly name" as a file |
'| 3) Retrieve its "unfriendly name" (e.g. "COM12") |
'| 4) Extract the com port number from the unfriendly name |
'| 5) Close the device (IMPORTANT: this must be done or you will not |
'| be able to open the device again, in any mode, without |
'| resetting the computer) |
'| 6) Open the device under its "unfriendly name" as a serial device |
'+--------------------------------------------------------------------+
Private Sub btnStart_Click()
' will hold the fully qualified name of the driver
Dim NewName$
' will be used to get data from the device driver
Dim buf$