Skip to content

Commit

Permalink
billsonnn#28 - CameraSnapshotMessageEvent added
Browse files Browse the repository at this point in the history
  • Loading branch information
oobjectt committed Dec 24, 2022
1 parent 26741b7 commit 955c9e7
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/nitro/communication/NitroMessages.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export class IncomingHeader
public static CAMERA_PUBLISH_STATUS = 2057;
public static CAMERA_PURCHASE_OK = 2783;
public static CAMERA_STORAGE_URL = 3696;
public static CAMERA_SNAPSHOT = 463;
public static COMPETITION_STATUS = 133;
public static INIT_CAMERA = 3878;
public static THUMBNAIL_STATUS = 3595;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { CameraSnapshotMessageParser } from '../../parser';

export class CameraSnapshotMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CameraSnapshotMessageParser);
}

public getParser(): CameraSnapshotMessageParser
{
return this.parser as CameraSnapshotMessageParser;
}
}
1 change: 1 addition & 0 deletions src/nitro/communication/messages/incoming/camera/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './CameraPublishStatusMessageEvent';
export * from './CameraPurchaseOKMessageEvent';
export * from './CameraSnapshotMessageEvent';
export * from './CameraStorageUrlMessageEvent';
export * from './CompetitionStatusMessageEvent';
export * from './InitCameraMessageEvent';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';

export class CameraSnapshotMessageParser implements IMessageParser
{
private _roomType: string;
private _roomId: number;

public flush(): boolean
{
this._roomType = null;
this._roomId = -1;

return true;
}

public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;

this._roomType = wrapper.readString();
this._roomId = wrapper.readInt();

return true;
}

public get roomType(): string
{
return this._roomType;
}

public get roomId(): number
{
return this._roomId;
}
}
1 change: 1 addition & 0 deletions src/nitro/communication/messages/parser/camera/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './CameraPublishStatusMessageParser';
export * from './CameraPurchaseOKMessageParser';
export * from './CameraSnapshotMessageParser';
export * from './CameraStorageUrlMessageParser';
export * from './CompetitionStatusMessageParser';
export * from './InitCameraMessageParser';
Expand Down

0 comments on commit 955c9e7

Please sign in to comment.