summaryrefslogtreecommitdiff
path: root/api_command.txt
blob: 931d224fc728650038bc039351aca66d86f855c9 (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
# NFCommander command API

This interfaces specifies the way NFCommander calls and communicates with the tools actually implementing
the commands specified on tags.

## Specification

TBD

## Execution

The command executable is spawned when the tag has been detected, read and parsed.
The `stdin` and `stdout` streams are connected to NFCommander and are used to exchange data and commands.

Once the tag is removed, NFCommander will send a SIGINT signal to the process.
The process is required to handle this signal and appropriately release any resources held.

Should the process terminate before the tag is removed, it is not respawned until the tag has been
removed and presented to the reader again.

## Parameters & Environment

The command process receives as its first argument the static part of the tag command.
The second parameter will be the dynamic part at the time of tag presentation, if present.

The command process will find in its environment the following variables:

* `TAG_UID`: UID of the tag that caused the execution of the command

## Communication

Commands may receive subsequent instructions (e.g. physical button presses) via their stdin stream.
This feature is not yet specified or implemented, but may become available in subsequent releases.

Commands may control the dynamic data section of the present tag using commands on their stdout
stream.
This feature can be used to persist a limited amount of state across tag presentations.

To set the dynamic data of the current tag, a command may send the following newline-terminated (\r\n)
command:

`DYNAMIC <data-len> <data>`