Working sample implementation for the EthernetInterface HTTPServer.
Dependencies: EthernetInterface HTTPServer mbed-rpc mbed-rtos mbed
Sample application which shows basic functionality of my HTTPServer library.
Import libraryHTTPServer
Single instance HTTP Server using new Ethernet Interface.
.
Revision 5:c5c2f7026638, committed 2013-08-17
- Comitter:
- leihen
- Date:
- Sat Aug 17 17:00:35 2013 +0000
- Parent:
- 4:fdd7369eeebe
- Commit message:
- Added RPC functionality to sample application.
Changed in this revision
HTTPServer.lib | Show annotated file 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 fdd7369eeebe -r c5c2f7026638 HTTPServer.lib --- a/HTTPServer.lib Sat Aug 17 15:35:01 2013 +0000 +++ b/HTTPServer.lib Sat Aug 17 17:00:35 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/leihen/code/HTTPServer/#909dcf44c3db +http://mbed.org/users/leihen/code/HTTPServer/#cc3f5c53d0d5
diff -r fdd7369eeebe -r c5c2f7026638 main.cpp --- a/main.cpp Sat Aug 17 15:35:01 2013 +0000 +++ b/main.cpp Sat Aug 17 17:00:35 2013 +0000 @@ -2,6 +2,8 @@ #include "HTTPServer.h" #include "FsHandler.h" #include "LocalFileSystem.h" +#include "RpcHandler.h" +#include "mbed_rpc.h" #define ALTERNATIVE //#undef ALTERNATIVE @@ -15,6 +17,7 @@ // Instantiate a local file system handler named 'local' which will be used later to access files on the mbed. LocalFileSystem local("local"); + #ifdef ALTERNATIVE // Create the EthernetInterface. This is optional, please see the documentation of HTTP Server's start method. EthernetInterface eth; @@ -24,9 +27,11 @@ int main() { pc.baud(460800); + RPC::add_rpc_class<RpcDigitalOut>(); HTTPFsRequestHandler::mount("/local/", "/"); svr.addHandler<HTTPFsRequestHandler>("/"); - + svr.addHandler<HTTPRpcRequestHandler>("/RPC"); + #ifdef ALTERNATIVE // Initialize the EthernetInterface and initiate a connection using DHCP. eth.init();