This application translates HTTP GET requests into the proper RS232 commands to control a Sharp Aquos TV

Dependencies:   EthernetInterface mbed-rtos mbed

AquosHTTP.h

Committer:
davisw00
Date:
2014-09-06
Revision:
2:3637af74f7f0
Parent:
0:427a14ebab60

File content as of revision 2:3637af74f7f0:

#ifndef _AQUOSHTTP
#define _AQUOSHTTP

#include "EthernetInterface.h"
#include "rtos.h"
#include <string.h>
#include "DebugPort.h"
#include "AquosTV.h"

class AquosHTTP {
    private:
        const static unsigned int BUF_SIZE = 256;
        DebugPort* m_dbg;
        AquosTV* m_tv;
        
    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, AquosTV* tv);
        ~AquosHTTP();
        
        AquosHTTP& init(const char *ipaddr, const char* netmask, const char* gateway);
        
        AquosHTTP& waitForRequest();
        const char* getRequest() const;
        
        AquosHTTP& returnSuccess();
        AquosHTTP& returnFailure();
        
        AquosHTTP& returnHelp();
};


#endif