15static const uint16_t START_CODE = 0xEFAA;
73 void setup()
override;
101 std::function<
void(int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t)> callback) {
145 [
this](int16_t face_id,
const std::string &name) { this->
trigger(face_id, name); });
167 [
this](int16_t
status, int16_t left, int16_t top, int16_t right, int16_t bottom, int16_t yaw, int16_t pitch,
168 int16_t roll) { this->
trigger(status, left, top, right, bottom, yaw, pitch, roll); });
193 auto name = this->name_.value(
x...);
195 this->parent_->enroll_face(name,
direction);
203 void play(Ts...
x)
override {
204 auto face_id = this->face_id_.value(
x...);
205 this->
parent_->delete_face(face_id);
virtual void play(const Ts &...x)=0
Helper class to easily give an object a parent of type T.
HlkFm22xComponent * parent_
This class simplifies creating components that periodically check a state.
void trigger(const Ts &...x)
Base class for all binary_sensor-type classes.
TEMPLATABLE_VALUE(int16_t, face_id) void play(Ts... x) override
void play(Ts... x) override
TEMPLATABLE_VALUE(std::string, name) TEMPLATABLE_VALUE(uint8_t
direction void play(Ts... x) override
EnrollmentDoneTrigger(HlkFm22xComponent *parent)
EnrollmentFailedTrigger(HlkFm22xComponent *parent)
FaceInfoTrigger(HlkFm22xComponent *parent)
FaceScanInvalidTrigger(HlkFm22xComponent *parent)
FaceScanMatchedTrigger(HlkFm22xComponent *parent)
FaceScanUnmatchedTrigger(HlkFm22xComponent *parent)
void delete_face(int16_t face_id)
sensor::Sensor * last_face_id_sensor_
void add_on_enrollment_done_callback(std::function< void(int16_t, uint8_t)> callback)
text_sensor::TextSensor * last_face_name_text_sensor_
CallbackManager< void(int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t)> face_info_callback_
void enroll_face(const std::string &name, HlkFm22xFaceDirection direction)
void handle_reply_(const std::vector< uint8_t > &data)
void send_command_(HlkFm22xCommand command, const uint8_t *data=nullptr, size_t size=0)
CallbackManager< void(uint8_t)> face_scan_invalid_callback_
void set_face_count_sensor(sensor::Sensor *face_count_sensor)
sensor::Sensor * face_count_sensor_
CallbackManager< void()> face_scan_unmatched_callback_
void set_enrolling_binary_sensor(binary_sensor::BinarySensor *enrolling_binary_sensor)
void set_version_text_sensor(text_sensor::TextSensor *version_text_sensor)
void set_enrolling_(bool enrolling)
void handle_note_(const std::vector< uint8_t > &data)
CallbackManager< void(int16_t, uint8_t)> enrollment_done_callback_
void set_last_face_id_sensor(sensor::Sensor *last_face_id_sensor)
CallbackManager< void(uint8_t)> enrollment_failed_callback_
sensor::Sensor * status_sensor_
void add_on_face_scan_matched_callback(std::function< void(int16_t, std::string)> callback)
text_sensor::TextSensor * version_text_sensor_
void set_last_face_name_text_sensor(text_sensor::TextSensor *last_face_name_text_sensor)
CallbackManager< void(int16_t, std::string)> face_scan_matched_callback_
void add_on_face_scan_invalid_callback(std::function< void(uint8_t)> callback)
binary_sensor::BinarySensor * enrolling_binary_sensor_
void add_on_face_scan_unmatched_callback(std::function< void()> callback)
void add_on_face_info_callback(std::function< void(int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t)> callback)
void add_on_enrollment_failed_callback(std::function< void(uint8_t)> callback)
HlkFm22xCommand active_command_
void set_status_sensor(sensor::Sensor *status_sensor)
void dump_config() override
void play(Ts... x) override
void play(Ts... x) override
Base-class for all sensors.
@ FACE_DIRECTION_UNDEFINED