Update packets

This commit is contained in:
Bill 2021-07-30 21:48:21 -04:00
parent df861e08ed
commit 89db02a844
6 changed files with 141 additions and 128 deletions

View File

@ -7,38 +7,39 @@ export class CameraPublishStatusMessageParser implements IMessageParser
private _secondsToWait: number = 0; private _secondsToWait: number = 0;
private _extraDataId: string; private _extraDataId: string;
public isOk(): boolean
{
return this._ok;
}
public getSecondsToWait(): number
{
return this._secondsToWait;
}
public getExtraDataId(): string
{
return this._extraDataId;
}
public flush(): boolean public flush(): boolean
{ {
this._ok = false; this._ok = false;
this._secondsToWait = 0; this._secondsToWait = 0;
this._extraDataId = null; this._extraDataId = null;
return true; return true;
} }
public parse(k: IMessageDataWrapper): boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
this._ok = k.readBoolean(); if(!wrapper) return false;
this._secondsToWait = k.readInt();
if(((this._ok) && (k.bytesAvailable))) this._ok = wrapper.readBoolean();
{ this._secondsToWait = wrapper.readInt();
this._extraDataId = k.readString();
} if(this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString();
return true; return true;
} }
public get ok(): boolean
{
return this._ok;
}
public get secondsToWait(): number
{
return this._secondsToWait;
}
public get extraDataId(): string
{
return this._extraDataId;
}
} }

View File

@ -8,8 +8,10 @@ export class CameraPurchaseOKMessageParser implements IMessageParser
return true; return true;
} }
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(!wrapper) return false;
return true; return true;
} }
} }

View File

@ -5,20 +5,24 @@ export class CameraStorageUrlMessageParser implements IMessageParser
{ {
private _url: string; private _url: string;
public flush(): boolean
{
this._url = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._url = wrapper.readString();
return true;
}
public get url(): string public get url(): string
{ {
return this._url; return this._url;
} }
public flush():boolean
{
this._url = '';
return true;
}
public parse(k:IMessageDataWrapper):boolean
{
this._url = k.readString();
return true;
}
} }

View File

@ -6,28 +6,31 @@ export class CompetitionStatusMessageParser implements IMessageParser
private _ok: boolean = false; private _ok: boolean = false;
private _errorReason: string = null; private _errorReason: string = null;
public isOk():boolean
{
return this._ok;
}
public getErrorReason():string
{
return this._errorReason;
}
public flush(): boolean public flush(): boolean
{ {
this._ok = false; this._ok = false;
this._errorReason = null; this._errorReason = null;
return true; return true;
} }
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
this._ok = k.readBoolean(); if(!wrapper) return false;
this._errorReason = k.readString();
this._ok = wrapper.readBoolean();
this._errorReason = wrapper.readString();
return true; return true;
} }
public get ok(): boolean
{
return this._ok;
}
public get errorReason(): string
{
return this._errorReason;
}
} }

View File

@ -7,38 +7,39 @@ export class InitCameraMessageParser implements IMessageParser
private _ducketPrice: number = 0; private _ducketPrice: number = 0;
private _publishDucketPrice: number = 0; private _publishDucketPrice: number = 0;
public getCreditPrice():number
{
return this._creditPrice;
}
public getDucketPrice():number
{
return this._ducketPrice;
}
public getPublishDucketPrice():number
{
return this._publishDucketPrice;
}
public flush(): boolean public flush(): boolean
{ {
this._creditPrice = 0; this._creditPrice = 0;
this._ducketPrice = 0; this._ducketPrice = 0;
this._publishDucketPrice = 0; this._publishDucketPrice = 0;
return true; return true;
} }
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
this._creditPrice = k.readInt(); if(!wrapper) return false;
this._ducketPrice = k.readInt();
if(k.bytesAvailable) this._creditPrice = wrapper.readInt();
{ this._ducketPrice = wrapper.readInt();
this._publishDucketPrice = k.readInt();
} if(wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt();
return true; return true;
} }
public get creditPrice(): number
{
return this._creditPrice;
}
public get ducketPrice(): number
{
return this._ducketPrice;
}
public get publishDucketPrice(): number
{
return this._publishDucketPrice;
}
} }

View File

@ -6,17 +6,6 @@ export class ThumbnailStatusMessageParser implements IMessageParser
private _ok: boolean = true; private _ok: boolean = true;
private _renderLimitHit: boolean = false; private _renderLimitHit: boolean = false;
public isOk():boolean
{
return this._ok;
}
public isRenderLimitHit():boolean
{
return this._renderLimitHit;
}
public flush(): boolean public flush(): boolean
{ {
this._ok = true; this._ok = true;
@ -24,13 +13,26 @@ export class ThumbnailStatusMessageParser implements IMessageParser
return true; return true;
} }
public parse(k:IMessageDataWrapper):boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(k.bytesAvailable) if(!wrapper) return false;
if(wrapper.bytesAvailable)
{ {
this._ok = k.readBoolean(); this._ok = wrapper.readBoolean();
this._renderLimitHit = k.readBoolean(); this._renderLimitHit = wrapper.readBoolean();
} }
return true; return true;
} }
public get ok(): boolean
{
return this._ok;
}
public get isRenderLimitHit(): boolean
{
return this._renderLimitHit;
}
} }