mirror of
https://github.com/jwetzell/acn-js.git
synced 2026-09-12 00:39:26 +00:00
add sdt disconnect and disconnecting data decoding
This commit is contained in:
@@ -130,6 +130,12 @@ export type SDTConnectRefuseData = {
|
|||||||
refuseCode: number;
|
refuseCode: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type SDTDisconnectData = SDTConnectData;
|
||||||
|
export type SDTDisconnectingData = {
|
||||||
|
protocolID: number;
|
||||||
|
reasonCode: number;
|
||||||
|
};
|
||||||
|
|
||||||
export type SDTGetSessionsData = {
|
export type SDTGetSessionsData = {
|
||||||
componentID: string;
|
componentID: string;
|
||||||
};
|
};
|
||||||
@@ -149,6 +155,8 @@ export type SessionDataTransportPDU = {
|
|||||||
| SDTConnectData
|
| SDTConnectData
|
||||||
| SDTConnectAcceptData
|
| SDTConnectAcceptData
|
||||||
| SDTConnectRefuseData
|
| SDTConnectRefuseData
|
||||||
|
| SDTDisconnectData
|
||||||
|
| SDTDisconnectingData
|
||||||
| Uint8Array;
|
| Uint8Array;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import {
|
|||||||
SDTConnectAcceptData,
|
SDTConnectAcceptData,
|
||||||
SDTConnectData,
|
SDTConnectData,
|
||||||
SDTConnectRefuseData,
|
SDTConnectRefuseData,
|
||||||
|
SDTDisconnectData,
|
||||||
|
SDTDisconnectingData,
|
||||||
SDTGetSessionsData,
|
SDTGetSessionsData,
|
||||||
SDTJoinAcceptData,
|
SDTJoinAcceptData,
|
||||||
SDTJoinData,
|
SDTJoinData,
|
||||||
@@ -141,6 +143,8 @@ function decodeData(
|
|||||||
| SDTConnectData
|
| SDTConnectData
|
||||||
| SDTConnectAcceptData
|
| SDTConnectAcceptData
|
||||||
| SDTConnectRefuseData
|
| SDTConnectRefuseData
|
||||||
|
| SDTDisconnectData
|
||||||
|
| SDTDisconnectingData
|
||||||
| 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) {
|
||||||
@@ -241,6 +245,7 @@ function decodeData(
|
|||||||
lastMissedSequence: view.getUint32(28),
|
lastMissedSequence: view.getUint32(28),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
case SessionDataTransportVectors.DISCONNECT:
|
||||||
case SessionDataTransportVectors.CONNECT:
|
case SessionDataTransportVectors.CONNECT:
|
||||||
case SessionDataTransportVectors.CONNECT_ACCEPT: {
|
case SessionDataTransportVectors.CONNECT_ACCEPT: {
|
||||||
return {
|
return {
|
||||||
@@ -253,6 +258,12 @@ function decodeData(
|
|||||||
refuseCode: view.getUint8(4),
|
refuseCode: view.getUint8(4),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
case SessionDataTransportVectors.DISCONNECTING: {
|
||||||
|
return {
|
||||||
|
protocolID: view.getUint32(0),
|
||||||
|
reasonCode: view.getUint8(4),
|
||||||
|
};
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
console.error(`unhandled SDT vector: ${vector}`);
|
console.error(`unhandled SDT vector: ${vector}`);
|
||||||
return bytes;
|
return bytes;
|
||||||
|
|||||||
Reference in New Issue
Block a user