1
0
Fork 0

track relative address offests

This commit is contained in:
Kevin Matz 2021-09-04 17:41:02 -04:00
parent c6386b0272
commit 25227ff083
1 changed files with 17 additions and 0 deletions

View File

@ -88,6 +88,23 @@ void Device::dmpSet(PDU::Message<DMP::Pdu> dmp)
{
auto type = std::static_pointer_cast<address_type>(dmp->header());
auto set_data = std::static_pointer_cast<address_pair_list>(dmp->data());
for(const auto& [range, data] : set_data->properties)
{
/// \cite DMP 5.1.2 Relative Addresses
/// Relative addresses are used to specify an address as an offset
/// from the most recently used address within the same PDU Block.
uint32_t address = range.address;
if (type->relative)
address += last_address_used;
/// \todo do something with DMP properties
/// \cite DMP 5.1.2 Relative Addresses
/// If a command addresses a range of properties then a subsequent
/// relative address shall be relative to the last property in that range.
last_address_used = address;
}
}