UDP Circuit basics, message changes
This commit is contained in:
109
lib/classes/messages/PlacesQuery.ts
Normal file
109
lib/classes/messages/PlacesQuery.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
// 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 PlacesQueryMessage implements MessageBase
|
||||
{
|
||||
name = 'PlacesQuery';
|
||||
messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyLow;
|
||||
id = Message.PlacesQuery;
|
||||
|
||||
AgentData: {
|
||||
AgentID: UUID;
|
||||
SessionID: UUID;
|
||||
QueryID: UUID;
|
||||
};
|
||||
TransactionData: {
|
||||
TransactionID: UUID;
|
||||
};
|
||||
QueryData: {
|
||||
QueryText: string;
|
||||
QueryFlags: number;
|
||||
Category: number;
|
||||
SimName: string;
|
||||
};
|
||||
|
||||
getSize(): number
|
||||
{
|
||||
return (this.QueryData['QueryText'].length + 1 + this.QueryData['SimName'].length + 1) + 69;
|
||||
}
|
||||
|
||||
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;
|
||||
this.AgentData['QueryID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.TransactionData['TransactionID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8(this.QueryData['QueryText'].length, pos++);
|
||||
buf.write(this.QueryData['QueryText'], pos);
|
||||
pos += this.QueryData['QueryText'].length;
|
||||
buf.writeUInt32LE(this.QueryData['QueryFlags'], pos);
|
||||
pos += 4;
|
||||
buf.writeInt8(this.QueryData['Category'], pos++);
|
||||
buf.writeUInt8(this.QueryData['SimName'].length, pos++);
|
||||
buf.write(this.QueryData['SimName'], pos);
|
||||
pos += this.QueryData['SimName'].length;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
let varLength = 0;
|
||||
const newObjAgentData: {
|
||||
AgentID: UUID,
|
||||
SessionID: UUID,
|
||||
QueryID: UUID
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
SessionID: UUID.zero(),
|
||||
QueryID: UUID.zero()
|
||||
};
|
||||
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['QueryID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData = newObjAgentData;
|
||||
const newObjTransactionData: {
|
||||
TransactionID: UUID
|
||||
} = {
|
||||
TransactionID: UUID.zero()
|
||||
};
|
||||
newObjTransactionData['TransactionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.TransactionData = newObjTransactionData;
|
||||
const newObjQueryData: {
|
||||
QueryText: string,
|
||||
QueryFlags: number,
|
||||
Category: number,
|
||||
SimName: string
|
||||
} = {
|
||||
QueryText: '',
|
||||
QueryFlags: 0,
|
||||
Category: 0,
|
||||
SimName: ''
|
||||
};
|
||||
varLength = buf.readUInt8(pos++);
|
||||
newObjQueryData['QueryText'] = buf.toString('utf8', pos, pos + (varLength - 1));
|
||||
pos += varLength;
|
||||
newObjQueryData['QueryFlags'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjQueryData['Category'] = buf.readInt8(pos++);
|
||||
varLength = buf.readUInt8(pos++);
|
||||
newObjQueryData['SimName'] = buf.toString('utf8', pos, pos + (varLength - 1));
|
||||
pos += varLength;
|
||||
this.QueryData = newObjQueryData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user