UDP Circuit basics, message changes
This commit is contained in:
56
lib/classes/messages/OfflineNotification.ts
Normal file
56
lib/classes/messages/OfflineNotification.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
// This file has been automatically generated by writeMessageClasses.js
|
||||
|
||||
import {UUID} from '../UUID';
|
||||
import {MessageFlags} from '../../enums/MessageFlags';
|
||||
import {MessageBase} from '../MessageBase';
|
||||
import {Message} from '../../enums/Message';
|
||||
|
||||
export class OfflineNotificationMessage implements MessageBase
|
||||
{
|
||||
name = 'OfflineNotification';
|
||||
messageFlags = MessageFlags.Trusted | MessageFlags.FrequencyLow;
|
||||
id = Message.OfflineNotification;
|
||||
|
||||
AgentBlock: {
|
||||
AgentID: UUID;
|
||||
}[];
|
||||
|
||||
getSize(): number
|
||||
{
|
||||
return ((16) * this.AgentBlock.length) + 1;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const count = this.AgentBlock.length;
|
||||
buf.writeUInt8(this.AgentBlock.length, pos++);
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
this.AgentBlock[i]['AgentID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
let varLength = 0;
|
||||
const count = buf.readUInt8(pos++);
|
||||
this.AgentBlock = [];
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
const newObjAgentBlock: {
|
||||
AgentID: UUID
|
||||
} = {
|
||||
AgentID: UUID.zero()
|
||||
};
|
||||
newObjAgentBlock['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentBlock.push(newObjAgentBlock);
|
||||
}
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user