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;
80 virtual void disconnect();
81 virtual bool reconnect() = 0;
84 virtual bool connected()
const;
96 void addToListening(
const std::vector<State::Address>&);
97 std::vector<State::Address> listening()
const;
100 virtual void updateAddress(
104 void sendMessage(
const State::Address& addr,
const ossia::value& v);
110 bool isLogging()
const;
111 void setLogging(DeviceLogging);
113 virtual ossia::net::device_base* getDevice()
const = 0;
115 virtual bool isLearning()
const;
116 virtual void setLearning(
bool);
118 virtual QMimeData* mimeData()
const;
119 virtual void setupContextMenu(QMenu&)
const;
121 void nodeCreated(
const ossia::net::node_base&);
122 void nodeRemoving(
const ossia::net::node_base&);
123 void nodeRenamed(
const ossia::net::node_base&, std::string);
124 void addressCreated(
const ossia::net::parameter_base&);
125 void addressUpdated(
const ossia::net::node_base&, ossia::string_view key);
126 void addressRemoved(
const ossia::net::parameter_base& addr);
128 Nano::Signal<void(
const State::Address&,
const ossia::value&)> valueUpdated;
133 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, pathAdded, arg_1)
137 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, pathUpdated, arg_1, arg_2)
139 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, pathRemoved, arg_1)
142 void namespaceUpdated() E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, namespaceUpdated)
145 void deviceChanged(ossia::net::device_base* old_dev, ossia::net::device_base* new_dev)
146 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, deviceChanged, old_dev, new_dev)
150 void logInbound(
const QString& arg_1)
const
151 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, logInbound, arg_1)
152 void logOutbound(
const QString& arg_1)
const
153 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, logOutbound, arg_1)
155 void connectionChanged(
bool arg_1)
const
156 E_SIGNAL(SCORE_LIB_DEVICE_EXPORT, connectionChanged, arg_1)
162 using callback_pair = std::pair<
163 ossia::net::parameter_base*,
164 ossia::callback_container<ossia::value_callback>::iterator>;
165 score::hash_map<State::Address, callback_pair> m_callbacks;
167 void removeListening_impl(ossia::net::node_base& node,
State::Address addr);
168 void removeListening_impl(
169 ossia::net::node_base& node,
State::Address addr, std::vector<State::Address>&);
170 void renameListening_impl(
const State::Address& parent,
const QString& newName);
171 void setLogging_impl(DeviceLogging)
const;
172 void enableCallbacks();
173 void disableCallbacks();
179 DeviceLogging m_logging = DeviceLogging::LogNothing;
180 bool m_callbacksEnabled =
false;
187 void replaceDevice(ossia::net::device_base*);
188 void releaseDevice();
191 void disconnect()
override;
193 using DeviceInterface::DeviceInterface;
195 ossia::net::device_base* getDevice()
const final override {
return m_dev.get(); }
197 std::unique_ptr<ossia::net::device_base> m_dev;
201 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
202 getNodeFromPath(
const QStringList& path, ossia::net::device_base& dev);
204 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
205 createNodeFromPath(
const QStringList& path, ossia::net::device_base& dev);
207 SCORE_LIB_DEVICE_EXPORT
Device::Node ToDeviceExplorer(
const ossia::net::node_base& node);
209 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
210 findNodeFromPath(
const Device::Node& path, ossia::net::device_base& dev);
212 SCORE_LIB_DEVICE_EXPORT ossia::net::node_base*
213 findNodeFromPath(
const QStringList& path, ossia::net::device_base& dev);
215 SCORE_LIB_DEVICE_EXPORT
217 ossia::net::network_context& ctx, std::unique_ptr<ossia::net::device_base> dev);
Definition: DeviceInterface.hpp:66
Definition: DeviceInterface.hpp:184
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:16
Definition: AddressSettings.hpp:62
The Address struct.
Definition: Address.hpp:58
The Message struct.
Definition: Message.hpp:15