summaryrefslogtreecommitdiff
path: root/api_reader.txt
blob: 8e2fa5a48a1ce33ce72423cb6162c57bb3d39c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# NFCommander reader API

This API concerns the communication with the active NFC components used for tag reading / writing.
Implementing this API allows the project to support new NFC hardware

## Specification

Additional readers can be connected by implementing their specifics in a shared library named
`reader_<name>.so`. In the NFCommander configuration, specifying the `nfc.reader` configuration
option sets the reader name that is to be loaded.

## Interface

The shared library should export the following symbols and respective prototypes

* `int init()` : Initialize the reader-specific data structures and communication details
* (optional) `int handle(int fd)` : Callback invoked when a registered descriptor is pending events
* `int scan()` : Invoked to request the current set of tags detectable in the field

## Operation

This section will describe the lifecycle of a reader implementation plugin.

### Initialization

After the shared library is loaded, the `init` export is called.

The module should connect to its specific hardware interface and verify that the field is
in operating condition.

The module may use the `config_get` NFCommander API to read specific configuration options,
such as ports to connect to.

If necessary, file descriptors and sockets can be registered with the core using the
`core_manage_fd` API. Pending events will be signaled using the libraries `handle` export.

### Operation

TBD

### Cleanup

TBD