- if (m_currentframe[2] <= CEC_USER_CONTROL_CODE_MAX)
- m_controller->SetCurrentButton((cec_user_control_code) m_currentframe[2]);
- }
- break;
- case CEC_OPCODE_USER_CONTROL_RELEASE:
- m_controller->AddKey();
- break;
- default:
- cec_frame params = m_currentframe;
- params.erase(params.begin(), params.begin() + 2);
- m_controller->AddCommand((cec_logical_address) initiator, (cec_logical_address) destination, opCode, ¶ms);
- break;
- }
- }
- else if (destination == (uint8_t) CECDEVICE_BROADCAST)
- {
- if (opCode == CEC_OPCODE_REQUEST_ACTIVE_SOURCE)
- {
- BroadcastActiveSource();
- }
- else if (opCode == CEC_OPCODE_SET_STREAM_PATH)
- {
- if (m_currentframe.size() >= 4)
- {
- int streamaddr = ((int)m_currentframe[2] << 8) | ((int)m_currentframe[3]);
- CStdString strLog;
- 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 = m_currentframe;
- params.erase(params.begin(), params.begin() + 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());
- }
+void CCECProcessor::AddCommand(const cec_command &command)
+{
+ m_controller->AddCommand(command);
+}
+
+void CCECProcessor::AddKey(void)
+{
+ m_controller->AddKey();
+}
+
+void CCECProcessor::AddLog(cec_log_level level, const CStdString &strMessage)
+{
+ m_controller->AddLog(level, strMessage);
+}
+
+bool CCECProcessor::SetAckMask(uint16_t iMask)
+{
+ bool bReturn(false);
+ CStdString strLog;
+ strLog.Format("setting ackmask to %2x", iMask);
+ m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
+
+ CCECAdapterMessage *output = new CCECAdapterMessage;
+
+ output->push_back(MSGSTART);
+ output->push_escaped(MSGCODE_SET_ACK_MASK);
+ output->push_escaped(iMask >> 8);
+ output->push_escaped((uint8_t)iMask);
+ output->push_back(MSGEND);
+
+ if ((bReturn = Transmit(output)) == false)
+ m_controller->AddLog(CEC_LOG_ERROR, "could not set the ackmask");
+
+ delete output;
+
+ return bReturn;