1
0
Fork 0

remove hard-coded constants

This commit is contained in:
Kevin Matz 2023-05-03 16:02:21 -04:00
parent f4c91891e0
commit 3745f44a5f
1 changed files with 3 additions and 3 deletions

View File

@ -170,10 +170,10 @@ void Message::write(std::vector<uint8_t> &buffer) const
mdb.pid == DISC_UNIQUE_BRANCH.pid)
return writeDiscBranch(buffer);
buffer.reserve(buffer.size() + 26 + mdb.pdl()); // pre-allocate necessary memory
buffer.reserve(buffer.size()+MESSAGE_MINIMUM_LENGTH+mdb.pdl()+2); // pre-allocate necessary memory
buffer.push_back(SC_RDM);
buffer.push_back(SC_SUB_MESSAGE);
buffer.push_back(24 + mdb.pdl());
buffer.push_back(MESSAGE_MINIMUM_LENGTH+mdb.pdl());
writeType(buffer, destination.manufacturer);
writeType(buffer, destination.device);
writeType(buffer, source.manufacturer);
@ -205,7 +205,7 @@ void Message::writeDiscBranch(std::vector<uint8_t> &buffer) const
mdb.pid != DISC_UNIQUE_BRANCH.pid)
return write(buffer);
buffer.reserve(buffer.size() + 24); // pre-allocate necessary memory
buffer.reserve(buffer.size() + MESSAGE_MINIMUM_LENGTH); // pre-allocate necessary memory
for (int i = 0; i < 7; i++)
buffer.push_back(0xfe); //!< Response Preamble bytes