This application translates HTTP GET requests into the proper RS232 commands to control a Sharp Aquos TV
Dependencies: EthernetInterface mbed-rtos mbed
Diff: AquosHTTP.h
- Revision:
- 0:427a14ebab60
- Child:
- 2:3637af74f7f0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AquosHTTP.h Tue Jul 29 23:01:55 2014 +0000 @@ -0,0 +1,41 @@ +#ifndef _AQUOSHTTP +#define _AQUOSHTTP + +#include "EthernetInterface.h" +#include "rtos.h" +#include <string.h> +#include "DebugPort.h" + +class AquosHTTP { + private: + const static unsigned int BUF_SIZE = 256; + DebugPort* m_dbg; + + protected: + EthernetInterface m_eth; + TCPSocketServer m_server; + TCPSocketConnection m_client; + + char m_buffer[BUF_SIZE]; + char m_response[BUF_SIZE]; + + void init(); + void arrayinit(char* ary); + + int setResponse(const char* msg); + + public: + AquosHTTP(DebugPort* dbg); + ~AquosHTTP(); + + AquosHTTP& init(const char *ipaddr, const char* netmask, const char* gateway); + + AquosHTTP& waitForRequest(); + const char* getRequest() const; + + AquosHTTP& returnSuccess(); + AquosHTTP& returnFailure(); +}; + + +#endif \ No newline at end of file