mirror of
https://github.com/esphome/esphome.git
synced 2025-09-21 12:42:21 +01:00
Merge branch 'cleanup_server_info_hello' into integration
This commit is contained in:
@@ -42,6 +42,8 @@ static constexpr uint8_t MAX_PING_RETRIES = 60;
|
|||||||
static constexpr uint16_t PING_RETRY_INTERVAL = 1000;
|
static constexpr uint16_t PING_RETRY_INTERVAL = 1000;
|
||||||
static constexpr uint32_t KEEPALIVE_DISCONNECT_TIMEOUT = (KEEPALIVE_TIMEOUT_MS * 5) / 2;
|
static constexpr uint32_t KEEPALIVE_DISCONNECT_TIMEOUT = (KEEPALIVE_TIMEOUT_MS * 5) / 2;
|
||||||
|
|
||||||
|
static constexpr auto ESPHOME_VERSION_REF = StringRef::from_lit(ESPHOME_VERSION);
|
||||||
|
|
||||||
static const char *const TAG = "api.connection";
|
static const char *const TAG = "api.connection";
|
||||||
#ifdef USE_CAMERA
|
#ifdef USE_CAMERA
|
||||||
static const int CAMERA_STOP_STREAM = 5000;
|
static const int CAMERA_STOP_STREAM = 5000;
|
||||||
@@ -1376,9 +1378,8 @@ bool APIConnection::send_hello_response(const HelloRequest &msg) {
|
|||||||
HelloResponse resp;
|
HelloResponse resp;
|
||||||
resp.api_version_major = 1;
|
resp.api_version_major = 1;
|
||||||
resp.api_version_minor = 12;
|
resp.api_version_minor = 12;
|
||||||
// Temporary string for concatenation - will be valid during send_message call
|
// Send only the version string - the client only logs this for debugging and doesn't use it otherwise
|
||||||
std::string server_info = App.get_name() + " (esphome v" ESPHOME_VERSION ")";
|
resp.set_server_info(ESPHOME_VERSION_REF);
|
||||||
resp.set_server_info(StringRef(server_info));
|
|
||||||
resp.set_name(StringRef(App.get_name()));
|
resp.set_name(StringRef(App.get_name()));
|
||||||
|
|
||||||
#ifdef USE_API_PASSWORD
|
#ifdef USE_API_PASSWORD
|
||||||
@@ -1425,8 +1426,6 @@ bool APIConnection::send_device_info_response(const DeviceInfoRequest &msg) {
|
|||||||
std::string mac_address = get_mac_address_pretty();
|
std::string mac_address = get_mac_address_pretty();
|
||||||
resp.set_mac_address(StringRef(mac_address));
|
resp.set_mac_address(StringRef(mac_address));
|
||||||
|
|
||||||
// Compile-time StringRef constants
|
|
||||||
static constexpr auto ESPHOME_VERSION_REF = StringRef::from_lit(ESPHOME_VERSION);
|
|
||||||
resp.set_esphome_version(ESPHOME_VERSION_REF);
|
resp.set_esphome_version(ESPHOME_VERSION_REF);
|
||||||
|
|
||||||
resp.set_compilation_time(App.get_compilation_time_ref());
|
resp.set_compilation_time(App.get_compilation_time_ref());
|
||||||
|
@@ -848,10 +848,17 @@ class FixedArrayBytesType(TypeInfo):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def public_content(self) -> list[str]:
|
def public_content(self) -> list[str]:
|
||||||
|
len_type = (
|
||||||
|
"uint8_t"
|
||||||
|
if self.array_size <= 255
|
||||||
|
else "uint16_t"
|
||||||
|
if self.array_size <= 65535
|
||||||
|
else "size_t"
|
||||||
|
)
|
||||||
# Add both the array and length fields
|
# Add both the array and length fields
|
||||||
return [
|
return [
|
||||||
f"uint8_t {self.field_name}[{self.array_size}]{{}};",
|
f"uint8_t {self.field_name}[{self.array_size}]{{}};",
|
||||||
f"uint8_t {self.field_name}_len{{0}};",
|
f"{len_type} {self.field_name}_len{{0}};",
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Reference in New Issue
Block a user