Remove unused directories and files in video_in_hal
[staging/basesystem.git] / nsframework / notification_persistent_service / server / include / ns_npp_notification.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup  tag_NS_NPPService
20 /// .
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
22
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup  tag_NS_NPPService
25 /// \brief    This file contains declaration of class CNotification.
26 ///
27 ////////////////////////////////////////////////////////////////////////////////////////////////////
28
29 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
30 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
31
32 ////////////////////////////////////////////////////////////////////////////////////////////////////
33 // Include Files
34 ////////////////////////////////////////////////////////////////////////////////////////////////////
35 #include <native_service/frameworkunified_types.h>
36 #include <map>
37 #include <string>
38 #include <iostream>
39 #include "ns_npp_notification_receiver.h"
40
41 typedef std::map<std::string, CNotificationReceiver *> NotifReceiver_Type;
42
43 /// Iterator of map of CNotificationReceiver
44 typedef NotifReceiver_Type::iterator NotifReceiver_Iterator_Type;
45
46 /**
47  *  This class is base class for all the notification types classes.
48  */
49 class CNotification {
50  private:
51   ////////////////////////////////////////////////////////////////////////////////////////////////
52   /// CNotification
53   /// Parameterless Constructor of CNotification class
54   ///
55   /// \param
56   ///
57   /// \return
58   ///
59   ////////////////////////////////////////////////////////////////////////////////////////////////
60   CNotification();
61
62  protected:
63   std::string m_cNotificationName;    ///< Name of Notification
64
65   UI_32 m_uiMaxMsgSize;     ///< Maximum size of notification data
66
67   EFrameworkunifiedNotificationType m_ePersistentType;  ///< type of notification
68
69   std::string m_cServiceName;     ///< List of services registering notification
70
71   NotifReceiver_Type *m_pmSubscribersList;  ///< list of subscribers of notification
72
73   ////////////////////////////////////////////////////////////////////////////////////////////////
74   /// AddReceiverInMap
75   /// This function adds the name of the service to receiver list of notification.
76   ///
77   /// \param  [IN] f_csubscribername
78   ///     std::string - name of application subscribing for notification
79   ///
80   /// \return EFrameworkunifiedStatus
81   //      EFrameworkunifiedStatus - success or failure status
82   ///
83   ////////////////////////////////////////////////////////////////////////////////////////////////
84   EFrameworkunifiedStatus AddReceiverInMap(const std::string &f_csubscribername);
85
86   ////////////////////////////////////////////////////////////////////////////////////////////////
87   /// PublishData
88   /// This function publishes the notification to subscribed clients.
89   ///
90   /// \param  [IN] f_hmsgqhandle
91   ///     HANDLE - MessageQ Handle of ReceiverQ
92   ///
93   /// \param  [IN] f_pmessage
94   ///     std::string - data of notification
95   ///
96   /// \param  [IN] f_uimsgsize
97   ///     std::string - length of data
98   ///
99   /// \return EFrameworkunifiedStatus
100   //      EFrameworkunifiedStatus - success or failure status
101   ///
102   ////////////////////////////////////////////////////////////////////////////////////////////////
103   EFrameworkunifiedStatus PublishData(HANDLE f_hmsgqhandle,
104                          const PVOID f_pmessage,
105                          const UI_32 f_uimsgsize);
106
107  public:
108   ////////////////////////////////////////////////////////////////////////////////////////////////
109   /// CNotification
110   /// Constructor of CNotification class
111   ///
112   /// \param  [IN] f_cnotificationname
113   ///     std::string - Notification name
114   ///
115   /// \param  [IN] f_uimaxmsgsize
116   ///     UI_32 - Maximum size of notification data
117   ///
118   /// \return
119   ///
120   ////////////////////////////////////////////////////////////////////////////////////////////////
121   CNotification(const std::string &f_cnotificationname,
122                 const UI_32 f_uimaxmsgsize);
123
124   ////////////////////////////////////////////////////////////////////////////////////////////////
125   /// ~CNotification
126   /// Destructor of CNotification class
127   ///
128   /// \param
129   ///
130   /// \return
131   ///
132   ////////////////////////////////////////////////////////////////////////////////////////////////
133   virtual ~CNotification();
134
135   ////////////////////////////////////////////////////////////////////////////////////////////////
136   /// AddEventReciever
137   /// This function adds the name of the application to receiver list of particular notification.
138   ///
139   /// \param  [IN] f_csubscribername
140   ///     std::string - name of application subscribing for notification
141   ///
142   /// \return EFrameworkunifiedStatus
143   //      EFrameworkunifiedStatus - success or failure status
144   ///
145   ////////////////////////////////////////////////////////////////////////////////////////////////
146   virtual EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
147
148   ////////////////////////////////////////////////////////////////////////////////////////////////
149   /// Publish
150   /// This function publishes the notification to subscribed clients.
151   ///
152   /// \param  [IN] f_cservicename
153   ///     std::string - name of service publishing the notification
154   ///
155   /// \param  [IN] f_pmessage
156   ///     std::string - data of notification
157   ///
158   /// \param  [IN] f_uimsgsize
159   ///     std::string - length of data
160   ///
161   /// \return EFrameworkunifiedStatus
162   //      EFrameworkunifiedStatus - success or failure status
163   ///
164   ////////////////////////////////////////////////////////////////////////////////////////////////
165   virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
166                              PVOID f_pmessage,
167                              const UI_32 f_uimsgsize);
168
169   ////////////////////////////////////////////////////////////////////////////////////////////////
170   /// DeleteEventReciever
171   /// This function deletes the name of application from receivers list.
172   ///
173   /// \param  [IN] f_csubscribername
174   ///     std::string - name of application
175   ///
176   /// \return EFrameworkunifiedStatus
177   //      EFrameworkunifiedStatus - success or failure status
178   ///
179   ////////////////////////////////////////////////////////////////////////////////////////////////
180   EFrameworkunifiedStatus DeleteEventReciever(const std::string &f_csubscribername);
181
182   ////////////////////////////////////////////////////////////////////////////////////////////////
183   /// SetNewSubscribersList
184   /// This function sets the subscribers list of notification
185   ///
186   /// \param  [IN] f_pnotification
187   ///     CNotification - notification object containing subscribers list
188   ///
189   /// \return EFrameworkunifiedStatus
190   //      EFrameworkunifiedStatus - success or failure status
191   ///
192   ////////////////////////////////////////////////////////////////////////////////////////////////
193   EFrameworkunifiedStatus SetNewSubscribersList(CNotification *f_pnotification);
194
195   ////////////////////////////////////////////////////////////////////////////////////////////////
196   /// SetEventPublisher
197   /// This function set the publisher name to current received service name
198   ///
199   /// \param  [IN] f_cservicename
200   ///     std::string - name of application
201   ///
202   /// \return EFrameworkunifiedStatus
203   //      EFrameworkunifiedStatus - success or failure status
204   ///
205   ////////////////////////////////////////////////////////////////////////////////////////////////
206   EFrameworkunifiedStatus SetEventPublisher(const std::string &f_cservicename);
207
208   ////////////////////////////////////////////////////////////////////////////////////////////////
209   /// ResetEventPublisher
210   /// This function resets the publisher name to NULL
211   ///
212   /// \param  [IN] f_cservicename
213   ///     std::string - name of application
214   ///
215   /// \return EFrameworkunifiedStatus
216   //      EFrameworkunifiedStatus - success or failure status
217   ///
218   ////////////////////////////////////////////////////////////////////////////////////////////////
219   EFrameworkunifiedStatus ResetEventPublisher(const std::string &f_cservicename);
220
221   ////////////////////////////////////////////////////////////////////////////////////////////////
222   /// IsServiceRegistered
223   /// This function checks whether the notification is registered with any service or not.
224   ///
225   /// \param
226   ///
227   /// \return BOOL
228   //      BOOL - true,if subscriber list is empty
229   ///
230   ////////////////////////////////////////////////////////////////////////////////////////////////
231   BOOL IsServiceRegistered();
232
233   ////////////////////////////////////////////////////////////////////////////////////////////////
234   /// IsSubscribersListEmpty
235   /// This function is used to check whether any service is subscribed to notification
236   ///
237   /// \param
238   ///
239   /// \return BOOL
240   //      BOOL - true,if subscriber list is empty
241   ///
242   ////////////////////////////////////////////////////////////////////////////////////////////////
243   BOOL IsSubscribersListEmpty();
244
245   ////////////////////////////////////////////////////////////////////////////////////////////////
246   /// GetNotificationName
247   /// This function is used to get the notification name.
248   ///
249   /// \param
250   ///
251   /// \return std::string
252   //      std::string - notification name
253   ///
254   ////////////////////////////////////////////////////////////////////////////////////////////////
255   std::string GetNotificationName();
256
257   ////////////////////////////////////////////////////////////////////////////////////////////////
258   /// GetPublisherName
259   /// This function is used to get the publisher name of notification.
260   ///
261   /// \param
262   ///
263   /// \return std::string
264   //      std::string - service name
265   ///
266   ////////////////////////////////////////////////////////////////////////////////////////////////
267   std::string GetPublisherName();
268
269   ////////////////////////////////////////////////////////////////////////////////////////////////
270   /// GetPersistenceType
271   /// This function is used to get the type of notification.
272   ///
273   /// \param
274   ///
275   /// \return EFrameworkunifiedPersistentVarType
276   //      EFrameworkunifiedPersistentVarType - persistent type
277   ///
278   ////////////////////////////////////////////////////////////////////////////////////////////////
279   EFrameworkunifiedNotificationType GetNotificationType();
280
281   ////////////////////////////////////////////////////////////////////////////////////////////////
282   /// GetMaxMessageSize
283   /// This function is used to get the max size of data of notification message.
284   ///
285   /// \param
286   ///
287   /// \return UI_32
288   //      UI_32 - Max Message Size
289   ///
290   ////////////////////////////////////////////////////////////////////////////////////////////////
291   UI_32 GetMaxMessageSize();
292
293   ////////////////////////////////////////////////////////////////////////////////////////////////
294   /// ResetMaxMessageSize
295   /// This function reset the max size of data that can be published with notification
296   ///
297   /// \param  [IN] f_uilength
298   ///     std::string - Max size for notification data
299   ///
300   /// \return EFrameworkunifiedStatus
301   //      EFrameworkunifiedStatus - success or failure status
302   ///
303   ////////////////////////////////////////////////////////////////////////////////////////////////
304   virtual EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
305
306 #ifdef NPP_PROFILEINFO_ENABLE
307
308   ////////////////////////////////////////////////////////////////////////////////////////////////
309   /// GetSubscriberList
310   /// Returns the list of subscribers subscribed to notification
311   ///
312   /// \param
313   ///
314   /// \return NotifReceiver_Type
315   //      NotifReceiver_Type - subscriber's list of notification
316   ///
317   ////////////////////////////////////////////////////////////////////////////////////////////////
318   NotifReceiver_Type *GetSubscriberList();
319
320 #endif
321 };
322
323 #endif  // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_