common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / nsframework / notification_persistent_service / server / include / ns_npp_state_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 CStateNotification.
26 ///
27 ////////////////////////////////////////////////////////////////////////////////////////////////////
28
29 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
30 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
31
32 ////////////////////////////////////////////////////////////////////////////////////////////////////
33 // Include Files
34 ////////////////////////////////////////////////////////////////////////////////////////////////////
35 #include <string>
36 #include "ns_npp_notification.h"
37
38 class CPersistentData;
39
40 /**
41  *  This class inherits CNotification class and implements state and persistent notification
42  *  related operations.
43  */
44 class CStateNotification : public CNotification {
45  public:
46   ////////////////////////////////////////////////////////////////////////////////////////////////
47   /// CStateNotification
48   /// Constructor of CStateNotification class
49   ///
50   /// \param  [IN] f_cnotificationname
51   ///     std::string - Notification name
52   ///
53   /// \param  [IN] f_uimaxmsgsize
54   ///     UI_32 - Maximum size of notification data
55   ///
56   /// \return
57   ///
58   ////////////////////////////////////////////////////////////////////////////////////////////////
59   CStateNotification(const std::string &f_cnotificationname,
60                      const UI_32 f_uimaxmsgsize);
61
62   ////////////////////////////////////////////////////////////////////////////////////////////////
63   /// ~CStateNotification
64   /// Destructor of CStateNotification class
65   ///
66   /// \param
67   ///
68   /// \return
69   ///
70   ////////////////////////////////////////////////////////////////////////////////////////////////
71   virtual ~CStateNotification();
72
73   ////////////////////////////////////////////////////////////////////////////////////////////////
74   /// AddEventReciever
75   /// This function adds the name of the application to receiver list of particular 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 AddEventReciever(const std::string &f_csubscribername);
85
86   ////////////////////////////////////////////////////////////////////////////////////////////////
87   /// Publish
88   /// This function publishes the notification to subscribed clients.
89   ///
90   /// \param  [IN] f_cservicename
91   ///     std::string - name of service publishing the notification
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   virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
104                              PVOID f_pmessage,
105                              const UI_32 f_uimsgsize);
106
107   ////////////////////////////////////////////////////////////////////////////////////////////////
108   /// GetPersistentData
109   /// This function get the data related to notification
110   ///
111   /// \param
112   ///
113   /// \return CPersistentData
114   //      CPersistentData - notification data
115   ///
116   ////////////////////////////////////////////////////////////////////////////////////////////////
117   const CPersistentData *GetPersistentData();
118
119   ////////////////////////////////////////////////////////////////////////////////////////////////
120   /// SetPersistentData
121   /// This function is used to set the data related to notification
122   ///
123   /// \param  [IN] f_pmessage
124   ///     PVOID - Message data
125   ///
126   /// \param  [IN] f_msgsize
127   ///     UI_32 - Size of Message data
128   ///
129   /// \return EFrameworkunifiedStatus
130   //      EFrameworkunifiedStatus - success or failure status
131   ///
132   ////////////////////////////////////////////////////////////////////////////////////////////////
133   virtual EFrameworkunifiedStatus SetPersistentData(PVOID f_pmessage,
134                                        const UI_32 f_msgsize);
135
136   ////////////////////////////////////////////////////////////////////////////////////////////////
137   /// GetDefaultPersistentData
138   /// This function get the default data(if any) related to notification
139   ///
140   /// \param
141   ///
142   /// \return CPersistentData
143   //      CPersistentData - notification data
144   ///
145   ////////////////////////////////////////////////////////////////////////////////////////////////
146   const CPersistentData *GetDefaultPersistentData();
147
148   ////////////////////////////////////////////////////////////////////////////////////////////////
149   /// SetDefaultPersistentData
150   /// This function is used to set the default data related to notification
151   ///
152   /// \param  [IN] f_pmessage
153   ///     PVOID - Message data
154   ///
155   /// \param  [IN] f_msgsize
156   ///     UI_32 - Size of Message data
157   ///
158   /// \return EFrameworkunifiedStatus
159   //      EFrameworkunifiedStatus - success or failure status
160   ///
161   ////////////////////////////////////////////////////////////////////////////////////////////////
162   virtual EFrameworkunifiedStatus SetDefaultPersistentData(PVOID f_pmessage,
163                                               const UI_32 f_msgsize);
164
165   ////////////////////////////////////////////////////////////////////////////////////////////////
166   /// IsPublished
167   /// This functions returns the published status of notification.
168   ///
169   /// \param
170   ///
171   /// \return BOOL
172   //      BOOL - returns true if published before
173   ///
174   ////////////////////////////////////////////////////////////////////////////////////////////////
175   BOOL IsPublished();
176
177   ////////////////////////////////////////////////////////////////////////////////////////////////
178   /// ResetMaxMessageSize
179   /// This function reset the max size of data that can be published with notification.
180   /// Also deletes the old persistent data and default data.
181   ///
182   /// \param  [IN] f_uilength
183   ///         std::string - Max size for notification data
184   ///
185   /// \return EFrameworkunifiedStatus
186   //          EFrameworkunifiedStatus - success or failure status
187   ///
188   ////////////////////////////////////////////////////////////////////////////////////////////////
189   EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
190
191  protected:
192   CPersistentData *m_pData;  ///< persistent data of notification
193
194   CPersistentData *m_pDefaultData;  ///< persistent data of notification
195
196   BOOL m_bWasPublished;       ///< Flag to check whether publisher had published notification
197
198  private:
199   ////////////////////////////////////////////////////////////////////////////////////////////////
200   /// SetData
201   /// This function is used to set the persistent data
202   ///
203   /// \param  [IN] f_pdata
204   ///     CPersistentData - persistent data ptr
205   ///
206   /// \param  [IN] f_pmessage
207   ///     PVOID - Message data
208   ///
209   /// \param  [IN] f_msgsize
210   ///     UI_32 - Size of Message data
211   ///
212   /// \return EFrameworkunifiedStatus
213   //      EFrameworkunifiedStatus - success or failure status
214   ///
215   ////////////////////////////////////////////////////////////////////////////////////////////////
216   EFrameworkunifiedStatus SetData(CPersistentData *f_pdata,
217                      PVOID f_pmessage,
218                      const UI_32 f_msgsize);
219 };
220
221 #endif  // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_