From ccda78ed6dab2a441c31bb5da6c6ad0397172dd3 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 21 Sep 2023 21:01:38 +0200 Subject: [PATCH] CoapPacket - Cleared up code --- source/doap/protocol/packet.d | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/doap/protocol/packet.d b/source/doap/protocol/packet.d index 264bc6e..5b60008 100644 --- a/source/doap/protocol/packet.d +++ b/source/doap/protocol/packet.d @@ -441,16 +441,16 @@ public class CoapPacket // Delta value is 2 bytes (BE) ubyte[] optionIdBytes = data[idx..idx+2]; ushort unProcessedValue = *(cast(ushort*)optionIdBytes.ptr); - ushort optionId = order(unProcessedValue, Order.BE); // The value found is then lacking 269 (so add it back) - optionId+=269; + ushort deltaAddition = order(unProcessedValue, Order.BE); + deltaAddition+=269; - // Then tack on the delta - optionId+=delta; + // Update delta + delta+=deltaAddition; - // TODO: What to do about delta? I think we should make it the new delta - delta=optionId; + // Our option ID is then calculated from the current delta + ushort optionId = delta; // Jump over [Option delta extended (16bit)] here idx+=2;