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

Dependencies:   EthernetInterface mbed-rtos mbed

main.cpp

Committer:
davisw00
Date:
2014-07-29
Revision:
0:427a14ebab60
Child:
2:3637af74f7f0

File content as of revision 0:427a14ebab60:

#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();
        }
    }
}