mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 19:38:30 +02:00
Add NDEF reading and writing to PN532 (#1351)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "ndef_record.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nfc {
|
||||
|
||||
static const uint8_t MAX_NDEF_RECORDS = 4;
|
||||
|
||||
class NdefMessage {
|
||||
public:
|
||||
NdefMessage(){};
|
||||
NdefMessage(std::vector<uint8_t> &data);
|
||||
|
||||
std::vector<NdefRecord *> get_records() { return this->records_; };
|
||||
|
||||
bool add_record(NdefRecord *record);
|
||||
bool add_text_record(const std::string &text);
|
||||
bool add_text_record(const std::string &text, const std::string &encoding);
|
||||
bool add_uri_record(const std::string &uri);
|
||||
|
||||
std::vector<uint8_t> encode();
|
||||
|
||||
protected:
|
||||
std::vector<NdefRecord *> records_;
|
||||
};
|
||||
|
||||
} // namespace nfc
|
||||
} // namespace esphome
|
||||
Reference in New Issue
Block a user