+ // check all clients
+ for (vector<CCECClient *>::iterator it = m_clients.begin(); it != m_clients.end(); it++)
+ (*it)->CheckKeypressTimeout();
+}
+
+void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...)
+{
+ CStdString strLog;
+
+ // format the message
+ va_list argList;
+ va_start(argList, strFormat);
+ strLog.FormatV(strFormat, argList);
+ va_end(argList);
+
+ cec_log_message message;
+ message.level = level;
+ message.time = GetTimeMs() - m_iStartTime;
+ snprintf(message.message, sizeof(message.message), "%s", strLog.c_str());
+
+ // send the message to all clients
+ for (vector<CCECClient *>::iterator it = m_clients.begin(); it != m_clients.end(); it++)
+ (*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
+ for (vector<CCECClient *>::iterator it = m_clients.begin(); it != m_clients.end(); it++)
+ (*it)->Alert(type, param);
+}
+
+CCECClient *CLibCEC::RegisterClient(libcec_configuration &configuration)
+{
+ if (!m_cec)
+ return NULL;
+
+ // create a new client instance
+ CCECClient *newClient = new CCECClient(m_cec, configuration);
+ if (!newClient)
+ return NULL;
+ m_clients.push_back(newClient);
+
+ // if the default client isn't set, set it
+ if (!m_client)
+ m_client = newClient;
+
+ // register the new client
+ if (m_cec->CECInitialised())
+ m_cec->RegisterClient(newClient);
+
+ return newClient;