2 #include <Device/Node/DeviceNode.hpp>
3 #include <Device/Protocol/DeviceSettings.hpp>
5 #include <ossia/detail/callback_container.hpp>
6 #include <ossia/network/base/value_callback.hpp>
8 #include <ossia-qt/device_metatype.hpp>
10 #include <nano_signal_slot.hpp>
11 #include <score_lib_device_export.h>
17 struct DocumentContext;
29 struct network_context;
30 using network_context_ptr = std::shared_ptr<network_context>;
38 struct FullAddressSettings;
42 bool canAddNode{
true};
43 bool canRemoveNode{
true};
44 bool canRenameNode{
true};
45 bool canSetProperties{
true};
46 bool canDisconnect{
true};
47 bool canRefreshValue{
true};
48 bool canRefreshTree{
false};
49 bool asyncConnect{
false};
51 bool canSerialize{
true};
53 bool hasCallbacks{
true};
56 enum DeviceLogging : int8_t
65 ,
public Nano::Observer
74 const QString& name()
const noexcept;
79 virtual DeviceResources usedResources()
const noexcept;
81 virtual void disconnect();
82 virtual bool reconnect() = 0;
85 virtual bool connected()
const;
97 void addToListening(
const std::vector<State::Address>&);
98 std::vector<State::Address> listening()
const;
101 virtual void updateAddress(
105 void sendMessage(
const State::Address& addr,
const ossia::value& v);
111 bool isLogging()
const;
112 void setLogging(DeviceLogging);
114 virtual ossia::net::device_base* getDevice()
const = 0;
116 virtual bool isLearning()
const;
117 virtual void setLearning(
bool);
119 virtual QMimeData* mimeData()
const;
120 virtual void setupContextMenu(QMenu&)
const;
122 void nodeCreated(
const ossia::net::node_base&);
123 void nodeRemoving(
const ossia::net::node_base&);
124 void nodeRenamed(
const ossia::net::node_base&, std::string);
125 void addressCreated(
const ossia::net::parameter_base&);
126 void addressUpdated(
const ossia::net::node_base&, ossia::string_view key);
127 void addressRemoved(
const ossia::net::parameter_base& addr);
129 Nano::Signal<void(
const State::Address&,
const ossia::value&)> valueUpdated;
134 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, pathAdded, arg_1)
138 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, pathUpdated, arg_1, arg_2)
140 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, pathRemoved, arg_1)
143 void namespaceUpdated() E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, namespaceUpdated)
146 void deviceChanged(ossia::net::device_base* old_dev, ossia::net::device_base* new_dev)
147 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, deviceChanged, old_dev, new_dev)
151 void logInbound(
const QString& arg_1)
const
152 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, logInbound, arg_1)
153 void logOutbound(
const QString& arg_1)
const
154 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, logOutbound, arg_1)
156 void connectionChanged(
bool arg_1)
const
157 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, connectionChanged, arg_1)
163 using callback_pair = std::pair<
164 ossia::net::parameter_base*,
165 ossia::callback_container<ossia::value_callback>::iterator>;
166 score::hash_map<State::Address, callback_pair> m_callbacks;
168 void removeListening_impl(ossia::net::node_base& node,
State::Address addr);
169 void removeListening_impl(
170 ossia::net::node_base& node,
State::Address addr, std::vector<State::Address>&);
171 void renameListening_impl(
const State::Address& parent,
const QString& newName);
172 void setLogging_impl(DeviceLogging)
const;
173 void enableCallbacks();
174 void disableCallbacks();
180 DeviceLogging m_logging = DeviceLogging::LogNothing;
181 bool m_callbacksEnabled =
false;
188 void replaceDevice(ossia::net::device_base*);
189 void releaseDevice();
192 void disconnect()
override;
194 using DeviceInterface::DeviceInterface;
196 ossia::net::device_base* getDevice()
const final override {
return m_dev.get(); }
198 std::unique_ptr<ossia::net::device_base> m_dev;
202 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
203 getNodeFromPath(
const QStringList& path, ossia::net::device_base& dev);
205 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
206 createNodeFromPath(
const QStringList& path, ossia::net::device_base& dev);
208 SCORE_LIB_DEVICE_EXPORT
Device::Node ToDeviceExplorer(
const ossia::net::node_base& node);
210 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
211 findNodeFromPath(
const Device::Node& path, ossia::net::device_base& dev);
213 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
214 findNodeFromPath(
const QStringList& path, ossia::net::device_base& dev);
216 SCORE_LIB_DEVICE_EXPORT
218 ossia::net::network_context& ctx, std::unique_ptr<ossia::net::device_base> dev);
Definition: DeviceInterface.hpp:66
Definition: DeviceInterface.hpp:185
Manipulation of Devices from Qt.
Definition: AddressSettings.cpp:14
Utilities for OSSIA data structures.
Definition: DeviceInterface.hpp:33
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: AddressSettings.hpp:49
Definition: DeviceInterface.hpp:41
Definition: DeviceSettings.hpp:20
Definition: AddressSettings.hpp:62
The Address struct.
Definition: Address.hpp:58
The Message struct.
Definition: Message.hpp:15