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 CStateNorPersistenceNotification.
27 ////////////////////////////////////////////////////////////////////////////////////////////////////
29 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
30 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
32 ////////////////////////////////////////////////////////////////////////////////////////////////////
34 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 #include "ns_npp_state_notification.h"
39 * This class inherits CStateNotification class and implements specific operations related to
40 * nor persistent notifications.
42 class CStateNorPersistenceNotification : public CStateNotification {
44 ////////////////////////////////////////////////////////////////////////////////////////////////
45 /// CStateNorPersistenceNotification
46 /// Constructor of CStateNorPersistenceNotification class
48 /// \param [IN] f_cnotificationname
49 /// std::string - Notification name
51 /// \param [IN] f_uimaxmsgsize
52 /// UI_32 - Maximum size of notification data
54 /// \param [IN] f_uidelay
57 /// \param [IN] f_epersistcategory
58 /// EFrameworkunifiedPersistCategory - persist category
60 ////////////////////////////////////////////////////////////////////////////////////////////////
61 CStateNorPersistenceNotification(const std::string &f_cnotificationname,
62 const UI_32 f_uimaxmsgsize,
63 const UI_32 f_uidelay,
64 const EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
66 ////////////////////////////////////////////////////////////////////////////////////////////////
67 /// ~CStateNorPersistenceNotification
68 /// Destructor of CStateNorPersistenceNotification class
70 ////////////////////////////////////////////////////////////////////////////////////////////////
71 ~CStateNorPersistenceNotification();
73 ////////////////////////////////////////////////////////////////////////////////////////////////
74 /// GetPersistenceDelay
75 /// Method to get the persistence delay for a specific notification.
80 // UI_32 - success or failure status
82 ////////////////////////////////////////////////////////////////////////////////////////////////
83 UI_32 GetPersistenceDelay();
85 ////////////////////////////////////////////////////////////////////////////////////////////////
87 /// This function publishes the notification to subscribed clients and saves the data
88 /// immediately to persistent memory.
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 /// PublishNotification
109 /// This function publishes the notification to subscribed clients.
111 /// \param [IN] f_cservicename
112 /// std::string - name of service publishing the notification
114 /// \param [IN] f_pmessage
115 /// std::string - data of notification
117 /// \param [IN] f_uimsgsize
118 /// std::string - length of data
120 /// \return EFrameworkunifiedStatus
121 // EFrameworkunifiedStatus - success or failure status
123 ////////////////////////////////////////////////////////////////////////////////////////////////
124 EFrameworkunifiedStatus PublishNotification(const std::string &f_cservicename,
126 const UI_32 f_uimsgsize);
128 ////////////////////////////////////////////////////////////////////////////////////////////////
129 /// GetPersistentCategory
130 /// Gets the persist type of notification
133 /// \return EFrameworkunifiedPersistCategory
134 // EFrameworkunifiedPersistCategory - persist type
136 ////////////////////////////////////////////////////////////////////////////////////////////////
137 EFrameworkunifiedPersistCategory GetPersistentCategory();
139 ////////////////////////////////////////////////////////////////////////////////////////////////
140 /// SetPersistentCategory
141 /// Sets the persist type of notification
143 /// \param [IN] f_epersistcategory
144 /// EFrameworkunifiedPersistCategory - persist category
146 /// \return EFrameworkunifiedStatus
147 // EFrameworkunifiedStatus - success or failure status
149 ////////////////////////////////////////////////////////////////////////////////////////////////
150 EFrameworkunifiedStatus SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory);
151 // Handle of the immediate persistence worker thread.
152 static HANDLE m_hNSImmediatePersistenceThread; // NOLINT (readability/naming)
155 ////////////////////////////////////////////////////////////////////////////////////////////////
157 /// Saves the persistent data to nor
159 /// \param [IN] f_pmessage
160 /// PVOID - Message data
162 /// \param [IN] f_msgsize
163 /// UI_32 - Size of Message data
165 /// \return EFrameworkunifiedStatus
166 // EFrameworkunifiedStatus - success or failure status
168 ////////////////////////////////////////////////////////////////////////////////////////////////
169 EFrameworkunifiedStatus SaveDataToNor(PVOID f_pmessage,
170 const UI_32 f_msgsize);
172 UI_32 m_uiDelay; // Time Delay between persistence on NOR
174 EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
177 #endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_