3#include <ossia/network/sockets/udp_socket.hpp>
4#include <ossia/protocols/dense/dense_protocol.hpp>
5#include <ossia/protocols/oscquery/oscquery_fwd.hpp>
9namespace ossia::oscquery_asio
11class oscquery_mirror_asio_protocol_dense;
12struct oscquery_dense_shared_async_state
14 oscquery_mirror_asio_protocol_dense& self;
18class OSSIA_EXPORT oscquery_mirror_asio_protocol_dense final
21 struct osc_sender_impl;
22 struct osc_receiver_impl;
23 using async_state = oscquery_dense_shared_async_state;
26 oscquery_mirror_asio_protocol_dense(
27 ossia::net::network_context_ptr ctx, std::string host,
28 uint16_t local_osc_port = 0);
29 ~oscquery_mirror_asio_protocol_dense()
override;
31 bool pull(net::parameter_base&)
override;
32 std::future<void> pull_async(net::parameter_base&)
override;
33 void request(net::parameter_base&)
override;
34 bool push(
const net::parameter_base&,
const ossia::value& v)
override;
36 bool push_bundle(
const std::vector<const ossia::net::parameter_base*>&)
override;
37 bool push_raw_bundle(
const std::vector<ossia::net::full_parameter_data>&)
override;
38 bool observe(net::parameter_base&,
bool)
override;
39 bool observe_quietly(net::parameter_base&,
bool)
override;
40 bool update(net::node_base& b)
override;
41 bool echo_incoming_message(
42 const ossia::net::message_origin_identifier&
id,
45 std::future<void> update_async(net::node_base& b)
override;
48 void set_device(net::device_base& dev)
override;
53 void connect() override;
55 void set_feedback(
bool fb) override;
57 void update_function();
58 void recompute_nodes();
59 int write_packet(std::span<
unsigned char> data);
61 friend struct http_async_answer<async_state>;
62 friend struct http_async_value_answer<async_state>;
63 using http_async_request =
ossia::oscquery_asio::http_async_request<async_state>;
64 using http_async_value_request
65 =
ossia::oscquery_asio::http_async_value_request<async_state>;
66 using http_async_answer =
ossia::oscquery_asio::http_async_answer<async_state>;
67 using http_async_value_answer
68 =
ossia::oscquery_asio::http_async_value_answer<async_state>;
69 using connection_handler = std::weak_ptr<
void>;
76 void cleanup_connections();
79 bool on_text_ws_message(connection_handler hdl, const std::
string& message);
80 bool on_binary_ws_message(connection_handler hdl, const std::
string& message);
81 bool on_value_http_message(const std::
string& address, const std::
string& message);
82 void on_osc_message(const oscpack::ReceivedMessage& m);
83 void process_raw_osc_data(const
char* data, std::
size_t sz);
86 void http_send_message(const std::
string& str);
87 void http_send_message(const rapidjson::StringBuffer& str);
90 bool query_connected();
93 void on_nodeRenamed(const
ossia::net::node_base& n, std::
string oldname);
95 ossia::net::network_context_ptr m_ctx;
97 std::unique_ptr<osc_receiver_impl> m_oscServer;
99 std::shared_ptr<oscquery_dense_shared_async_state> m_async_state;
100 std::atomic_bool m_hasWS{};
103 net::listened_parameters m_listening;
107 std::promise<void> m_namespacePromise;
109 std::string m_queryHost;
110 std::string m_queryPort;
111 std::string m_httpHost;
114 std::unique_ptr<http_async_client_context> m_http;
117 ossia::timer m_timer;
119 ossia::flat_set<ossia::net::parameter_base*, ossia::net::parameter_alphabetical_sort>
122 std::optional<ossia::net::udp_send_socket> to_client;
123 ossia::net::message_origin_identifier m_id;
124 std::atomic<bool> m_feedback{
true};
125 bool m_zombie_on_remove{
true};
Root of a device tree.
Definition ossia/network/base/device.hpp:58
The parameter_base class.
Definition ossia/network/base/parameter.hpp:48
The protocol_base class.
Definition protocol.hpp:40
The value class.
Definition value.hpp:173
Full information about a parameter.
Definition parameter_data.hpp:61
Represents the capabilities of an OSCQuery server.
Definition host_info.hpp:12