send
Extends the collect command to include the ability to send a string, or lines from a file to the set device before collecting data. This command is commonly used when an instrument needs to be polled to output data and to command devices. It contains all the same functionality as collect so instrument data and device responses can be saved into variables and/or to files.
Attributes:
string: the sting to send to the device
file:the filename to write all collected data to
var: the variable to write all collected data to
type: "Hex" or "Text" depending on the type of communication
behavior: "triggerterminator" (can be abrievieated "tt"), "chars", or "numberofbytes".
Trigger/Terminator collected all data between a trigger string and a terminator
string. Number of Bytes collects a specific number of bytes. Chars collects a
specific number of characters.
timeout: the max milliseconds to wait before terminating communication with the device
aftercollection: the string to be appened to the collected data
triggerterminator attributes
ms: integer value for the minimum milliseconds to wait after collection begins
trigger: the string to wait for before collecting/looking for the terminator. Empty string
to begin collecting immediately.
terminator: the string to wait for before terminating the connection. Empty string to collect
until the timeout occurs.
keeptrigger: "True" or "False" - determines if the trigger is also collected along with the
data following it
keepterminator: "True" or "False" - determines if the terminator is also collected along
with the data preceding it
chars attributes
length: the number of characters to collect
collected: the name of the variable to store the number of collected characters
numberofbytes attributes
bytes: number of bytes to collect
bytescollected: number of bytes actually collected
var: the name of the variable to store the collected bytes
file send attributes
sendfile: the file to be sent to the device
start: the line of the file to start from
sendlines: the number of lines to send
sendchars: the number of ASCII characters to send
Examples:
Text communications/collection:
<send string="start" behavior="tt" file="CollectionFile.txt" var="MyData" ms="5000" trigger="{13}" terminator="{13}" timeout="8000" type="Text" keeptrigger="false" keepterminator="true" />
<send string="off" />
Number of bytes collection for hex communication:
<collect file="CollectionFile.txt" var="data" behavior="numberofbytes" bytes="32" bytescollected="collected" timeout="5000" type="Hex" />
Send a file:
<send sendfile="myfile.txt" sendlines="10" start="1" /> - sends the first 10 lines of the file
<send sendfile="myfile.txt" sendchars="4" start="7" /> - sends up to 4 characters from line 7 of the file