OTA PACKET PARSER: Difference between revisions
No edit summary |
No edit summary |
||
| Line 37: | Line 37: | ||
<script> | <script> | ||
function hexToBits(hex) { | function hexToBits(hex) { | ||
return hex.match(/.{1,2}/g).map( | return hex.match(/.{1,2}/g).map(b => | ||
parseInt( | parseInt(b, 16).toString(2).padStart(8, '0')).join(''); | ||
} | } | ||
| Line 49: | Line 49: | ||
const max = Math.pow(2, bits.length); | const max = Math.pow(2, bits.length); | ||
return value >= max / 2 ? value - max : value; | return value >= max / 2 ? value - max : value; | ||
} | |||
function bigIntFromBits(bits) { | |||
return BigInt('0b' + bits).toString(); | |||
} | } | ||
| Line 57: | Line 61: | ||
} | } | ||
return ascii; | return ascii; | ||
} | } | ||
| Line 85: | Line 79: | ||
resultBody.appendChild(row); | resultBody.appendChild(row); | ||
}; | }; | ||
const getBits = (start, end) => bits.slice(start, end); | const getBits = (start, end) => bits.slice(start, end); | ||
// | // Refer to telemetry parser logic — exact structure | ||
output("IMEI", | output("IMEI", bigIntFromBits(getBits(25, 75))); | ||
output("Packet Type", bitsToInt(getBits(75, 80))); | output("Packet Type", bitsToInt(getBits(75, 80))); | ||
output("OTA Source", bitsToInt(getBits(80, 85))); | output("OTA Source", bitsToInt(getBits(80, 85))); | ||
Revision as of 10:00, 21 July 2025
OTA Packet Parser
Parsed Output:
| Field | Value |
|---|