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

Dependencies:   EthernetInterface mbed-rtos mbed

Committer:
davisw00
Date:
Sat Sep 06 23:47:21 2014 +0000
Revision:
2:3637af74f7f0
Parent:
0:427a14ebab60
Implemented Channel commands.  Wait for response is not working; therefore commands are followed by a 50ms wait

Who changed what in which revision?

UserRevisionLine numberNew contents of line
davisw00 0:427a14ebab60 1 #ifndef _AQUOSTV
davisw00 0:427a14ebab60 2 #define _AQUOSTV
davisw00 0:427a14ebab60 3 #include "mbed.h"
davisw00 0:427a14ebab60 4 #include <string.h>
davisw00 0:427a14ebab60 5 #include <stdio.h>
davisw00 0:427a14ebab60 6
davisw00 0:427a14ebab60 7 #include "DebugPort.h"
davisw00 0:427a14ebab60 8
davisw00 2:3637af74f7f0 9 const char gblHelp[] = " \n\
davisw00 2:3637af74f7f0 10 poweron Power on SharpAquos \n\
davisw00 2:3637af74f7f0 11 poweroff Power off SharpAquos \n\
davisw00 2:3637af74f7f0 12 volume## Set volume to two digit number \n\
davisw00 2:3637af74f7f0 13 input# Set input to one digit number \n\
davisw00 2:3637af74f7f0 14 selecttv Set input to tv \n\
davisw00 2:3637af74f7f0 15 chanalog Set TV channel to analog 1-136 \n\
davisw00 2:3637af74f7f0 16 chdigiair#### Set TV to digital air 1-9999 \n\
davisw00 2:3637af74f7f0 17 chdigicable####.#### Set TV to digital cable with major.minor \n\
davisw00 2:3637af74f7f0 18 chdigi2cable##### Set TV to digital cable with 0-63839999 \n\
davisw00 2:3637af74f7f0 19 chup TV Channel Up \n\
davisw00 2:3637af74f7f0 20 chdw TV Channel Down \n\
davisw00 2:3637af74f7f0 21 ";
davisw00 0:427a14ebab60 22
davisw00 0:427a14ebab60 23
davisw00 0:427a14ebab60 24 #define AQUOSBUF 128
davisw00 0:427a14ebab60 25
davisw00 0:427a14ebab60 26 class AquosTV {
davisw00 0:427a14ebab60 27 private:
davisw00 0:427a14ebab60 28 const static unsigned int BUF_SIZE = 256;
davisw00 0:427a14ebab60 29 DebugPort *m_dbg;
davisw00 0:427a14ebab60 30
davisw00 0:427a14ebab60 31 protected:
davisw00 0:427a14ebab60 32 Serial* m_tv;
davisw00 0:427a14ebab60 33 char httpcmd[128];
davisw00 0:427a14ebab60 34 char rs232cmd[128];
davisw00 0:427a14ebab60 35
davisw00 0:427a14ebab60 36 void init();
davisw00 0:427a14ebab60 37
davisw00 2:3637af74f7f0 38 int getNumber(char** input, const char eol='\0');
davisw00 2:3637af74f7f0 39 bool sendcmd(const char* cmd);
davisw00 2:3637af74f7f0 40
davisw00 0:427a14ebab60 41 public:
davisw00 0:427a14ebab60 42 AquosTV(DebugPort *dbg);
davisw00 0:427a14ebab60 43 virtual ~AquosTV();
davisw00 0:427a14ebab60 44
davisw00 0:427a14ebab60 45 bool processCommand(const char* httpin);
davisw00 0:427a14ebab60 46 const char* http() ;
davisw00 0:427a14ebab60 47 const char* tvcmd() ;
davisw00 0:427a14ebab60 48 };
davisw00 0:427a14ebab60 49
davisw00 0:427a14ebab60 50
davisw00 0:427a14ebab60 51 #endif