BasicWEB.h File Reference


Detailed Description

Basic WEB Server for AVR32 UC3.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file BasicWEB.h.

#include "portmacro.h"
#include "shell.h"
#include "supervisor.h"

Go to the source code of this file.

Functions

eExecStatus e_webserver_cmd_get_config (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The get webserver config command: get the config fields value of http port Takes no parameter.
eExecStatus e_webserver_cmd_set_config (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply)
 The set webserver config command: set the http port. Takes one parameter : port=ppppp.
 portTASK_FUNCTION_PROTO (vBasicWEBServer, pvParameters)
 WEB server main task.


Function Documentation

eExecStatus e_webserver_cmd_get_config ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The get webserver config command: get the config fields value of http port Takes no parameter.

Note:
This function must be of the type pfShellCmd defined by the shell module.
Parameters:
xModId Input. The module that is calling this function.
FsNavId Ignored.
ac Input. The argument counter. For this command, should be 1.
av Input. The argument vector.
ppcStringReply Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns:
the status of the command execution.

Definition at line 404 of file BasicWEB.c.

References SHELL_ERRMSG_MEMALLOC, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, sprintf(), and webHttpPort.

Referenced by e_syscmds_cmd_get_config().

00407 {
00408   if(ppcStringReply != NULL)
00409   {
00410     /* allocate a buffer for answer */
00411     *ppcStringReply = (signed portCHAR *)pvPortMalloc(15);
00412     if( NULL == *ppcStringReply )
00413     {
00414        *ppcStringReply = (signed portCHAR *)SHELL_ERRMSG_MEMALLOC;
00415        return( SHELL_EXECSTATUS_KO );
00416     }
00417     /* get HTTP port and add it to the buffer */
00418     sprintf((char *)*ppcStringReply,"port=%u\r\n", webHttpPort);
00419     /* no error, return */
00420     return( SHELL_EXECSTATUS_OK );
00421   }
00422   return( SHELL_EXECSTATUS_KO );
00423 }

eExecStatus e_webserver_cmd_set_config ( eModId  xModId,
signed short  FsNavId,
int  ac,
signed portCHAR *  av[],
signed portCHAR **  ppcStringReply 
)

The set webserver config command: set the http port. Takes one parameter : port=ppppp.

Note:
This function must be of the type pfShellCmd defined by the shell module.
Parameters:
xModId Input. The module that is calling this function.
FsNavId Ignored.
ac Input. The argument counter. For this command, should be 1.
av Input. The argument vector.
ppcStringReply Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string.
Returns:
the status of the command execution.

Definition at line 364 of file BasicWEB.c.

References config_file_set_value(), HTTP_CONFIG_FILE, SHELL_ERRMSG_CONFIGERROR, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, and SHELL_MSG_REBOOT.

Referenced by e_syscmds_cmd_set_config().

00367 {
00368   if (config_file_set_value(HTTP_CONFIG_FILE, ac, av) != 0)
00369   {
00370     if(ppcStringReply != NULL)
00371     {
00372       *ppcStringReply = (signed portCHAR *)SHELL_ERRMSG_CONFIGERROR;
00373     }
00374     return( SHELL_EXECSTATUS_KO );
00375   }
00376   if(ppcStringReply != NULL)
00377   {
00378     /* allocate a buffer for answer */
00379     *ppcStringReply = (signed portCHAR *)pvPortMalloc( strlen( SHELL_MSG_REBOOT ) +1 ); // Alloc
00380     if( NULL != *ppcStringReply )
00381     {
00382        strcpy( (char *)*ppcStringReply, SHELL_MSG_REBOOT );
00383     }
00384   }
00385   return( SHELL_EXECSTATUS_OK );
00386 }

portTASK_FUNCTION_PROTO ( vBasicWEBServer  ,
pvParameters   
)

WEB server main task.


Generated on Fri Feb 19 02:22:42 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5