swift
Loading...
Searching...
No Matches
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 <algorithm>
7
8#include <QPointer>
9#include <QTimer>
10#include <QtGlobal>
11
13#include "misc/dbusserver.h"
14
15using namespace swift::misc;
16using namespace swift::misc::audio;
17using namespace swift::misc::aviation;
18using namespace swift::core::afv::clients;
19
20namespace swift::core::context
21{
28
30 {
31 if (devices.isEmpty())
32 {
33 return;
34 }
35 m_registeredDevices.registerDevices(devices);
36 }
37
39 {
40 m_registeredDevices.unRegisterDevices(devices);
41 }
42
44 {
45 m_registeredDevices.unRegisterDevices(identifier);
46 }
47
49 {
50 m_registeredCallsigns.insert(identifier, callsign);
51 }
52
54 {
55 m_registeredCallsigns.remove(identifier);
56 Q_UNUSED(callsign)
57 }
58
60 {
61 return std::ranges::any_of(m_registeredCallsigns, [&](const CCallsign &cs) { return callsign == cs; });
62 }
63
64 CAudioDeviceInfoList CContextAudio::getRegisteredDevices() const { return m_registeredDevices; }
65
66} // namespace swift::core::context
ContextMode
How to handle a given context.
void changedLocalAudioDevices(const swift::misc::audio::CAudioDeviceInfoList &devices)
Changed audio devices (e.g. device enabled/disable).
CContextAudioBase(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime)
Constructor.
CContextAudio(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime)
Constructor.
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.
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.
Value object encapsulating information of a callsign.
Definition callsign.h:30
Free functions in swift::misc.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QueuedConnection