<< Previous | Index | Next >>

Appendix E. Serial Console Commands

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>

This command sets the IP address for the gateway.


IP address

The IP address for the gateway in dotted decimal format. The factory default is 10.10.1.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

User-chosen string. The factory default is RabbitLink.






set ip <IP address>

This command sets the IP address for the RabbitLink.


IP address

The IP address for the RabbitLink in dotted decimal format. The factory default is 10.10.1.100.






set netmask x.x.x.x

This command sets the netmask.


x.x.x.x

This is the dotted decimal format of the netmask. The factory default is 255.255.255.0.






set passphrase 

This command will prompt for a passphrase twice to confirm that the passphrase was correctly entered. The characters are not echoed back as a security measure. As another security measure, the passphrase is hashed before it is stored on the RabbitLink. Whenever a new session starts with Dynamic C or the RFU, the user will be asked for the passphrase. It should be as long as possible to increase security, up to the maximum length of 255 characters.






set port x

This 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

The port number. The factory default is 4244.






set dhcp <on | off>

This command enables and disables the use of any DHCP server that is available on the network. The default condition is on. This command is only available with RabbitLink serial console version 2.00 and later.


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.





createv <varname> <vartype> <format> <value> [strlen]

This command creates a variable and stores it in the flash file system on the RabbitLink. The variable can be referenced in HTML files using SSI; e.g. <!--#echo var="var1"-->).


varname

The name of the variable.


vartype

Type of the variable (int8, int16, int32, float32, or string)


format

The printf-style format specifier (such as %d) for outputting the variable


value

The value to assign to the variable


strlen

Maximum length of the string for variables of type string.

Examples


createv var1 float32 "%.2f" 3.14
createv var2 string "%s" "This is a test." 50





getv <varname>

This command gets the value of the specified variable. The value is printed using the format specifier given in the createv command.


varname

The variable whose value is requested.






putv <varname> <value>

This command assigns the specified value to the specified variable.


varname

The variable whose value is being changed.


value

The new value for the variable.






list variables

This command lists all the variables by name and type that are stored in the flash file system on the RabbitLink.






reset variables

This 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

Identifies the file to delete.






get <filename>   

This command returns the contents of the specified file.


filename

Identifies the file.






list files

This command lists all the files in the flash file system on the RabbitLink.






put <filename>
<body of file>
<ctrl-D>

This command sends an ASCII 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.

filename

Identifies the file.


body of file

Everything sent before a <ctrl-D> (or a <ctrl-Z>) is part of the file contents.


ctrl-D
(or a ctrl-Z)

This is the end of file marker.






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.

filename

Identifies the file.


size

The number of bytes in the file being transferred.


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 address

The address to which the e-mail is sent; e.g. rabbit@warren.com.


subject

After receiving the mail command, the RabbitLink will accept the next string as the subject of the e-mail


body

After receiving the subject of the e-mail, the RabbitLink will accept strings that follow as the body of the e-mail.


ctrl-D

ctrl-D (0x04) is the end of the e-mail.






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 name
E-mail address of the RabbitLink; e.g. rabbit@warren.com.





set mail server <IP address>

This command sets the IP address of the mail server.


IP address

The IP address of the mail server in dotted decimal format.


E.5 Other Console Commands





echo <on | off>

This command toggles the echoing of characters.






help [filename]

This command displays the online help.


filename

This optional parameter limits the help information to that which is associated with the specified file.






reset

This 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.


filename

This 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 printf go to the RabbitLink serial console in addition to the Dynamic C Stdio window.

Parameter

flag

0 - printf() and related commands work as normal
1 - printf() and related commands go to the RabbitLink serial console as well.

Return Value

0 if successful, -1 if not.


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 C STDIO window.

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.


ConsoleFinish


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 and non-zero if all the data have been received.

Library

STDIO.LIB

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);
}


<< Previous | Index | Next >>
Z-World, Inc.
www.zworld.com
Phone: 1.530.757.3737
Fax: 1.530.757.3792
Rabbit Semiconductor
www.rabbitsemiconductor.com
Phone: 1.530.757.8400
Fax: 1.530.757.8402