mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T739, added proxy functions for audio context to register devices (from multiple machines)
This commit is contained in:
committed by
Mat Sutcliffe
parent
c38c8374a3
commit
fdf4bf6b57
@@ -190,6 +190,15 @@ namespace BlackCore
|
||||
//! \copydoc IContextAudio::parseCommandLine
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||
|
||||
//! Register a device on a machine (for core/GUI it will return all known devices on all machines)
|
||||
virtual void registerDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices) = 0;
|
||||
|
||||
//! Unregister devices
|
||||
virtual void unRegisterDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices) = 0;
|
||||
|
||||
//! All registered devices
|
||||
virtual BlackMisc::Audio::CAudioDeviceInfoList getRegisteredDevices() const = 0;
|
||||
|
||||
// ------------- DBus ---------------
|
||||
|
||||
private:
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Audio;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -31,5 +32,21 @@ namespace BlackCore
|
||||
return this;
|
||||
}
|
||||
|
||||
void CContextAudio::registerDevices(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
if (devices.isEmpty()) { return; }
|
||||
m_registeredDevices.registerDevices(devices);
|
||||
}
|
||||
|
||||
void CContextAudio::unRegisterDevices(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
m_registeredDevices.unRegisterDevices(devices);
|
||||
}
|
||||
|
||||
CAudioDeviceInfoList CContextAudio::getRegisteredDevices() const
|
||||
{
|
||||
return m_registeredDevices;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -45,7 +45,9 @@ namespace BlackCore
|
||||
// Interface implementations
|
||||
//! \publicsection
|
||||
//! @{
|
||||
// ---- FUNCTIONS GO HERE ----
|
||||
virtual void registerDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices) override;
|
||||
virtual void unRegisterDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices) override;
|
||||
virtual BlackMisc::Audio::CAudioDeviceInfoList getRegisteredDevices() const override;
|
||||
//! @}
|
||||
|
||||
protected:
|
||||
@@ -54,6 +56,9 @@ namespace BlackCore
|
||||
|
||||
//! Register myself in DBus
|
||||
CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server);
|
||||
|
||||
private:
|
||||
BlackMisc::Audio::CAudioDeviceInfoList m_registeredDevices;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace BlackCore
|
||||
{
|
||||
CContextAudioProxy::CContextAudioProxy(const QString &serviceName, QDBusConnection &connection, CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) : IContextAudio(mode, runtime), m_dBusInterface(nullptr)
|
||||
{
|
||||
this->m_dBusInterface = new BlackMisc::CGenericDBusInterface(
|
||||
this->m_dBusInterface = new CGenericDBusInterface(
|
||||
serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(), connection, this);
|
||||
this->relaySignals(serviceName, connection);
|
||||
}
|
||||
@@ -40,6 +40,23 @@ namespace BlackCore
|
||||
Q_UNUSED(c)
|
||||
}
|
||||
|
||||
void CContextAudioProxy::registerDevices(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
if (devices.isEmpty()) { return; }
|
||||
m_dBusInterface->callDBus(QLatin1String("registerDevices"));
|
||||
}
|
||||
|
||||
void CContextAudioProxy::unRegisterDevices(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
if (devices.isEmpty()) { return; }
|
||||
m_dBusInterface->callDBus(QLatin1String("unRegisterDevices"));
|
||||
}
|
||||
|
||||
CAudioDeviceInfoList CContextAudioProxy::getRegisteredDevices() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::Audio::CAudioDeviceInfoList>(QLatin1String("getRegisteredDevices"));
|
||||
}
|
||||
|
||||
void CContextAudioProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
/**
|
||||
@@ -51,14 +68,6 @@ namespace BlackCore
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"changedAudioDevices", this, SIGNAL(changedAudioDevices(BlackMisc::Audio::CAudioDeviceInfoList)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"changedSelectedAudioDevices", this, SIGNAL(changedSelectedAudioDevices(BlackMisc::Audio::CAudioDeviceInfoList)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"ptt", this, SIGNAL(ptt(bool, BlackMisc::Audio::PTTCOM, BlackMisc::CIdentifier)));
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s)
|
||||
**/
|
||||
|
||||
this->relayBaseClassSignals(serviceName, connection, IContextAudio::ObjectPath(), IContextAudio::InterfaceName());
|
||||
|
||||
@@ -58,10 +58,13 @@ namespace BlackCore
|
||||
static void unitTestRelaySignals();
|
||||
|
||||
public slots:
|
||||
// interface overrides
|
||||
//! All Dbus xsinterface overrides
|
||||
//! \publicsection
|
||||
//! @{
|
||||
// ------ functions GO HERE -------
|
||||
//! Register a device on a machine (for core/GUI it will return all known devices on all machines)
|
||||
virtual void registerDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices) override;
|
||||
virtual void unRegisterDevices(const BlackMisc::Audio::CAudioDeviceInfoList &devices) override;
|
||||
virtual BlackMisc::Audio::CAudioDeviceInfoList getRegisteredDevices() const override;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user