- cec_opcode opCode = (cec_opcode) frame.data[1];
- if (destination == (uint16_t) m_iLogicalAddress)
- {
- switch(opCode)
- {
- case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
- ReportPhysicalAddress();
- break;
- case CEC_OPCODE_GIVE_OSD_NAME:
- ReportOSDName((cec_logical_address)initiator);
- break;
- case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
- ReportVendorID((cec_logical_address)initiator);
- break;
- case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
- frame.shift(2);
- ParseVendorId((cec_logical_address)initiator, frame);
- TransmitAbort((cec_logical_address)initiator, CEC_OPCODE_VENDOR_COMMAND_WITH_ID);
- break;
- case CEC_OPCODE_GIVE_DECK_STATUS:
- // need to support opcodes play and deck control before doing anything with this
- TransmitAbort((cec_logical_address)initiator, CEC_OPCODE_GIVE_DECK_STATUS);
- break;
- case CEC_OPCODE_MENU_REQUEST:
- ReportMenuState((cec_logical_address)initiator);
- break;
- case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
- ReportPowerState((cec_logical_address)initiator);
- SetActiveView();
- break;
- case CEC_OPCODE_GET_CEC_VERSION:
- ReportCECVersion((cec_logical_address)initiator);
- break;
- case CEC_OPCODE_USER_CONTROL_PRESSED:
- if (frame.size > 2)
- {
- m_controller->AddKey();
-
- if (frame.data[2] <= CEC_USER_CONTROL_CODE_MAX)
- m_controller->SetCurrentButton((cec_user_control_code) frame.data[2]);
- }
- break;
- case CEC_OPCODE_USER_CONTROL_RELEASE:
- m_controller->AddKey();
- break;
- default:
- frame.shift(2);
- m_controller->AddCommand((cec_logical_address) initiator, (cec_logical_address) destination, opCode, &frame);
- break;
- }
- }
- else if (destination == (uint8_t) CECDEVICE_BROADCAST)
- {
- CStdString strLog;
- if (opCode == CEC_OPCODE_REQUEST_ACTIVE_SOURCE)
- {
- strLog.Format(">> %i requests active source", initiator);
- m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
- BroadcastActiveSource();
- }
- else if (opCode == CEC_OPCODE_SET_STREAM_PATH)
- {
- if (frame.size >= 4)
- {
- int streamaddr = ((int)frame.data[2] << 8) | ((int)frame.data[3]);
- strLog.Format(">> %i requests stream path from physical address %04x", initiator, streamaddr);
- m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
- if (streamaddr == m_physicaladdress)
- BroadcastActiveSource();
- }
- }
- else
- {
- cec_frame params = frame;
- frame.shift(2);
- m_controller->AddCommand((cec_logical_address) initiator, (cec_logical_address) destination, opCode, ¶ms);
- }
- }
- else
- {
- CStdString strLog;
- strLog.Format("ignoring frame: destination: %u != %u", destination, (uint16_t)m_iLogicalAddress);
- m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
- }