add sdt get sessions data decoding

This commit is contained in:
2024-12-07 11:36:11 -06:00
parent 10403a49ca
commit af67fe3cfe
3 changed files with 20 additions and 10 deletions
+8 -8
View File
@@ -5,22 +5,22 @@ not sure how far I will take this but messing around with E1.17 ACN protocol
- rlp - rlp
- sdt - sdt
- vectors - vectors
- [x] REL_WRAP
- [x] UNREL_WRAP
- [ ] CHANNEL_PARAMS
- [x] JOIN - [x] JOIN
- [x] JOIN_REFUSE - [x] JOIN_REFUSE
- [x] JOIN_ACCEPT - [x] JOIN_ACCEPT
- [ ] LEAVE
- [x] LEAVING - [x] LEAVING
- [ ] NAK
- [x] REL_WRAP
- [x] UNREL_WRAP
- [x] GET_SESSIONS
- [ ] SESSIONS
- [x] ACK
- [ ] CHANNEL_PARAMS
- [ ] LEAVE
- [ ] CONNECT - [ ] CONNECT
- [ ] CONNECT_ACCEPT - [ ] CONNECT_ACCEPT
- [ ] CONNECT_REFUSE - [ ] CONNECT_REFUSE
- [ ] DISCONNECT - [ ] DISCONNECT
- [ ] DISCONNECTING - [ ] DISCONNECTING
- [x] ACK
- [ ] NAK
- [ ] GET_SESSIONS
- [ ] SESSIONS
- dmp - dmp
- ddl - ddl
+5 -1
View File
@@ -111,10 +111,14 @@ export type SDTAckData = {
reliableSequenceNumber: number; reliableSequenceNumber: number;
}; };
export type SDTGetSessionsData = {
componentID: string;
};
export type SessionDataTransportPDU = { export type SessionDataTransportPDU = {
vector: SessionDataTransportVectors; vector: SessionDataTransportVectors;
// TODO(jwetzell): cleanup these types // TODO(jwetzell): cleanup these types
data: SDTJoinData | SDTJoinAcceptData | SDTJoinRefuseData | SDTWrapperData | SDTAckData | SDTLeavingData | Uint8Array; data: SDTJoinData | SDTJoinAcceptData | SDTJoinRefuseData | SDTWrapperData | SDTAckData | SDTLeavingData | SDTGetSessionsData | Uint8Array;
}; };
export type SDTClientBlock = { export type SDTClientBlock = {
+7 -1
View File
@@ -1,6 +1,7 @@
import { import {
Protocols, Protocols,
SDTAckData, SDTAckData,
SDTGetSessionsData,
SDTJoinAcceptData, SDTJoinAcceptData,
SDTJoinData, SDTJoinData,
SDTJoinRefuseData, SDTJoinRefuseData,
@@ -124,7 +125,7 @@ function decodeClientBlock(bytes: Uint8Array) {
function decodeData( function decodeData(
vector: SessionDataTransportVectors, vector: SessionDataTransportVectors,
bytes: Uint8Array bytes: Uint8Array
): SDTJoinData | SDTJoinAcceptData | SDTJoinRefuseData | SDTWrapperData | SDTAckData | SDTLeavingData | Uint8Array { ): SDTJoinData | SDTJoinAcceptData | SDTJoinRefuseData | SDTWrapperData | SDTAckData | SDTLeavingData | SDTGetSessionsData | Uint8Array {
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
switch (vector) { switch (vector) {
case SessionDataTransportVectors.JOIN: { case SessionDataTransportVectors.JOIN: {
@@ -209,6 +210,11 @@ function decodeData(
reasonCode: view.getUint8(24), reasonCode: view.getUint8(24),
}; };
} }
case SessionDataTransportVectors.GET_SESSIONS: {
return {
componentID: toHex(bytes.subarray(0, 16))
}
}
default: default:
console.error(`unhandled SDT vector: ${vector}`); console.error(`unhandled SDT vector: ${vector}`);
return bytes; return bytes;