Script Cmd: RECV
RECV [-acCt:xX] [arg1 | subcommand]
This command allows the script to wait for some sequence of characters. The characters can be ASCII or binary (specified with ASCII-coded-hex, the -x option), or the command can be set up to just wait for some number of characters (-X), ignoring what characters are actually received. Without specifying -x or -X, this command is essentially the same as the "wait" portion of the SEND command. The added capability that this provides is the ability to wait for a binary sequence or just some number of incoming characters.
New as of Jul, 2012:
New as of Apr, 2014:
New as of May, 2016:
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: -x and -X options are mutually exclusive. Don't use both in one command instance.
NOTE2: the subcommands 'blkinit' and 'blkcpy' are used exclusively, and aside from '-a' with 'blkcpy', should not be mixed with other command line options..
NOTE3: the RECVBLOCK shell variable is cleared by 'blkinit'. It is only populated when blkcpy transfers characters to it. The actual number of characters (could be zero) transferred to RECVBLOCK is stored in the shell variable RECVBLKTOT.
NOTE4: uCon's ability to detect small (<25msec) bursts of idle time on a serial port depends heavily on the CPU. The smaller the burst to detect, the more likely you'll need a reasonbly high-end PC to succeed. While generally speaking 25msec is not very short for embedded systems, it is tricky to detect this through a windows application. The best I've acheived is detection of about a 15msec burst running uCon on a quad-core I5 host; so, your results may vary.
NOTE5: when blkcpy is run without -a, the buffer is first scanned for nulls (0x00) and if found, replaced with "<0>" so that the buffer can be processed as a string..NOTE6: since the -n option changes the way RECV accumulates data from the target; it only makes sense to use with with the 'blkinit' subcommand.
This script subroutine will simply wait for 10 characters to be received:
This script subroutine will wait for the string "hello_there":
This script subroutine will wait for the binary ACK-EOT character sequence (0x06 0x04):
Similar to example #2, this script subroutine will wait for the string "hello_there", but it will populate the RECVBLOCK shell variable with most recently recieved 128 characters around that string
This script subroutine will retrieve the target's prompt and store it in uCon's PROMPT shell variable:
This script takes each received character and echoes it back out the port until 'X' is received: