void CCECClient::AddCommand(const cec_command &command)
{
- CLockObject lock(m_mutex);
+ if (command.destination == CECDEVICE_BROADCAST || GetLogicalAddresses().IsSet(command.destination))
+ {
+ CLockObject lock(m_mutex);
- LIB_CEC->AddLog(CEC_LOG_NOTICE, ">> %s (%X) -> %s (%X): %s (%2X)", ToString(command.initiator), command.initiator, ToString(command.destination), command.destination, ToString(command.opcode), command.opcode);
+ LIB_CEC->AddLog(CEC_LOG_NOTICE, ">> %s (%X) -> %s (%X): %s (%2X)", ToString(command.initiator), command.initiator, ToString(command.destination), command.destination, ToString(command.opcode), command.opcode);
- if (m_configuration.callbacks && m_configuration.callbacks->CBCecCommand)
- m_configuration.callbacks->CBCecCommand(m_configuration.callbackParam, command);
- else if (!m_commandBuffer.Push(command))
- LIB_CEC->AddLog(CEC_LOG_WARNING, "command buffer is full");
+ if (m_configuration.callbacks && m_configuration.callbacks->CBCecCommand)
+ m_configuration.callbacks->CBCecCommand(m_configuration.callbackParam, command);
+ else if (!m_commandBuffer.Push(command))
+ LIB_CEC->AddLog(CEC_LOG_WARNING, "command buffer is full");
+ }
}
int CCECClient::MenuStateChanged(const cec_menu_state newState)
(*it)->AddLog(message);
}
+void CLibCEC::AddCommand(const cec_command &command)
+{
+ // send the command to all clients
+ for (vector<CCECClient *>::iterator it = m_clients.begin(); it != m_clients.end(); it++)
+ (*it)->AddCommand(command);
+}
+
void CLibCEC::Alert(const libcec_alert type, const libcec_parameter ¶m)
{
// send the alert to all clients
// no longer being used
void CLibCEC::AddKey(const cec_keypress &UNUSED(key)) {}
-void CLibCEC::AddCommand(const cec_command &UNUSED(command)) {}
void CLibCEC::ConfigurationChanged(const libcec_configuration &UNUSED(config)) {}
void CLibCEC::SetCurrentButton(cec_user_control_code UNUSED(iButtonCode)) {}
CLibCEC *CLibCEC::GetInstance(void) { return NULL; }
void AddLog(const cec_log_level level, const char *strFormat, ...);
static void AddKey(void) {} //UNUSED
static void AddKey(const cec_keypress &key); //UNUSED
- static void AddCommand(const cec_command &command); //UNUSED
+ void AddCommand(const cec_command &command);
static void ConfigurationChanged(const libcec_configuration &config); //UNUSED
static void SetCurrentButton(cec_user_control_code iButtonCode); //UNUSED
void CheckKeypressTimeout(void);