+ CLockObject lock(&m_mutex);
+ m_iLastActive = GetTimeMs();
+ m_handler->HandleCommand(command);
+ m_condition.Signal();
+ return true;
+}
+
+void CCECBusDevice::PollVendorId(void)
+{
+ CLockObject lock(&m_mutex);
+ if (m_iLastActive > 0 && m_iLogicalAddress != CECDEVICE_BROADCAST &&
+ m_vendor.vendor == CEC_VENDOR_UNKNOWN &&
+ GetTimeMs() - m_iLastActive > 5000)
+ {
+ m_iLastActive = GetTimeMs();
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
+ if (m_processor->Transmit(command))
+ m_condition.Wait(&m_mutex, 1000);
+ }
+}
+
+bool CCECBusDevice::PowerOn(void)
+{
+ CStdString strLog;
+ strLog.Format("<< powering on device with logical address %d", (int8_t)m_iLogicalAddress);
+ AddLog(CEC_LOG_DEBUG, strLog.c_str());
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_IMAGE_VIEW_ON);
+
+ return m_processor->Transmit(command);
+}
+
+bool CCECBusDevice::Standby(void)
+{
+ CStdString strLog;
+ strLog.Format("<< putting device with logical address %d in standby mode", (int8_t)m_iLogicalAddress);
+ AddLog(CEC_LOG_DEBUG, strLog.c_str());
+
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_STANDBY);
+
+ return m_processor->Transmit(command);
+}
+
+/** @name Getters */
+//@{
+cec_version CCECBusDevice::GetCecVersion(void)
+{
+ if (m_cecVersion == CEC_VERSION_UNKNOWN)
+ {
+ if (!MyLogicalAddressContains(m_iLogicalAddress))
+ {
+ AddLog(CEC_LOG_NOTICE, "<< requesting CEC version");
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_CEC_VERSION);
+ CLockObject lock(&m_mutex);
+ if (m_processor->Transmit(command))
+ m_condition.Wait(&m_mutex, 1000);
+ }
+ }
+
+ return m_cecVersion;
+}
+
+cec_menu_language &CCECBusDevice::GetMenuLanguage(void)
+{
+ if (!strcmp(m_menuLanguage.language, "???"))
+ {
+ if (!MyLogicalAddressContains(m_iLogicalAddress))
+ {
+ AddLog(CEC_LOG_NOTICE, "<< requesting menu language");
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_MENU_LANGUAGE);
+ CLockObject lock(&m_mutex);
+ if (m_processor->Transmit(command))
+ m_condition.Wait(&m_mutex, 1000);
+ }
+ }
+
+ return m_menuLanguage;
+}
+
+cec_logical_address CCECBusDevice::GetMyLogicalAddress(void) const
+{
+ return m_processor->GetLogicalAddress();