add sdt connect, connect accept, connect refuse data decoding

This commit is contained in:
2024-12-07 12:06:03 -06:00
parent 759ae56bdc
commit a47205ed9c
3 changed files with 34 additions and 3 deletions
+3 -3
View File
@@ -17,9 +17,9 @@ not sure how far I will take this but messing around with E1.17 ACN protocol
- [x] ACK - [x] ACK
- [ ] CHANNEL_PARAMS - [ ] CHANNEL_PARAMS
- [ ] LEAVE - [ ] LEAVE
- [ ] CONNECT - [x] CONNECT
- [ ] CONNECT_ACCEPT - [x] CONNECT_ACCEPT
- [ ] CONNECT_REFUSE - [x] CONNECT_REFUSE
- [ ] DISCONNECT - [ ] DISCONNECT
- [ ] DISCONNECTING - [ ] DISCONNECTING
- dmp - dmp
+13
View File
@@ -120,6 +120,16 @@ export type SDTNakData = {
lastMissedSequence: number; lastMissedSequence: number;
}; };
export type SDTConnectData = {
protocolID: number;
};
export type SDTConnectAcceptData = SDTConnectData;
export type SDTConnectRefuseData = {
protocolID: number;
refuseCode: number;
};
export type SDTGetSessionsData = { export type SDTGetSessionsData = {
componentID: string; componentID: string;
}; };
@@ -136,6 +146,9 @@ export type SessionDataTransportPDU = {
| SDTLeavingData | SDTLeavingData
| SDTGetSessionsData | SDTGetSessionsData
| SDTNakData | SDTNakData
| SDTConnectData
| SDTConnectAcceptData
| SDTConnectRefuseData
| Uint8Array; | Uint8Array;
}; };
+18
View File
@@ -1,6 +1,9 @@
import { import {
Protocols, Protocols,
SDTAckData, SDTAckData,
SDTConnectAcceptData,
SDTConnectData,
SDTConnectRefuseData,
SDTGetSessionsData, SDTGetSessionsData,
SDTJoinAcceptData, SDTJoinAcceptData,
SDTJoinData, SDTJoinData,
@@ -135,6 +138,9 @@ function decodeData(
| SDTLeavingData | SDTLeavingData
| SDTGetSessionsData | SDTGetSessionsData
| SDTNakData | SDTNakData
| SDTConnectData
| SDTConnectAcceptData
| SDTConnectRefuseData
| Uint8Array { | 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) {
@@ -235,6 +241,18 @@ function decodeData(
lastMissedSequence: view.getUint32(28), lastMissedSequence: view.getUint32(28),
}; };
} }
case SessionDataTransportVectors.CONNECT:
case SessionDataTransportVectors.CONNECT_ACCEPT: {
return {
protocolID: view.getUint32(0),
};
}
case SessionDataTransportVectors.CONNECT_REFUSE: {
return {
protocolID: view.getUint32(0),
refuseCode: view.getUint8(4),
};
}
default: default:
console.error(`unhandled SDT vector: ${vector}`); console.error(`unhandled SDT vector: ${vector}`);
return bytes; return bytes;