Chris Styles
/
WorkingHTTPServer
HTTP Server based on Rolf Meyers work
main.cpp@0:27247b1ce338, 2010-05-13 (annotated)
- Committer:
- chris
- Date:
- Thu May 13 15:09:04 2010 +0000
- Revision:
- 0:27247b1ce338
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:27247b1ce338 | 1 | #include "mbed.h" |
chris | 0:27247b1ce338 | 2 | #include "HTTPServer.h" |
chris | 0:27247b1ce338 | 3 | #include "HTTPRPC.h" |
chris | 0:27247b1ce338 | 4 | #include "HTTPFS.h" |
chris | 0:27247b1ce338 | 5 | |
chris | 0:27247b1ce338 | 6 | HTTPServer http; |
chris | 0:27247b1ce338 | 7 | DigitalOut led1(LED1, "led1"); |
chris | 0:27247b1ce338 | 8 | DigitalOut led2(LED2, "led2"); |
chris | 0:27247b1ce338 | 9 | DigitalOut led3(LED3, "led3"); |
chris | 0:27247b1ce338 | 10 | DigitalOut led4(LED4, "led4"); |
chris | 0:27247b1ce338 | 11 | LocalFileSystem local("local"); |
chris | 0:27247b1ce338 | 12 | |
chris | 0:27247b1ce338 | 13 | int main(void) { |
chris | 0:27247b1ce338 | 14 | Base::add_rpc_class<AnalogIn>(); |
chris | 0:27247b1ce338 | 15 | Base::add_rpc_class<AnalogOut>(); |
chris | 0:27247b1ce338 | 16 | Base::add_rpc_class<DigitalIn>(); |
chris | 0:27247b1ce338 | 17 | Base::add_rpc_class<DigitalOut>(); |
chris | 0:27247b1ce338 | 18 | Base::add_rpc_class<PwmOut>(); |
chris | 0:27247b1ce338 | 19 | Base::add_rpc_class<Timer>(); |
chris | 0:27247b1ce338 | 20 | Base::add_rpc_class<SPI>(); |
chris | 0:27247b1ce338 | 21 | Base::add_rpc_class<BusOut>(); |
chris | 0:27247b1ce338 | 22 | Base::add_rpc_class<BusIn>(); |
chris | 0:27247b1ce338 | 23 | |
chris | 0:27247b1ce338 | 24 | http.addHandler(new HTTPRPC()); |
chris | 0:27247b1ce338 | 25 | http.addHandler(new HTTPFileSystemHandler("/", "/local/")); |
chris | 0:27247b1ce338 | 26 | http.bind(); |
chris | 0:27247b1ce338 | 27 | |
chris | 0:27247b1ce338 | 28 | while(1) { |
chris | 0:27247b1ce338 | 29 | http.poll(); |
chris | 0:27247b1ce338 | 30 | } |
chris | 0:27247b1ce338 | 31 | } |
chris | 0:27247b1ce338 | 32 |