CoapPacket

- Cleared up code
This commit is contained in:
Tristan B. Velloza Kildaire 2023-09-21 21:01:38 +02:00
parent 6dfd908184
commit ccda78ed6d

View File

@ -441,16 +441,16 @@ public class CoapPacket
// Delta value is 2 bytes (BE) // Delta value is 2 bytes (BE)
ubyte[] optionIdBytes = data[idx..idx+2]; ubyte[] optionIdBytes = data[idx..idx+2];
ushort unProcessedValue = *(cast(ushort*)optionIdBytes.ptr); ushort unProcessedValue = *(cast(ushort*)optionIdBytes.ptr);
ushort optionId = order(unProcessedValue, Order.BE);
// The value found is then lacking 269 (so add it back) // 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 // Update delta
optionId+=delta; delta+=deltaAddition;
// TODO: What to do about delta? I think we should make it the new delta // Our option ID is then calculated from the current delta
delta=optionId; ushort optionId = delta;
// Jump over [Option delta extended (16bit)] here // Jump over [Option delta extended (16bit)] here
idx+=2; idx+=2;