Skip to content

Commit ef7cef6

Browse files
oobjecttbillsonnn
andauthored
#28 - CameraSnapshotMessageEvent added (#36)
Co-authored-by: Bill <[email protected]>
1 parent 53ab155 commit ef7cef6

File tree

6 files changed

+56
-1
lines changed

6 files changed

+56
-1
lines changed

src/nitro/communication/NitroMessages.ts

+2-1
Large diffs are not rendered by default.

src/nitro/communication/messages/incoming/IncomingHeader.ts

+1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ export class IncomingHeader
335335
public static CAMERA_PUBLISH_STATUS = 2057;
336336
public static CAMERA_PURCHASE_OK = 2783;
337337
public static CAMERA_STORAGE_URL = 3696;
338+
public static CAMERA_SNAPSHOT = 463;
338339
public static COMPETITION_STATUS = 133;
339340
public static INIT_CAMERA = 3878;
340341
public static THUMBNAIL_STATUS = 3595;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { IMessageEvent } from '../../../../../api';
2+
import { MessageEvent } from '../../../../../events';
3+
import { CameraSnapshotMessageParser } from '../../parser';
4+
5+
export class CameraSnapshotMessageEvent extends MessageEvent implements IMessageEvent
6+
{
7+
constructor(callBack: Function)
8+
{
9+
super(callBack, CameraSnapshotMessageParser);
10+
}
11+
12+
public getParser(): CameraSnapshotMessageParser
13+
{
14+
return this.parser as CameraSnapshotMessageParser;
15+
}
16+
}

src/nitro/communication/messages/incoming/camera/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './CameraPublishStatusMessageEvent';
22
export * from './CameraPurchaseOKMessageEvent';
3+
export * from './CameraSnapshotMessageEvent';
34
export * from './CameraStorageUrlMessageEvent';
45
export * from './CompetitionStatusMessageEvent';
56
export * from './InitCameraMessageEvent';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
2+
3+
export class CameraSnapshotMessageParser implements IMessageParser
4+
{
5+
private _roomType: string;
6+
private _roomId: number;
7+
8+
public flush(): boolean
9+
{
10+
this._roomType = null;
11+
this._roomId = -1;
12+
13+
return true;
14+
}
15+
16+
public parse(wrapper: IMessageDataWrapper): boolean
17+
{
18+
if(!wrapper) return false;
19+
20+
this._roomType = wrapper.readString();
21+
this._roomId = wrapper.readInt();
22+
23+
return true;
24+
}
25+
26+
public get roomType(): string
27+
{
28+
return this._roomType;
29+
}
30+
31+
public get roomId(): number
32+
{
33+
return this._roomId;
34+
}
35+
}

src/nitro/communication/messages/parser/camera/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './CameraPublishStatusMessageParser';
22
export * from './CameraPurchaseOKMessageParser';
3+
export * from './CameraSnapshotMessageParser';
34
export * from './CameraStorageUrlMessageParser';
45
export * from './CompetitionStatusMessageParser';
56
export * from './InitCameraMessageParser';

0 commit comments

Comments
 (0)