↰ Return to documentation for file (include/ndef-lite/record-header.hpp)
#ifndef RECORD_HEADER_H
#define RECORD_HEADER_H
#include "ndef-lite/record-type.hpp"
enum class RecordFlag {
IL = 0x08, // ID_LENGTH is present.
SR = 0x10, // Short record.
CF = 0x20, // Chunk flag.
ME = 0x40, // Message end.
MB = 0x80 // Message begin.
};
struct NDEFRecordHeader
{
NDEFRecordType::TypeID tnf;
bool il;
bool sr;
bool cf;
bool me;
bool mb;
// Methods
static NDEFRecordHeader from_byte(const uint8_t value);
uint8_t asByte();
bool inline constexpr operator==(const NDEFRecordHeader& rhs) const
{
// clang-format off
return (
this->cf == rhs.cf &&
this->il == rhs.il &&
this->mb == rhs.mb &&
this->me == rhs.me &&
this->sr == rhs.sr &&
this->tnf == rhs.tnf
);
// clang-format on
}
};
#endif // RECORD_HEADER_H