2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __MEDIA_VISION_EVENT_MANAGER_H__
18 #define __MEDIA_VISION_EVENT_MANAGER_H__
21 * @file EventManager.h
22 * @brief This file contains functionality for event manager.
25 #include "EventTrigger.h"
26 #include "EventDefs.h"
28 namespace mediavision {
29 namespace surveillance {
34 * @class EventManagerDestroyer
35 * @brief This class contains event manager destroyer functionality.
39 class EventManagerDestroyer {
42 * @brief Default destructor.
46 ~EventManagerDestroyer();
49 * @brief Initializes pointer to EventManager which will be destroyed.
52 * @param [in] pointer The pointer to EventManager which will be destroyed
54 void initialize(EventManager *pointer);
57 EventManager *__pInstance;
62 * @brief This class contains event manager functionality.
70 * @brief Gets EventManager instance.
74 static EventManager& getInstance();
77 * @brief Registers event.
80 * @param [in] eventTrigger The event trigger to be register (NULL if internal)
81 * @param [in] triggerId Unique event trigger identifier to be register
82 * @param [in] eventType Type of the event
83 * @param [in] videoStreamId Video stream identificator
84 * @param [in] engineCfg The engine configuration for event trigger
85 * @param [in] callback The callback to be called if event will be occured
86 * @param [in] user_data The user data to be passed to the callback function
87 * @param [in] numberOfPoints The number of ROI points
88 * @param [in] roi The intput array with ROI points
89 * @return @c 0 on success, otherwise a negative error value
92 mv_surveillance_event_trigger_h eventTrigger,
94 const char *eventType,
96 mv_engine_config_h engineCfg,
97 mv_surveillance_event_occurred_cb callback,
103 * @brief Unregisters event.
106 * @param [in] triggerId Unique event trigger identifier to be
108 * @param [in] videoStreamId Video stream identifier for which event
109 * will be unregistered
110 * @return @c 0 on success, otherwise a negative error value
112 int unregisterEvent(long int triggerId, int videoStreamId);
115 * @brief Pushes media source to run event triggers.
118 * @param [in] source The media source to be pushed
119 * @param [in] videoStreamId The video stream identificator for media source
120 * @return @c 0 on success, otherwise a negative error value
122 int pushSource(mv_source_h source, int videoStreamId);
125 * @brief Gets supported event types.
128 * @param [out] eventTypes The supported event types
129 * @return @c 0 on success, otherwise a negative error value
131 static int getSupportedEventTypes(StringVector& eventTypes);
134 * @brief Gets all supported event result value names.
137 * @param [out] eventResValNames The supported event result value names
138 * @return @c 0 on success, otherwise a negative error value
140 static int getSupportedEventResultValueNames(StringVector& eventResValNames);
143 * @brief Gets supported event result value names for an event type.
146 * @param [in] eventTypeName The name of the event type to return
147 * result value names for
148 * @param [out] eventResValNames The supported event result value names
149 * @return @c 0 on success, otherwise a negative error value
151 static int getSupportedEventResultValueNames(
152 const std::string& eventTypeName,
153 StringVector& eventResValNames);
158 EventManager(const EventManager&);
160 EventManager& operator=(EventManager&);
164 static void setSupportedEventTypes();
166 EventTriggersIter isTriggerExists(EventTrigger *trigger, int videoStreamId);
168 friend class EventManagerDestroyer;
171 static EventManager *__pInstance;
173 static EventManagerDestroyer Destroyer;
175 static EventTypesMap SupportedEventTypes;
178 EventTriggersMap __eventTriggers;
184 #endif /* __MEDIA_VISION_EVENT_MANAGER_H__ */