From 1f22af635893d4c3221dffca8f05ea3bb8870028 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 4 Jun 2023 00:14:53 +0200 Subject: Initial documentation and planning --- api_command.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 api_command.txt (limited to 'api_command.txt') 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 ` -- cgit v1.2.3