mirror of
https://github.com/jwetzell/acn-js.git
synced 2026-08-13 10:43:38 +00:00
decode SDT data in RLP if found
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { RootLayerPDU } from '../models';
|
||||
import pdu from '.';
|
||||
import { Protocols, RootLayerPDU, SessionDataTransportPDU } from '../models';
|
||||
import { toHex } from '../utils';
|
||||
|
||||
function decode(bytes: Uint8Array): RootLayerPDU {
|
||||
@@ -49,7 +50,11 @@ function decode(bytes: Uint8Array): RootLayerPDU {
|
||||
const dataOffset = headerOffset + 16;
|
||||
// NOTE(jwetzell): flags/lengthH + lengthL + lengthX + vector + header
|
||||
const dataLength = length - (1 + 1 + (lengthFlag ? 1 : 0) + 4 + 16);
|
||||
const data = bytes.subarray(dataOffset, dataOffset + dataLength);
|
||||
let data: SessionDataTransportPDU | Uint8Array = bytes.subarray(dataOffset, dataOffset + dataLength);
|
||||
|
||||
if (vector === Protocols.SDT) {
|
||||
data = pdu.sdt.decode(data);
|
||||
}
|
||||
|
||||
return {
|
||||
vector,
|
||||
|
||||
Reference in New Issue
Block a user