2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup tag_NS_NPPService
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup tag_NS_NPPService
25 /// \brief This file contains declaration of class CStateNotification.
27 ////////////////////////////////////////////////////////////////////////////////////////////////////
29 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
30 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
32 ////////////////////////////////////////////////////////////////////////////////////////////////////
34 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 #include "ns_npp_notification.h"
38 class CPersistentData;
41 * This class inherits CNotification class and implements state and persistent notification
44 class CStateNotification : public CNotification {
46 ////////////////////////////////////////////////////////////////////////////////////////////////
47 /// CStateNotification
48 /// Constructor of CStateNotification class
50 /// \param [IN] f_cnotificationname
51 /// std::string - Notification name
53 /// \param [IN] f_uimaxmsgsize
54 /// UI_32 - Maximum size of notification data
58 ////////////////////////////////////////////////////////////////////////////////////////////////
59 CStateNotification(const std::string &f_cnotificationname,
60 const UI_32 f_uimaxmsgsize);
62 ////////////////////////////////////////////////////////////////////////////////////////////////
63 /// ~CStateNotification
64 /// Destructor of CStateNotification class
70 ////////////////////////////////////////////////////////////////////////////////////////////////
71 virtual ~CStateNotification();
73 ////////////////////////////////////////////////////////////////////////////////////////////////
75 /// This function adds the name of the application to receiver list of particular notification.
77 /// \param [IN] f_csubscribername
78 /// std::string - name of application subscribing for notification
80 /// \return EFrameworkunifiedStatus
81 // EFrameworkunifiedStatus - success or failure status
83 ////////////////////////////////////////////////////////////////////////////////////////////////
84 EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
86 ////////////////////////////////////////////////////////////////////////////////////////////////
88 /// This function publishes the notification to subscribed clients.
90 /// \param [IN] f_cservicename
91 /// std::string - name of service publishing the notification
93 /// \param [IN] f_pmessage
94 /// std::string - data of notification
96 /// \param [IN] f_uimsgsize
97 /// std::string - length of data
99 /// \return EFrameworkunifiedStatus
100 // EFrameworkunifiedStatus - success or failure status
102 ////////////////////////////////////////////////////////////////////////////////////////////////
103 virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
105 const UI_32 f_uimsgsize);
107 ////////////////////////////////////////////////////////////////////////////////////////////////
108 /// GetPersistentData
109 /// This function get the data related to notification
113 /// \return CPersistentData
114 // CPersistentData - notification data
116 ////////////////////////////////////////////////////////////////////////////////////////////////
117 const CPersistentData *GetPersistentData();
119 ////////////////////////////////////////////////////////////////////////////////////////////////
120 /// SetPersistentData
121 /// This function is used to set the data related to notification
123 /// \param [IN] f_pmessage
124 /// PVOID - Message data
126 /// \param [IN] f_msgsize
127 /// UI_32 - Size of Message data
129 /// \return EFrameworkunifiedStatus
130 // EFrameworkunifiedStatus - success or failure status
132 ////////////////////////////////////////////////////////////////////////////////////////////////
133 virtual EFrameworkunifiedStatus SetPersistentData(PVOID f_pmessage,
134 const UI_32 f_msgsize);
136 ////////////////////////////////////////////////////////////////////////////////////////////////
137 /// GetDefaultPersistentData
138 /// This function get the default data(if any) related to notification
142 /// \return CPersistentData
143 // CPersistentData - notification data
145 ////////////////////////////////////////////////////////////////////////////////////////////////
146 const CPersistentData *GetDefaultPersistentData();
148 ////////////////////////////////////////////////////////////////////////////////////////////////
149 /// SetDefaultPersistentData
150 /// This function is used to set the default data related to notification
152 /// \param [IN] f_pmessage
153 /// PVOID - Message data
155 /// \param [IN] f_msgsize
156 /// UI_32 - Size of Message data
158 /// \return EFrameworkunifiedStatus
159 // EFrameworkunifiedStatus - success or failure status
161 ////////////////////////////////////////////////////////////////////////////////////////////////
162 virtual EFrameworkunifiedStatus SetDefaultPersistentData(PVOID f_pmessage,
163 const UI_32 f_msgsize);
165 ////////////////////////////////////////////////////////////////////////////////////////////////
167 /// This functions returns the published status of notification.
172 // BOOL - returns true if published before
174 ////////////////////////////////////////////////////////////////////////////////////////////////
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.
182 /// \param [IN] f_uilength
183 /// std::string - Max size for notification data
185 /// \return EFrameworkunifiedStatus
186 // EFrameworkunifiedStatus - success or failure status
188 ////////////////////////////////////////////////////////////////////////////////////////////////
189 EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
192 CPersistentData *m_pData; ///< persistent data of notification
194 CPersistentData *m_pDefaultData; ///< persistent data of notification
196 BOOL m_bWasPublished; ///< Flag to check whether publisher had published notification
199 ////////////////////////////////////////////////////////////////////////////////////////////////
201 /// This function is used to set the persistent data
203 /// \param [IN] f_pdata
204 /// CPersistentData - persistent data ptr
206 /// \param [IN] f_pmessage
207 /// PVOID - Message data
209 /// \param [IN] f_msgsize
210 /// UI_32 - Size of Message data
212 /// \return EFrameworkunifiedStatus
213 // EFrameworkunifiedStatus - success or failure status
215 ////////////////////////////////////////////////////////////////////////////////////////////////
216 EFrameworkunifiedStatus SetData(CPersistentData *f_pdata,
218 const UI_32 f_msgsize);
221 #endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_