Home Contents | # v4kf.new | V4kf | Core4 Lua Event System

## SYNOPSIS

1. rdrhandle = v4kf.new(app, device [, speed])
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. If the optional speed argument is missing, it defaults to 38400bps.

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")