mirror of
https://github.com/esphome/esphome.git
synced 2025-08-01 07:57:47 +00:00
Merge branch 'integration' into memory_api
This commit is contained in:
commit
c8140e966a
@ -609,6 +609,9 @@ class BytesType(TypeInfo):
|
|||||||
super().__init__(field)
|
super().__init__(field)
|
||||||
self.needs_decode = needs_decode
|
self.needs_decode = needs_decode
|
||||||
self.needs_encode = needs_encode
|
self.needs_encode = needs_encode
|
||||||
|
# Only set decode_length if we need decoding
|
||||||
|
if needs_decode:
|
||||||
|
self.decode_length = "value.as_string()"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def public_content(self) -> list[str]:
|
def public_content(self) -> list[str]:
|
||||||
@ -640,18 +643,6 @@ class BytesType(TypeInfo):
|
|||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
@property
|
|
||||||
def decode_length_content(self) -> str:
|
|
||||||
if not self.needs_decode:
|
|
||||||
return "" # No decode needed for SOURCE_SERVER messages
|
|
||||||
|
|
||||||
# Decode into storage only - pointer/length are only needed for encoding
|
|
||||||
return (
|
|
||||||
f"case {self.number}:\n"
|
|
||||||
f" this->{self.field_name} = value.as_string();\n"
|
|
||||||
f" break;"
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def encode_content(self) -> str:
|
def encode_content(self) -> str:
|
||||||
return f"buffer.encode_bytes({self.number}, this->{self.field_name}_ptr_, this->{self.field_name}_len_);"
|
return f"buffer.encode_bytes({self.number}, this->{self.field_name}_ptr_, this->{self.field_name}_len_);"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user