Home Contents | # Introduction | V4kf | Core4 Lua Event System

## OVERVIEW

The V4KF module provides support for some Leadus/Omron card readers. Supported models are V4KF (Insertion reader), V2BF (Motorized reader) and V2XF (Motorized reader/writer).

This is a high level interface to the reader features. Allocate a new instance using v4kf.new().

General reader state handling is done using v4kf:reset(), v4kf:init(), v4kf:close(), v4kf:insert(), v4kf:eject(), v4kf:capture() and v4kf:lock().

The functions v4kf:hasCard(), v4kf:hasLockedCard(), v4kf:isEmpty(), v4kf:isOnline(), v4kf:isProcessing(), v4kf:isReady(), v4kf:readerType(), v4kf:sensors(), v4kf:state() and v4kf:version() provide information about the reader.

Buffered magnetic stripe data is retrieved by calling v4kf:magdata() and cleared from the buffer using v4kf:clearMagdata().

There is chip card support with v4kf:chipActivate(), v4kf:chipDisable(), v4kf:chipEnable(), v4kf:chipExecute(), v4kf:chipRead() and v4kf:chipWrite().

There are callbacks named v4kf.online(), v4kf.error(), v4kf.stateChanged(), v4kf.magdataChanged(), v4kf.senseChanged(), v4kf.processingComplete() and v4kf.error().

v4kf:setTrace() and v4kf:fd() help with debugging.

## QUICK START

- Open the reader device by calling v4kf.new().
- Initialize the reader with v4kf:init().
- When the reader is initialized, accept a card with v4kf:insert().
- When a card is inserted, as reported by v4kf:state() and v4kf.stateChanged(), retrieve the magnetic stripe data calling v4kf:magdata().
- Eject the card using v4kf:eject().
- Again, completion can be seen via v4kf:state() and v4kf.stateChanged(). Retrieve the magnetic stripe data that was read when the card was pulled calling v4kf:magdata().