#include <lua/v4kf.lh>
- code = rdrhandle:state()
- name = rdrhandle:stateName([code])
v4kf:state() provides the current state of the reader handler.
v4kf:stateName() can be used to get a printable name of the state for debugging purposes. The function returns the name of the current state when called with no parameter or the name of the passed state code.
The states are:
| code | name | Description |
|---|---|---|
| V4KF_STATE_RESET | Reset | The reader is not initialized. Before the reader can be used, call v4kf:init() and wait for completion. |
| V4KF_STATE_INITIALIZING | Initializing | The reader is being initialized. During initialization, the shutter clicks once or twice. When initialization is complete, the reader enters one of the next states, depending whether a card is already inside. |
| V4KF_STATE_CLOSED | Closed | The shutter is closed and the reader is empty. If this state was reached via the Ejecting state, then there might be magstripe data available via v4kf:magdata() that has been read while the card was removed. |
| V4KF_STATE_ACCEPTING | Accepting | The shutter is open and the reader is waiting for a card to be inserted. |
| V4KF_STATE_INSERTED | Inserted | A card is inserted completely. If the card has a magstripe that was readable, the data is available with v4kf:magdata(). |
| V4KF_STATE_LOCKED | Locked | A card is inserted completely and locked against removal. As with Inserted state, there is possibly magstripe data available. This is the only state that allows usage of chip card commands. |
| V4KF_STATE_EJECTING | Ejecting | The shutter is open and the reader is waiting for a card to be removed. When the card has been completely removed, the shutter closes and the reader enters the Closed state. |
| V4KF_STATE_PROCESSING | Processing | A chip card command is executing. |
| V4KF_STATE_CAPTURING | Capturing | A card is being transported to the rear and captured inside the reader. When the card has been captured, the reader enters the Closed state. |