add more cfh packets

This commit is contained in:
dank074 2021-11-26 18:44:27 -06:00
parent f4bae6b951
commit 8e3ec85eb2
10 changed files with 147 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -337,7 +337,7 @@ export class IncomingHeader
public static POLL_OFFER = 3785;
public static QUESTION_ANSWERED = 2589;
public static QUESTION_FINISHED = 1066;
public static CALL_FOR_HELP_PENDING_CALLS = 1121;
public static CFH_PENDING_CALLS = 1121;
public static GUIDE_ON_DUTY_STATUS = 1548;
public static GUIDE_SESSION_ATTACHED = 1591;
public static GUIDE_SESSION_DETACHED = 138;
@ -354,4 +354,6 @@ export class IncomingHeader
public static ISSUE_CLOSE_NOTIFICATION = 934;
public static QUIZ_DATA = 2927;
public static QUIZ_RESULTS = 2772;
public static CFH_PENDING_CALLS_DELETED = 77;
public static CFH_REPLY = 3796;
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CallForHelpPendingCallsDeletedMessageParser } from '../../parser/help/CallForHelpPendingCallsDeletedMessageParser';
export class CallForHelpPendingCallsDeletedMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CallForHelpPendingCallsDeletedMessageParser);
}
public getParser(): CallForHelpPendingCallsDeletedMessageParser
{
return this.parser as CallForHelpPendingCallsDeletedMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CallForHelpPendingCallsMessageParser } from '../../parser/help/CallForHelpPendingCallsMessageParser';
export class CallForHelpPendingCallsMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CallForHelpPendingCallsMessageParser);
}
public getParser(): CallForHelpPendingCallsMessageParser
{
return this.parser as CallForHelpPendingCallsMessageParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CallForHelpReplyMessageParser } from '../../parser/help/CallForHelpReplyMessageParser';
export class CallForHelpReplyMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CallForHelpReplyMessageParser);
}
public getParser(): CallForHelpReplyMessageParser
{
return this.parser as CallForHelpReplyMessageParser;
}
}

View File

@ -1,4 +1,7 @@
export * from './CallForHelpDisabledNotifyMessageEvent';
export * from './CallForHelpPendingCallsDeletedMessageEvent';
export * from './CallForHelpPendingCallsMessageEvent';
export * from './CallForHelpReplyMessageEvent';
export * from './CallForHelpResultMessageEvent';
export * from './GuideOnDutyStatusMessageEvent';
export * from './GuideSessionAttachedMessageEvent';

View File

@ -0,0 +1,15 @@
import { IMessageDataWrapper } from '../../../../../core';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class CallForHelpPendingCallsDeletedMessageParser implements IMessageParser
{
flush(): boolean
{
return true;
}
parse(wrapper: IMessageDataWrapper): boolean
{
return true;
}
}

View File

@ -0,0 +1,47 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class CallForHelpPendingCallsMessageParser implements IMessageParser
{
private _calls: ICall[];
flush(): boolean
{
this._calls = [];
return true;
}
parse(wrapper: IMessageDataWrapper): boolean
{
this._calls = [];
const count = wrapper.readInt();
for(let i = 0; i < count; i++)
{
const callId = wrapper.readString();
const timestamp = wrapper.readString();
const message = wrapper.readString();
this._calls.push({ callId: callId, timeStamp: timestamp, message: message });
}
return true;
}
public get pendingCalls(): ICall[]
{
return this._calls;
}
public get count(): number
{
return this._calls.length;
}
}
export interface ICall
{
callId: string;
timeStamp: string;
message: string;
}

View File

@ -0,0 +1,24 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class CallForHelpReplyMessageParser implements IMessageParser
{
private _message: string;
flush(): boolean
{
this._message = null;
return true;
}
parse(wrapper: IMessageDataWrapper): boolean
{
this._message = wrapper.readString();
return true;
}
public get message(): string
{
return this._message;
}
}

View File

@ -1,4 +1,7 @@
export * from './CallForHelpDisabledNotifyMessageParser';
export * from './CallForHelpPendingCallsDeletedMessageParser';
export * from './CallForHelpPendingCallsMessageParser';
export * from './CallForHelpReplyMessageParser';
export * from './CallForHelpResultMessageParser';
export * from './GuideOnDutyStatusMessageParser';
export * from './GuideReportingStatusMessageParser';