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 /// \ingroup tag_NPPService
19 /// \brief The file conains declaration of CPersistentData, CNotificationsToPersist and CPersistDataHeader class.
20 /// This class is used to hold the persistent data related to state and persistent
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
25 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
26 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
28 #include <native_service/frameworkunified_types.h>
35 * This class holds the message and message length of notification data.
37 class CPersistentData {
39 // no members in private
42 PVOID m_pMessage; ///< pointer to message structure
44 UI_32 m_uiMsgSize; ///< length of message
46 ////////////////////////////////////////////////////////////////////////////////////////////////
48 /// Constructor of CPersistentData class
54 ////////////////////////////////////////////////////////////////////////////////////////////////
57 ////////////////////////////////////////////////////////////////////////////////////////////////
59 /// Destructor of CPersistentData class
65 ////////////////////////////////////////////////////////////////////////////////////////////////
69 class CNotificationsToPersist {
71 // no members in private
74 std::string m_cNotificationName; ///< Name of Notification
76 UI_32 m_uiMaxMsgLength; ///< Maximum data length of notification
78 EFrameworkunifiedNotificationType m_ePersistentType; ///< type of notification
80 EFrameworkunifiedPersistCategory m_ePersistCategory; ///< Persistent category
82 std::string m_cPublisherName; ///< Service Name
84 CPersistentData *m_pPersistentData; ///< Persistent data related to notification
86 UI_32 m_uiDelay; ///< Maximum delay for persistence
88 ////////////////////////////////////////////////////////////////////////////////////////////////
89 /// CNotificationsToPersist
90 /// Constructor of CNotificationsToPersist class
96 ////////////////////////////////////////////////////////////////////////////////////////////////
97 CNotificationsToPersist(): m_cNotificationName(""),
99 m_ePersistentType(eFrameworkunifiedUnknown),
100 m_ePersistCategory(eFrameworkunifiedUserData),
101 m_cPublisherName(""),
102 m_pPersistentData(NULL),
106 ////////////////////////////////////////////////////////////////////////////////////////////////
107 /// ~CNotificationsToPersist
108 /// Destructor of CNotificationsToPersist class
114 ////////////////////////////////////////////////////////////////////////////////////////////////
115 ~CNotificationsToPersist() {
116 if (NULL != m_pPersistentData) { // LCOV_EXCL_BR_LINE 6: m_pPersistentData can't be NULL
117 delete m_pPersistentData;
118 m_pPersistentData = NULL;
123 class CPersistDataHeader {
125 // no members in private
128 UI_32 m_uiSize; ///< size of the associated data blob
129 UI_32 m_uiOffset; ///< Offset at which the data blob starts
130 EFrameworkunifiedNotificationType m_ePersistentType;
131 CHAR m_cPublisherName[MAX_QUEUE_NAME_SIZE];
132 CHAR m_cNotificationName[MAX_STRING_SIZE_NOTIFICATION];
133 UI_32 m_uiMaxMsgLength; ///< max size of the associated data
135 ////////////////////////////////////////////////////////////////////////////////////////////////
136 /// CPersistDataHeader
137 /// Constructor of CPersistDataHeader class
143 ////////////////////////////////////////////////////////////////////////////////////////////////
144 CPersistDataHeader(): m_uiSize(0),
146 m_ePersistentType(eFrameworkunifiedPersistedStateVar),
147 m_uiMaxMsgLength(0) {
148 std::memset(m_cPublisherName, 0, MAX_QUEUE_NAME_SIZE);
149 std::memset(m_cNotificationName, 0, MAX_STRING_SIZE_NOTIFICATION);
152 ////////////////////////////////////////////////////////////////////////////////////////////////
153 /// ~CPersistDataHeader
154 /// Destructor of CPersistDataHeader class
160 ////////////////////////////////////////////////////////////////////////////////////////////////
161 ~CPersistDataHeader() {
165 #endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_