Here is a library for playback of AutoANT scripts.
Introduction:
AutoANT scripts are simple scripts describing sequences of Ant
messages. They are described in the example scripts at
http://www.thisisant.com/forum/viewthread/1538
These scripts can be created with AntWare or AutoANT-instrumented
version of the Quarq qapy python library.
This is a C library for interpreting such scripts. It is
hand-written for minimal resource usage. It is supplied as a C
source file and header file.
Requirements:
The library requires filling out the autoant_ops_t structure with
callback functions as documented in autoant.h. The following
functions are required:
.get_char() -- receives a character from the input file
.seek() -- moves the location within the input file
.send_ant_message() -- sends a message out the ANT radio
.receive_ant_message() -- receives an ANT message from the ANT
radio in a nonblocking way. (It is OK
to return immediately if no message is
ready, in which case the function will
be called repeatedly.) If it is easier
to receive one character at a time, the
receive_ant() function in
example_posix.c can be adopted.
.get_milliseconds() -- returns an incrementing counter of
milliseconds. Used for timing purposes.
Limited to 16 bits. 1/1024 of a second is
probably sufficient accuracy for most
AutoANT scripts.
Other functions are optional for error reporting, interactivity, etc.
Limitations:
The library has some limitations, mostly due to fixed sizes to avoid
heap usage.
1. Line length limitation
Line length is limited to 240 characters. This is set by the
AUTOANT_MAX_LINE_LEN macro in autoant.c.
2. Stack depth limitation
Only 5 nested calls to loop() are allowed. This is set by the
AUTOANT_MAX_RECURSION_DEPTH macro in autoant.c.
3. Re-entrancy
The library is not re-entrant. It could be extended to be, by
moving all internal state in with the autoant_ops_t struct.
This is not anticipated as a high priority.
Examples provided:
example_print.c is a dummy implementation that just prints
information to the terminal. It should be
compilable on any C99 compiler.
example_posix.c contains enough plumbing to play back an AutoANT
file over a POSIX serial port. It requires POSIX
header files such as provided by UNIX systems or
Cygwin. It has only been tested in Linux.
Good luck!
Mark Rages, March 2013