EventHandler: Add EventSubscriptions enum

This commit is contained in:
tt2468 2021-05-13 17:32:50 -07:00
parent 4d6901c075
commit 11d28d17f1
4 changed files with 32 additions and 1 deletions

View File

@ -94,6 +94,7 @@ set(obs-websocket_HEADERS
src/WebSocketProtocol.h
src/WebSocketSession.h
src/eventhandler/EventHandler.h
src/eventhandler/types/EventSubscriptions.h
src/requesthandler/RequestHandler.h
src/requesthandler/rpc/Request.h
src/requesthandler/rpc/RequestResult.h

View File

@ -1,4 +1,5 @@
#include "WebSocketSession.h"
#include "eventhandler/types/EventSubscriptions.h"
#include "plugin-macros.generated.h"
@ -13,7 +14,7 @@ WebSocketSession::WebSocketSession() :
_isIdentified(false),
_ignoreInvalidMessages(false),
_ignoreNonFatalRequestChecks(false),
_eventSubscriptions(0)
_eventSubscriptions(EventSubscriptions::All)
{
}

View File

@ -6,6 +6,7 @@
#include "../obs-websocket.h"
#include "../WebSocketServer.h"
#include "types/EventSubscriptions.h"
class EventHandler
{

View File

@ -0,0 +1,28 @@
#pragma once
namespace EventSubscriptions {
enum EventSubscriptions {
// Set subscriptions to 0 to disable all events
None = 0,
// Receive events in the `General` category
General = (1 << 0),
// Receive events in the `Config` category
Config = (1 << 1),
// Receive events in the `Scenes` category
Scenes = (1 << 2),
// Receive events in the `Inputs` category
Inputs = (1 << 3),
// Receive events in the `Transitions` category
Transitions = (1 << 4),
// Receive events in the `Filters` category
Filters = (1 << 5),
// Receive events in the `Outputs` category
Outputs = (1 << 6),
// Receive events in the `Scene Items` category
SceneItems = (1 << 7),
// Receive events in the `MediaInputs` category
MediaInputs = (1 << 8),
// Receive all event categories
All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs),
};
};