void three() { send_command(THREE); }
50
void four() { send_command(FOUR); }
-
void five() { send_command(FIVE); }
-
void six() { send_command(SIX); }
-
void seven() { send_command(SEVEN); }
-
void eight() { send_command(EIGHT); }
55
void nine() { send_command(NINE); }
-
void up() { send_command(UP_K); }
-
void left() { send_command(LEFT_K); }
-
void right() { send_command(RIGHT_K); }
-
void down() { send_command(DOWN_K); }
60
void ret() { send_command(RETURN); }
-
void exit() { send_command(EXIT); }
-
void a() { send_command(A); }
-
void b() { send_command(B); }
-
void c() { send_command(C); }
65
void d() { send_command(D); }
-
void txt() { send_command(TXT); }
-
void pip() { send_command(PIP); }
-
void pre_ch() { send_command(PRE_CH); }
-
void search() { send_command(SEARCH); }
70
void vol_up() { send_command(VOL_UP); }
-
void vol_down() { send_command(VOL_DOWN); }
-
void dual() { send_command(DUAL); }
-
void usb_hub() { send_command(USB_HUB); }
-
void mute() { send_command(MUTE); }
75
void p_size() { send_command(P_SIZE); }
-
void ch_list() { send_command(CH_LIST); }
-
void subtitle() { send_command(SUBTITLE); }
-
void prog_up() { send_command(PROG_UP); }
-
void prog_down() { send_command(PROG_DOWN); }
80
void pause() { send_command(PAUSE); }
-
void rewind() { send_command(REWIND); }
-
void forward() { send_command(FORWARD); }
-
void menu() { send_command(MENU); }
-
void smart_tv() { send_command(SMART_TV); }
85
void record() { send_command(RECORD); }
-
void play() { send_command(PLAY); }
-
void stop() { send_command(STOP); }
-
};
-
The code starts with an enumeration that contains all the constants we need:
the length of each control code (
CMD_LEN
) and the control codes themselves.
There’s one entry in the enumeration for each key on our remote control.
In line 33, we define an
IRsend
object named
tv
that we’ll use to send commands
using the
send_command
method.
send_command
uses
IRsend
’s
sendSAMSUNG
method
because in this example we’re using a Samsung remote control. If you’re using
a device from Sony or Sharp, you have to adjust the code accordingly. Note
report erratum • discuss
Cloning a Remote • 209
www.it-ebooks.info