BALTECH Docs |
C API for BALTECH SDK
|
brp_errcode brp_AR_RunScript | ( | brp_protocol | protocol, |
brp_buf | Script, | ||
size_t | Script_len | ||
) |
This command runs a BaltechScript.
This is a small sequence of instructions for the reader to execute. Typically, it's used to control reader feedback, i.e. LEDs, beeper, relay, and other I/O ports when you have highly specific requirements and/or want to store the script on the reader.
Instead of AR.RunScript , we recommend the__ UI command set__ as it's easier to implement and sufficient for the majority of use cases.
A script consists of the following parts:
Here are a few examples of how to create a script. We'll use the following script commands as they're the most important ones:
In this example, we'll switch on the green LED permanently. To do so, we need to run the Enable script as follows:
01 00
You can run a sequence of scripts in parallel by concatenating them.
In this example, we'll switch on the green LED permanently. At the same time, we have the beeper beep 3 times for 200 ms. To do so, we extend the Enable script from the above example with a Toggle script:
01 00 03 02 03 02
The Toggle script in this sequence is composed as follows:
The unit of this value is 1/10 sec, i.e. it's 200 ms in this example. This time period applies to the length of the beep and the delay afterwards, i.e. you have a duration of 2x200 ms per beep and a duration of 1200 ms for the entire sequence.
Concatenated scripts are always executed in parallel. However, you can still produce a consecutive feedback sequence using ToggleInverted and an appropriate delay. In this example, we'll use the toggle script from the above example to have the beeper beep 3 times for 200 ms. After the third beep, the red LED is enabled:
03 02 03 02 06 01 01 0C
The ToggleInverted script in this sequence is composed as follows:
The unit of this value is 1/10 sec, i.e. it's 1200 ms in this example. This corresponds to the duration of the Toggle script that runs in parallel (see also previous example). Thus the LED (controlled by the ToggleInverted script) turns on after the beeper sequence (controlled by the Toggle script) is completed.
[in] | protocol | used to execute the command |
[in] | Script | Script to execute |
[in] | Script_len |