Files
node-metaverse/lib/classes/messages/StartPingCheck.ts

51 lines
1.3 KiB
TypeScript

// 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;
}
}