3#include <ossia/network/base/protocol.hpp>
4#include <ossia/network/generic/wrapped_parameter.hpp>
6#include <ossia-qt/js_utilities.hpp>
25struct ws_generic_client_parameter_data_base
27 ws_generic_client_parameter_data_base() =
default;
28 ws_generic_client_parameter_data_base(
const ws_generic_client_parameter_data_base&)
30 ws_generic_client_parameter_data_base(ws_generic_client_parameter_data_base&&)
32 ws_generic_client_parameter_data_base&
33 operator=(
const ws_generic_client_parameter_data_base&)
35 ws_generic_client_parameter_data_base&
36 operator=(ws_generic_client_parameter_data_base&&)
38 ws_generic_client_parameter_data_base(
const QJSValue& val)
39 : request{val.property(
"request")}
40 , openListening{val.property(
"openListening")}
41 , closeListening{val.property(
"closeListening")}
46 QJSValue openListening;
47 QJSValue closeListening;
50struct ws_generic_client_parameter_data
51 :
public parameter_data
52 ,
public ws_generic_client_parameter_data_base
54 using base_data_type = ws_generic_client_parameter_data_base;
55 ws_generic_client_parameter_data() =
default;
56 ws_generic_client_parameter_data(
const ws_generic_client_parameter_data&) =
default;
57 ws_generic_client_parameter_data(ws_generic_client_parameter_data&&) =
default;
58 ws_generic_client_parameter_data& operator=(
const ws_generic_client_parameter_data&)
60 ws_generic_client_parameter_data& operator=(ws_generic_client_parameter_data&&)
63 ws_generic_client_parameter_data(
const std::string& name)
64 : parameter_data{name}
68 ws_generic_client_parameter_data(
const QJSValue& val)
69 : parameter_data{
ossia::qt::make_parameter_data(val)}
70 , ws_generic_client_parameter_data_base{val}
74 bool valid() const noexcept {
return !request.isNull() || type; }
77using ws_generic_client_parameter = wrapped_parameter<ws_generic_client_parameter_data>;
78using ws_generic_client_node = ossia::net::wrapped_node<
79 ws_generic_client_parameter_data, ws_generic_client_parameter>;
81class OSSIA_EXPORT ws_generic_client_protocol final
85 W_OBJECT(ws_generic_client_protocol)
88 ws_generic_client_protocol(
const QString& addr, QByteArray code);
90 ws_generic_client_protocol(
const ws_generic_client_protocol&) =
delete;
91 ws_generic_client_protocol(ws_generic_client_protocol&&) =
delete;
92 ws_generic_client_protocol& operator=(
const ws_generic_client_protocol&) =
delete;
93 ws_generic_client_protocol& operator=(ws_generic_client_protocol&&) =
delete;
95 ~ws_generic_client_protocol()
override;
109 static ws_generic_client_parameter_data read_data(
const QJSValue& js) {
return js; }
112 void sig_push(
const ws_generic_client_parameter* arg_1,
const ossia::value& v)
113 E_SIGNAL(OSSIA_EXPORT, sig_push, arg_1, v)
116 :
void slot_push(
const ws_generic_client_parameter*,
const ossia::value& v);
120 void on_ready(
const QString& host);
121 void apply_reply(QJSValue);
123 QQmlEngine* m_engine{};
124 QQmlComponent* m_component{};
127 QWebSocket* m_websocket{};
131 QList<std::pair<QNetworkReply*, const ws_generic_client_parameter*>> m_replies;
134using ws_generic_client_device
135 = ossia::net::wrapped_device<ws_generic_client_node, ws_generic_client_protocol>;
136class OSSIA_EXPORT WS :
public QObject
140 W_INLINE_PROPERTY_VALUE(
141 bool, processFromJson, =
false, processFromJson, setProcessFromJson,
142 processFromJsonChanged);
147Q_DECLARE_METATYPE(ossia::net::ws_generic_client_parameter*)
148W_REGISTER_ARGTYPE(ossia::net::ws_generic_client_parameter*)
149W_REGISTER_ARGTYPE(
const ossia::net::ws_generic_client_parameter*)
Root of a device tree.
Definition ossia/network/base/device.hpp:58
The node_base class.
Definition node.hpp:48
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