16 static const uint8_t PN532_COMMAND_VERSION_DATA = 0x02;
17 static const uint8_t PN532_COMMAND_SAMCONFIGURATION = 0x14;
18 static const uint8_t PN532_COMMAND_RFCONFIGURATION = 0x32;
19 static const uint8_t PN532_COMMAND_INDATAEXCHANGE = 0x40;
20 static const uint8_t PN532_COMMAND_INLISTPASSIVETARGET = 0x4A;
21 static const uint8_t PN532_COMMAND_POWERDOWN = 0x16;
33 void setup()
override;
68 virtual bool write_data(
const std::vector<uint8_t> &data) = 0;
69 virtual bool read_data(std::vector<uint8_t> &data, uint8_t
len) = 0;
70 virtual bool read_response(uint8_t command, std::vector<uint8_t> &data) = 0;
72 std::unique_ptr<nfc::NfcTag>
read_tag_(std::vector<uint8_t> &uid);
91 uint8_t &message_start_index);
121 void set_uid(
const std::vector<uint8_t> &uid) { uid_ = uid; }
123 bool process(std::vector<uint8_t> &data);
127 this->publish_state(
false);
129 this->found_ =
false;
146 bool check(Ts...
x)
override {
return this->parent_->is_writing(); }
bool format_mifare_classic_ndef_(std::vector< uint8_t > &uid)
enum esphome::pn532::PN532::NfcTask READ
virtual bool write_data(const std::vector< uint8_t > &data)=0
std::vector< PN532BinarySensor * > binary_sensors_
bool is_mifare_ultralight_formatted_(const std::vector< uint8_t > &page_3_to_6)
virtual bool read_response(uint8_t command, std::vector< uint8_t > &data)=0
void dump_config() override
virtual bool is_read_ready()=0
bool check(Ts... x) override
bool write_mifare_classic_block_(uint8_t block_num, std::vector< uint8_t > &data)
bool read_mifare_ultralight_bytes_(uint8_t start_page, uint16_t num_bytes, std::vector< uint8_t > &data)
void set_uid(const std::vector< uint8_t > &uid)
void register_ontagremoved_trigger(nfc::NfcOnTagTrigger *trig)
PN532OnFinishedWriteTrigger(PN532 *parent)
This class simplifies creating components that periodically check a state.
std::unique_ptr< nfc::NfcTag > read_tag_(std::vector< uint8_t > &uid)
enum PN532ReadReady read_ready_(bool block)
void on_shutdown() override
nfc::NdefMessage * next_task_message_to_write_
bool clean_tag_(std::vector< uint8_t > &uid)
std::vector< uint8_t > current_uid_
void add_on_finished_write_callback(std::function< void()> callback)
bool format_mifare_classic_mifare_(std::vector< uint8_t > &uid)
Base class for all automation conditions.
bool find_mifare_ultralight_ndef_(const std::vector< uint8_t > &page_3_to_6, uint8_t &message_length, uint8_t &message_start_index)
bool clean_mifare_ultralight_()
CallbackManager< void()> on_finished_write_callback_
std::unique_ptr< nfc::NfcTag > read_mifare_ultralight_tag_(std::vector< uint8_t > &uid)
enum esphome::pn532::PN532::PN532Error NONE
std::vector< uint8_t > uid_
void register_ontag_trigger(nfc::NfcOnTagTrigger *trig)
virtual bool read_data(std::vector< uint8_t > &data, uint8_t len)=0
bool auth_mifare_classic_block_(std::vector< uint8_t > &uid, uint8_t block_num, uint8_t key_num, const uint8_t *key)
bool write_mifare_classic_tag_(std::vector< uint8_t > &uid, nfc::NdefMessage *message)
void register_tag(PN532BinarySensor *tag)
float get_setup_priority() const override
Implementation of SPI Controller mode.
Base class for all binary_sensor-type classes.
bool write_mifare_ultralight_page_(uint8_t page_num, std::vector< uint8_t > &write_data)
bool write_mifare_ultralight_tag_(std::vector< uint8_t > &uid, nfc::NdefMessage *message)
std::unique_ptr< nfc::NfcTag > read_mifare_classic_tag_(std::vector< uint8_t > &uid)
bool write_tag_(std::vector< uint8_t > &uid, nfc::NdefMessage *message)
std::vector< nfc::NfcOnTagTrigger * > triggers_ontagremoved_
bool format_tag_(std::vector< uint8_t > &uid)
bool write_command_(const std::vector< uint8_t > &data)
uint16_t read_mifare_ultralight_capacity_()
bool read_mifare_classic_block_(uint8_t block_num, std::vector< uint8_t > &data)
Helper class to easily give an object a parent of type T.
void write_mode(nfc::NdefMessage *message)
std::vector< nfc::NfcOnTagTrigger * > triggers_ontag_