NodeUpdateProxy.hpp
1 #pragma once
2 #include <State/Value.hpp>
3 
4 #include <Device/Node/DeviceNode.hpp>
5 
6 #include <QString>
7 
8 #include <score_plugin_deviceexplorer_export.h>
9 
10 namespace State
11 {
12 struct Address;
13 }
14 
15 namespace Device
16 {
17 struct AddressSettings;
18 struct DeviceSettings;
19 class DeviceInterface;
20 }
21 
22 namespace Explorer
23 {
24 class DeviceDocumentPlugin;
25 class DeviceExplorerModel;
39 class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT NodeUpdateProxy
40 {
41 public:
42  DeviceDocumentPlugin& devModel;
43 
44  explicit NodeUpdateProxy(DeviceDocumentPlugin& root);
45  NodeUpdateProxy(const NodeUpdateProxy&) = delete;
46  NodeUpdateProxy(NodeUpdateProxy&&) = delete;
47  NodeUpdateProxy& operator=(const NodeUpdateProxy&) = delete;
48  NodeUpdateProxy& operator=(NodeUpdateProxy&&) = delete;
49 
50  void addDevice(const Device::Node& node);
51  void loadDevice(const Device::Node& node);
52 
53  void updateDevice(const QString& name, const Device::DeviceSettings& dev);
54 
55  void removeDevice(const Device::DeviceSettings& dev);
56 
64  void addAddress(
65  const Device::NodePath& parentPath, const Device::AddressSettings& settings,
66  int row);
67 
68  void addAddress(const Device::FullAddressSettings& settings);
69 
75  void addNode(const Device::NodePath& parentPath, const Device::Node& node, int row);
76 
77  void updateAddress(
78  const Device::NodePath& nodePath, const Device::AddressSettings& settings);
79 
80  void removeNode(
81  const Device::NodePath& parentPath, const Device::AddressSettings& settings);
82 
83  // Local : the Device::Node structure
84  // Remote : what's behind a DeviceInterface
85  void
86  addLocalAddress(Device::Node& parent, const Device::AddressSettings& data, int row);
87  void addLocalAddresses(Device::Node& parent, Device::AddressSettings data, int row);
88 
89  void addLocalNode(Device::Node& parent, Device::Node&& node);
90 
91  void removeLocalNode(const State::Address&);
92  void updateLocalValue(const State::AddressAccessor&, const ossia::value&);
93  void updateLocalSettings(
95  Device::DeviceInterface& newdev);
96 
97  void updateRemoteValue(const State::Address&, const ossia::value&);
98 
99  ossia::value refreshRemoteValue(const State::Address&) const;
100  std::optional<ossia::value> try_refreshRemoteValue(const State::Address&) const;
101  void refreshRemoteValues(const Device::NodeList&);
102 
103 private:
104  void rec_addNode(Device::NodePath parentPath, const Device::Node& node, int row);
105 };
106 }
Definition: DeviceInterface.hpp:66
The NodeUpdateProxy class.
Definition: NodeUpdateProxy.hpp:40
Path in a tree of QAbstractItemModel objects.
Definition: TreePath.hpp:34
Manipulation of Devices from Qt.
Definition: AddressSettings.cpp:14
Utilities for OSSIA data structures.
Definition: DeviceInterface.hpp:33
Definition: AddressSettings.hpp:49
Definition: DeviceSettings.hpp:16
Definition: AddressSettings.hpp:62
Definition: Address.hpp:108
The Address struct.
Definition: Address.hpp:58