10#include <esp_gattc_api.h>
17static const espbt::ESPBTUUID ALPHA3_GENI_SERVICE_UUID = espbt::ESPBTUUID::from_uint16(0xfe5d);
18static const espbt::ESPBTUUID ALPHA3_GENI_CHARACTERISTIC_UUID = espbt::ESPBTUUID::from_raw(
19 {0xa9, 0x7b, 0xb8, 0x85, 0x00, 0x1a, 0x28, 0xaa, 0x2a, 0x43, 0x6e, 0x03, 0xd1, 0xff, 0x9c, 0x85});
20static const int16_t GENI_RESPONSE_HEADER_LENGTH = 13;
21static const size_t GENI_RESPONSE_TYPE_LENGTH = 8;
23static const uint8_t GENI_RESPONSE_TYPE_FLOW_HEAD[GENI_RESPONSE_TYPE_LENGTH] = {31, 0, 1, 48, 1, 0, 0, 24};
24static const int16_t GENI_RESPONSE_FLOW_OFFSET = 0;
25static const int16_t GENI_RESPONSE_HEAD_OFFSET = 4;
27static const uint8_t GENI_RESPONSE_TYPE_POWER[GENI_RESPONSE_TYPE_LENGTH] = {44, 0, 1, 0, 1, 0, 0, 37};
28static const int16_t GENI_RESPONSE_VOLTAGE_AC_OFFSET = 0;
29static const int16_t GENI_RESPONSE_VOLTAGE_DC_OFFSET = 4;
30static const int16_t GENI_RESPONSE_CURRENT_OFFSET = 8;
31static const int16_t GENI_RESPONSE_POWER_OFFSET = 12;
32static const int16_t GENI_RESPONSE_MOTOR_POWER_OFFSET = 16;
33static const int16_t GENI_RESPONSE_MOTOR_SPEED_OFFSET = 20;
37 void setup()
override;
40 esp_ble_gattc_cb_param_t *param)
override;
This class simplifies creating components that periodically check a state.
void set_current_sensor(sensor::Sensor *sensor)
void set_head_sensor(sensor::Sensor *sensor)
void handle_geni_response_(const uint8_t *response, uint16_t length)
bool is_current_response_type_(const uint8_t *response_type)
sensor::Sensor * head_sensor_
sensor::Sensor * flow_sensor_
uint8_t response_type_[GENI_RESPONSE_TYPE_LENGTH]
sensor::Sensor * voltage_sensor_
void set_power_sensor(sensor::Sensor *sensor)
void set_flow_sensor(sensor::Sensor *sensor)
void send_request_(uint8_t *request, size_t len)
sensor::Sensor * speed_sensor_
sensor::Sensor * power_sensor_
void set_speed_sensor(sensor::Sensor *sensor)
void extract_publish_sensor_value_(const uint8_t *response, int16_t length, int16_t response_offset, int16_t value_offset, sensor::Sensor *sensor, float factor)
void set_voltage_sensor(sensor::Sensor *sensor)
sensor::Sensor * current_sensor_
void dump_config() override
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
Base-class for all sensors.
Providing packet encoding functions for exchanging data with a remote host.