28 #include "ccec/CECFrame.hpp"
29 #include "ccec/Header.hpp"
30 #include "ccec/Operand.hpp"
31 #include "ccec/Operands.hpp"
32 #include "ccec/MessageProcessor.hpp"
33 #include "ccec/MessageDecoder.hpp"
34 #include "ccec/Exception.hpp"
35 #include "ccec/Util.hpp"
39 void MessageDecoder::decode(
const CECFrame &in_)
41 const int HEADER_OFFSET = 0;
42 const int OPCODE_OFFSET = 1;
43 const int OPRAND_OFFSET = 2;
45 Header header(in_, HEADER_OFFSET);
47 if (in_.length() == 1) {
49 processor.process(
Polling(), header);
53 CECFrame in = in_.subFrame(OPRAND_OFFSET);
57 switch (
OpCode(in_, OPCODE_OFFSET).opCode()) {
70 case REQUEST_ACTIVE_SOURCE:
74 CCEC_LOG( LOG_DEBUG,
"Decoding STANDBY\r\n");
75 processor.process(
Standby(), header);
83 case SET_MENU_LANGUAGE:
89 case GIVE_PHYSICAL_ADDRESS:
92 case REPORT_PHYSICAL_ADDRESS:
95 case GIVE_DEVICE_VENDOR_ID:
101 case ROUTING_INFORMATION:
104 case SET_STREAM_PATH:
107 case GET_MENU_LANGUAGE:
110 case DEVICE_VENDOR_ID:
116 case VENDOR_COMMAND_WITH_ID:
119 case VENDOR_REMOTE_BUTTON_DOWN:
122 case VENDOR_REMOTE_BUTTON_UP:
131 case USER_CONTROL_RELEASED:
134 case USER_CONTROL_PRESSED:
137 case GIVE_DEVICE_POWER_STATUS:
140 case REPORT_POWER_STATUS:
147 processor.process(
Abort(), header);
155 case REQUEST_SHORT_AUDIO_DESCRIPTOR:
159 case REPORT_SHORT_AUDIO_DESCRIPTOR:
162 case SYSTEM_AUDIO_MODE_REQUEST:
165 case SET_SYSTEM_AUDIO_MODE:
168 case REPORT_AUDIO_STATUS :
172 CCEC_LOG( LOG_DEBUG,
"Unhandled Message Received \n");
173 OpCode(in_, OPCODE_OFFSET).print();
179 CCEC_LOG( LOG_EXP,
"MessageDecoder::decode caught %s \r\n",e.what());
181 catch(std::exception &e)
183 CCEC_LOG( LOG_EXP,
"MessageDecoder::decode caught an %s \r\n",e.what());
184 in_.hexDump(LOG_EXP);