OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
dmx_protocol_base.hpp
1#pragma once
2#include <ossia/detail/config.hpp>
3
4#include <ossia/detail/timer.hpp>
5#include <ossia/network/base/protocol.hpp>
6#include <ossia/network/common/complex_type.hpp>
7#include <ossia/network/context.hpp>
8#include <ossia/network/domain/domain.hpp>
9#include <ossia/protocols/artnet/dmx_buffer.hpp>
10
11#include <array>
12#include <cstdint>
13
14namespace ossia::net
15{
16struct dmx_config;
17class dmx_parameter;
18class OSSIA_EXPORT dmx_protocol_base : public ossia::net::protocol_base
19{
20public:
21 dmx_protocol_base(ossia::net::network_context_ptr, const dmx_config& conf);
22 ~dmx_protocol_base();
23
24 void set_device(ossia::net::device_base& dev) override;
25
26 bool pull(ossia::net::parameter_base& param) override;
27 bool push(const ossia::net::parameter_base& param, const ossia::value& v) override;
28 bool push_raw(const ossia::net::full_parameter_data&) override;
29 bool observe(ossia::net::parameter_base& param, bool enable) override;
30
31 bool update(ossia::net::node_base&) override;
32
33 dmx_buffer& buffer() noexcept { return m_buffer; }
34
35protected:
36 ossia::net::network_context_ptr m_context;
37
38 dmx_buffer m_buffer;
39
40 ossia::net::device_base* m_device{};
41 dmx_config m_conf{};
42};
43
44class OSSIA_EXPORT dmx_output_protocol_base : public dmx_protocol_base
45{
46public:
47 dmx_output_protocol_base(ossia::net::network_context_ptr, const dmx_config& conf);
48 void stop_processing();
49
50protected:
51 ossia::timer m_timer;
52};
53
54class OSSIA_EXPORT dmx_input_protocol_base : public dmx_protocol_base
55{
56public:
57 using dmx_protocol_base::dmx_protocol_base;
58 // Caches the DMX address -> ossia parameter mapping for
59 // fast operation during input
60 void create_channel_map();
61 void on_dmx(const uint8_t* dmx, int count);
62
63protected:
64 std::array<dmx_parameter*, 512> m_cache;
65};
66}
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