mirror of
https://github.com/esphome/esphome.git
synced 2025-11-20 00:35:44 +00:00
Compare commits
1 Commits
lock_ns
...
frame_help
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88717ac1f5 |
@@ -84,9 +84,7 @@ class APIFrameHelper {
|
||||
public:
|
||||
APIFrameHelper() = default;
|
||||
explicit APIFrameHelper(std::unique_ptr<socket::Socket> socket, const ClientInfo *client_info)
|
||||
: socket_owned_(std::move(socket)), client_info_(client_info) {
|
||||
socket_ = socket_owned_.get();
|
||||
}
|
||||
: socket_(std::move(socket)), client_info_(client_info) {}
|
||||
virtual ~APIFrameHelper() = default;
|
||||
virtual APIError init() = 0;
|
||||
virtual APIError loop();
|
||||
@@ -149,9 +147,8 @@ class APIFrameHelper {
|
||||
APIError write_raw_(const struct iovec *iov, int iovcnt, socket::Socket *socket, std::vector<uint8_t> &tx_buf,
|
||||
const std::string &info, StateEnum &state, StateEnum failed_state);
|
||||
|
||||
// Pointers first (4 bytes each)
|
||||
socket::Socket *socket_{nullptr};
|
||||
std::unique_ptr<socket::Socket> socket_owned_;
|
||||
// Socket ownership (4 bytes on 32-bit, 8 bytes on 64-bit)
|
||||
std::unique_ptr<socket::Socket> socket_;
|
||||
|
||||
// Common state enum for all frame helpers
|
||||
// Note: Not all states are used by all implementations
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include "esphome/core/automation.h"
|
||||
#include "esphome/core/component.h"
|
||||
|
||||
namespace esphome::lock {
|
||||
namespace esphome {
|
||||
namespace lock {
|
||||
|
||||
template<typename... Ts> class LockAction : public Action<Ts...> {
|
||||
public:
|
||||
@@ -71,4 +72,5 @@ class LockUnlockTrigger : public Trigger<> {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace esphome::lock
|
||||
} // namespace lock
|
||||
} // namespace esphome
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include "esphome/core/controller_registry.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome::lock {
|
||||
namespace esphome {
|
||||
namespace lock {
|
||||
|
||||
static const char *const TAG = "lock";
|
||||
|
||||
@@ -107,4 +108,5 @@ LockCall &LockCall::set_state(const std::string &state) {
|
||||
}
|
||||
const optional<LockState> &LockCall::get_state() const { return this->state_; }
|
||||
|
||||
} // namespace esphome::lock
|
||||
} // namespace lock
|
||||
} // namespace esphome
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
#include "esphome/core/preferences.h"
|
||||
#include <initializer_list>
|
||||
|
||||
namespace esphome::lock {
|
||||
namespace esphome {
|
||||
namespace lock {
|
||||
|
||||
class Lock;
|
||||
|
||||
@@ -176,4 +177,5 @@ class Lock : public EntityBase {
|
||||
ESPPreferenceObject rtc_;
|
||||
};
|
||||
|
||||
} // namespace esphome::lock
|
||||
} // namespace lock
|
||||
} // namespace esphome
|
||||
|
||||
Reference in New Issue
Block a user