NNN40 run a HTTP server with RPC using Soft AP mode

Dependencies:   WIFI_API_32kRAM mbed

Fork of HTTP-Server by Francois Berder

The sample code will run as a WiFi Soft AP mode with given AP configuration setting including SSID name and password. IP address (fixed to 192.168.2.1 for the current version of WIFI_API)of AP router will be print out once Soft AP mode is operating.

User can open their web browser and go to http://192.168.2.1/. and have a try on switch on a led. Firstly, we need to create an object to control a led

/media/uploads/wgd8700/http_server2.png

Then, led can be switch on using RPC command /media/uploads/wgd8700/http_server3.png

More information cab be found from the links below

https://developer.mbed.org/users/feb11/code/HTTP-Server/

https://developer.mbed.org/cookbook/Interfacing-Using-RPC

Files at this revision

API Documentation at this revision

Comitter:
feb11
Date:
Thu Jul 18 10:10:14 2013 +0000
Parent:
9:a9bf63017854
Child:
11:f57e9de44f6f
Commit message:
Improved javascript code

Changed in this revision

Formatter.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Formatter.cpp	Thu Jul 18 09:39:35 2013 +0000
+++ b/Formatter.cpp	Thu Jul 18 10:10:14 2013 +0000
@@ -26,6 +26,8 @@
 var list = document.getElementById(\"type\");\
 var type = list.options[list.selectedIndex].value;\
 var name = document.getElementById(\"name\").value;\
+if(name === \"\") \
+return;\
 var arg = document.getElementById(\"arg\").value;\
 var url;\
 if(arg === \"\") url = \"http://\" + ip + type + \"new?name=\" + name;\
@@ -35,6 +37,8 @@
 function submitCallFuncForm()\
 {\
 var command = document.getElementById(\"command\").value;\
+if(command === \"\") \
+return; \
 var tmp = command.split(\' \');\
 var url = tmp[0];\
 if(tmp.length > 1)\
@@ -68,7 +72,7 @@
 <h3>Call a function :</h3>\
 <p>Enter an RPC command.</p>\
 <form>\
-Command: <input type= \"text\" id=\"command\"><br>\
+Command: <input type= \"text\" id=\"command\" maxlength=127><br>\
 <p><input type=\"button\" value=\"Send\" onclick=\"javascript:submitCallFuncForm();\"></p><br>\
 </form>\
 </body> \