FAQ Article ID dl_faq022
Question
I use Docklight to simulate a serial device.
Sending predefined answers using your "Receive Sequence" function works pretty well.
But what if I want dynamic answers, instead of sending the same static answer all the time?
Applies to:
Docklight V1.6 - V1.9 / Docklight Scripting V1.6 - V1.9
Answer
The OnSend / OnReceive features in Docklight Scripting can help out here. Basically there two different alternatives:
1.) Use a DL_OnReceive() procedure to decide what to do after Docklight receives a request for data from the other device.
Inside the DL_OnReceive() function, you can decide for yourself what Send Sequence should be transmitted, or if you
want to provide random data for a Send Sequence with wildcards.
2.) If you prefer to have something like a "Send" button that spits out a different sequence every time it is pushed,
have a look at the "Flexible Answers" demo script provided below. This example project and script shows how you can build
a
list of individual sequences that are assigned to a "master" button. Each time the master button is pressed,
a different sequence is transmitted.
Related Links
Docklight Sample Script - Flexible Answers to incoming requests using DL_OnSend()
Docklight Manual - Sub DL_OnReceive(), Evaluating Receive Sequence Data
Docklight Manual - Sub DL_OnSend(), Send Sequence Data Manipulation
back to the Docklight FAQ page
|