![]() |
RabbitLink User's Manual |
This appendix describes the RabbitLink serial console commands. The serial console was designed to be human-accessible as a convenient way to setup the network configuration. It is possible to use these commands programatically from the target, though it is not recommended. If Internet services are desired, Z-World suggests the DeviceMate software, which may be run on the RabbitLink board.
E.1 Configuration Commands
These commands are used to set network parameters and to password protect the RabbitLink.
set gateway <IP address>IP addressThe IP address for the gateway in dotted decimal format. The factory default is
10.10.6.1.
set hostname <name>This command allows the RabbitLink to be identified with a unique name, that may be up to 40 characters long.
name
set ip <IP address>IP addressThe IP address for the RabbitLink in dotted decimal format. The factory default is
10.10.1.100.
set netmask x.x.x.xx.x.x.xThis is the dotted decimal format of the netmask. The factory default is
255.255.255.0.
set port xThis command sets the TCP port number. If the RabbitLink is being used behind a firewall, it may be necessary to punch a hole in the firewall to allow remote access.
x
E.2 Variables Commands
The RabbitLink serial console has the ability to handle SSI (Server Side Includes) variables. These variables are stored in an xmem buffer. This means that the memory will lose the variables when power is cycled, although the references to the variables will still exist. Remember that any HTML file that includes SSI tags must have the file extension
.shtml.
getv <varname>This command gets the value of the specified variable. The value is printed using the format specifier given in the
createvcommand.varname
putv <varname> <value>This command assigns the specified value to the specified variable.
varnamevalue
list variablesThis command lists all the variables by name and type that are stored in the flash file system on the RabbitLink.
reset variablesThis command deletes all the variables that are stored in the flash file system on the RabbitLink.
E.3 File Commands
delete <filename>Deletes the specified file from the flash file system on the RabbitLink.
filename
get <filename>filename
list filesThis command lists all the files in the flash file system on the RabbitLink.
put <filename><size>This command sends a binary file to the flash file system on the RabbitLink. There is a time-out for this command: the data transfer begins no later than 60 seconds after the RabbitLink senses there is no activity.
NOTE It is faster and more efficient to transfer all files, including ASCII files, as binary files. filenamesize
E.4 E-Mail Commands
mail <e-mail address>
<subject>
<body>
<ctrl-D>The mail command sends an e-mail via the RabbitLink to the specified address.
e-mail addressThe address to which the e-mail is sent; e.g.
rabbit@warren.com.subjectAfter receiving the mail command, the RabbitLink will accept the next string as the subject of the e-mail
bodyAfter receiving the subject of the e-mail, the RabbitLink will accept strings that follow as the body of the e-mail.
ctrl-D
set mail from <e-mail address>This command sets the RabbitLink's e-mail address. The address will be included in the From line of all e-mail messages sent from the RabbitLink. Any error responses from the SMTP server will be sent to this address.
e-mail nameE-mail address of the RabbitLink; e.g. rabbit@warren.com.
set mail server <IP address>IP address
E.5 Other Console Commands
echo <on | off>
help [filename]filenameThis optional parameter limits the help information to that which is associated with the specified file.
resetThis command resets the basic network parameters (the netmask and the IP addresses of the RabbitLink and its gateway) to factory defaults.
show [filename]This command lists all assignable variables and their settings, except for the passphrase.
filenameThis optional parameter limits the list of variables to those associated with the specified file.
E.6 RabbitLink Console API (prior to Dynamic C 7.20)
The RabbitLink serial console may be accessed via the serial port using the PROG IN connector on the RabbitLink, as was done in Chapter 2 to configure the RabbitLink.
If RabbitLink firmware version 1.00 is being used, the API functions described in this section will be recognized by the RabbitLink. Prior to Dynamic C 7.20 these functions were in
STDIO.LIB.
PrintToConsole
int PrintToConsole(char flag);This function controls whether STDIO commands such as
printfgo to the RabbitLink serial console in addition tothe Dynamic CSTDIOwindow.Parameter
flag
0-
printfand related commands work as normal1-printfand related commands go to the RabbitLink serial console as well.Return Value
SendToConsole
int SendToConsole(char *data, int length);This function writes a binary buffer of a specified length to the serial console on a RabbitLink. Any data are acceptable since the data will not show up in
the Dynamic CSTDIOwindow.Parameters
data
A pointer to the data to be sent.
length
The length of the buffer passed in data
.Return Value
The actual number of bytes written to the console.
int ConsoleFinish(long timeout);
int ConsoleFinish(long timeout);This function finishes receiving data from the RabbitLink serial console by blocking for an optional amount of time to do it. If the timeout is set to 0, the function will not receive any data, but will poll to determine whether there are more
data to receive.Parameters
timeout
The length of time to time out, in milliseconds, and is 0 for
ConsoleFinish()to determine whether there are more data to receive.Return Value
0 if there are more data on the serial console, non-zero if all
the data have been received.Library
E.7 Example Using the RabbitLink Console API
main() {
// first method
SendToConsole("set ip 10.10.2.102\n", 19);
// second method
PrintToConsole(1);
printf("set gateway 10.10.2.1\n");
PrintToConsole(0);
}
| Z-World http://www.zworld.com Voice: (530) 757-3737 FAX: (530) 757-3792 sales@zworld.com |