mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 06:33:51 +00:00
[packet_transport] Make some arguments const (#8700)
Co-authored-by: clydeps <U5yx99dok9>
This commit is contained in:
@@ -353,7 +353,7 @@ static bool process_rolling_code(Provider &provider, PacketDecoder &decoder) {
|
||||
/**
|
||||
* Process a received packet
|
||||
*/
|
||||
void PacketTransport::process_(std::vector<uint8_t> &data) {
|
||||
void PacketTransport::process_(const std::vector<uint8_t> &data) {
|
||||
auto ping_key_seen = !this->ping_pong_enable_;
|
||||
PacketDecoder decoder((data.data()), data.size());
|
||||
char namebuf[256]{};
|
||||
|
||||
@@ -101,12 +101,12 @@ class PacketTransport : public PollingComponent {
|
||||
|
||||
protected:
|
||||
// child classes must implement this
|
||||
virtual void send_packet(std::vector<uint8_t> &buf) const = 0;
|
||||
virtual void send_packet(const std::vector<uint8_t> &buf) const = 0;
|
||||
virtual size_t get_max_packet_size() = 0;
|
||||
virtual bool should_send() { return true; }
|
||||
|
||||
// to be called by child classes when a data packet is received.
|
||||
void process_(std::vector<uint8_t> &data);
|
||||
void process_(const std::vector<uint8_t> &data);
|
||||
void send_data_(bool all);
|
||||
void flush_();
|
||||
void add_data_(uint8_t key, const char *id, float data);
|
||||
@@ -146,7 +146,6 @@ class PacketTransport : public PollingComponent {
|
||||
const char *platform_name_{""};
|
||||
void add_key_(const char *name, uint32_t key);
|
||||
void send_ping_pong_request_();
|
||||
void process_ping_request_(const char *name, uint8_t *ptr, size_t len);
|
||||
|
||||
inline bool is_encrypted_() { return !this->encryption_key_.empty(); }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user