swift
contextaudioimpl.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include <QPointer>
7 #include <QTimer>
8 #include <QtGlobal>
9 
11 #include "misc/dbusserver.h"
12 
13 using namespace swift::misc;
14 using namespace swift::misc::audio;
15 using namespace swift::misc::aviation;
16 using namespace swift::core::afv::clients;
17 
18 namespace swift::core::context
19 {
20  CContextAudio::CContextAudio(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime)
21  : CContextAudioBase(mode, runtime)
22  {
24  Qt::QueuedConnection);
25  }
26 
28  {
29  if (devices.isEmpty()) { return; }
30  m_registeredDevices.registerDevices(devices);
31  }
32 
34  {
35  m_registeredDevices.unRegisterDevices(devices);
36  }
37 
39  {
40  m_registeredDevices.unRegisterDevices(identifier);
41  }
42 
43  void CContextAudio::registerAudioCallsign(const CCallsign &callsign, const CIdentifier &identifier)
44  {
45  m_registeredCallsigns.insert(identifier, callsign);
46  }
47 
48  void CContextAudio::unRegisterAudioCallsign(const CCallsign &callsign, const CIdentifier &identifier)
49  {
50  m_registeredCallsigns.remove(identifier);
51  Q_UNUSED(callsign)
52  }
53 
55  {
56  for (const CCallsign &cs : m_registeredCallsigns.values())
57  {
58  if (callsign == cs) { return true; }
59  }
60  return false;
61  }
62 
63  CAudioDeviceInfoList CContextAudio::getRegisteredDevices() const { return m_registeredDevices; }
64 
65 } // namespace swift::core::context
ContextMode
How to handle a given context.
The class providing facades (the contexts) for all DBus relevant operations.
Definition: corefacade.h:57
void changedLocalAudioDevices(const swift::misc::audio::CAudioDeviceInfoList &devices)
Changed audio devices (e.g. device enabled/disable)
void registerAudioCallsign(const swift::misc::aviation::CCallsign &callsign, const swift::misc::CIdentifier &identifier)
Register an audio callsign (used with AFV)
void unRegisterDevices(const swift::misc::audio::CAudioDeviceInfoList &devices)
Unregister devices.
void registerDevices(const swift::misc::audio::CAudioDeviceInfoList &devices)
Register a device on a machine (for core/GUI it will return all known devices on all machines)
void unRegisterDevicesFor(const swift::misc::CIdentifier &identifier)
Remove all devices for identifier (i.e. "a machine")
void unRegisterAudioCallsign(const swift::misc::aviation::CCallsign &callsign, const swift::misc::CIdentifier &identifier)
Un-register an audio callsign (used with AFV)
misc::audio::CAudioDeviceInfoList getRegisteredDevices() const
All registered devices.
bool hasRegisteredAudioCallsign(const swift::misc::aviation::CCallsign &callsign) const
Un-register an audio callsign (used with AFV)
void onChangedLocalDevices(const swift::misc::audio::CAudioDeviceInfoList &devices)
Devices have been changed.
const CIdentifier & identifier() const
Get identifier.
Definition: identifiable.h:27
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition: identifier.h:29
bool isEmpty() const
Synonym for empty.
Definition: sequence.h:285
Value object encapsulating a list of audio devices.
void unRegisterDevices(const CAudioDeviceInfoList &devices)
Un-register devices.
void registerDevices(const CAudioDeviceInfoList &devices)
Register devices.
Value object encapsulating information of a callsign.
Definition: callsign.h:30
Free functions in swift::misc.