mirror of
https://github.com/jwetzell/acn-js.git
synced 2026-08-08 08:33:37 +00:00
add sdt get sessions data decoding
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user