HttpServer example

Dependencies:   C12832_lcd EthernetInterface HttpServer mbed-rpc mbed-rtos mbed

Dependents:   HttpServer

Fork of HttpServerSample by Yasushi TAUCHI

Files at this revision

API Documentation at this revision

Comitter:
MohamadNazrin
Date:
Tue Mar 13 04:09:04 2018 +0000
Parent:
5:bfa9878aa274
Commit message:
http server

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
HttpServer.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r bfa9878aa274 -r 833b006caaf1 C12832_lcd.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Tue Mar 13 04:09:04 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r bfa9878aa274 -r 833b006caaf1 HttpServer.lib
--- a/HttpServer.lib	Sat Feb 22 05:55:58 2014 +0000
+++ b/HttpServer.lib	Tue Mar 13 04:09:04 2018 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/yueee_yt/code/HttpServer/#b8f6a11c70db
+https://os.mbed.com/users/MohamadNazrin/code/HttpServer/#01d401a897cd
diff -r bfa9878aa274 -r 833b006caaf1 TextLCD.lib
--- a/TextLCD.lib	Sat Feb 22 05:55:58 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r bfa9878aa274 -r 833b006caaf1 main.cpp
--- a/main.cpp	Sat Feb 22 05:55:58 2014 +0000
+++ b/main.cpp	Tue Mar 13 04:09:04 2018 +0000
@@ -1,43 +1,23 @@
-//#define DNS_SERVER_ADDRESS(ipaddr)        (ip4_addr_set_u32(ipaddr, ipaddr_addr("208.67.222.222"))) /* resolver1.opendns.com */
 #include "mbed.h"
-#include "rtos.h"
 #include "EthernetInterface.h"
 #include "HTTPServer.h"
-#include "mbed_rpc.h"
-#include "TextLCD.h"
+#include "C12832_lcd.h" // Include for LCD code
+
+C12832_LCD lcd; //Initialize LCD Screen
+
 
 EthernetInterface eth;
 
-DigitalOut led4(LED4);
-
-LocalFileSystem local("local");
-void LcdWrite(Arguments* arg, Reply* r);    //ADD Here!!
-
-TextLCD lcd(p24, p26, p27, p28, p29, p30);
-
-void aliveState(void const *args)
-{
-    while (true) {
-        led4 = !led4;
-        Thread::wait(1000);
-    }
-}
-
+    static const char*          mbedIp       = "192.168.137.2";  //IP
+    static const char*          mbedMask     = "255.255.255.0";  // Mask
+    static const char*          mbedGateway  = "192.168.137.1";    //Gateway
+   
 int main()
 {
     printf("********* PROGRAM START ***********\r\n");
-    Thread thread(aliveState);
-    RPC::add_rpc_class<RpcDigitalOut>();
-    RPC::construct<RpcDigitalOut, PinName, const char*>(LED1, "led1");
-    RPC::construct<RpcDigitalOut, PinName, const char*>(LED2, "led2");
-    RPC::construct<RpcDigitalOut, PinName, const char*>(LED3, "led3");
-    RPCFunction rpcFunc(LcdWrite, "LcdWrite"); //ADD Here!!
-    lcd.cls();
-    lcd.locate(0,0);
-
     printf("EthernetInterface Setting up...\r\n");
-    if(eth.init()!=0) {                             //for DHCP Server
-        //if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address
+    //if(eth.init()!=0) {                             //for DHCP Server
+        if(eth.init(mbedIp,mbedMask,mbedGateway)!=0) { //for Static IP Address
         printf("EthernetInterface Initialize Error \r\n");
         return -1;
     }
@@ -50,17 +30,10 @@
     printf("Gateway Address is %s\r\n", eth.getGateway());
     printf("Ethernet Setup OK\r\n");
 
-    HTTPServerAddHandler<SimpleHandler>("/hello"); //Default handler
-    FSHandler::mount("/local", "/");
-    HTTPServerAddHandler<FSHandler>("/");
-    HTTPServerAddHandler<RPCHandler>("/rpc");
+    HTTPServerAddHandler<SimpleHandler>("/"); //Default handler
     lcd.locate(0,0);
-    lcd.printf("%s",eth.getIPAddress());
+    lcd.printf("IP:%s",eth.getIPAddress());
     HTTPServerStart(80);
 }
 
-void LcdWrite(Arguments* arg, Reply* r)  //ADD Here!!
-{
-    lcd.locate(0,1);
-    lcd.printf("%s",arg->argv[0]);
-}
+