Elo TouchSystems 1525L manual Releasing access to the device, Errors And Error Processing

Models: 1525L

1 181
Download 181 pages 9.32 Kb
Page 97
Image 97
Releasing access to the device

MagTek Device Drivers for Windows

‘set up error handling

On Error Resume Next

‘submit echo command

Put #1, , "/echo Hello" + Chr$(10)

‘declare an input buffer

a$ = String(2000, Chr$(0))

‘read echo response from device

Get #1, , a$

If Err.Number <> 0 Then

<<process error>> End If

Note

File I/O interaction with the device is synchronous; the read operation will block until a response is received from the device or is returned by the driver (as in a property request). This means that a read command cannot be canceled because the computer will not accept any new commands while one is pending. The only exception to this is when the development environment provides access to the Win32 API, giving the application the ability to use overlapped file I/O.

Releasing access to the device

Releasing access to the device is very simple. If using MSComm, close the device by setting its PortOpen property to False:

‘close the port

mscomm1.PortOpen = FALSE

If opened as a file, close it as in the following:

‘close the port

Close #1

ERRORS AND ERROR PROCESSING

A command’s execution status is returned to an application in the command’s response, if it has one. The status value is a two digit numeric field located at positions 23 and 24 of the response (refer to Appendix C. Status Codes for a description of all error conditions) .

Errors are processed differently for property manipulation. If an error occurs while getting a property, the response will be returned with an empty property value. No status is returned when setting a property because the set command has no response defined for it.

If a command returns a non-zero status, indicating an error, an application can typically respond in the following manner:

94

Page 97
Image 97
Elo TouchSystems 1525L manual Releasing access to the device, Errors And Error Processing