Script Cmd: SEND
SEND [-cC:d:np:rt:Tx] [string_to_target]
Pass the specified string to the target and wait for the prompt. With no options to override the default operation, this command will not complete until the target has sent back the string that is contained in the $PROMPT shell variable. See options below for changing this behaviour. If no string is specified, then the command simply sends the line terminator ('\r\n' or '\n').
If the -t option is used in this command, then upon completion, the shell variable SCR_TIMEOUT will be loaded with either "TRUE" or "FALSE". The script can use this to know if a timeout actually occurred (SCR_TIMEOUT="TRUE") or the command received what it was expecting to receive within the allocated time (SCR_TIMEOUT="FALSE").
Note1: The SEND command can be used to simply wait for some arbitrary string from the other end without sending a single character. To do this, run the SEND command with the -c option to omit the terminating EOL, and omit the [string_to_target] argument entirely. Then, specify the string to wait for as an argument to the -p option. For example, assume you want to block waiting for "hello world", the following command would apply:
SEND -cp "hello world"
Refer to EXAMPLE_1 on the main scripting page for a typical working example of the SEND command.
Note2: If the SEND command is configured to wait for some kind of response from the target (i.e. the -p option is used or PROMPT shell variable is set), then the shell variable LASTLINE will be loaded with the most recently received line (carriage_return or line_feed-terminated string) of data from the target system.
Note3: The argument to -t can be floating point; hence, the timeout resolution can be at best 100ths of a second (obviously limited to the accuracy of the PC's timer).
Note4: All commands in uCon scripting use the function "getopt()" for parsing the dash-prefixed command line options. If you need to send a string that starts with a dash, then by default, that will probably confuse uCon because the initial dash will cause the command line parser to process it as a command line option. To get around this, you need to tell getopt that you have entered all your options. This is done with a double-dash. For example, if you want to send the string "-version", and not wait for any response, you issue the command
SEND -n -- "-version"
The double-dash after the -n tells getopt() to stop processing options; hence, the -version is seen as the string to be sent, not as a 'v' option.
Note5: As of Jun20, 2012, the -p option supports the ability to specify "\xHH" as a character (where 'HH' is ascii-coded-hex). This allows the script to support cases where SEND should terminate when the response may not be printable ASCII. A combination of ASCII and non-ASCII can be specified in the string. For example, SEND -p "\x41\x42\x43123" is the same as SEND -p "ABC123"
Note6: The -C option only applies when used in conjunction with the -x option. The valid checksum types are those found in the Csum methods dropdown list of Config->Miscellaneous dialog box.