Skip to content
  • There are no suggestions because the search field is empty.

Sending out a sequence of commands

I need to send a sequence of commands to my device. First, I have to send a question mark, to which my device responds with an ACK. Then I have to send an ENQ command, at which point the device responds with my data. Finally, I have to send an ACK back to the device to close the communications. Can this be done in OmniServer?

To do this, you will need to use our "Chaining" feature for host messages. Basically, you can move or "chain" from one host message to another based upon the success or failure of the response from a device.

Each Host Request/Device Response sequence will be a host message. So, you will need the following messages:

  • ?ACK
  • ENQ<data>
  • ACK<no_response>

The steps you will need to take are as follows:

  1. Create the items you will need for <data>, plus one additional discrete item that we'll call "Trigger".
  2. Create your three host messages (don't worry about chaining for now).
  3. Go to your first message, and click on the "Chains and Triggers" tab. Select "Trigger" for the "Trigger Point", and select in the "On Message Success" chain your second message. Finally, check the box "Only activate message via trigger of message chain".
  4. Go to your second message, and click on the "Chains and Triggers" tab. Select in the "On Message Success" chain your third message. Finally, check the box "Only activate message via trigger of message chain".
  5. Go to your third message, and click on the "Chains and Triggers" tab. Check the box "Only activate message via trigger of message chain".
Now, start your client (we are assuming that devices and topics have already been created). Change the value of "Trigger" to Logical True, and your data will appear in the "data" item.
 
What happened was this: "Trigger", because it is a Trigger Point, started the first message and sent the question mark. The device responded with an ACK. Since this was a "successful" response, OmniServer chained to the second message (via the "On Success" message chain). The second message send an ENQ, to which the device responded with the data. Since that was also a "successful" message, the "On Success" message chain went to the third message, where OmniServer sent the device the ACK character.
 
What if a response wasn't successful? You could have chained to another host message via the "On Failure" chain, so you can do some error checking or re-sending of the data, if required.