Dynamic HTTP server example. More...
#include <BoardSupport/inc/stdtypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <inttypes.h>
#include <time.h>
#include <string.h>
#include <Libs/NETlib/net.h>
#include <Libs/NETlib/httplib.h>
#include <BoardSupport/inc/BoardSpecific.h>
#include <Common/Common.h>
#include <Common/uartio.h>
#include <Common/timer.h>
#include <Common/CPrintf.h>
#include <BoardSupport/config/netconfig.c>
#include ".\webpage\webpage.c"
#include ".\webpage\webpage.gen"
Functions | |
void | UpdateLedStates (void) |
void | toggle_led (direntry_type *fp, unsigned int led_nr) |
int32_t | http_interpreter (httpserv_type *http_server) |
User defined callback function. More... | |
int | main (void) |
Variables | |
char * | program_name = "dynamic HTTP server" |
direntry_type | led1 = {"led1" , "led1.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |
direntry_type | led2 = {"led2" , "led2.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |
direntry_type | led3 = {"led3" , "led3.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |
direntry_type | led4 = {"led4" , "led4.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |
_ _ _ __| | ___(_) ____ _ __ | |_ / _` | / __| |/ _` | '_ \| __| | (_| | _ \__ \ | (_| | | | | |_ \__,_|(_) ___/_|\__, |_| |_|\__| Signalprocessing |___/ Technology
This program installs a HTTP server (port 80) with either fix IP 192.168.168.200 (configurable in netconfig.c) or DHCP assigned address (e.g. 192.168.168.143, host name mydemo).
To verify this program, first 'ping' the DSP:
>ping 192.168.168.200
or, if configured for DHCP
>ping mydemo
If the settings and network connections are correct, the pings will be replied.
To see the web page type in your browser:
>http://192.168.168.200/index.htm
or, if configured for DHCP
>http://mydemo/index.htm
All pages and messages are hard-coded via c-variables into the code, but can also be loaded from internal flash.
void UpdateLedStates | ( | void | ) |
void toggle_led | ( | direntry_type * | fp, |
unsigned int | led_nr | ||
) |
int main | ( | void | ) |
char* program_name = "dynamic HTTP server" |
direntry_type led1 = {"led1" , "led1.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |
direntry_type led2 = {"led2" , "led2.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |
direntry_type led3 = {"led3" , "led3.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |
direntry_type led4 = {"led4" , "led4.gif" , sizeof(ledoff_gif) , FTP_RW | FTP_RAM, 'B', (uint32_t)ledoff_gif } |