DeviceList.hpp
1 #pragma once
2 #include <Device/Protocol/DeviceInterface.hpp>
3 #include <Device/Protocol/DeviceSettings.hpp>
4 
5 #include <QString>
6 
7 #include <score_plugin_deviceexplorer_export.h>
8 
9 #include <functional>
10 #include <vector>
11 #include <verdigris>
12 
13 namespace Device
14 {
15 
25 class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT DeviceList : public QObject
26 {
27  W_OBJECT(DeviceList)
28 public:
29  DeviceInterface& device(const QString& name) const;
30  DeviceInterface& device(const Device::Node& name) const;
31 
32  DeviceInterface* findDevice(const QString& name) const;
33 
34  void addDevice(DeviceInterface* dev);
35  void removeDevice(const QString& name);
36 
37  void apply(std::function<void(Device::DeviceInterface&)>);
38  void setLogging(bool);
39 
40  void setLocalDevice(DeviceInterface*);
41  void setAudioDevice(DeviceInterface* dev) { m_audioDevice = dev; }
42  DeviceInterface* localDevice() const { return m_localDevice; }
43  DeviceInterface* audioDevice() const { return m_audioDevice; }
44  const std::vector<DeviceInterface*>& devices() const;
45 
46 public:
47  void logInbound(const QString& arg_1) const
48  E_SIGNAL(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, logInbound, arg_1)
49  void logOutbound(const QString& arg_1) const
50  E_SIGNAL(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, logOutbound, arg_1)
51  void logError(const QString& arg_1) const
52  E_SIGNAL(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, logError, arg_1)
53 
54  void deviceAdded(DeviceInterface* dev) const
55  E_SIGNAL(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, deviceAdded, dev)
56  void deviceRemoved(DeviceInterface* dev) const
57  E_SIGNAL(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, deviceRemoved, dev)
58 
59 private:
60  std::vector<DeviceInterface*> m_devices;
61  DeviceInterface *m_localDevice{}, *m_audioDevice{};
62  bool m_logging = false;
63 };
64 }
65 
66 W_REGISTER_ARGTYPE(Device::DeviceInterface*)
Definition: DeviceInterface.hpp:66
The DeviceList class.
Definition: DeviceList.hpp:26
Manipulation of Devices from Qt.
Definition: AddressSettings.cpp:14