void CPeripheralBusAddon::Register(const PeripheralPtr& peripheral) { if (!peripheral) return; PeripheralAddonPtr addon; unsigned int peripheralIndex; CSingleLock lock(m_critSection); if (SplitLocation(peripheral->Location(), addon, peripheralIndex)) { if (addon->Register(peripheralIndex, peripheral)) m_manager.OnDeviceAdded(*this, *peripheral); } }
void CPeripheralBus::Register(const PeripheralPtr& peripheral) { if (!peripheral) return; bool bPeripheralAdded = false; { CSingleLock lock(m_critSection); if (!HasPeripheral(peripheral->Location())) { m_peripherals.push_back(peripheral); bPeripheralAdded = true; } } if (bPeripheralAdded) { 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()); m_manager.OnDeviceAdded(*this, *peripheral); } }
bool CPeripheralAddon::Register(unsigned int peripheralIndex, const PeripheralPtr& peripheral) { if (!peripheral) return false; CSingleLock lock(m_critSection); if (m_peripherals.find(peripheralIndex) == m_peripherals.end()) { if (peripheral->Type() == PERIPHERAL_JOYSTICK) { m_peripherals[peripheralIndex] = std::static_pointer_cast<CPeripheralJoystick>(peripheral); CLog::Log(LOGNOTICE, "%s - new %s device registered on %s->%s: %s", __FUNCTION__, PeripheralTypeTranslator::TypeToString(peripheral->Type()), PeripheralTypeTranslator::BusTypeToString(PERIPHERAL_BUS_ADDON), peripheral->Location().c_str(), peripheral->DeviceName().c_str()); return true; } } return false; }