summaryrefslogtreecommitdiff
path: root/api_command.txt
diff options
context:
space:
mode:
Diffstat (limited to 'api_command.txt')
-rw-r--r--api_command.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/api_command.txt b/api_command.txt
new file mode 100644
index 0000000..931d224
--- /dev/null
+++ b/api_command.txt
@@ -0,0 +1,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>`