CGI
[HTTP Server]

Introduction

CGI commands are accepted by the Web Server via the HTTP GET command. All CGI commands follow the HTTP GET syntax of name=value. For example, to set PIC port pin A2, we can send the following HTTP command to the target board:
http://10.1.0.1/?a2=1
In this example the name part is "a2" and the value part is '1'.

GET Command

A remote client invokes a function by the HTML GET method with more than one parameter. Refer to RFC1866 (the HTML 2.0 language specification) for more information. When a remote browser executes a GET method with more than one parameter, the HTTP server parses it and calls the main application with the actual method code and its parameter. In order to handle this method, the main application must implement a callback function with an appropriate code. The Modtronix HTTP Server does not perform "URL decoding". This means that if any of the form field text contains certain special non-alphanumeric characters (such as <, >, #, %, etc.), the actual parameter value would contain "%xx" ("xx" being the two-digit hexadecimal value of the ASCII character) instead of the actual character. For example, an entry of "<Name>" would return "%3CName%3C".

The HTTPExecGetCmd() function is a callback function from the HTTP Server. When the HTTP Server receives a GET method with more than one parameter, it calls this function. This function has been implemented by the Modtronix SBC65EC Web Server in the "httpexec.c" file! All commands implemented by the Modtronix SBC65EC Web Server are listed below.

This function must repetively call the HTTPGetParam() function until all name-value parameters sent with the GET command have been obtained. It must then decode the name-value parameter and take appropriate actions. Such actions may include supplying a new Web page name to be returned and/or performing an I/O task.

Defined Commands

The following list of commands are implemented by the Modtronix SBC65EC Web Server in the "httpexec.c" file. This file can be modified by the user to add aditional commands:


PIC Port Commands

A PIC Port command has the following syntax: "pxx=v"

The following PIC port commands are implemented by the Modtronix SBC65EC Web Server:
Command SyntaxDescription
p=YYPort Command - set the given PIC port to the given hex value. The given hex value must be in uppercase! For example:
"a=8A" will set PIC port A to 0x8A.
p[0-7]=[1,0]Port Pin Command - set or clear the given PIC port pin. For example:
"a0=0" will clear PIC port A0 (Port A, pin 0)
"f7=1" will set PIC port F7 (Port F, pin 7)
p[0-7]r=[1,0]Port Pin Command, Remember - - Same as "Port Pin Command" command, except that the settings are saved to the application configuration, and is remembered after power up.
pc[0-7]=[1,0]Port Pin Configuration - Configure given PIC port pin as input or output. '0' will configure pin to be an output, and '1' an input. The port direction configured with this command will NOT be remembered after the next power up, use the "Port Pin Configuration, Remember" command to achieve this! Example to use this command:
"ac0=0" will configure PIC port A0 (Port A, pin 0) to be an output.
"fc7=1" will configure PIC port F7 (Port F, pin 7) to be an input
pc[0-7]r=[1,0]Port Pin Configuration, Remember - Same as "Port Pin Configuration" command, except that the settings are saved to the application configuration, and is remembered after power up.
px[0-7]=[1,0]Inverted Port Pin Command - Set or clear the given PIC port pin. The value is inverted! For example:
"ax0=0" will set PIC port A0 (Port A, pin 0)
"fx7=1" will clear PIC port F7 (Port F, pin 7)

Examples:
Example GET commandDescription
f=01This example will set PIC port F to 0x01
c5=1This example will set PIC port C5
bx0=1This example will clear PIC port B0
An example of sending a GET command to a target board with an IP address of "10.1.0.1" is:
http://10.1.0.1/?f=01
This command can be sent by entering the line above in a standard web browser, or could be send by custom software.


Config Commands

The Config Command is used to modifying the Application Configuration bytes. To see what can be configured with this command, please have a look at the list of Application Configuration bytes.

The Config command has the following syntax: "kxx=v"

All Config commands can only be executed by a logged in user!

Examples:
Example GET commandDescription
k00=100This example will set the the "Application Configuration byte" at 0x00 (MSB of IP address) to 100
k2A=16This example will set the "Application Configuration byte" at 0x2A (Port F direction) to 16 (0x0f). Address 0x2A contains the TRIS register for PIC Port F. Setting a bit to 0 will configure the port as an output, and 1 as an input. In this example we set TRISF to 0x0f = binary 00001111. This will configure port F pins 0-3 as inputs, and pins 4-7 as outputs.
k2F=16This example will set the "Application Configuration byte" at 0x2F (Port F default value) to 10 (0x0a). Address 0x2F contains the default value for PIC Port F at power up. In this example we set it to 0x0a = binary 00001010. This will set the default value of port F pins 1 and 3 to 1 (5V), and pins 0, 2, 4, 5, 6, 7 to 0 (0V) at power up.
An example of sending a GET command to a target board with an IP address of "10.1.0.1" is:
http://10.1.0.1/?k1A=22
This command can be sent by entering the line above in a standard web browser, or could be send by custom software.


General Commands

The General command has the following syntax: "lx=v"

The following General commands are implemented by the Modtronix SBC65EC Web Server. If the Logged In column contains a 'X' character then this command can only be executed by a logged in user!
Command Syntax Logged
In
Description
la=strX New Username - assigns a new Username. The given "str" is the new username, and must be an alpha numeric string of 1 to 8 characters. For example:
"la=wombat" will set the new username to "wombat".
lb=strX New Password - assigns a new Password. The given "str" is the new password, and must be an alpha numeric string of 1 to 8 characters. For example:
"lb=gumtree" will set the new username to "gumtree".
ln=strX New NetBIOS name - assigns a new NetBIOS name. The given "str" is the new name, and must be an alpha numeric string of 1 to 15 characters. For example:
"lb=CROC1" will set the new username to "CROC1".
lu=str  Username - gives the username of an user attempting to log in. The given "str" is the username, and must be an alpha numeric string of 1 to 8 characters. This command must be followed by the Password command. For example:
"lu=admin" will send a request to log in for the "admin" user.
lp=str  Password - gives the password of an user attempting to log in. The given "str" is the password, and must be an alpha numeric string of 1 to 8 characters. This command must followed the Username command. For example:
"lp=pw" will send a request to log with the "pw" password.

Examples:
The following example will log in an user with username="admin" and password="pw" to a target with an IP address of "10.1.0.1":
http://10.1.0.1/?lu=admin&lp=pw
This command can be sent by entering the line above in a standard web browser, or could be send by custom software.


Short Commands

Short commands do not have any command operands. They always have the following syntax: "m=v"

The following Short commands are implemented by the Modtronix SBC65EC Web Server. If the Logged In column contains a 'X' character then this command can only be executed by a logged in user!
Command Syntax Logged
In
Description
m=rX Reset Board - reset's the board. This command can be used to remotely reset the board. This can be used to update the firmware via the network bootloader for example.
m=oX Log Out - log out the current user.

Examples:
The following example will reset a target with an IP address of "10.1.0.1":
http://10.1.0.1/?m=r
This command can be sent by entering the line above in a standard web browser, or could be send by custom software.


Generated on Mon Oct 9 13:22:09 2006 for SBC65EC Web Server by  doxygen 1.4.7