19#include <esp_gattc_api.h>
29static const espbt::ESPBTUUID BEDJET_SERVICE_UUID = espbt::ESPBTUUID::from_raw(
"00001000-bed0-0080-aa55-4265644a6574");
30static const espbt::ESPBTUUID BEDJET_STATUS_UUID = espbt::ESPBTUUID::from_raw(
"00002000-bed0-0080-aa55-4265644a6574");
31static const espbt::ESPBTUUID BEDJET_COMMAND_UUID = espbt::ESPBTUUID::from_raw(
"00002004-bed0-0080-aa55-4265644a6574");
32static const espbt::ESPBTUUID BEDJET_NAME_UUID = espbt::ESPBTUUID::from_raw(
"00002001-bed0-0080-aa55-4265644a6574");
116 void loop()
override;
124 if (this->
name_.empty()) {
134 esp_ble_gattc_cb_param_t *param)
override;
This class simplifies creating components that periodically check a state.
Hub component connecting to the BedJet device over Bluetooth.
void status_packet_ready_()
bool set_target_temp(float temp_c)
Set the target temperature to temp_c in °C.
void set_name_(const std::string &name)
const BedjetStatusPacket * get_status_packet() const
void dump_config() override
bool button_cool()
Press the COOL button.
uint8_t get_fan_speed()
Return the fan speed as a percent in the range 5%-100%.
void setup_time_()
Initializes time sync callbacks to support syncing current time to the BedJet.
bool button_dry()
Press the DRY button.
void set_time_id(time::RealTimeClock *time_id)
Set the time::RealTimeClock implementation.
uint8_t write_bedjet_packet_(BedjetPacket *pkt)
Send the BedjetPacket to the device.
bool button_ext_heat()
Press the EXT HT button.
uint8_t get_fan_index()
Return the fan speed index, in the range 0-19.
std::unique_ptr< BedjetCodec > codec_
void set_clock(uint8_t hour, uint8_t minute)
Attempt to set the BedJet device's clock to the specified time.
bool discover_characteristics_()
static const uint32_t MIN_NOTIFY_THROTTLE
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
bool set_fan_speed(uint8_t fan_speed_pct)
Set the fan speed to a percent in the range 5% - 100%, at 5% increments.
time::RealTimeClock * time_id_
bool set_fan_index(uint8_t fan_speed_index)
Set the fan speed to a stepped index in the range 0-19.
uint16_t get_time_remaining()
Return the remaining runtime, in seconds.
bool set_time_remaining(uint8_t hours, uint8_t mins)
Set the operational runtime remaining.
void upgrade_firmware()
Attempts to check for and apply firmware updates.
uint16_t char_handle_name_
void dispatch_state_(bool is_ready)
bool button_memory1()
Press the M1 (memory recall) button.
uint8_t set_notify_(bool enable)
Configures the local ESP BLE client to register (true) or unregister (false) for status notifications...
void set_status_timeout(uint32_t timeout)
Set the status timeout.
std::vector< BedJetClient * > children_
bool button_turbo()
Press the TURBO button.
bool button_heat()
Press the HEAT button.
static const uint32_t DEFAULT_STATUS_TIMEOUT
void register_child(BedJetClient *obj)
Register a BedJetClient child component.
bool send_button(BedjetButton button)
Send the button.
uint8_t write_notify_config_descriptor_(bool enable)
Reimplementation of BLEClient.gattc_event_handler() for ESP_GATTC_REG_FOR_NOTIFY_EVT.
uint16_t char_handle_status_
bool button_memory3()
Press the M3 (memory recall) button.
uint16_t char_handle_cmd_
bool button_off()
Press the OFF button.
static const uint32_t NOTIFY_WARN_THRESHOLD
uint16_t config_descr_status_
float get_setup_priority() const override
void send_local_time()
Attempts to sync the local time (via time_id) to the BedJet device.
bool button_memory2()
Press the M2 (memory recall) button.
espbt::ClientState node_state
std::string address_str() const
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
Providing packet encoding functions for exchanging data with a remote host.
std::unique_ptr< T > make_unique(Args &&...args)
The format of a BedJet V3 status packet.