mirror of
https://github.com/esphome/esphome.git
synced 2026-03-04 03:38:20 -07:00
[api] Use const char* overloads for text and alarm_control_panel commands
Avoid implicit StringRef->std::string conversion when the protobuf message fields are already StringRef. Use the (const char*, size_t) overloads directly.
This commit is contained in:
@@ -879,7 +879,7 @@ uint16_t APIConnection::try_send_text_info(EntityBase *entity, APIConnection *co
|
||||
}
|
||||
void APIConnection::on_text_command_request(const TextCommandRequest &msg) {
|
||||
ENTITY_COMMAND_MAKE_CALL(text::Text, text, text)
|
||||
call.set_value(msg.state);
|
||||
call.set_value(msg.state.c_str(), msg.state.size());
|
||||
call.perform();
|
||||
}
|
||||
#endif
|
||||
@@ -1327,7 +1327,7 @@ void APIConnection::on_alarm_control_panel_command_request(const AlarmControlPan
|
||||
call.pending();
|
||||
break;
|
||||
}
|
||||
call.set_code(msg.code);
|
||||
call.set_code(msg.code.c_str(), msg.code.size());
|
||||
call.perform();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user