Port from Avnet's Internet Of Things full WiGo demo: SmartConfig - WebServer - Exosite - Android sensor Fusion App

Dependencies:   NVIC_set_all_priorities mbed cc3000_hostdriver_mbedsocket TEMT6200 TSI Wi-Go_eCompass_Lib_V3 WiGo_BattCharger

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers demo.h Source File

demo.h

00001 #ifndef DEMO_H
00002 #define DEMO_H
00003 #include "TCPSocketConnection.h"
00004 #include "TCPSocketServer.h"
00005 
00006 #ifdef    __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 #define MAX_CGI_PARAMS 4
00011 #define MAX_DYN_HTML_PARAMS 9
00012 #define MAX_DYN_HTML_PARAM_SIZE 40
00013 #define ROOT "/"
00014 
00015 
00016 #define HTTP_RESP "HTTP/1.0 200 OK\n\n"
00017 
00018 #define HTTP_CGI_ENABLED
00019 #define HTTP_DYN_HTML_ENABLED
00020 #define HTTP_PORT     80
00021 
00022 #define MAX_REPLACE_CHAR 16
00023 
00024 
00025 // Struct that indicates all the elements necessary to handle
00026 typedef struct
00027 {
00028     // name of parameter that will be analyzed
00029     // Currently not implemented to verify each
00030     // This would enable us to be flexible with parameter list
00031     //char [][]
00032     
00033     // Array of functions that will handle each parameter
00034     void (*cgiHandlerFunc[MAX_CGI_PARAMS])(char *);
00035         
00036 } cgi_handler;
00037 
00038 
00039 typedef struct
00040 {
00041      char dynHtmlParamName[MAX_DYN_HTML_PARAMS][MAX_DYN_HTML_PARAM_SIZE];
00042      void (*dynHtmlFunc[40])(char *);  //PF was 20
00043 } dyn_html_handler;
00044 
00045 void serverMain(int port, char * ipage,  cgi_handler * handleList, dyn_html_handler * dhList);
00046 void handleHTTPRequest(TCPSocketConnection *client);
00047 void pageReplace(char * page, char * ind, char * val);
00048 void getViewsNum(char * str);
00049 void sendHTTPData(char * buf, long len, TCPSocketConnection *client);
00050 
00051 int demo_wifi_main(void);
00052 void testFunc(char * str);
00053 void getBatteryVoltageStr(char * str);
00054 void getLightVoltageStr(char * str);
00055 void getAccelXYZ_Str(char * str);
00056 void getTemperatureStr(char * str);
00057 void getTSI_sliderStr(char * str);
00058 void getCompassStr(char * str);
00059 void getM3110Str(char * str);
00060 void getAltitudeStr(char * str);
00061 
00062 #ifdef    __cplusplus
00063 }
00064 #endif // __cplusplus
00065 #endif // DEMO_H
00066