collect

collect

Connects to the device and collects/stores data from the set device based on the following attributes.

Attributes:

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 for the terminator before ending communication with the device
aftercollection: a string to be appended to the collected data
 
triggerterminator attributes
ms: integer value for the minimum milliseconds to wait after collection begins - terminating characters or strings are ignored during this period.
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

Examples: 

Text collection with a trigger and terminator:
<collect file="CollectionFile.txt" var="data" behavior="tt" ms="5000" trigger="{13}" terminator="end" timeout="8000" type="Text" keeptrigger="True" keepterminator="False" />
 
Number of bytes collection for hex communication:
<collect file="CollectionFile.txt" var="data" behavior="numberofbytes" bytes="32" bytescollected="collected" timeout="5000" type="Hex" />
 
To collect 8 characters (e.g. "ABCDEFGH") from the device:
<collect behavior="chars" file="data.txt" var="MyString" length="8" collected="total" timeout="5000" type="Text" />