This application translates HTTP GET requests into the proper RS232 commands to control a Sharp Aquos TV
Dependencies: EthernetInterface mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:427a14ebab60
- Child:
- 2:3637af74f7f0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jul 29 23:01:55 2014 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" +#include "EthernetInterface.h" +#include "rtos.h" +#include "DebugPort.h" +#include "AquosHTTP.h" +#include "AquosTV.h" +#include <string.h> + +#define DBG 1 + +const char ip[] = "192.168.16.36"; +const char mask[] = "255.255.255.0"; +const char gateway[] = "192.168.16.1"; + +int main() { + bool loop=true; + DebugPort dbg; + dbg.setLED(0,1,1); //yellow for init + wait(0.1); + + AquosHTTP server(&dbg); + server.init(ip,mask,gateway); + AquosTV tv(&dbg); + + + while(loop) { + dbg.setLED(0,0,0); //off while waiting + server.waitForRequest(); + dbg.setLED(0,0,1); //blue in progress + if( tv.processCommand( server.getRequest() )) { + dbg.setLED(0,1,0); + server.returnSuccess(); + } else { + dbg.setLED(1,0,0); + server.returnFailure(); + } + } +}