53 static const size_t familyCodeIdx = 0;
54 static const size_t crc8Idx = 7;
57 static const uint8_t defaultByteVal = 0x00;
64 RomId(
const ByteBuffer & romIdBytes) : m_romId(romIdBytes) { }
68 this->m_romId = rhs.m_romId;
74 return (this->m_romId == rhs.m_romId);
83 operator ByteBuffer &()
89 operator const ByteBuffer &()
const
97 memset(m_romId, defaultByteVal, byteLen);
103 return m_romId[familyCodeIdx];
115 return m_romId[crc8Idx];
121 m_romId[crc8Idx] =
crc8;
uint8_t calculateCrc8(uint8_t crc8, uint8_t data)
Definition: crc.cpp:39
Standard container for a 1-Wire ROM ID.
Definition: RomId.h:43
bool operator!=(const RomId &rhs) const
Definition: RomId.h:77
void setFamilyCode(uint8_t familyCode)
Set the family code byte.
Definition: RomId.h:107
RomId(const ByteBuffer &romIdBytes)
Definition: RomId.h:64
bool valid() const
Definition: RomId.h:139
bool crc8Valid() const
Definition: RomId.h:126
RomId()
Definition: RomId.h:62
const RomId & operator=(const RomId &rhs)
Definition: RomId.h:66
void setCrc8(uint8_t crc8)
Set the CRC8 byte.
Definition: RomId.h:119
bool operator==(const RomId &rhs) const
Definition: RomId.h:72
array< uint8_t, byteLen >::Buffer ByteBuffer
Built-in array representation.
Definition: RomId.h:50
uint8_t familyCode() const
Read the Family Code byte.
Definition: RomId.h:101
RomId(const RomId &romId)
Definition: RomId.h:63
uint8_t crc8() const
Read the CRC8 byte.
Definition: RomId.h:113
void setValidCrc8()
Calculate and set the CRC8 for the ROM ID.
Definition: RomId.h:132
Generic array class similar to std::array.
Definition: array.h:43
static const size_t byteLen
Length of the buffer in bytes.
Definition: RomId.h:47
void reset()
Reset to the default starting value.
Definition: RomId.h:95