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.
.
Diff: main.cpp
- Revision:
- 5:c5c2f7026638
- Parent:
- 1:6cbd17e628f1
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();