7static const char *
const TAG =
"copy.fan";
12 if (source_traits.supports_preset_modes()) {
56 if (
state.has_value())
57 call2.set_state(*
state);
62 if (
speed.has_value())
63 call2.set_speed(*
speed);
67 if (
call.has_preset_mode())
68 call2.set_preset_mode(
call.get_preset_mode());
void control(const fan::FanCall &call) override
void dump_config() override
fan::FanTraits get_traits() override
void copy_state_from_source_()
optional< bool > get_state() const
void set_supported_preset_modes(std::initializer_list< const char * > preset_modes)
Set the supported preset modes (stored on Fan, referenced by FanTraits via pointer).
void add_on_state_callback(F &&callback)
Register a callback that will be called each time the state changes.
virtual FanTraits get_traits()=0
void clear_preset_mode_()
Clear the preset mode.
bool set_preset_mode_(const char *preset_mode, size_t len)
Set the preset mode (finds and stores pointer from traits).
StringRef get_preset_mode() const
Get the current preset mode.
FanDirection direction
The current direction of the fan.
bool oscillating
The current oscillation state of the fan.
bool state
The current on/off state of the fan.
void wire_preset_modes_(FanTraits &traits)
Wire the Fan-owned preset modes pointer into the given traits object.
bool has_preset_mode() const
Check if a preset mode is currently active.
int speed
The current fan speed level.
void set_direction(bool direction)
Set whether this fan supports changing direction.
void set_speed(bool speed)
Set whether this fan supports speed levels.
void set_supported_speed_count(int speed_count)
Set how many speed levels this fan has.
void set_oscillation(bool oscillation)
Set whether this fan supports oscillation.
Providing packet encoding functions for exchanging data with a remote host.