mirror of
https://github.com/esphome/esphome.git
synced 2025-10-09 13:23:47 +01:00
Merge branch 'lock_mask' into integration
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/preferences.h"
|
||||
#include <initializer_list>
|
||||
|
||||
namespace esphome {
|
||||
namespace lock {
|
||||
@@ -44,6 +45,12 @@ class LockTraits {
|
||||
void set_assumed_state(bool assumed_state) { this->assumed_state_ = assumed_state; }
|
||||
|
||||
bool supports_state(LockState state) const { return supported_states_mask_ & (1 << state); }
|
||||
void set_supported_states(std::initializer_list<LockState> states) {
|
||||
supported_states_mask_ = 0;
|
||||
for (auto state : states) {
|
||||
supported_states_mask_ |= (1 << state);
|
||||
}
|
||||
}
|
||||
uint8_t get_supported_states_mask() const { return supported_states_mask_; }
|
||||
void set_supported_states_mask(uint8_t mask) { supported_states_mask_ = mask; }
|
||||
void add_supported_state(LockState state) { supported_states_mask_ |= (1 << state); }
|
||||
|
Reference in New Issue
Block a user