BuGUI
BUtton Grid User Interface
Loading...
Searching...
No Matches
clear.hpp
1#pragma once
2#include <bugui/hardware/protocol/protocol.hpp>
3#include <bugui/concepts/device.hpp>
4
5namespace bugui
6{
9template <typename T>
10struct clear { };
11
14template <has_clear Device>
15struct clear<Device>
16 : virtual protocol<component<Device, class Device::clear>>
17{
18protected:
19 void component_reset()
20 {
21 this->send([](auto& formater)
22 {
23 if constexpr
24 (array_like<decltype(Device::clear::message())>)
25 for (const auto& m : Device::clear::message())
26 formater.add(m);
27 else
28 formater.add(Device::clear::message());
29 });
30 }
31};
32
35template <clear_component Component>
36struct clear<Component>
37 : virtual protocol<Component>
38{
39protected:
40 void component_reset()
41 {
42 this->send([](auto& formater)
43 {
44 if constexpr
45 (array_like<decltype(Component::clear_t::message())>)
46 for (const auto& m : Component::clear_t::message())
47 formater.add(m);
48 else
49 formater.add(Component::clear_t::message());
50 });
51 }
52};
53
54} // namespace bugui
Definition common.hpp:26
Empty struct for devices or componants that do not provide a command to clear all feedback (LED's,...
Definition clear.hpp:10
Inherits from different protocols, depending on the device's specification.
Definition protocol.hpp:13