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