// 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 AgentThrottleMessage implements MessageBase { name = 'AgentThrottle'; messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow; id = Message.AgentThrottle; AgentData: { AgentID: UUID; SessionID: UUID; CircuitCode: number; }; Throttle: { GenCounter: number; Throttles: Buffer; }; getSize(): number { return (this.Throttle['Throttles'].length + 1) + 40; } // @ts-ignore writeToBuffer(buf: Buffer, pos: number): number { const startPos = pos; this.AgentData['AgentID'].writeToBuffer(buf, pos); pos += 16; this.AgentData['SessionID'].writeToBuffer(buf, pos); pos += 16; buf.writeUInt32LE(this.AgentData['CircuitCode'], pos); pos += 4; buf.writeUInt32LE(this.Throttle['GenCounter'], pos); pos += 4; buf.writeUInt8(this.Throttle['Throttles'].length, pos++); this.Throttle['Throttles'].copy(buf, pos); pos += this.Throttle['Throttles'].length; return pos - startPos; } // @ts-ignore readFromBuffer(buf: Buffer, pos: number): number { const startPos = pos; let varLength = 0; const newObjAgentData: { AgentID: UUID, SessionID: UUID, CircuitCode: number } = { AgentID: UUID.zero(), SessionID: UUID.zero(), CircuitCode: 0 }; newObjAgentData['AgentID'] = new UUID(buf, pos); pos += 16; newObjAgentData['SessionID'] = new UUID(buf, pos); pos += 16; newObjAgentData['CircuitCode'] = buf.readUInt32LE(pos); pos += 4; this.AgentData = newObjAgentData; const newObjThrottle: { GenCounter: number, Throttles: Buffer } = { GenCounter: 0, Throttles: Buffer.allocUnsafe(0) }; newObjThrottle['GenCounter'] = buf.readUInt32LE(pos); pos += 4; varLength = buf.readUInt8(pos++); newObjThrottle['Throttles'] = buf.slice(pos, pos + varLength); pos += varLength; this.Throttle = newObjThrottle; return pos - startPos; } }