2
0
mirror of https://github.com/esiur/esiur-js.git synced 2026-04-03 21:48:21 +00:00

Instance.Link

This commit is contained in:
2022-08-13 04:00:26 +03:00
parent 1985363ad7
commit 2689bb7fd5
12 changed files with 1595 additions and 829 deletions

View File

@@ -31,6 +31,7 @@ import IIPPacketCommand from "./IIPPacketCommand.js";
import IIPPacketEvent from "./IIPPacketEvent.js";
import IIPPacketReport from "./IIPPacketReport.js";
import TransmissionType from '../../Data/TransmissionType.js';
import ExceptionCode from "../../Core/ExceptionCode.js";
export default class IIPPacket
{
@@ -81,6 +82,7 @@ export default class IIPPacket
this.command = (data.getUint8(offset) >> 6);
if (this.command == IIPPacketCommand.Event)
{
this.event = (data.getUint8(offset++) & 0x3f);
@@ -104,7 +106,7 @@ export default class IIPPacket
else
{
this.action = (data.getUint8(offset++) & 0x3f);
if (this.notEnough(offset, ends, 4))
return -this.dataLengthNeeded;
@@ -183,6 +185,9 @@ export default class IIPPacket
offset += cl;
}
else {
throw new Error("Unknown event packet.");
}
}
else if (this.command == IIPPacketCommand.Request)
{
@@ -478,6 +483,9 @@ export default class IIPPacket
offset += parsed.size;
}
else {
throw new Error("Unknown request packet.");
}
}
else if (this.command == IIPPacketCommand.Reply)
{
@@ -580,9 +588,12 @@ export default class IIPPacket
this.currentTime = data.getDateTime(offset);
offset += 8;
this.jitter = data.GetUint32(offset);
this.jitter = data.getUint32(offset);
offset += 4;
}
else {
throw new Error("Unknown reply packet.");
}
}
else if (this.command == IIPPacketCommand.Report)
{
@@ -637,6 +648,9 @@ export default class IIPPacket
offset += parsed.size;
}
else {
throw new Error("Unknown report packet.");
}
}
return offset - this.originalOffset;