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
- sdt
- vectors
- [x] REL_WRAP
- [x] UNREL_WRAP
- [ ] CHANNEL_PARAMS
- [x] JOIN
- [x] JOIN_REFUSE
- [x] JOIN_ACCEPT
- [ ] LEAVE
- [x] LEAVING
- [ ] NAK
- [x] REL_WRAP
- [x] UNREL_WRAP
- [x] GET_SESSIONS
- [ ] SESSIONS
- [x] ACK
- [ ] CHANNEL_PARAMS
- [ ] LEAVE
- [ ] CONNECT
- [ ] CONNECT_ACCEPT
- [ ] CONNECT_REFUSE
- [ ] DISCONNECT
- [ ] DISCONNECTING
- [x] ACK
- [ ] NAK
- [ ] GET_SESSIONS
- [ ] SESSIONS
- dmp
- ddl
+5 -1
View File
@@ -111,10 +111,14 @@ export type SDTAckData = {
reliableSequenceNumber: number;
};
export type SDTGetSessionsData = {
componentID: string;
};
export type SessionDataTransportPDU = {
vector: SessionDataTransportVectors;
// 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 = {
+7 -1
View File
@@ -1,6 +1,7 @@
import {
Protocols,
SDTAckData,
SDTGetSessionsData,
SDTJoinAcceptData,
SDTJoinData,
SDTJoinRefuseData,
@@ -124,7 +125,7 @@ function decodeClientBlock(bytes: Uint8Array) {
function decodeData(
vector: SessionDataTransportVectors,
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);
switch (vector) {
case SessionDataTransportVectors.JOIN: {
@@ -209,6 +210,11 @@ function decodeData(
reasonCode: view.getUint8(24),
};
}
case SessionDataTransportVectors.GET_SESSIONS: {
return {
componentID: toHex(bytes.subarray(0, 16))
}
}
default:
console.error(`unhandled SDT vector: ${vector}`);
return bytes;