return peripheral;
}
-void CPeripherals::OnDeviceAdded(const CPeripheralBus &bus, const CStdString &strLocation)
+void CPeripherals::OnDeviceAdded(const CPeripheralBus &bus, const CPeripheral &peripheral)
{
CGUIDialogPeripheralManager *dialog = (CGUIDialogPeripheralManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_MANAGER);
if (dialog && dialog->IsActive())
dialog->Update();
- CPeripheral *peripheral = GetByPath(strLocation);
- if (peripheral)
- CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35005), peripheral->DeviceName());
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35005), peripheral.DeviceName());
}
-void CPeripherals::OnDeviceDeleted(const CPeripheralBus &bus, const CStdString &strLocation)
+void CPeripherals::OnDeviceDeleted(const CPeripheralBus &bus, const CPeripheral &peripheral)
{
CGUIDialogPeripheralManager *dialog = (CGUIDialogPeripheralManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_MANAGER);
if (dialog && dialog->IsActive())
dialog->Update();
- CPeripheral *peripheral = GetByPath(strLocation);
- if (peripheral)
- CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35006), peripheral->DeviceName());
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35006), peripheral.DeviceName());
}
int CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, const PeripheralType classType, int iVendorId, int iProductId) const
/*!
* @brief Called when a device has been added to a bus.
* @param bus The bus the device was added to.
- * @param strLocation The path of the fileitem.
+ * @param peripheral The peripheral that has been added.
*/
- virtual void OnDeviceAdded(const CPeripheralBus &bus, const CStdString &strLocation);
+ virtual void OnDeviceAdded(const CPeripheralBus &bus, const CPeripheral &peripheral);
/*!
* @brief Called when a device has been deleted from a bus.
* @param bus The bus from which the device removed.
- * @param strLocation The path of the fileitem.
+ * @param peripheral The peripheral that has been removed.
*/
- virtual void OnDeviceDeleted(const CPeripheralBus &bus, const CStdString &strLocation);
+ virtual void OnDeviceDeleted(const CPeripheralBus &bus, const CPeripheral &peripheral);
/*!
* @brief Creates a new instance of a peripheral.
m_peripherals.erase(m_peripherals.begin() + iDevicePtr);
lock.Leave();
- m_manager->OnDeviceDeleted(*this, peripheral->FileLocation());
+ m_manager->OnDeviceDeleted(*this, *peripheral);
delete peripheral;
}
}
CLog::Log(LOGNOTICE, "%s - new %s device registered on %s->%s: %s (%s:%s)", __FUNCTION__, PeripheralTypeTranslator::TypeToString(peripheral->Type()), PeripheralTypeTranslator::BusTypeToString(m_type), peripheral->Location().c_str(), peripheral->DeviceName().c_str(), peripheral->VendorIdAsString(), peripheral->ProductIdAsString());
lock.Leave();
- m_manager->OnDeviceAdded(*this, peripheral->FileLocation());
+ m_manager->OnDeviceAdded(*this, *peripheral);
}
}
case CEC_OPCODE_STANDBY:
/* a device was put in standby mode */
CLog::Log(LOGDEBUG, "%s - device %d was put in standby mode", __FUNCTION__, command.initiator);
- if (command.initiator == CECDEVICE_TV && GetSettingBool("standby_pc_on_tv_standby"))
+ if (command.initiator == CECDEVICE_TV && GetSettingBool("standby_pc_on_tv_standby") &&
+ (!m_screensaverLastActivated.IsValid() || CDateTime::GetCurrentDateTime() - m_screensaverLastActivated > CDateTimeSpan(0, 0, 0, SCREENSAVER_TIMEOUT)))
{
- if (!m_screensaverLastActivated.IsValid() || CDateTime::GetCurrentDateTime() - m_screensaverLastActivated > CDateTimeSpan(0, 0, 0, SCREENSAVER_TIMEOUT))
- {
- m_bStarted = false;
- g_application.getApplicationMessenger().Suspend();
- }
+ m_bStarted = false;
+ g_application.getApplicationMessenger().Suspend();
}
break;
default: