Sending Commands With Parameters (Send Sequence Wildcards)
When testing a serial device, the device will most likely support a number of commands that include a parameter.
Example: A digital camera supports a command to set the exposure time. For setting the exposure time to 25 milliseconds, you need to send the following sequence:
e | x | p | | 0 | 2 | 5 | r ("r" is a terminating <CR> Carriage Return character)
To avoid defining a new Send Sequence for every exposure time you want to try, you can use a Send Sequence with wildcards instead:
e | x | p | | ? | ? | ? | r
The following step-by-step example describes how to define an exposure time command with a parameter and use a different exposure value each time the sequence is sent.
•Docklight is ready to run a test as described in testing a serial device or a protocol implementation.
A) Preparing the project
Create a new Docklight project and set up all communication parameters.
B) Defining the commands used
|1.||Create a new Send Sequence. Enter a Name for the sequence.|
|2.||Enter the fixed part of your command in the Sequence section. For our example you would enter the following sequence in ASCII mode:|
e | x | p | |
|3.||Now open the context menu using the right mouse button, and choose Wildcard '?' (matches one character) F7 to insert one wildcard at the cursor position. In our example we would have to repeat this until there are three '?' wildcards for our three-digit exposure time. The sequence now looks like this:|
e | x | p | | ? | ? | ?
|4.||Now add the terminating <CR> character, using the default control character shortcut Ctrl+Enter. The example sequence now is|
e | x | p | | ? | ? | ? | r
|5.||Click OK to add the new sequence to the Send Sequence list.|
C) Sending a command to the serial device
|1.||Use the Send button to open the serial communication port and send one command to the serial device.|
|2.||The communication pauses and the Send Sequence Parameter dialog pops up, allowing you to enter the parameter value. In our example, an exposure time, e.g. "025".|
|3.||Confirm by pressing Enter. The sequence is now sent to the serial device.|
It is possible to define commands with several parameters, using several wildcard areas within one sequence. The Send Sequence Parameter dialog will then appear several times before sending out a sequence.
NOTE: If you are using Wildcard '?', you must provide exactly one character for each '?' when sending the sequence. For variable-length parameters use Wildcard '#' (matches zero or one character) F8.
NOTE: You cannot use a Send Sequence with wildcards as an automatic answer for a Receive Sequence (see Action).
NOTE: If your Send Sequence requires a checksum, you can define it as described in Calculating and Validating Checksums. The checksum is calculated after the wildcard/parameter area has been filled with the actual data, then the resulting sequence data is handed over to the send queue.