ESPHome
2024.12.2
|
This class is responsible for encoding command packets and decoding status packets. More...
#include <bedjet_codec.h>
Public Member Functions | |
BedjetPacket * | get_button_request (BedjetButton button) |
Returns a BedjetPacket that will initiate a BedjetButton press. More... | |
BedjetPacket * | get_set_target_temp_request (float temperature) |
Returns a BedjetPacket that will set the device's target temperature . More... | |
BedjetPacket * | get_set_fan_speed_request (uint8_t fan_step) |
Returns a BedjetPacket that will set the device's target fan speed. More... | |
BedjetPacket * | get_set_time_request (uint8_t hour, uint8_t minute) |
Returns a BedjetPacket that will set the device's current time. More... | |
BedjetPacket * | get_set_runtime_remaining_request (uint8_t hour, uint8_t minute) |
Returns a BedjetPacket that will set the device's remaining runtime. More... | |
bool | decode_notify (const uint8_t *data, uint16_t length) |
Decodes the incoming status packet received on the BEDJET_STATUS_UUID. More... | |
void | decode_extra (const uint8_t *data, uint16_t length) |
Decodes the extra bytes that were received after being notified with a partial packet. More... | |
bool | compare (const uint8_t *data, uint16_t length) |
bool | has_status () |
const BedjetStatusPacket * | get_status_packet () const |
void | clear_status () |
Protected Member Functions | |
BedjetPacket * | clean_packet_ () |
Cleans up the packet before sending. More... | |
Protected Attributes | |
uint8_t | last_buffer_size_ = 0 |
BedjetPacket | packet_ |
BedjetStatusPacket * | status_packet_ |
BedjetStatusPacket | buf_ |
This class is responsible for encoding command packets and decoding status packets.
The BedJet protocol depends on registering for notifications on the esphome::BedJet::BEDJET_SERVICE_UUID characteristic. If the BedJet is on, it will send rapid updates as notifications. If it is off, it generally will not notify of any status.
As the BedJet V3's BedjetStatusPacket exceeds the buffer size allowed for BLE notification packets, the notification packet will contain BedjetStatusPacket::is_partial == 1
. When that happens, an additional read of the esphome::BedJet::BEDJET_SERVICE_UUID characteristic will contain the second portion of the full status packet.
This class supports encoding a number of BedjetPacket commands:
Definition at line 163 of file bedjet_codec.h.
|
protected |
Cleans up the packet before sending.
Definition at line 15 of file bedjet_codec.cpp.
|
inline |
Definition at line 177 of file bedjet_codec.h.
bool esphome::bedjet::BedjetCodec::compare | ( | const uint8_t * | data, |
uint16_t | length | ||
) |
true
if the new packet is meaningfully different from the last seen packet. Definition at line 133 of file bedjet_codec.cpp.
void esphome::bedjet::BedjetCodec::decode_extra | ( | const uint8_t * | data, |
uint16_t | length | ||
) |
Decodes the extra bytes that were received after being notified with a partial packet.
Definition at line 70 of file bedjet_codec.cpp.
bool esphome::bedjet::BedjetCodec::decode_notify | ( | const uint8_t * | data, |
uint16_t | length | ||
) |
Decodes the incoming status packet received on the BEDJET_STATUS_UUID.
true
if the packet was decoded and represents a "partial" packet; false
otherwise. Definition at line 92 of file bedjet_codec.cpp.
BedjetPacket * esphome::bedjet::BedjetCodec::get_button_request | ( | BedjetButton | button | ) |
Returns a BedjetPacket that will initiate a BedjetButton press.
Definition at line 28 of file bedjet_codec.cpp.
BedjetPacket * esphome::bedjet::BedjetCodec::get_set_fan_speed_request | ( | uint8_t | fan_step | ) |
Returns a BedjetPacket that will set the device's target fan speed.
Definition at line 44 of file bedjet_codec.cpp.
BedjetPacket * esphome::bedjet::BedjetCodec::get_set_runtime_remaining_request | ( | uint8_t | hour, |
uint8_t | minute | ||
) |
Returns a BedjetPacket that will set the device's remaining runtime.
Definition at line 61 of file bedjet_codec.cpp.
BedjetPacket * esphome::bedjet::BedjetCodec::get_set_target_temp_request | ( | float | temperature | ) |
Returns a BedjetPacket that will set the device's target temperature
.
Definition at line 36 of file bedjet_codec.cpp.
BedjetPacket * esphome::bedjet::BedjetCodec::get_set_time_request | ( | uint8_t | hour, |
uint8_t | minute | ||
) |
Returns a BedjetPacket that will set the device's current time.
Definition at line 52 of file bedjet_codec.cpp.
|
inline |
Definition at line 176 of file bedjet_codec.h.
|
inline |
Definition at line 175 of file bedjet_codec.h.
|
protected |
Definition at line 187 of file bedjet_codec.h.
|
protected |
Definition at line 182 of file bedjet_codec.h.
|
protected |
Definition at line 184 of file bedjet_codec.h.
|
protected |
Definition at line 186 of file bedjet_codec.h.