mirror of
https://github.com/jwetzell/acn-js.git
synced 2026-09-13 01:09:26 +00:00
add sdt disconnect and disconnecting data decoding
This commit is contained in:
@@ -4,6 +4,8 @@ import {
|
||||
SDTConnectAcceptData,
|
||||
SDTConnectData,
|
||||
SDTConnectRefuseData,
|
||||
SDTDisconnectData,
|
||||
SDTDisconnectingData,
|
||||
SDTGetSessionsData,
|
||||
SDTJoinAcceptData,
|
||||
SDTJoinData,
|
||||
@@ -141,6 +143,8 @@ function decodeData(
|
||||
| SDTConnectData
|
||||
| SDTConnectAcceptData
|
||||
| SDTConnectRefuseData
|
||||
| SDTDisconnectData
|
||||
| SDTDisconnectingData
|
||||
| Uint8Array {
|
||||
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
||||
switch (vector) {
|
||||
@@ -241,6 +245,7 @@ function decodeData(
|
||||
lastMissedSequence: view.getUint32(28),
|
||||
};
|
||||
}
|
||||
case SessionDataTransportVectors.DISCONNECT:
|
||||
case SessionDataTransportVectors.CONNECT:
|
||||
case SessionDataTransportVectors.CONNECT_ACCEPT: {
|
||||
return {
|
||||
@@ -253,6 +258,12 @@ function decodeData(
|
||||
refuseCode: view.getUint8(4),
|
||||
};
|
||||
}
|
||||
case SessionDataTransportVectors.DISCONNECTING: {
|
||||
return {
|
||||
protocolID: view.getUint32(0),
|
||||
reasonCode: view.getUint8(4),
|
||||
};
|
||||
}
|
||||
default:
|
||||
console.error(`unhandled SDT vector: ${vector}`);
|
||||
return bytes;
|
||||
|
||||
Reference in New Issue
Block a user