Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: net lpc1768 crypto clock web fram log
web-server-this.c
00001 #include "http.h" 00002 #include "web-pages-this.h" 00003 #include "web.h" 00004 00005 #define DO_HOME_HTML DO_THIS + 0 00006 #define DO_BATTERY_HTML DO_THIS + 1 00007 #define DO_BATTERY_AJAX DO_THIS + 2 00008 #define DO_BATTERY_SCRIPT DO_THIS + 3 00009 #define DO_SYSTEM_HTML DO_THIS + 4 00010 #define DO_SYSTEM_AJAX DO_THIS + 5 00011 #define DO_SYSTEM_SCRIPT DO_THIS + 6 00012 00013 int WebServerThisDecideWhatToDo(char *pPath, char* pLastModified) 00014 { 00015 if (HttpSameStr(pPath, "/" )) return DO_HOME_HTML; 00016 if (HttpSameStr(pPath, "/battery" )) return DO_BATTERY_HTML; 00017 if (HttpSameStr(pPath, "/battery-ajax" )) return DO_BATTERY_AJAX; 00018 if (HttpSameStr(pPath, "/system" )) return DO_SYSTEM_HTML; 00019 if (HttpSameStr(pPath, "/system-ajax" )) return DO_SYSTEM_AJAX; 00020 00021 if (HttpSameStr(pPath, "/battery.js" )) return HttpSameDate(WebBatteryScriptDate, WebBatteryScriptTime, pLastModified) ? DO_NOT_MODIFIED : DO_BATTERY_SCRIPT; 00022 if (HttpSameStr(pPath, "/system.js" )) return HttpSameDate(WebSystemScriptDate, WebSystemScriptTime, pLastModified) ? DO_NOT_MODIFIED : DO_SYSTEM_SCRIPT; 00023 00024 return DO_NOT_FOUND; 00025 } 00026 00027 bool WebServerThisHandleQuery(int todo, char* pQuery) 00028 { 00029 switch (todo) 00030 { 00031 case DO_BATTERY_AJAX: WebBatteryQuery (pQuery); return true; 00032 case DO_BATTERY_HTML: WebBatteryQuery (pQuery); return true; 00033 case DO_SYSTEM_HTML: WebSystemQuery (pQuery); return true; 00034 case DO_SYSTEM_AJAX: WebSystemQuery (pQuery); return true; 00035 } 00036 return false; 00037 } 00038 bool WebServerThisPost(int todo, int contentLength, int contentStart, int size, char* pRequestStream, uint32_t positionInRequestStream, bool* pComplete) 00039 { 00040 return false; 00041 } 00042 bool WebServerThisReply(int todo) 00043 { 00044 switch (todo) 00045 { 00046 case DO_HOME_HTML: WebHomeHtml (); return true; 00047 case DO_BATTERY_HTML: WebBatteryHtml (); return true; 00048 case DO_BATTERY_AJAX: WebBatteryAjax (); return true; 00049 case DO_BATTERY_SCRIPT: WebBatteryScript (); return true; 00050 case DO_SYSTEM_HTML: WebSystemHtml (); return true; 00051 case DO_SYSTEM_AJAX: WebSystemAjax (); return true; 00052 case DO_SYSTEM_SCRIPT: WebSystemScript (); return true; 00053 } 00054 return false; 00055 }
Generated on Tue Jul 12 2022 21:42:35 by
1.7.2