mirror of
https://github.com/esphome/esphome.git
synced 2025-07-31 07:36:35 +00:00
cleanup
This commit is contained in:
parent
ad52d80281
commit
5e906b1dd9
@ -1679,7 +1679,7 @@ void NoiseEncryptionSetKeyRequest::dump_to(std::string &out) const {
|
||||
__attribute__((unused)) char buffer[64];
|
||||
out.append("NoiseEncryptionSetKeyRequest {\n");
|
||||
out.append(" key: ");
|
||||
out.append(format_hex_pretty(this->key_ptr_, this->key_len_));
|
||||
out.append(format_hex_pretty(reinterpret_cast<const uint8_t *>(this->key.data()), this->key.size()));
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
@ -3163,7 +3163,7 @@ void BluetoothGATTWriteRequest::dump_to(std::string &out) const {
|
||||
out.append("\n");
|
||||
|
||||
out.append(" data: ");
|
||||
out.append(format_hex_pretty(this->data_ptr_, this->data_len_));
|
||||
out.append(format_hex_pretty(reinterpret_cast<const uint8_t *>(this->data.data()), this->data.size()));
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
@ -3195,7 +3195,7 @@ void BluetoothGATTWriteDescriptorRequest::dump_to(std::string &out) const {
|
||||
out.append("\n");
|
||||
|
||||
out.append(" data: ");
|
||||
out.append(format_hex_pretty(this->data_ptr_, this->data_len_));
|
||||
out.append(format_hex_pretty(reinterpret_cast<const uint8_t *>(this->data.data()), this->data.size()));
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
|
@ -657,7 +657,11 @@ class BytesType(TypeInfo):
|
||||
return f"buffer.encode_bytes({self.number}, this->{self.field_name}_ptr_, this->{self.field_name}_len_);"
|
||||
|
||||
def dump(self, name: str) -> str:
|
||||
return f"out.append(format_hex_pretty(this->{self.field_name}_ptr_, this->{self.field_name}_len_));"
|
||||
# Use pointer/length if available (SOURCE_SERVER/SOURCE_BOTH), otherwise use std::string
|
||||
if self.needs_encode:
|
||||
return f"out.append(format_hex_pretty(this->{self.field_name}_ptr_, this->{self.field_name}_len_));"
|
||||
else:
|
||||
return f"out.append(format_hex_pretty(reinterpret_cast<const uint8_t*>(this->{self.field_name}.data()), this->{self.field_name}.size()));"
|
||||
|
||||
def get_size_calculation(self, name: str, force: bool = False) -> str:
|
||||
return f"ProtoSize::add_bytes_field(total_size, {self.calculate_field_id_size()}, this->{self.field_name}_len_);"
|
||||
|
Loading…
x
Reference in New Issue
Block a user