Chris Styles
/
DemoBoard_HTTP_RPC
main.cpp@1:3a52abf35e4f, 2009-09-22 (annotated)
- Committer:
- chris
- Date:
- Tue Sep 22 12:02:37 2009 +0000
- Revision:
- 1:3a52abf35e4f
- Parent:
- 0:cf26091e3c21
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 1:3a52abf35e4f | 1 | #include "DemoBoard.h" |
chris | 0:cf26091e3c21 | 2 | |
chris | 0:cf26091e3c21 | 3 | /* |
chris | 0:cf26091e3c21 | 4 | * This project uses an RFID tag reader and the USB interface as a HID keyboard |
chris | 0:cf26091e3c21 | 5 | * When an RFID tag is presented to the reader, it is "typed" to the host |
chris | 0:cf26091e3c21 | 6 | */ |
chris | 0:cf26091e3c21 | 7 | |
chris | 0:cf26091e3c21 | 8 | int main() { |
chris | 0:cf26091e3c21 | 9 | |
chris | 0:cf26091e3c21 | 10 | |
chris | 1:3a52abf35e4f | 11 | // Create a HTTPServer on default Port |
chris | 1:3a52abf35e4f | 12 | HTTPServer *http = new HTTPServer(); |
chris | 1:3a52abf35e4f | 13 | |
chris | 1:3a52abf35e4f | 14 | // Register RPC in /rpc space |
chris | 1:3a52abf35e4f | 15 | http->addHandler(new HTTPRPC()); |
chris | 1:3a52abf35e4f | 16 | |
chris | 1:3a52abf35e4f | 17 | // Register local filesystem to all places which are not in /rpc |
chris | 1:3a52abf35e4f | 18 | http->addHandler(new HTTPFileSystemHandler("/", "/local/")); |
chris | 1:3a52abf35e4f | 19 | |
chris | 1:3a52abf35e4f | 20 | // Register the HTTPServer on the Network device (will hopfully disappear in the next Version) |
chris | 1:3a52abf35e4f | 21 | http->bind(); |
chris | 1:3a52abf35e4f | 22 | |
chris | 1:3a52abf35e4f | 23 | NetServer *net = NetServer::get(); |
chris | 1:3a52abf35e4f | 24 | |
chris | 1:3a52abf35e4f | 25 | lcd.locate(0,1); |
chris | 1:3a52abf35e4f | 26 | lcd.printf("%hhu.%hhu.%hhu.%hhu\n", (net->getIPAddr().addr)&0xFF, (net->getIPAddr().addr>>8)&0xFF, (net->getIPAddr().addr>>16)&0xFF, (net->getIPAddr().addr>>24)&0xFF); |
chris | 1:3a52abf35e4f | 27 | |
chris | 1:3a52abf35e4f | 28 | while(1) { |
chris | 1:3a52abf35e4f | 29 | http->poll(); |
chris | 1:3a52abf35e4f | 30 | } |
chris | 1:3a52abf35e4f | 31 | |
chris | 0:cf26091e3c21 | 32 | |
chris | 0:cf26091e3c21 | 33 | |
chris | 0:cf26091e3c21 | 34 | } |
chris | 0:cf26091e3c21 | 35 | |
chris | 0:cf26091e3c21 | 36 |