OSSIA
Open Scenario System for Interactive Application
artnet_protocol.hpp
1 #pragma once
2 #include <ossia/detail/config.hpp>
3 #if defined(OSSIA_PROTOCOL_ARTNET)
4 #include <ossia/network/sockets/udp_socket.hpp>
5 #include <ossia/protocols/artnet/dmx_protocol_base.hpp>
6 
7 using artnet_node = void*;
8 
9 namespace ossia::net
10 {
11 struct dmx_config;
12 class OSSIA_EXPORT artnet_protocol final : public dmx_output_protocol_base
13 {
14 public:
15  artnet_protocol(
16  ossia::net::network_context_ptr, const dmx_config& conf, std::string_view host);
17  ~artnet_protocol();
18 
19  void set_device(ossia::net::device_base& dev) override;
20 
21 private:
22  void update_function();
23 
24  artnet_node m_node;
25 };
26 
27 class OSSIA_EXPORT artnet_input_protocol final : public dmx_input_protocol_base
28 {
29 public:
30  artnet_input_protocol(
31  ossia::net::network_context_ptr, const dmx_config& conf, std::string_view host);
32  ~artnet_input_protocol();
33 
34  void set_device(ossia::net::device_base& dev) override;
35 
36 private:
37  void on_packet(artnet_node n, int port);
38  void do_read();
39  void stop() override;
40 
41  artnet_node m_node;
42  std::unique_ptr<ossia::net::udp_receive_socket> m_socket;
43 };
44 }
45 
46 #endif
Root of a device tree.
Definition: ossia/network/base/device.hpp:58