Home  Contents

v4kf.new

V4kf Core4 Lua Event System

SYNOPSIS

  1. rdrhandle = v4kf.new(app, device [, speed, [protocol]])
  2. rdrhandle:close()

DESCRIPTION

Create a new V4KF reader handler. The handler is attached to the event processor passed in app. The reader is attached to the serial port device.

The optional speed choses the serial port speed. When not set or nil, the driver choses the fastest speed supported by the reader device.

The optional protocol selects the reader protocol, default value is "Leadus". Following is a list of supported protocols.

"Leadus"
Leadus V4KF, V2BF, V2XF
"Sankyo"
Sankyo ICT3K7-3R6940
"HoptSchuler"
Hopt+Schuler CHD845, CHD862

The v4kf:close() will close the serial device when no longer needed. The handle becomes invalid. This automatically happens during garbage collection, but that takes an unknown amount of time.

RETURN VALUE

On success, a V4KF handler instance. If opening the serial device fails, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library.

EXAMPLE

>  > 
app = event.new() rdr = v4kf.new(app, "/dev/ttyS2")