UDP Circuit basics, message changes
This commit is contained in:
50
lib/classes/messages/StartPingCheck.ts
Normal file
50
lib/classes/messages/StartPingCheck.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
// This file has been automatically generated by writeMessageClasses.js
|
||||
|
||||
import {MessageFlags} from '../../enums/MessageFlags';
|
||||
import {MessageBase} from '../MessageBase';
|
||||
import {Message} from '../../enums/Message';
|
||||
|
||||
export class StartPingCheckMessage implements MessageBase
|
||||
{
|
||||
name = 'StartPingCheck';
|
||||
messageFlags = MessageFlags.FrequencyHigh;
|
||||
id = Message.StartPingCheck;
|
||||
|
||||
PingID: {
|
||||
PingID: number;
|
||||
OldestUnacked: number;
|
||||
};
|
||||
|
||||
getSize(): number
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
buf.writeUInt8(this.PingID['PingID'], pos++);
|
||||
buf.writeUInt32LE(this.PingID['OldestUnacked'], pos);
|
||||
pos += 4;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
let varLength = 0;
|
||||
const newObjPingID: {
|
||||
PingID: number,
|
||||
OldestUnacked: number
|
||||
} = {
|
||||
PingID: 0,
|
||||
OldestUnacked: 0
|
||||
};
|
||||
newObjPingID['PingID'] = buf.readUInt8(pos++);
|
||||
newObjPingID['OldestUnacked'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
this.PingID = newObjPingID;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user