12 namespace fingerprint_grow {
14 static const uint16_t START_CODE = 0xEF01;
16 static const uint16_t ENROLLMENT_SLOT_UNUSED = 0xFFFF;
19 static const uint8_t WAIT_FOR_WAKE_UP_MS = 200;
21 static const uint32_t DEFAULT_IDLE_PERIOD_TO_SLEEP_MS = 5000;
98 void setup()
override;
102 this->
address_[0] = (uint8_t) (address >> 24);
103 this->
address_[1] = (uint8_t) (address >> 16);
104 this->
address_[2] = (uint8_t) (address >> 8);
105 this->
address_[3] = (uint8_t) (address & 0xFF);
171 uint8_t
transfer_(std::vector<uint8_t> *p_data_buffer);
223 [
this](uint16_t finger_id, uint16_t confidence) { this->trigger(finger_id, confidence); });
252 [
this](uint8_t scan_num, uint16_t finger_id) { this->trigger(scan_num, finger_id); });
272 TEMPLATABLE_VALUE(uint16_t, finger_id)
273 TEMPLATABLE_VALUE(uint8_t, num_scans)
275 void play(Ts...
x)
override {
276 auto finger_id = this->finger_id_.value(x...);
277 auto num_scans = this->num_scans_.value(x...);
279 this->
parent_->enroll_fingerprint(finger_id, num_scans);
281 this->
parent_->enroll_fingerprint(finger_id, 2);
286 template<
typename... Ts>
296 void play(Ts...
x)
override {
297 auto finger_id = this->finger_id_.value(
x...);
298 this->
parent_->delete_fingerprint(finger_id);
304 void play(Ts...
x)
override { this->
parent_->delete_all_fingerprints(); }
311 void play(Ts...
x)
override {
312 auto state = this->state_.value(
x...);
319 TEMPLATABLE_VALUE(uint8_t,
state)
320 TEMPLATABLE_VALUE(uint8_t,
speed)
321 TEMPLATABLE_VALUE(uint8_t, color)
322 TEMPLATABLE_VALUE(uint8_t, count)
324 void play(Ts...
x)
override {
325 auto state = this->state_.value(x...);
326 auto speed = this->speed_.value(x...);
327 auto color = this->color_.value(x...);
328 auto count = this->count_.value(x...);
TEMPLATABLE_VALUE(uint16_t, finger_id) void play(Ts... x) override
void set_new_password(uint32_t new_password)
CallbackManager< void(uint16_t, uint16_t)> finger_scan_matched_callback_
void finish_enrollment(uint8_t result)
uint16_t system_identifier_code_
void set_last_finger_id_sensor(sensor::Sensor *last_finger_id_sensor)
CallbackManager< void(uint8_t, uint16_t)> enrollment_scan_callback_
uint16_t last_aura_led_duration_
std::vector< uint8_t > data_
FingerScanMatchedTrigger(FingerprintGrowComponent *parent)
void add_on_enrollment_failed_callback(std::function< void(uint16_t)> callback)
void add_on_enrollment_done_callback(std::function< void(uint16_t)> callback)
void delete_all_fingerprints()
void add_on_finger_scan_invalid_callback(std::function< void()> callback)
FingerScanUnmatchedTrigger(FingerprintGrowComponent *parent)
TEMPLATABLE_VALUE(bool, state) void play(Ts... x) override
void set_fingerprint_count_sensor(sensor::Sensor *fingerprint_count_sensor)
This class simplifies creating components that periodically check a state.
void set_status_sensor(sensor::Sensor *status_sensor)
uint8_t scan_image_(uint8_t buffer)
uint8_t save_fingerprint_()
void get_fingerprint_count_()
void delete_fingerprint(uint16_t finger_id)
sensor::Sensor * fingerprint_count_sensor_
CallbackManager< void()> finger_scan_start_callback_
EnrollmentScanTrigger(FingerprintGrowComponent *parent)
EnrollmentFailedTrigger(FingerprintGrowComponent *parent)
void set_enrolling_binary_sensor(binary_sensor::BinarySensor *enrolling_binary_sensor)
void set_capacity_sensor(sensor::Sensor *capacity_sensor)
void set_address(uint32_t address)
GPIOPin * sensor_power_pin_
uint8_t transfer_(std::vector< uint8_t > *p_data_buffer)
sensor::Sensor * status_sensor_
void add_on_finger_scan_start_callback(std::function< void()> callback)
sensor::Sensor * last_finger_id_sensor_
sensor::Sensor * security_level_sensor_
void add_on_finger_scan_matched_callback(std::function< void(uint16_t, uint16_t)> callback)
uint8_t enrollment_image_
void set_security_level_sensor(sensor::Sensor *security_level_sensor)
void enroll_fingerprint(uint16_t finger_id, uint8_t num_buffers)
CallbackManager< void(uint16_t)> enrollment_failed_callback_
sensor::Sensor * last_confidence_sensor_
CallbackManager< void()> finger_scan_unmatched_callback_
uint32_t last_transfer_ms_
binary_sensor::BinarySensor * enrolling_binary_sensor_
void play(Ts... x) override
void set_password(uint32_t password)
void add_on_enrollment_scan_callback(std::function< void(uint8_t, uint16_t)> callback)
FingerScanMisplacedTrigger(FingerprintGrowComponent *parent)
void led_control(bool state)
sensor::Sensor * capacity_sensor_
uint8_t enrollment_buffers_
CallbackManager< void()> finger_scan_misplaced_callback_
EnrollmentDoneTrigger(FingerprintGrowComponent *parent)
FingerScanStartTrigger(FingerprintGrowComponent *parent)
CallbackManager< void(uint16_t)> enrollment_done_callback_
Implementation of SPI Controller mode.
void play(Ts... x) override
Base class for all binary_sensor-type classes.
uint16_t enrollment_slot_
FingerScanInvalidTrigger(FingerprintGrowComponent *parent)
void set_sensor_power_pin(GPIOPin *sensor_power_pin)
void set_idle_period_to_sleep_ms(uint32_t period_ms)
void set_sensing_pin(GPIOPin *sensing_pin)
Base-class for all sensors.
uint32_t idle_period_to_sleep_ms_
void add_on_finger_scan_misplaced_callback(std::function< void()> callback)
void aura_led_control(uint8_t state, uint8_t speed, uint8_t color, uint8_t count)
uint32_t last_aura_led_control_
void set_last_confidence_sensor(sensor::Sensor *last_confidence_sensor)
Helper class to easily give an object a parent of type T.
void add_on_finger_scan_unmatched_callback(std::function< void()> callback)
CallbackManager< void()> finger_scan_invalid_callback_
void dump_config() override