summaryrefslogtreecommitdiffstats
path: root/nsframework/notification_persistent_service/server/include
diff options
context:
space:
mode:
Diffstat (limited to 'nsframework/notification_persistent_service/server/include')
-rw-r--r--nsframework/notification_persistent_service/server/include/app_states.h187
-rw-r--r--nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h40
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp.h296
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h230
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h558
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h111
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h145
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h218
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_notification.h323
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h496
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h68
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h94
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h121
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h122
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_persistence.h365
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h536
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h119
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h165
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_personality.h75
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h132
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h34
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h330
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h109
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h177
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h221
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h104
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h73
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_threads.h46
-rw-r--r--nsframework/notification_persistent_service/server/include/ns_npp_types.h212
29 files changed, 5707 insertions, 0 deletions
diff --git a/nsframework/notification_persistent_service/server/include/app_states.h b/nsframework/notification_persistent_service/server/include/app_states.h
new file mode 100644
index 00000000..a7f4b4a0
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/app_states.h
@@ -0,0 +1,187 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file all the states, events, internal transitions of state machine.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
+
+#include <native_service/frameworkunified_sm_framework_if.h>
+#include <native_service/ns_np_service.h>
+#include <string>
+
+const UI_32 kCuiEventIdStartLimit = 20;
+
+DEFINE_COMPOSITESTATE(sNotificationpersistentserviceNPPRoot) // NOLINT (readability/naming)
+DEFINE_ORTHOGONALSTATE_OVERRIDE(sNotificationpersistentserviceNPPStart)
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNPPError)
+
+// =====Define Persistence state
+DEFINE_LEAFSTATE_OVERRIDE(sNotificationpersistentservicePersistenceReady)
+DEFINE_LEAFSTATE(sNotificationpersistentservicePersistenceError)
+
+// DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnSaveDataAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType)
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync)
+
+// =====Define Shutdown state
+DEFINE_LEAFSTATE(sNotificationpersistentserviceShutdownIdle)
+// DEFINE_LEAFSTATE_OVERRIDE(sNotificationpersistentserviceShutdownDataSave)
+class CsNotificationpersistentserviceShutdownDataSave : public CFrameworkunifiedLeafState {
+ public:
+ explicit CsNotificationpersistentserviceShutdownDataSave(std::string f_pName);
+ virtual ~CsNotificationpersistentserviceShutdownDataSave();
+ EFrameworkunifiedStatus FrameworkunifiedOnEntry(CEventDataPtr f_peventdata);
+ EFrameworkunifiedStatus FrameworkunifiedOnExit(CEventDataPtr f_peventdata);
+ private:
+ std::string m_cShutdownRequestor;
+};
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown) // NOLINT (readability/naming)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceReInitShutdownTimer)
+
+// =====Define Notification state
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNotificationReady)
+DEFINE_LEAFSTATE(sNotificationpersistentserviceNotificationError)
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications)
+DEFINE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence)
+
+#endif
+
+// ==========Define event
+DEFINE_EVENT(evIdle, kCuiEventIdStartLimit + 1)
+DEFINE_EVENT(evReady, kCuiEventIdStartLimit + 2)
+DEFINE_EVENT(evShutdown, kCuiEventIdStartLimit + 3)
+DEFINE_EVENT(evError, kCuiEventIdStartLimit + 4)
+
+DEFINE_EVENT(evNPSetNotfnPersistentType, kCuiEventIdStartLimit + 5)
+DEFINE_EVENT(evNPSetDefaultPersistentData, kCuiEventIdStartLimit + 6)
+DEFINE_EVENT(evNPReadPersistedData, kCuiEventIdStartLimit + 7)
+DEFINE_EVENT(evNPReleaseLoadAck, kCuiEventIdStartLimit + 8)
+DEFINE_EVENT(evNPNorShutdownAck, kCuiEventIdStartLimit + 9)
+DEFINE_EVENT(evNPRegisterPersistentFile, kCuiEventIdStartLimit + 10)
+DEFINE_EVENT(evNPReleasePersistentFile, kCuiEventIdStartLimit + 11)
+DEFINE_EVENT(evNPLoadPersistentFile, kCuiEventIdStartLimit + 12)
+DEFINE_EVENT(evNPSetFilePersistentType, kCuiEventIdStartLimit + 13)
+DEFINE_EVENT(evNPSetFolderPersistentType, kCuiEventIdStartLimit + 14)
+DEFINE_EVENT(evUserChange, kCuiEventIdStartLimit + 15)
+DEFINE_EVENT(evShutdownTimeout, kCuiEventIdStartLimit + 16)
+
+DEFINE_EVENT(evNPPublishNotification, kCuiEventIdStartLimit + 17)
+DEFINE_EVENT(evNPRegisterNotifications, kCuiEventIdStartLimit + 18)
+DEFINE_EVENT(evNPSubscribeToNotification, kCuiEventIdStartLimit + 19)
+DEFINE_EVENT(evNPSubscribeToNotifications, kCuiEventIdStartLimit + 20)
+DEFINE_EVENT(evNPUnRegisterNotifications, kCuiEventIdStartLimit + 21)
+DEFINE_EVENT(evNPUnSubscribeFromNotification, kCuiEventIdStartLimit + 22)
+DEFINE_EVENT(evNPRegisterPersistentFolder, kCuiEventIdStartLimit + 23)
+DEFINE_EVENT(evNPLoadPersistentFolder, kCuiEventIdStartLimit + 24)
+DEFINE_EVENT(evNPReleasePersistentFolder, kCuiEventIdStartLimit + 25)
+DEFINE_EVENT(evNPUnSubscribeFromNotifications, kCuiEventIdStartLimit + 26)
+DEFINE_EVENT(evCheckAllFilesPersisted, kCuiEventIdStartLimit + 27)
+DEFINE_EVENT(evNPGetReadyStatus, kCuiEventIdStartLimit + 28)
+DEFINE_EVENT(evNPRegisterImmediateNotifications, kCuiEventIdStartLimit + 29)
+DEFINE_EVENT(evNPClearPersistedData, kCuiEventIdStartLimit + 30)
+
+DEFINE_EVENT(evNPShutdownDataSave, kCuiEventIdStartLimit + 31)
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+DEFINE_EVENT(evNPProfileNotification, kCuiEventIdStartLimit + 32)
+DEFINE_EVENT(evNPProfilePersistence, kCuiEventIdStartLimit + 33)
+
+#endif
+
+DEFINE_EVENT(evNPPublishImmediateNotification, kCuiEventIdStartLimit + 34)
+DEFINE_EVENT(evNPPersistentSync, kCuiEventIdStartLimit + 35)
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// SetPersonality
+/// Set the personality in the framework on userchange.
+///
+/// \param [IN] f_happ
+/// HANDLE - Application Handle
+///
+/// \param [IN] f_tMsg
+/// NC_User - Structure containing user specific details
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus SetPersonality(HANDLE f_happ, NC_User &f_tMsg); // NOLINT (runtime/references)
+
+
+/*
+ * CShutDownMsgData
+ * This class is used to pass the data between states sShutdownIdle and sShutdownDataSave
+ */
+class CShutDownMsgData : public CEventData {
+ public:
+ // constructor
+ CShutDownMsgData(UI_32 f_uieventid, EFrameworkunifiedShutdownType f_etype, UI_32 f_uidata): CEventData(f_uieventid),
+ m_eShutdownType(f_etype), m_uiMsgData(f_uidata) {} // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ // destructor
+ virtual ~CShutDownMsgData() {}
+
+ EFrameworkunifiedShutdownType m_eShutdownType;
+
+ UI_32 m_uiMsgData;
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_APP_STATES_H_
diff --git a/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h b/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
new file mode 100644
index 00000000..a7c9f8ec
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file notification_persistent_service.h
+ * @brief \~english include all notification_persistent_service head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup native_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup notification_persistent_service
+ * @ingroup native_service
+ * @{
+ */
+
+#ifndef NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_ // NOLINT(build/header_guard)
+#define NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_
+
+#endif // NATIVESERVICE_NOTIFICATIONPERSISTENTSERVICE_H_
+
+/** @}*/ // end of notification_persistent_service
+/** @}*/ // end of native_service
+/** @}*/ // end of BaseSystem
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp.h b/nsframework/notification_persistent_service/server/include/ns_npp.h
new file mode 100644
index 00000000..f96dd755
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp.h
@@ -0,0 +1,296 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
+
+#include <native_service/frameworkunified_sm_framework_types.h>
+#include <native_service/frameworkunified_sm_hsm.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+class CPersistenceManager;
+class CNotificationManager;
+class CnotificationpersistentservicePersonalizationManager;
+
+/**
+ * This class act as a controller class which holds the instance of notification, personalization
+ * and persistence manager respectively.
+ */
+class CNSNPP: public CFrameworkunifiedHSM {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNSNPP
+ /// Constructor of CNSNPP class
+ ///
+ /// \param f_happ
+ /// PVOID - application handle
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CNSNPP(PVOID f_happ);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNSNPP
+ /// Destructor of CNSNPP class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNSNPP();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// Init
+ /// This function is used to allocate dynamic memory for member variables of this class after
+ /// creation of object.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Init(HANDLE f_happ);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// DeInit
+ /// This function is used to deinitialize the NPP object.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return VOID
+ /// VOID - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID DeInit(HANDLE f_happ);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FrameworkunifiedCreate
+ /// This function is pure virtual function of parent class.
+ /// In this function, states and events of StateMachine are created and connected.
+ ///
+ /// \param [in] f_peventdata
+ /// PVOID - Event data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_peventdata = NULL);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePersistAll
+ /// Persist all persistent state, user persistent state notification data;
+ /// and all global and user related files to permenant storage
+ ///
+ /// \param [in] f_eshutdowntype
+ /// EFrameworkunifiedShutdownType - shutdown type i.e. normal shutdown, quick, data reset
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePersistAll(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveNotificationPersistentData
+ /// In this function, all the data related to persistent notification is retrieved from
+ /// notification manager and stored in persistent file by persistent manager.
+ ///
+ /// \param [in] f_epersistenttype
+ /// EFrameworkunifiedPersistentVarType - Type of persistent notification
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveNotificationPersistentData(EFrameworkunifiedNotificationType f_epersistenttype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag = 0x0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceLoadPersistentNotificationData
+ /// In this transition, persistent file is loaded by persistent manager and
+ /// persistent notifications and its data is loaded to notification manager.
+ ///
+ /// \param [in] f_epersistenttype
+ /// EFrameworkunifiedPersistentVarType - Type of persistent notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceLoadPersistentNotificationData(EFrameworkunifiedNotificationType f_epersistenttype);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// DeletePersistedDataFolder
+ /// This function does not deletes the data instead just rename the folder which needs to
+ /// be deleted. And this data will gets deleted during next startup.
+ ///
+ /// \param f_uipersistcategoryflag
+ /// UI_32 - Rename the persisted data folder depending on enum EFrameworkunifiedPersistCategory value
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeletePersistedDataFolder(UI_32 f_uipersistcategoryflag);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// Syncfs
+ /// Syncfs is carried out.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Syncfs();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of NotificationManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationManager *m_pNotificationManager; ///< Instance of Notification Manager
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of PersonalizationManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CnotificationpersistentservicePersonalizationManager *m_pPersonalizationManager; ///< Instance of Personalization Manager
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Singleton instance of PersistenceManager
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistenceManager *m_pPersistenceManager;
+ // scheduling priority of read thread
+ static SI_32 m_siReadThreadPrio; // NOLINT (readability/naming)
+ // scheduling priority of write thread
+ static SI_32 m_siWriteThreadPrio; // NOLINT (readability/naming)
+ // scheduling priority of immediate persistence thread
+ static SI_32 m_siImmediatePersistenceThreadPrio; // NOLINT (readability/naming)
+ // number of times CRC check is required. (CRC check will be done more than once only on failure)
+ static UI_16
+ m_siCRCCheckCount; // NOLINT (readability/naming)
+
+ private:
+ ///< name of reader thread
+ const std::string m_cReadThreadName; // NOLINT (readability/naming)
+ ///< name of writer thread
+ const std::string m_cWriteThreadName; // NOLINT (readability/naming)
+ ///< name of immediate persistence thread
+ const std::string m_cImmediatePersistenceThreadName; // NOLINT (readability/naming)
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateAndStartChildThreads
+ /// This function creates and start all child threads.
+ ///
+ /// \param f_happ
+ /// HANDLE - Application handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateAndStartChildThreads(HANDLE f_happ);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SwitchToFileStructureVersion1
+ /// Copy all the data from old persistent path to new persistent path
+ ///
+ /// \param [IN] f_uinppversion
+ /// UI_32 - New version of NPPService
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SwitchToFileStructureVersion1(const UI_32 f_uinppversion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SwitchToFileStructureVersion2
+ /// Move immediate notification data files from IMMEDIATE_PERSISTENCE_STORAGE_V1 to
+ /// IMMEDIATE_PERSISTENCE_STORAGE_V2/AllUserAppData/UserData
+ ///
+ /// \param [IN] f_uinppversion
+ /// UI_32 - New version of NPPService
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SwitchToFileStructureVersion2(const UI_32 f_uinppversion);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNSNPPVersion
+ /// Get the version of NSNPP from version.txt
+ ///
+ /// \param
+ ///
+ /// \return UI_8
+ /// UI_8 - version number
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetNSNPPVersion();
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNSNPPVersion
+ /// Set the version of NSNPP in version.txt
+ ///
+ /// \param [IN] f_uiversion
+ /// UI_32 - version number
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - Returns status of operation
+ ///
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNSNPPVersion(UI_8 f_uiversion);
+
+ HANDLE m_hNSReadThread; ///< Reader thread handle
+
+ HANDLE m_hNSWriteThread; ///< Writer thread handle
+
+ HANDLE m_hNSImmediatePersistenceThread; ///< immediate persistence thread handle
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h b/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
new file mode 100644
index 00000000..aed4d2a8
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
@@ -0,0 +1,230 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CBinaryAccesser class.
+/// This class stores data in a file in binary format.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+#include "ns_npp_persistent_accesser.h"
+
+class CPersistentAccesser;
+class CPersistentData;
+class CNotificationsToPersist;
+class CPersistDataHeader;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+typedef Persistent_Notification_List_Type::iterator Persistent_Notification_List_Iterator;
+
+/**
+ * This class stores data in a file in binary format.
+ *
+ */
+class CBinaryAccesser: public CPersistentAccesser {
+ public:
+ typedef enum FileOpentype {
+ EREAD = 0,
+ EWRITE
+ } FILE_OPEN_TYPE;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CBinaryAccesser
+ /// Constructor of CBinaryAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CBinaryAccesser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CBinaryAccesser
+ /// Destructor of CBinaryAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CBinaryAccesser();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistData
+ /// Persist data in persistent memory in a file in binary format.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Memory file path for saving notification.
+ ///
+ /// \param [IN] f_vdata
+ /// Persistent_Notification_List_Type* - Data which has to be persisted.
+ ///
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedNotificationType - Type of Notification.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vdata,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RetrieveData
+ /// Retrieve data from from a file from persistent memory and store in a vector.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Memory file path from where to retrieve notification data.
+ ///
+ /// \param [OUT] f_vdata
+ /// Persistent_Notification_List_Type*& - Retrieved notification data is filled in this vector.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vdata, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ private:
+ UI_32 m_uiCurStrOffset;
+ UI_32 m_uiCurStrSize;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenFileForReading
+ /// Open file in read mode.
+ ///
+ /// \param [OUT] f_Fd
+ /// int * - File descriptor to read from a file
+ ///
+ /// \param [IN] f_cfilepath
+ /// std::string - File Path from the file is to be read
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenFileForReading(int *f_infd,
+ std::string f_cfilepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OpenFileForWriting
+ /// Open file in write mode.
+ ///
+ /// \param [OUT] f_Fd
+ /// int * - File descriptor to write to a file
+ ///
+ /// \param [IN] f_cfilepath
+ /// std::string - File Path for the file that is to be written
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OpenFileForWriting(int *f_outfd,
+ std::string f_cfilepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// WriteHeaderAndData
+ /// Write header and data in a file.
+ ///
+ /// \param [IN] f_pnotificationstopersist
+ /// CNotificationsToPersist - Object of class CNotificationsToPersist
+ ///
+ /// \param [IN] f_pdata
+ /// PVOID - notification data
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to write the file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus WriteHeaderAndData(CNotificationsToPersist *f_pnotificationstopersist,
+ PVOID f_pdata,
+ int f_outfd);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReadHeaderAndData
+ /// Read header from the file.
+ ///
+ /// \param [IN] f_objcpersistdataheader
+ /// CPersistDataHeader& - Object of class CPersistDataHeader
+ ///
+ /// \param [OUT] f_pdata
+ /// CHAR*& -
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to read the file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadHeaderAndData(CPersistDataHeader &f_objcpersistdataheader, // NOLINT (runtime/references)
+ CHAR *&f_pdata, int f_infd); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FillNotificationList
+ /// This function retrieves the notification data from file and fill it in map.
+ ///
+ /// \param [IN] f_Fd
+ /// int - File descriptor to retrieve notification data.
+ ///
+ /// \param [OUT] f_vdata
+ /// Persistent_Notification_List_Type*& - Retrieved notification data is filled in this vector.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FillNotificationList(int f_infd,
+ Persistent_Notification_List_Type *&f_vdata, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ EFrameworkunifiedStatus WriteFileHeaderAndDuplicate(int f_outfd, std::string f_cfilepath);
+ EFrameworkunifiedStatus CheckFileHeader(int f_infd);
+ EFrameworkunifiedStatus OpenBakFileForReading(int *f_infd, std::string f_cfilepath);
+ UI_32 CalcCRC(PVOID f_pdata, UI_32 f_size);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_BINARY_ACCESSER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h b/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
new file mode 100644
index 00000000..984296f6
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
@@ -0,0 +1,558 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CCopyWorker and CArchive.
+/// Class CCopyWorker holds the implementation for worker thread.
+/// Class CArchive holds the implementation for archive.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
+
+#define LIBTARFAIL -1
+#define LIBTARSUCCESS 0
+#define TARMODE 0644
+#define FILEERROR -1
+
+#include <pthread.h>
+#include <libtar.h>
+#include <stdio.h>
+#include <zlib.h>
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/ns_utility_sys.hpp>
+#include <native_service/frameworkunified_multithreading.h>
+#include <native_service/ns_np_service.h>
+
+#include <map>
+#include <string>
+
+#include "ns_npp_types.h"
+
+typedef std::map<std::string, UI_32> TMTagCRC; // map of tag and corresponding CRC
+typedef std::map<std::string, TMTagCRC> TMServiceTagCRC; // map of service and tag list
+typedef std::map<int, gzFile> GZFiles;
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStart
+/// Callback method on start of worker thread.
+///
+/// \param [IN] f_hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStart(HANDLE f_hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPCopyWorkerOnStop
+/// Callback method on stopping of worker thread.
+///
+/// \param [IN] f_hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPCopyWorkerOnStop(HANDLE f_hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// gzopen_frontend
+/// Method to set archiving options.
+///
+/// \param [IN] f_pcpathname
+/// PCHAR - Thread Handle
+///
+/// \param [IN] f_sioflags
+/// SI_32 - Open file flags
+///
+/// \param [IN] f_simode
+/// SI_32 - File Mode
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+SI_32 OpenArchive(PCHAR f_pcpathname, SI_32 f_sioflags, SI_32 f_simode);
+
+int CloseArchive(int fd);
+ssize_t ReadArchive(int fd, void *buf, size_t count);
+ssize_t WriteArchive(int fd, const void *buf, size_t count);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnDeleteOldDataCmd
+/// This callback is used to delete the data which was requested to be deleted during
+/// previous shutdown.
+///
+/// \param [in] f_happ
+/// HANDLE - Handle to notificationpersistentservice_application Framework.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnDeleteOldDataCmd(HANDLE f_happ);
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPDataResetThreadCallback
+/// Callback of data reset thread.
+/// This callback delete all the data which was requested for reset during previous shutdown.
+///
+/// \param [in] f_parg
+/// PVOID - Thread argument
+///
+/// \return PVOID
+/// PVOID - NULL
+////////////////////////////////////////////////////////////////////////////////////////////
+PVOID NSPDataResetThreadCallback(PVOID f_parg);
+
+class CCopyWorker {
+ public:
+ static TMServiceTagCRC g_mservicetagcrc;
+ static CMutex g_objmtxservicetag;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CCopyWorker
+ /// Constructor of class CCopyWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CCopyWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CCopyWorker
+ /// Destructor of class CCopyWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CCopyWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdCopy
+ /// Callback method for start copy command.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdCopy(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdResume
+ /// Callback method for resuming worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdResume(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdStart
+ /// Callback method for starting worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdStart(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdArchive
+ /// Callback method to start archiving/unarchiving for file or folder
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdArchive(HANDLE f_hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnWrkCmdStop
+ /// Callback method for stopping worker thread.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnWrkCmdStop(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnCmdShutdownRequest
+ /// Callback method on shutdown request.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnCmdShutdownRequest(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Abort
+ /// Method to abort worker thread tasks.
+ ///
+ ///
+ /// \return VOID
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static VOID Abort();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetCopyStatusToFailure
+ /// Method to set the copy status to failure.
+ ///
+ /// \param [IN] f_tcopystatusresponse
+ /// NSP_CopyStatusResponse - Response status struct
+ ///
+ /// \param [IN] f_eworkerfailcmd
+ /// ENPS_CopyWorkerFailures - Worker failure Commands
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetCopyStatusToFailure(NSP_CopyStatusResponse &f_tcopystatusresponse, // NOLINT (runtime/references)
+ const ENPS_CopyWorkerFailures f_eworkerfailcmd);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// InAbortState
+ /// Method to check if the thread is in abort state
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return BOOL
+ // BOOL - true if in abort state or false.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL InAbortState() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SendAck
+ /// Method to send ack to the parent thread
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \param [IN] f_eworkercmd
+ /// ENSP_CopyWorkerProtocol - Worker protocol command
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SendAck(HANDLE hthread, const ENSP_CopyWorkerProtocol &f_eworkercmd);
+
+ private:
+ static pthread_mutex_t m_sAbortMutex; // NOLINT (readability/naming) , Mutex for abort
+ static BOOL m_sbAbortCopy; // NOLINT (readability/naming) , Check for abort state
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CopyFile
+ /// Copy the content of source file f_csrcpath to destination file f_cdestpath.
+ /// Creates the destination file path if does not exists.
+ ///
+ /// \param [IN] f_csrcpath
+ /// PCSTR - source file path
+ ///
+ /// \param [IN] f_cdestpath
+ /// PCSTR - dest file path
+ ///
+ /// \param [OUT] f_uiwritesize
+ /// UI_32 - number of bytes written to the destination file
+ ///
+ /// \param [IN] f_btmpfile
+ /// BOOL - TRUE:RELEASE-temp file use /FALSE:LOAD-temp file not use
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK on success else eFrameworkunifiedStatusFail
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CopyFile(PCSTR f_csrcpath, PCSTR f_cdestpath, UI_32 &f_uiwritesize, BOOL btmpfile = FALSE); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetCopyBufSize
+ /// Get the buffer size appropriate for file copy
+ ///
+ /// \param [IN] f_si32openfd
+ /// SI_32 - File descriptor of a file opened with open() api
+ ///
+ /// \param [OUT] f_ui32filesize
+ /// UI_32 - Get the size of file
+ ///
+ /// \return SI_32
+ /// SI_32 - Returns the buffer size appropriate for file copy
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ SI_32 GetCopyBufSize(SI_32 f_si32openfd, UI_32 &f_ui32filesize); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// VerifyWithStoredCRC
+ /// Verify CRC stored internally for the tag matches with the CRC of a file (file passed as a argument)
+ ///
+ /// \param [IN] f_crequesterappname
+ /// PCSTR - Name of the requester. This is to find the corresponding stored CRC
+ ///
+ /// \param [IN] f_cpersistenttag
+ /// PCSTR - Tag. This is to find the corresponding stored CRC
+ ///
+ /// \param [IN] f_cFile
+ /// PCSTR - Complete file path on temporary storage.
+ /// Comparison of CRC needs to be done with this temporary file.
+ ///
+ /// \return BOOL
+ /// BOOL - Returns TRUE if f_cFile's CRC matches with CRC stored internally for the corresponding tag
+ /// else FALSE
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL VerifyWithStoredCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, PCSTR f_cFile, UI_32 &f_ui32crc); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UpdateTagCRC
+ /// Update the passed CRC in the internal map for the corresponding requester and tag.
+ ///
+ /// \param [IN] f_crequesterappname
+ /// PCSTR - Name of the requester.
+ ///
+ /// \param [IN] f_cpersistenttag
+ /// PCSTR - File Tag.
+ ///
+ /// \param [IN] f_ui32crc
+ /// UI_32 - New CRC.
+ ///
+ /// \return None
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID UpdateTagCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, UI_32 f_ui32crc);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// TryFileCopyWithCRCCheck
+ /// Try to copy file from source to destination until src and dest CRC matches or max f_ui32checkcount
+ /// number of times
+ ///
+ /// \param [IN] f_csource
+ /// PCSTR - Source file
+ ///
+ /// \param [IN] f_cdest
+ /// PCSTR - Destination file
+ ///
+ /// \param [IN] f_ui32checkcount
+ /// UI_32 - Maximum number of times to perform file copy
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - eFrameworkunifiedStatusOK - If file copy done successfully and CRC matches.
+ /// eFrameworkunifiedStatusFail - otherwise
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus TryFileCopyWithCRCCheck(PCSTR f_csource, PCSTR f_cdest, UI_32 f_ui32checkcount);
+
+ class CArchive {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CArchive
+ /// Constructor of CArchive class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CArchive();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CArchive
+ /// Destructor of CArchive class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CArchive();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Archive
+ /// Method for performing folder archive or extraction operation.
+ ///
+ /// \param [IN] f_tarchiveinfocmd
+ /// NSP_CopyInfoCmd - Archive Command Info Structure
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Archive(NSP_CopyInfoCmd &f_tarchiveinfocmd, NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// FileOperationUsingLibz
+ /// Method to determine whether to compress or decompres file using libz.
+ ///
+ /// \param [IN] f_toperainfocmd
+ /// NSP_CopyInfoCmd - File Operation Command Info Structure
+ ///
+ /// \param [IN] f_toperarespstatus
+ /// NSP_CopyStatusResponse - File Operation Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus FileOperationUsingLibz(NSP_CopyInfoCmd &f_toperainfocmd, NSP_CopyStatusResponse &f_toperarespstatus); // NOLINT (runtime/references)
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateTar
+ /// Method to Create tar archive.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the folder to be archived
+ ///
+ /// \param [IN] f_cdestpath
+ /// std::string - Destination path for the archived folder.
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreateTar(const std::string &f_csourepath, const std::string &f_cdestpath,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ExtractTar
+ /// Method to extract tar archive.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the folder to be extracted
+ ///
+ /// \param [IN] f_csourcedest
+ /// std::string - Destination path for the extracted folder.
+ ///
+ /// \param [IN] f_tarchivestatusresponse
+ /// NSP_CopyStatusResponse - Archive Command Response Structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ExtractTar(const std::string &f_csourepath, const std::string &f_csourcedest,
+ NSP_CopyStatusResponse &f_tarchivestatusresponse); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Create
+ /// Method to Create archive
+ ///
+ /// \param [IN] f_pctarfiledestpath
+ /// CHAR - Destination path for the archived folder.
+ ///
+ /// \param [IN] f_pcrootdirpath
+ /// CHAR - Source path of the folder to be archived
+ ///
+ /// \param [IN] f_plibtarlist
+ /// BOOL - TRUE if user file else FALSE
+ ///
+ /// \return SI_32
+ //
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Create(std::string &f_pctarfiledestpath, std::string &f_pcrootdirpath, libtar_list_t *f_plibtarlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Extract
+ /// Nethod to extract archive.
+ ///
+ /// \param [IN] f_pcrootdirpath
+ /// CHAR - Source path of the folder to be extracted
+ ///
+ /// \param [IN] f_pctarfiledestpath
+ /// CHAR - Destination path for extraction.
+ ///
+ /// \return SI_32
+ //
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Extract(std::string &f_pcrootdirpath, std::string &f_pctarfiledestpath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CompressUsingZlib
+ /// Method to compress file using libz
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the file to be compressed
+ ///
+ /// \param [IN] f_cdestpath
+ /// std::string - Destination path for the compressed file.
+ ///
+ /// \param [IN] f_iziplevel
+ /// Level of compression i.e.
+ /// More compression results in more time taken for compression operation and vice versa.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CompressUsingZlib(const std::string &f_csourepath, const std::string &f_cdestpath, SI_32 f_iziplevel);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeCompressUsingZlib
+ /// Method to decompress file using libz.
+ ///
+ /// \param [IN] f_csourepath
+ /// std::string - Source path of the file to be decompressed.
+ ///
+ /// \param [IN] f_csourcedest
+ /// std::string - Destination path for the decompressed file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeCompressUsingZlib(const std::string &f_csourepath, const std::string &f_csourcedest);
+ };
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_COPY_WORKER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h b/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
new file mode 100644
index 00000000..4f7876db
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CFSDirectory.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+
+
+// Class to provide file system directory operations like create,delete etc.
+class CFSDirectory {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFSDirectory
+ /// Constructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFSDirectory
+ /// Destructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to check if the directory exists.
+ ///
+ /// \param [in] f_cdirpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL DoesDirecotryExist(const std::string &f_cdirpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to create a directory.
+ ///
+ /// \param [in] f_cdirpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus CreateDirectory(const std::string &f_cdirpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to verify directory.
+ ///
+ /// \param [in] f_cpath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL IsDirectory(const std::string &f_cpath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete directory with delay of f_uidelay(msec)
+ /// between consecutive deletes.
+ ///
+ /// \param [in] f_cpath
+ /// std::string - Path of the directory to delete.
+ /// \param [in] f_uidelay
+ /// UI_32 - delay in millisec before recursive call.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveDirectory(std::string f_cpath, const UI_32 f_uidelay = 0);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_FS_DIRECTORY_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h b/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
new file mode 100644
index 00000000..30c8a26f
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
@@ -0,0 +1,145 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup tag_NS_NPPService
+/// \ingroup tag_NS_NPPService
+///
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This class holds the message queue handles for notification subscribers
+///
+/// This is a singleton class which holds the message queue handles for notification subscribers.
+/// This will ensure that NS_NPPService will hold only one handle per subscriber.
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <map>
+#include <utility>
+
+typedef std::map<std::string, HANDLE> HandleList_Type;
+typedef std::pair<HandleList_Type::iterator, bool> HandleListRetStatus_Type;
+
+
+
+/**
+ * This class holds the message queue handles for notification subscribers
+ */
+class CHandleList {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetHandleList
+ /// This function is used to get the singleton instance of class.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \return CHandleList
+ /// CHandleList - singleton instance of class
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static CHandleList *GetHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReleaseHandleList
+ /// This function is used to release the instance of class.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus ReleaseHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddHandleInList
+ /// Add pair of subscriber name and corresponding handle in map.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ /// \param [IN] f_hmqhandle
+ /// HANDLE - Message queue handle of the subscriber
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus -
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddHandleInList(std::string f_csubscribername, HANDLE f_hmqhandle);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RemoveHandleFromList
+ /// Remove handle for subscriber from the list.
+ /// Handle will actually get removed when all the notifications are unsubscribed by the subscriber
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus -
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveHandleFromList(std::string f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSubscriberMqHandle
+ /// Get the message queue handle of a subscriber.
+ /// NOTE: Not thread safe. Others threads would not use this function.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return HANDLE
+ // HANDLE - Message queue handle of the subscriber
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ HANDLE GetSubscriberMqHandle(std::string f_csubscribername);
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CHandleList
+ /// Constructor of CHandleList class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CHandleList();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CHandleList
+ /// Destructor of CHandleList class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CHandleList();
+
+ HandleList_Type m_mHandleList; ///< map which stores all the message queue handle
+
+ static CHandleList *m_psHandleList; // NOLINT (readability/naming)
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h b/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
new file mode 100644
index 00000000..a3994ca0
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
@@ -0,0 +1,218 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CImmediatePersistenceWorker and holds the
+/// implementation for worker thread.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_timer_if.hpp>
+
+#include "ns_npp_types.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSP_NorPersistenceWorkerOnStart
+/// Callback method on start of worker thread.
+///
+/// \param [IN] hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStart(HANDLE hthread);
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+/// NSPNorPersistenceWorkerOnStop
+/// Callback method on stopping of worker thread.
+///
+/// \param [IN] hthread
+/// HANDLE - Thread Handle
+///
+/// \return EFrameworkunifiedStatus
+// EFrameworkunifiedStatus - success or failure status
+///
+////////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStop(HANDLE hthread);
+
+// Forward Declaration for class
+class CNotificationsToPersist;
+
+
+/**
+ * This class handles the immediate persistence notification related requests.
+ *
+ */
+class CNorPersistenceWorker {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNorPersistenceWorker
+ /// Constructor of class CNorPersistenceWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNorPersistenceWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNorPersistenceWorker
+ /// Destructor of class CNorPersistenceWorker
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNorPersistenceWorker();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnNorPersistenceTimerStart
+ /// When immediate persistence notification publish request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_TIMER_START command to the worker thread and this function gets called.
+ /// This function starts the respective timer of the notification. Timeout of timer writes
+ /// corresponding notification data to persistent memory.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnNorPersistenceTimerStart(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RegisterImmediatePersistNotification
+ /// When immediate persistence notification register request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_REGISTER command to the worker thread and this function gets called.
+ /// Registration with worker thread is required because only child thread will be responsible for
+ /// data saving related stuff. It creates a timer corresponding to the notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RegisterImmediatePersistNotification(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// UnregisterImmediatePersistNotification
+ /// When immediate persistence notification unregister request is received by NPPService. It sends a
+ /// NOR_PERSISTENCE_UNREGISTER command to the worker thread and this function gets called.
+ /// It deletes a timer corresponding to the notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus UnregisterImmediatePersistNotification(HANDLE hthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnShutdown
+ /// This API stops all the immediate notification timer.
+ /// This API immediately writes the data to persistent memory if the timer is runnning,
+ /// irrespective of delay unless the data .
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnShutdown(HANDLE hthread);
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnCategoryChange
+ /// This API updates the category of immediate persistence notification.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnCategoryChange(HANDLE hthread);
+};
+
+/**
+ * CTimerHelper class maps the timer id and corresponding data.
+ *
+ */
+class CTimerHelper: public NSTimer {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CTimerHelper
+ /// Constructor of class CTimerHelper
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CTimerHelper();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CTimerHelper
+ /// Destructor of class CTimerHelper
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CTimerHelper();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetCmdId
+ /// Returns the timer id of the timer.
+ ///
+ /// \param [IN] none
+ ///
+ /// \return UI_32
+ // UI_32 - Timer id of the timer
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetCmdId();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// OnTimeOut
+ /// This function gets called when timer expires. This function writes the notification data in
+ /// persistent memory.
+ ///
+ /// \param [IN] f_hthread
+ /// HANDLE - Thread Handle
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus OnTimeOut(HANDLE hthread);
+
+ // member variables
+ PUI_8 m_pui8HeaderAndData; // header and corresponding data of the notfn stored as part of timer
+
+ private:
+ UI_32 m_uiCmdId; // command id associated with timer
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOR_PERSISTENCE_WORKER_THREAD_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
new file mode 100644
index 00000000..673e54cd
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
@@ -0,0 +1,323 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <map>
+#include <string>
+#include <iostream>
+#include "ns_npp_notification_receiver.h"
+
+typedef std::map<std::string, CNotificationReceiver *> NotifReceiver_Type;
+
+/// Iterator of map of CNotificationReceiver
+typedef NotifReceiver_Type::iterator NotifReceiver_Iterator_Type;
+
+/**
+ * This class is base class for all the notification types classes.
+ */
+class CNotification {
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotification
+ /// Parameterless Constructor of CNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification();
+
+ protected:
+ std::string m_cNotificationName; ///< Name of Notification
+
+ UI_32 m_uiMaxMsgSize; ///< Maximum size of notification data
+
+ EFrameworkunifiedNotificationType m_ePersistentType; ///< type of notification
+
+ std::string m_cServiceName; ///< List of services registering notification
+
+ NotifReceiver_Type *m_pmSubscribersList; ///< list of subscribers of notification
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddReceiverInMap
+ /// This function adds the name of the service to receiver list of notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddReceiverInMap(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PublishData
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_hmsgqhandle
+ /// HANDLE - MessageQ Handle of ReceiverQ
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PublishData(HANDLE f_hmsgqhandle,
+ const PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotification
+ /// Constructor of CNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotification
+ /// Destructor of CNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// DeleteEventReciever
+ /// This function deletes the name of application from receivers list.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus DeleteEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNewSubscribersList
+ /// This function sets the subscribers list of notification
+ ///
+ /// \param [IN] f_pnotification
+ /// CNotification - notification object containing subscribers list
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetNewSubscribersList(CNotification *f_pnotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetEventPublisher
+ /// This function set the publisher name to current received service name
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetEventPublisher(const std::string &f_cservicename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetEventPublisher
+ /// This function resets the publisher name to NULL
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of application
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetEventPublisher(const std::string &f_cservicename);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsServiceRegistered
+ /// This function checks whether the notification is registered with any service or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - true,if subscriber list is empty
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsServiceRegistered();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsSubscribersListEmpty
+ /// This function is used to check whether any service is subscribed to notification
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - true,if subscriber list is empty
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsSubscribersListEmpty();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationName
+ /// This function is used to get the notification name.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - notification name
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetNotificationName();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPublisherName
+ /// This function is used to get the publisher name of notification.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - service name
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPublisherName();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceType
+ /// This function is used to get the type of notification.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedPersistentVarType
+ // EFrameworkunifiedPersistentVarType - persistent type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedNotificationType GetNotificationType();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetMaxMessageSize
+ /// This function is used to get the max size of data of notification message.
+ ///
+ /// \param
+ ///
+ /// \return UI_32
+ // UI_32 - Max Message Size
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetMaxMessageSize();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetMaxMessageSize
+ /// This function reset the max size of data that can be published with notification
+ ///
+ /// \param [IN] f_uilength
+ /// std::string - Max size for notification data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSubscriberList
+ /// Returns the list of subscribers subscribed to notification
+ ///
+ /// \param
+ ///
+ /// \return NotifReceiver_Type
+ // NotifReceiver_Type - subscriber's list of notification
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ NotifReceiver_Type *GetSubscriberList();
+
+#endif
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h b/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
new file mode 100644
index 00000000..e730d02a
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
@@ -0,0 +1,496 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of singleton class CNotificationManager which is used
+/// to manage notification information.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+
+#include <map>
+#include <vector>
+#include <string>
+#include <iostream>
+
+/// forward declaration of class
+class CNotification;
+class CPersistentData;
+class CNotificationsToPersist;
+class CStateNotification;
+
+/// map of all the available notification.
+typedef std::map<std::string, CNotification *> Notification_Type;
+
+/// iterator for map of notifications.
+typedef Notification_Type::iterator Notification_Iterator_Type;
+
+/// map of all available persistent notification and its data.
+typedef std::map<std::string, CPersistentData *> Persistent_Type;
+
+/// Iterator for map of persistent notifications.
+typedef Persistent_Type::iterator Persistent_Iterator_Type;
+
+/**
+ * This class is used to manage the operations related to notification
+ * on registration, subscription, publication, etc.
+ */
+class CNotificationManager {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationManager
+ /// Constructor of CNotificationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationManager
+ /// Destructor of CNotificationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnRegisterEvents
+ /// This function creates notification object depending on its type and if already created it
+ /// adds the service name to the list in the notification object.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum length of Message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - type of notification
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Delay time for persistence
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay = 0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnUnRegisterEvents
+ /// This function removes the name of the service from the notification object.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service unregistering from notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnUnRegisterEvents(const std::string &f_cservicename,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnPublishEvent
+ /// This function stores the published data in the notification object in case of state and
+ /// persistent notification.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - pointer to message
+ ///
+ /// \param f_uimsgsize
+ /// UI_32 - size of Message
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnPublishEvent(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnSubscribeToEvent
+ /// This function adds the name of the application to subscribers list in notification object.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing to notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnSubscribeToEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnUnSubscribeFromEvent
+ /// This function adds the name of the application to subscribers list in notification object.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing to notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnUnSubscribeFromEvent(const std::string &f_csubscribername,
+ const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NPGetPersistentNotificationData
+ /// Get data for notification name
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - name of notification
+ /// \param [OUT] f_pnotificationdata
+ /// PVOID - data corresponding to notification name
+ /// \param [IN] f_uidatasize
+ /// UI_32 - size of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NPGetPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pnotificationdata, const UI_32 f_uidatasize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceServiceOnGetPersistentData
+ /// This function is used to get the persistent data stored related to notification.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification Name
+ ///
+ /// \param [IN] f_creceivername
+ /// std::string - Source Name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceServiceOnGetPersistentData(const std::string &f_cnotificationname,
+ const std::string &f_creceivername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceGetPersistentNotificationData
+ /// This function is used to get the list of persistent notifications and the data associated
+ /// with it.
+ ///
+ /// \param [OUT] f_pvpersistnotification
+ /// CNotificationsToPersist - vector containing list of persistent notifications and
+ /// data associated with it.
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedNotificationType - Type of notification
+ ///
+ /// \param [IN] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceGetPersistentNotificationData(std::vector<CNotificationsToPersist *> *f_pvpersistnotification,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentNotificationData
+ /// This function is used to create the persistent notifications object and fill the data
+ /// related with it on system load.
+ ///
+ /// \param [IN] f_pvpersistnotification
+ /// vector<CNotificationsToPersist> - vector containing list of notifications and data associated with it
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentNotificationData(std::vector<CNotificationsToPersist *> *f_pvpersistnotification);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationInfo
+ /// This function is used to get the notification information.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification Name
+ ///
+ /// \param [IN] l_pnotificationstopersist
+ /// CNotificationsToPersist - Notification info structure
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetNotificationInfo(const std::string &f_cnotificationname,
+ CNotificationsToPersist *&l_pnotificationstopersist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetDefaultPersistentNotificationData
+ /// This function is used to set the default data of persistent notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ /// \param [IN] f_pmessage
+ /// PVOID - message data
+ /// \param [IN] f_uimsgsize
+ /// UI_32 - message size
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetDefaultPersistentNotificationData(const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentCategory
+ /// This function is used to set the persistent type of persistent notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentCategory(const std::string &f_cnotificationname,
+ const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePublishImmediateNotification
+ /// This function publish the immediate notification f_cnotificationname to all its subscribers.
+ /// This API is called when service updates the immediate notification data in persistent memory
+ /// using synchronous API.
+ ///
+ /// \param [IN] f_cservicename
+ /// const std::string& - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// const std::string& - notification name
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - pointer to message
+ ///
+ /// \param f_uimsgsize
+ /// UI_32 - size of Message
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - eFrameworkunifiedStatusOK on success
+ /// eFrameworkunifiedStatusInvldParam - invalid parameter
+ /// eFrameworkunifiedStatusNullPointer - if notification not found
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePublishImmediateNotification(const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetNotificationProfilingData
+ /// This function is used to get the notification profiling information.
+ ///
+ /// \param [OUT] f_tNotificationProfileInfo
+ /// std::string - all the notification info of all applications concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetNotificationProfilingData(std::string &f_cnotificationprofileInfo); // NOLINT (runtime/references)
+
+#endif
+
+ private:
+ Notification_Type *m_pmNotificationList; /// < map containing list of all notifications.
+
+ std::vector<std::string> *m_pvPersistentList; /// < vector containing list of all persistent notifications.
+
+ std::vector<std::string> *m_pvUserPersistentList; /// < vector containing list of all user persistent notifications.
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateNotificationObject
+ /// This function is used to get notification object from map if it exists else create new
+ /// object as per type of notification.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum size of notification message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - Delay time for persistence
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Persistence Delay
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification *CreateNotificationObject(const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay = 0);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SearchNotification
+ /// This function is used to search whether notification object is present in map or not.
+ /// If present it sends the reference. CNotification - reference to pointer of notification object
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotification *SearchNotification(const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SearchPersistenceNotification
+ /// This function is used to search whether the given persistent notification object
+ /// is present in map or not.
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \return CStateNotification
+ // CStateNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNotification *SearchPersistenceNotification(const std::string &f_cnotificationname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreateNotificationObjectToPersist
+ /// Creates the CNotificationsToPersist object from notification object and the persistent data.
+ ///
+ /// \param [IN] f_pnotification
+ /// CStateNotification - notification object ptr
+ /// \param [IN] f_pdata
+ /// CPersistentData - persistent data
+ ///
+ /// \return CNotification
+ // CNotification - pointer of notification object
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationsToPersist *CreateNotificationObjectToPersist(CStateNotification *f_pnotification,
+ const CPersistentData *f_pdata);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RemoveUserSpecificNotificationEntry
+ /// This function is used to get the singleton instance of class.
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus RemoveUserSpecificNotificationEntry();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ChangeNotificationType
+ /// This function creates new notification object depending on the type and replaces the old one.
+ /// The subscribers list is copied from the old notification object is copied to the new one.
+ ///
+ /// \param [IN] f_pnotification
+ /// CNotification* - old notification object
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service registering for notification
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - notification name
+ ///
+ /// \param [IN] f_uimsglength
+ /// UI_32 - Maximum length of Message
+ ///
+ /// \param [IN] f_enotificationtype
+ /// EFrameworkunifiedPersistentVarType - new type of notification
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - Delay time for persistence
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ChangeNotificationType(CNotification *f_pnotification,
+ const std::string &f_cservicename,
+ const std::string &f_cnotificationname,
+ const UI_32 f_uimsglength,
+ const EFrameworkunifiedNotificationType f_enotificationtype,
+ const UI_32 f_uidelay);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_MANAGER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h b/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
new file mode 100644
index 00000000..09f6b151
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
@@ -0,0 +1,68 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of class CNotificationReceiver.
+/// It holds the handle of message queue for sending notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/frameworkunified_types.h>
+
+class CNotificationReceiver {
+ private:
+ // no members in private
+
+ public:
+ HANDLE m_MsgQHandle; ///< handle to message queue
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationReceiver
+ /// Constructor of CNotificationReceiver class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationReceiver();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationReceiver
+ /// Destructor of CNotificationReceiver class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationReceiver();
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATION_RECEIVER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h b/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
new file mode 100644
index 00000000..e668af6a
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
@@ -0,0 +1,94 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_NPP_INFO ZONEMASK(25)
+#define ZONE_PRD_INFO3 ZONEMASK(26)
+#define ZONE_PRD_INFO2 ZONEMASK(27)
+#define ZONE_PRD_INFO1 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 "NPP Info"
+#define ZONE_TEXT_26 "Product Info3"
+#define ZONE_TEXT_27 "Product Info2"
+#define ZONE_TEXT_28 "Product Info1"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_NS_WAR, ZONE_NS_ERR, ZONE_PRD_INFO2
+#endif
+
+extern const CHAR AppName[]; // NOLINT (readability/naming)
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_NOTIFICATIONPERSISTENTSERVICELOG_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h b/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
new file mode 100644
index 00000000..04468bee
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
@@ -0,0 +1,121 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CFilePersistence class.
+/// This class is responsible for persisting and retrieving of files.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
+
+#include <native_service/ns_np_service.h>
+#include <string>
+#include <map>
+#include "ns_npp_persistence.h"
+
+// Forward declaration of classes.
+class CPersistence;
+class CRegistryEntry;
+
+/**
+ * This class is responsible for persisting and retrieving of files..
+ */
+class CFilePersistence : public CPersistence {
+ private:
+ TSourceRegistryList m_mPersistFileRegistry;
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFilePersistence
+ /// Constructor of CFilePersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFilePersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFilePersistence
+ /// Destructor of CFilePersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFilePersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Request for release file to persistent storage. File persist will be done at shutdown.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Release(std::string f_cappname, std::string f_ctag, std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype, std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load file from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Load(std::string f_cappname, std::string f_ctag, std::string f_cretrievepath,
+ std::string f_cusername);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FILE_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h b/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
new file mode 100644
index 00000000..39cf9753
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
@@ -0,0 +1,122 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
+
+#include <native_service/frameworkunified_framework_if.h>
+#include <string>
+
+#include "ns_npp_persistence.h"
+
+
+// class CPersistence;
+
+class CFolderPersistence : public CPersistence {
+ private:
+ TSourceRegistryList m_mPersistFolderRegistry; // map to hold the folder registry entries
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFolderPersistence
+ /// Constructor of CFolderPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFolderPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFolderPersistence
+ /// Destructor of CFolderPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFolderPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Entry for the folder is stored in map for persistence.
+ /// If f_bPersist is TRUE folder will be persisted immediately else will be persisted on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - Folder which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Release(std::string f_crequesterappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Load(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername);
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSIST_FOLDER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
new file mode 100644
index 00000000..d84f9fbe
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
@@ -0,0 +1,365 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistence class.
+/// This is a abstract class for file and folder persistency.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+#include <string>
+#include <map>
+#include <list>
+
+#include "ns_npp_notificationpersistentservicelog.h"
+#include "ns_npp_copy_worker.h"
+
+class CRegistryEntry;
+
+typedef std::string TSourceName;
+typedef std::string TTag;
+typedef std::map< TTag, CRegistryEntry > TTagRegistryList;
+typedef TTagRegistryList::iterator TTagRegistryListItr;
+
+typedef std::map<TSourceName, TTagRegistryList> TSourceRegistryList;
+typedef TSourceRegistryList::iterator TSourceRegistryListItr;
+
+typedef std::list<NSP_CopyInfoCmd> TPendingJobs;
+typedef TPendingJobs::iterator TPendingJobsItr;
+
+/**
+ * This is a abstract class for file and folder persistence.
+ */
+class CPersistence {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistence
+ /// Constructor of CPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistence
+ /// Destructor of CPersistence class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Register
+ /// Register file/folder tag for persistence.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] bisuserpersistence
+ /// BOOL - TRUE if user persistence else FALSE
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Register(std::string f_crequestorappname, std::string f_ctag, BOOL bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Release
+ /// Entry for the file/Folder is stored in map for persistence.
+ /// If f_bPersist is TRUE file/folder will be persisted immediately else will be persist on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File/Folder path that is to be persisted.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Release(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername) = 0;
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Load
+ /// Load file/folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Path to retrieve.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Load(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ std::string f_cusername) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Persist
+ /// Persist file/folder immediately
+ ///
+ /// \param [IN] f_objregistryentry
+ /// CRegistryEntry& - Registry entry job object to persist.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Persist(CRegistryEntry &f_objregistryentry); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceivedFromWorker
+ ///
+ ///
+ /// \param [in] pSource
+ /// PCSTR - Name of the source.
+ /// \param [in] f_ctag
+ /// PCSTR - file/folder tag.
+ /// \param [in] f_bcopystatus
+ /// BOOL - Status of file/folder copy by copy worker.
+ /// \param [in] f_eloadtype
+ /// ENPS_Loadtype - Type of load release or load.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, BOOL f_bcopystatus,
+ ENPS_Loadtype f_eloadtype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllReleaseRequests
+ /// Persist all files/folders which are not persisted yet.
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HaveAllReleaseRequestsPersisted
+ /// Checks if all release requests are processed or not
+ ///
+ /// \param [out] f_ctagnotreleased
+ /// std::string - list of tags not released by application
+ ///
+ /// \return BOOL
+ /// TRUE if all release requests are processed else false
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HaveAllReleaseRequestsPersisted(std::string &f_ctagnotreleased); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistFlag
+ /// Resets persist flag.
+ ///
+ /// \param none
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllUserRequests
+ /// Persist all files/folders which are not persisted yet.
+ ///
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistAllUserRequests();
+
+ // virtual VOID ListAllInMap() = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReadThreadHandle
+ /// Set read thread handle.
+ ///
+ /// \param [in] f_hreadthread
+ /// HANDLE - Handle of the read thread.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReadThreadHandle(HANDLE f_hreadthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetWriteThreadHandle
+ /// Set write thread handle.
+ ///
+ /// \param [in] f_hwritethread
+ /// HANDLE - Handle of the write thread.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetWriteThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetStoragePath
+ /// Get the permanent storage path. Get it from NS_NPPService's config file.
+ ///
+ /// \return std::string
+ /// std::string - Permanant storage path
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static std::string GetStoragePath();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of file/folder
+ ///
+ /// \param [IN] f_crequestorname
+ /// string - Application Name
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const std::string &f_crequestorname,
+ const std::string &f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Check if the file/folder being persisted is user specific
+ ///
+ /// \param [in] - f_ctag
+ /// std::string - File/Folder Tag
+ ///
+ /// \return status
+ /// BOOL - TRUE for user specific persistence
+ /// FALSE for global persistence
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ virtual BOOL IsUserPersistence(std::string f_ctag);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceProfilingData
+ /// This function is used to get the persistence info
+ ///
+ /// \param [out] f_cpersistenceprofileinfo
+ /// std::string - Persistence info concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo); // NOLINT (runtime/references)
+
+#endif
+
+ protected:
+ EFrameworkunifiedStatus ProcessReleaseRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ std::string f_cusername);
+
+ EFrameworkunifiedStatus ProcessLoadRequest(std::string f_crequesterappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cretrievepath,
+ std::string f_cusername);
+
+ VOID AddRequestData(NSP_CopyInfoCmd &f_tcpinfo, // NOLINT (runtime/references)
+ std::string f_sourcepath,
+ std::string f_destpath,
+ std::string f_crequesterappname,
+ std::string f_ctag,
+ ENPS_Loadtype f_eloadtype,
+ ENotificationpersistentservicePersistType f_epersisttype);
+
+ EFrameworkunifiedStatus SendRequestMessage(NSP_CopyInfoCmd &f_tcpinfo); // NOLINT (runtime/references)
+
+ std::string m_cStoragePath; ///< Persistent memory storage path
+
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_eCompressionType; ///< Compression type for file/folder persistency
+
+ HANDLE m_hNSWriteToPersistentMem; ///< Child thread handle, copies file to persistent memory.
+
+ HANDLE m_hNSReadFromPersistentMem; ///< Child thread handle, copies file from persistent memory.
+
+ // TODO(my_username): Remove this member var. Once the API to get application handle is available, use that.
+ HANDLE m_hAppHandle;
+
+ TSourceRegistryList m_mPersistRegistry;
+
+ TPendingJobs m_lPendingJobs; ///< stores the list of pending jobs sequentially
+
+ BOOL m_bPersist; ///< persist or not. It will be set to TRUE either on shutdown or userchange
+
+ UI_32 m_uiNotificationpersistentservicePersistCategoryFlag; ///< Stores the persist category flag value on shutdown request.
+ ///< It is needed to decide which data to persist, if
+ ///< release request is received by NSNPP after shutdown request
+};
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
new file mode 100644
index 00000000..99f98d7e
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
@@ -0,0 +1,536 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistenceManager class.
+/// This class acts as a manager for notification persistent data storage
+/// and file and folder persistence.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
+
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_np_service.h>
+#include <map>
+#include <string>
+#include <vector>
+#include "ns_npp_types.h"
+#include "ns_npp_persistent_accesser.h"
+
+class CPersistence;
+class CPersistentData;
+class CNotificationsToPersist;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Map of all persist file type. i.e. FilePersistence and FolderPersistence
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::map<ENotificationpersistentservicePersistType, CPersistence *> Persist_Type;
+
+typedef Persist_Type::iterator Persist_Type_Iter;
+
+/**
+ * This class acts as a manager for storing notification data,file and folder in
+ * persistent memory.
+ */
+class CPersistenceManager {
+ public:
+ /// Disable Persistence
+ static BOOL m_bPersistenceDisabled; // NOLINT (readability/naming)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistenceManager
+ /// Constructor of CPersistenceManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistenceManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistenceManager
+ /// Destructor of CPersistenceManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistenceManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceRegister
+ /// Registers a tag for the file or folder. This tag will be used for releasing or loading a
+ /// file or folder.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Tag to register is for a file
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Tag to register is for a folder
+ ///
+ /// \param [IN] bisuserpersistence
+
+ /// BOOL - TRUE if user persistence else FALSE
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceRegister(std::string f_cappname,
+ std::string f_ctag,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceRelease
+ /// Entry for the file or folder is stored in map for persistence.
+ /// If f_bPersist is TRUE file or folder will be persist immediately else will be persist
+ /// on shutdown
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_cmempath
+ /// string - File/Folder which needs to persist.
+ ///
+ /// \param [IN] enotificationpersistentservicereleasetype
+ /// EFrameworkunifiedReleaseType - eFrameworkunifiedNotOnRelease = 0 :not on release
+ /// eFrameworkunifiedPersistOnShutdown :persist on shutdown
+ /// eFrameworkunifiedPersistInstantly :persist instantly
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Persist a file to a persistent memory
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Persist a folder to a persistent memory
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceRelease(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cmempath,
+ EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceLoad
+ /// Load file/folder from persistent memory to the specified location.
+ ///
+ /// \param [IN] f_cappname
+ /// string - Name of the application requesting for persistence
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder corresponding to this tag will be retrieved.
+ ///
+ /// \param [IN] f_cretrievepath
+ /// string - Filepath for retrieved file/folder.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Load a file from persistent memory
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Load a folder from persistent memory
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - If tag is registered as user, then f_cusername holds the name of user,
+ /// else an empty string
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceLoad(std::string f_cappname,
+ std::string f_ctag,
+ std::string f_cretrievepath,
+ ENotificationpersistentservicePersistType f_epersisttype,
+ std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceivedFromWorker
+ /// Send release ack to file/folder persistence object.
+ ///
+ /// \param [IN] f_csource
+ /// PCSTR - Source of released file/folder
+ ///
+ /// \param [IN] f_ctag
+ /// PCSTR - Tag of released file/folder
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE - Ack for file persistence object
+ /// ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER - Ack for folder persistence object
+ ///
+ /// \param [in] f_bcopystatus
+ /// BOOL - Status of file/folder copy by worker.
+ ///
+ /// \param [in] f_eloadtype
+ /// ENPS_Loadtype - Type of load release or load.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, ENotificationpersistentservicePersistType f_epersisttype,
+ BOOL f_bcopystatus, ENPS_Loadtype f_eloadtype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveNotificationData
+ /// Save notification data in a persistent file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - List of all notifications and corresponding data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveNotificationData(Persistent_Notification_List_Type *f_vpersistentnotificationlist);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSaveUserNotificationData
+ /// Save notification data of user in a persistent file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - List of all notifications and corresponding data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSaveUserNotificationData(Persistent_Notification_List_Type *f_vpersistentnotificationlist);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadNotificationData
+ /// Get the list of all persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadUserNotificationData
+ /// Get the list of all user persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadUserNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceReadNorNotificationData
+ /// Get the list of all Nor persistent notifications from a persistent memory and store it in a map.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceReadNorNotificationData(Persistent_Notification_List_Type *&f_vnotificationlist); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistAllReleaseRequests
+ /// Persist all files and folder contained in the map in persistent memory.
+ ///
+ /// \param [in] f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - Hex value from enum EFrameworkunifiedPersistCategory, representing data to persist
+ /// 0 - persist orignal data and
+ /// 1 - persist default data
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentservicePersistAllUserRequests
+ /// Persist all user files and folder contained in the map in persistent memory.
+ ///
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentservicePersistAllUserRequests();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReadThreadHandle
+ /// Pass the handle of the read thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hreadthread
+ /// HANDLE - Handle of read thread.
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReadThreadHandle(HANDLE f_hreadthread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetWriteThreadHandle
+ /// Pass the handle of the write thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hwritethread
+ /// HANDLE - Handle of write thread.
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetWriteThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetNorPersistenceThreadHandle
+ /// Pass the handle of the Nor persistence write thread to the object of file/folder persistence
+ ///
+ /// \param [IN] f_hwritethread
+ /// HANDLE - Handle of write thread.
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetNorPersistenceThreadHandle(HANDLE f_hwritethread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetUserPersistentPath
+ /// Set user persistent path.
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - Name of user
+ ///
+ /// \return
+ ///
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetUserPersistentPath(std::string f_cusername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Check if the persistence is user specific
+ ///
+ /// \param [in] - f_ctag
+ /// std::string - File/folder Tag
+ ///
+ /// \param [in] - f_epersisttype
+ /// ENotificationpersistentservicePersistType - persistent type
+ ///
+ /// \return status
+ /// BOOL - TRUE for user specific persistence
+ /// FALSE for global persistence
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsUserPersistence(std::string f_ctag, ENotificationpersistentservicePersistType f_epersisttype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HaveAllReleaseRequestsPersisted
+ /// Checks if all files and immediate persistent data are persisted.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ /// TRUE if all release requests are processed else false
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HaveAllReleaseRequestsPersisted();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistFlag
+ /// Resets persist flag.
+ ///
+ /// \param none
+ ///
+ /// \return none
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ClearPersistenceData
+ /// Deletes the data from the persistent memory
+ ///
+ /// \param [in] f_enotificationpersistentserviceclearpersistencescope
+ /// EFrameworkunifiedClearPersistence - data to be deleted from memory
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ClearPersistenceData(const EFrameworkunifiedClearPersistence &f_enotificationpersistentserviceclearpersistencescope);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersistentCategory
+ /// Sets the persist type of file or folder
+ ///
+ /// \param [IN] f_crequestorname
+ /// string - Application name
+ ///
+ /// \param [IN] f_ctag
+ /// string - File/Folder will be persist against this tag.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \param [IN] f_bPersist
+ /// ENotificationpersistentservicePersistType - file or folder
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersistentCategory(std::string f_crequestorname,
+ std::string f_ctag,
+ EFrameworkunifiedPersistCategory f_epersistcategory,
+ ENotificationpersistentservicePersistType f_epersisttype);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistNORData
+ /// Sends the message to Immediate Persistence Thread to Persists the data immediately or reset
+ /// the NOR data depending on persist category flag during shutdown irrespective of delay.
+ ///
+ /// \param f_eshutdowntype
+ /// EFrameworkunifiedShutdownType - shutdown type - normal, quick, data reset
+ ///
+ /// \param f_uinotificationpersistentservicepersistcategoryflag
+ /// UI_32 - flag representing whether to persist or reset data.
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PersistNORData(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetImmediateDataPersistedStatus
+ /// Set/Reset the persistence status of immediate persistence data
+ ///
+ /// \param [in] - f_bstatus
+ /// BOOL
+ /// TRUE - immediate persistent data are persisted
+ /// FALSE - immediate persistent data not persisted
+ ///
+ /// \return
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetImmediateDataPersistedStatus(BOOL f_bstatus);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetFilePersistedStatus
+ /// Set/Reset the persistence status of files and folders
+ ///
+ /// \param [in] - f_bstatus
+ /// BOOL
+ /// TRUE - all files are persisted
+ /// FALSE - all files and folders are not persisted
+ ///
+ /// \return
+ ///////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetFilePersistedStatus(BOOL f_bstatus);
+
+#ifdef NPP_PROFILEINFO_ENABLE
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceProfilingData
+ /// This function is used to get the persistence info
+ ///
+ /// \param [out] f_cpersistenceprofileinfo
+ /// std::string - Persistence info concated in a string
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo); // NOLINT (runtime/references)
+
+#endif
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ReadImmediateNotificationData
+ /// Get the list of all immediate persistent notifications of f_epersistcategory
+ /// from a persistent memory in a vector.
+ ///
+ /// \param [OUT] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Retrieved list of all notifications and corresponding data
+ ///
+ /// \param [IN] f_epersistcategory
+ /// const EFrameworkunifiedPersistCategory - persistent category
+ ///
+ /// \return EFrameworkunifiedStatus
+ /// EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ReadImmediateNotificationData(Persistent_Notification_List_Type *&f_vpersistentnotificationlist, // NOLINT (runtime/references)
+ const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ std::string m_cUserNotificationTag; ///< Tag associated with a file which is used
+ ///< for storing user related notification persistent data.
+
+ std::string m_cNotificationPersistFilepath; ///< Persistent file path for storing persistent data
+
+ std::string m_cNotificationUserMemFilepath; ///< Memory location of a file for storing persistent data of a user
+
+ Persist_Type m_mPersist_Type; ///< Map holds the objects of file and folder persistency.
+
+ CPersistentAccesser *m_poDataAccesser; ///< Object for persistent data accesser
+
+ HANDLE m_hNSImmediatePersistenceThread; ///< Nor persistence thread handle
+
+ BOOL m_bAllFilePersisted; // all files have been persisted
+
+ BOOL m_bImmediatedDataPersisted; // all immediate peristence data have been persisted
+
+ EFrameworkunifiedStatus Init();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// NPServiceOnCpWorkerAckCmd
+/// Handles when the CopyWorker sends an ack back for a message received .
+///
+/// \param [in] f_happ
+/// HANDLE - Handle to notificationpersistentservice_application Framework.
+///
+/// \return status
+/// EFrameworkunifiedStatus - success or error
+////////////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus NPServiceOnCpWorkerAckCmd(HANDLE f_happ);
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENCE_MANAGER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
new file mode 100644
index 00000000..bfb15386
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
@@ -0,0 +1,119 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CPersistentAccesser class.
+/// This is a abstract class. Derived classes of this class will store the data in different
+/// file formats.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include <vector>
+
+class CPersistentData;
+class CNotificationsToPersist;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// vector of all available persistent notification and its data.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
+
+/**
+ * This is a abstract class. Derived classes of this class will store the data in different
+ * file formats.
+ */
+class CPersistentAccesser {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistentAccesser
+ /// Constructor of CPersistentAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistentAccesser() {}
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistentAccesser
+ /// Destructor of CPersistentAccesser class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CPersistentAccesser() { // LCOV_EXCL_START 14: Resident process, global instance not released
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PersistData
+ /// Persist data in persistent memory depending on file format.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type - Data which has to be persisted.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Read data from this file.
+ ///
+ /// \param [IN] f_epersistenttype
+ /// EFrameworkunifiedNotificationType - Type of persistent notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus PersistData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *f_vpersistentnotificationlist,
+ EFrameworkunifiedNotificationType f_epersistenttype,
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// RetrieveData
+ /// Retrieve data in persistent memory depending on file format.
+ ///
+ /// \param [IN] f_cmemfilepath
+ /// std::string - Write data from this file.
+ ///
+ /// \param [IN] f_vpersistentnotificationlist
+ /// Persistent_Notification_List_Type* - Retrieved data.
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus RetrieveData(std::string f_cmemfilepath,
+ Persistent_Notification_List_Type *&f_vpersistentnotificationlist, // NOLINT (runtime/references)
+ EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData) = 0;
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_ACCESSER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
new file mode 100644
index 00000000..84e2b433
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
@@ -0,0 +1,165 @@
+ /*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file conains declaration of CPersistentData, CNotificationsToPersist and CPersistDataHeader class.
+/// This class is used to hold the persistent data related to state and persistent
+/// notification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+#ifdef AGL_STUB
+#include <cstring>
+#endif
+/**
+ * This class holds the message and message length of notification data.
+ */
+class CPersistentData {
+ private:
+ // no members in private
+
+ public:
+ PVOID m_pMessage; ///< pointer to message structure
+
+ UI_32 m_uiMsgSize; ///< length of message
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistentData
+ /// Constructor of CPersistentData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistentData
+ /// Destructor of CPersistentData class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistentData();
+};
+
+class CNotificationsToPersist {
+ private:
+ // no members in private
+
+ public:
+ std::string m_cNotificationName; ///< Name of Notification
+
+ UI_32 m_uiMaxMsgLength; ///< Maximum data length of notification
+
+ EFrameworkunifiedNotificationType m_ePersistentType; ///< type of notification
+
+ EFrameworkunifiedPersistCategory m_ePersistCategory; ///< Persistent category
+
+ std::string m_cPublisherName; ///< Service Name
+
+ CPersistentData *m_pPersistentData; ///< Persistent data related to notification
+
+ UI_32 m_uiDelay; ///< Maximum delay for persistence
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationsToPersist
+ /// Constructor of CNotificationsToPersist class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationsToPersist(): m_cNotificationName(""),
+ m_uiMaxMsgLength(0),
+ m_ePersistentType(eFrameworkunifiedUnknown),
+ m_ePersistCategory(eFrameworkunifiedUserData),
+ m_cPublisherName(""),
+ m_pPersistentData(NULL),
+ m_uiDelay(0) {
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationsToPersist
+ /// Destructor of CNotificationsToPersist class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationsToPersist() {
+ if (NULL != m_pPersistentData) { // LCOV_EXCL_BR_LINE 6: m_pPersistentData can't be NULL
+ delete m_pPersistentData;
+ m_pPersistentData = NULL;
+ }
+ }
+};
+
+class CPersistDataHeader {
+ private:
+ // no members in private
+
+ public:
+ UI_32 m_uiSize; ///< size of the associated data blob
+ UI_32 m_uiOffset; ///< Offset at which the data blob starts
+ EFrameworkunifiedNotificationType m_ePersistentType;
+ CHAR m_cPublisherName[MAX_QUEUE_NAME_SIZE];
+ CHAR m_cNotificationName[MAX_STRING_SIZE_NOTIFICATION];
+ UI_32 m_uiMaxMsgLength; ///< max size of the associated data
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CPersistDataHeader
+ /// Constructor of CPersistDataHeader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CPersistDataHeader(): m_uiSize(0),
+ m_uiOffset(0),
+ m_ePersistentType(eFrameworkunifiedPersistedStateVar),
+ m_uiMaxMsgLength(0) {
+ std::memset(m_cPublisherName, 0, MAX_QUEUE_NAME_SIZE);
+ std::memset(m_cNotificationName, 0, MAX_STRING_SIZE_NOTIFICATION);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CPersistDataHeader
+ /// Destructor of CPersistDataHeader class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CPersistDataHeader() {
+ }
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSISTENT_DATA_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_personality.h b/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
new file mode 100644
index 00000000..9ac052f2
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
@@ -0,0 +1,75 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contain declaration of CNotificationpersistentservicePersonality class.
+/// The class object define personality.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+
+/**
+ * This class holds all the informations related to a personality.
+ */
+class CNotificationpersistentservicePersonality {
+ private:
+ // no members in private
+
+ public:
+ std::string m_cUserName; ///< user name
+
+ UI_32 m_uiUserId; ///< unique identifier of each user
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CNotificationpersistentservicePersonality
+ /// Constructor of CNotificationpersistentservicePersonality class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CNotificationpersistentservicePersonality(): m_cUserName(""), m_uiUserId(0) {} // LCOV_EXCL_BR_LINE 11: unexpected branch
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CNotificationpersistentservicePersonality
+ /// Destructor of CNotificationpersistentservicePersonality class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CNotificationpersistentservicePersonality() {}
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALITY_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h b/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
new file mode 100644
index 00000000..b1042fbe
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
@@ -0,0 +1,132 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of singleton class CnotificationpersistentservicePersonalizationManager which is
+/// used to manage information of personality.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include <map>
+#include "ns_npp_personality.h"
+
+typedef std::map<std::string, CNotificationpersistentservicePersonality *> Personality_Type;
+
+/**
+ * This class maintains information on creation of new personality or
+ * change of personality.
+ */
+class CnotificationpersistentservicePersonalizationManager {
+ private:
+ Personality_Type *m_pmPersonality; ///< list of personality
+
+ UI_32 m_uiUserId; ///< unique user id
+
+ std::string m_cCurrentPersonality; ///< current personality name
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CreatePersonality
+ /// This function is used to create new Personality.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus CreatePersonality(const std::string &f_cpersonalityname);
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CnotificationpersistentservicePersonalizationManager
+ /// Constructor of CnotificationpersistentservicePersonalizationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CnotificationpersistentservicePersonalizationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CnotificationpersistentservicePersonalizationManager
+ /// Destructor of CnotificationpersistentservicePersonalizationManager class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CnotificationpersistentservicePersonalizationManager();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceGetPersonality
+ /// This function is used to get the current personality.
+ ///
+ /// \param [OUT] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceGetPersonality(std::string &f_cpersonalityname); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceSetPersonality
+ /// This function is used to set the new personality.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus NotificationpersistentserviceSetPersonality(const std::string f_cpersonalityname);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// NotificationpersistentserviceIsValidPersonality
+ /// Check if user is valid or not.
+ ///
+ /// \param [IN] f_cpersonalityname
+ /// std::string - Personality name
+ ///
+ /// \return BOOL
+ /// TRUE - Valid user
+ /// FALSE - Not a valid user
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL NotificationpersistentserviceIsValidPersonality(const std::string f_cpersonalityname);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PERSONALIZATION_MANAGER_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h b/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
new file mode 100644
index 00000000..13b96a23
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
@@ -0,0 +1,34 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NativeServices
+/// \brief This file contains declaration of all the protocols and structures related to profiling.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
+
+
+#define NPS_PROFILE_NOTIFICATION_REQ 0x1AA
+#define NPS_PROFILE_NOTIFICATION_RESP 0x1BB
+
+#define NPS_PROFILE_PERSISTENCE_REQ 0x2AA
+#define NPS_PROFILE_PERSISTENCE_RESP 0x2BB
+
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_PROFILING_PROTOCOLS_INTERNAL_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h b/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
new file mode 100644
index 00000000..3cb475ee
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
@@ -0,0 +1,330 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NPPService
+/// \brief The file contains declaration of CRegistryEntry class.
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "ns_npp_types.h"
+
+/**
+ * This class contains the registry information of the files/folders to be peresisted.
+ */
+class CRegistryEntry {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegistryEntry
+ /// Constructor of CRegistryEntry class
+ ///
+ /// \param [OUT] f_ctag
+ /// std::string& - File or Folder tag
+ ///
+ /// \param [OUT] f_crequester
+ /// std::string& - Requester Name
+ ///
+ /// \param [OUT] f_cstoragepath
+ /// std::string& - File or Folder persistence storage path
+ ///
+ /// \param [IN] f_bisuserpersistence
+ /// BOOL - File or Folder is user specific
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ explicit CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester,
+ const std::string &f_cstoragepath, BOOL f_bisuserpersistence);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegistryEntry
+ /// Copy Constructor of CRegistryEntry class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegistryEntry(const CRegistryEntry &f_objin);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// operator=
+ /// Operator overload =
+ ///
+ /// \param [IN] f_objin
+ /// CRegistryEntry& - In object.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegistryEntry &operator=(const CRegistryEntry &f_objin); // NOLINT (readability/naming)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetReleasePath
+ /// Set release path.
+ ///
+ /// \param [IN] f_creleasepath
+ /// std::string& - Path of the file/folder to be released.
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetReleasePath(const std::string &f_creleasepath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetBeingPersisted
+ /// Set the file/folder persist member variable to true to notify that the file/folder is being
+ /// persisted.
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetBeingPersisted();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AckReceived
+ /// Ack from copy worker received. Process the ack.
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID AckReceived();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsReleased
+ /// Check if File/folder released or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file/folder is released else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsReleased() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// HasntBeenPersisted
+ /// File persisted or not
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file is not persisted else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL HasntBeenPersisted() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsPersisted
+ /// File/Folder persisted or not
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if file/folder is persisted else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsPersisted() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsAckPending
+ /// Ack is pending or not.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - True if ack is pending else false
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsAckPending() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistPath
+ /// Get the persist path.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the persist path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetPersistPath() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetReleasePath
+ /// Get the release path.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the release path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetReleasePath() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetLoadPath
+ /// Get the load path.
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - type of persisted data
+ ///
+ /// \param [IN] f_cusername
+ /// std::string - Current user name
+ ///
+ ///
+ /// \return std::string
+ // std::string - Returns the load path.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetRequester
+ /// Get the name of requester.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the name of requester.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetRequester() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetTag
+ /// Get the tag.
+ ///
+ /// \param
+ ///
+ /// \return std::string
+ // std::string - Returns the tag.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string GetTag() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsUserPersistence
+ /// Returns TRUE if it is a user persistence.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - Returns TRUE if it is a user persistence.
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsUserPersistence();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetCurrentAction
+ /// Set current copying action of a the corresponding tag.
+ ///
+ /// \param [IN] f_ecurrentaction
+ /// ENPS_Loadtype - Current action
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetCurrentAction(ENPS_Loadtype f_ecurrentaction);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetPersistedFlag
+ /// Reset Persist flags
+ ///
+ /// \param
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID ResetPersistedFlag();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistProperties
+ /// creates persistence path and stores the persist type
+ ///
+ /// \param [IN] f_epersisttype
+ /// ENotificationpersistentservicePersistType - Set persist type
+ /// \param [IN] f_cusername
+ /// std::string - Username related to persist tag if any.
+ ///
+ ///
+ /// \return
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ VOID SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername = "");
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistType
+ /// Returns persist type of a job
+ ///
+ /// \param
+ ///
+ /// \return ENotificationpersistentservicePersistType
+ // ENotificationpersistentservicePersistType - Returns persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ENotificationpersistentservicePersistType GetPersistType() const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persistent type related to tag
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Returns persistent type of tag
+ ///
+ /// \param
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - Returns persistent type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ENPSPersistenceJobState m_eJobState; // Current state of a job
+
+ private:
+ std::string m_cTag; // File/Folder tag
+ std::string m_cRequestor; // Requester application name
+ BOOL m_bIsReleased; // if file or folder released
+ BOOL m_bIsPersisted; // if file or folder is persisted
+ std::string m_cPersistPath; // Persist path
+ std::string m_cReleasePath; // Release path
+ std::string m_cBasePath; // Persist base path
+ BOOL m_bIsUserPersistence; // If user persistence
+ ENPS_Loadtype m_eCurrentAction; // Current action to load file to/from
+ /// temporary/persistence memory
+ ENotificationpersistentservicePersistType m_ePersistType;
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
new file mode 100644
index 00000000..da5427de
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
@@ -0,0 +1,109 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CRegularNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notification.h"
+
+/**
+ * This class inherits CNotification class and implements regular notification related operations.
+ */
+class CRegularNotification : public CNotification {
+ private:
+ // no members in private
+
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CRegularNotification
+ /// Constructor of CRegularNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CRegularNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CRegularNotification
+ /// Destructor of CRegularNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CRegularNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+};
+
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGULAR_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
new file mode 100644
index 00000000..26edf734
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
@@ -0,0 +1,177 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStateNorPersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_state_notification.h"
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * nor persistent notifications.
+ */
+class CStateNorPersistenceNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStateNorPersistenceNotification
+ /// Constructor of CStateNorPersistenceNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \param [IN] f_uidelay
+ /// UI_32 - delay
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNorPersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const UI_32 f_uidelay,
+ const EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStateNorPersistenceNotification
+ /// Destructor of CStateNorPersistenceNotification class
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStateNorPersistenceNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistenceDelay
+ /// Method to get the persistence delay for a specific notification.
+ ///
+ /// \param
+ ///
+ /// \return UI_32
+ // UI_32 - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ UI_32 GetPersistenceDelay();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients and saves the data
+ /// immediately to persistent memory.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// PublishNotification
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus PublishNotification(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Gets the persist type of notification
+ ///
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory);
+ // Handle of the immediate persistence worker thread.
+ static HANDLE m_hNSImmediatePersistenceThread; // NOLINT (readability/naming)
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SaveDataToNor
+ /// Saves the persistent data to nor
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SaveDataToNor(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ UI_32 m_uiDelay; // Time Delay between persistence on NOR
+
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOR_PERSISTENCE_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
new file mode 100644
index 00000000..aaa69927
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
@@ -0,0 +1,221 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStateNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_notification.h"
+
+class CPersistentData;
+
+/**
+ * This class inherits CNotification class and implements state and persistent notification
+ * related operations.
+ */
+class CStateNotification : public CNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStateNotification
+ /// Constructor of CStateNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStateNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStateNotification
+ /// Destructor of CStateNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~CStateNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// AddEventReciever
+ /// This function adds the name of the application to receiver list of particular notification.
+ ///
+ /// \param [IN] f_csubscribername
+ /// std::string - name of application subscribing for notification
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus AddEventReciever(const std::string &f_csubscribername);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Publish
+ /// This function publishes the notification to subscribed clients.
+ ///
+ /// \param [IN] f_cservicename
+ /// std::string - name of service publishing the notification
+ ///
+ /// \param [IN] f_pmessage
+ /// std::string - data of notification
+ ///
+ /// \param [IN] f_uimsgsize
+ /// std::string - length of data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus Publish(const std::string &f_cservicename,
+ PVOID f_pmessage,
+ const UI_32 f_uimsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentData
+ /// This function get the data related to notification
+ ///
+ /// \param
+ ///
+ /// \return CPersistentData
+ // CPersistentData - notification data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ const CPersistentData *GetPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentData
+ /// This function is used to set the data related to notification
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetDefaultPersistentData
+ /// This function get the default data(if any) related to notification
+ ///
+ /// \param
+ ///
+ /// \return CPersistentData
+ // CPersistentData - notification data
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ const CPersistentData *GetDefaultPersistentData();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetDefaultPersistentData
+ /// This function is used to set the default data related to notification
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual EFrameworkunifiedStatus SetDefaultPersistentData(PVOID f_pmessage,
+ const UI_32 f_msgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// IsPublished
+ /// This functions returns the published status of notification.
+ ///
+ /// \param
+ ///
+ /// \return BOOL
+ // BOOL - returns true if published before
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL IsPublished();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ResetMaxMessageSize
+ /// This function reset the max size of data that can be published with notification.
+ /// Also deletes the old persistent data and default data.
+ ///
+ /// \param [IN] f_uilength
+ /// std::string - Max size for notification data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus ResetMaxMessageSize(const UI_32 f_uilength);
+
+ protected:
+ CPersistentData *m_pData; ///< persistent data of notification
+
+ CPersistentData *m_pDefaultData; ///< persistent data of notification
+
+ BOOL m_bWasPublished; ///< Flag to check whether publisher had published notification
+
+ private:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetData
+ /// This function is used to set the persistent data
+ ///
+ /// \param [IN] f_pdata
+ /// CPersistentData - persistent data ptr
+ ///
+ /// \param [IN] f_pmessage
+ /// PVOID - Message data
+ ///
+ /// \param [IN] f_msgsize
+ /// UI_32 - Size of Message data
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetData(CPersistentData *f_pdata,
+ PVOID f_pmessage,
+ const UI_32 f_msgsize);
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
new file mode 100644
index 00000000..1123941c
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
@@ -0,0 +1,104 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStatePersistenceNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include "ns_npp_state_notification.h"
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * persistent notifications.
+ */
+class CStatePersistenceNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStatePersistenceNotification
+ /// Constructor of CStatePersistenceNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStatePersistenceNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize,
+ const EFrameworkunifiedPersistCategory f_epersistcategory = eFrameworkunifiedUserData);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStatePersistenceNotification
+ /// Destructor of CStatePersistenceNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStatePersistenceNotification();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetPersistentCategory
+ /// Gets the persist type of notification
+ ///
+ ///
+ /// \return EFrameworkunifiedPersistCategory
+ // EFrameworkunifiedPersistCategory - persist type
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedPersistCategory GetPersistentCategory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// SetPersistentCategory
+ /// Sets the persist type of notification
+ ///
+ /// \param [IN] f_epersistcategory
+ /// EFrameworkunifiedPersistCategory - persist category
+ ///
+ /// \return EFrameworkunifiedStatus
+ // EFrameworkunifiedStatus - success or failure status
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory);
+
+ private:
+ EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
new file mode 100644
index 00000000..8423e3e9
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
@@ -0,0 +1,73 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief This file contains declaration of class CStatePersistenceUserNotification.
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Include Files
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include "ns_npp_state_notification.h"
+
+
+/**
+ * This class inherits CStateNotification class and implements specific operations related to
+ * persistent notifications specific to user.
+ */
+class CStatePersistenceUserNotification : public CStateNotification {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CStatePersistenceUserNotification
+ /// Constructor of CStatePersistenceUserNotification class
+ ///
+ /// \param [IN] f_cnotificationname
+ /// std::string - Notification name
+ ///
+ /// \param [IN] f_uimaxmsgsize
+ /// UI_32 - Maximum size of notification data
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CStatePersistenceUserNotification(const std::string &f_cnotificationname,
+ const UI_32 f_uimaxmsgsize);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CStatePersistenceUserNotification
+ /// Destructor of CStatePersistenceUserNotification class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CStatePersistenceUserNotification();
+};
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_STATE_PERSISTENCE_USER_NOTIFICATION_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_threads.h b/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
new file mode 100644
index 00000000..042e8579
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
+
+// name of threads
+#define NS_NPP_READ_THREAD_NAME "NS_NPPReadWkr"
+#define NS_NPP_WRITE_THREAD_NAME "NS_NPPWriteWkr"
+#define NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME "NS_NPPIPWkr"
+#define NS_NPP_DATA_RESET_THREAD_NAME "NS_NPPDataRst"
+
+// priority of threads
+#define NS_NPP_READ_THREAD_PRIO 15
+#define NS_NPP_WRITE_THREAD_PRIO 15
+#define NS_NPP_IMMEDIATE_PERSIST_THREAD_PRIO 25
+#define NS_NPP_DATA_RESET_THREAD_PRIO 10
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_THREADS_H_
diff --git a/nsframework/notification_persistent_service/server/include/ns_npp_types.h b/nsframework/notification_persistent_service/server/include/ns_npp_types.h
new file mode 100644
index 00000000..79a44d74
--- /dev/null
+++ b/nsframework/notification_persistent_service/server/include/ns_npp_types.h
@@ -0,0 +1,212 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \defgroup <<Group Tag>> <<Group Name>>
+/// \ingroup tag_NS_NPPService
+/// .
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_NS_NPPService
+/// \brief
+///
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
+#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
+
+#include <native_service/frameworkunified_sm_eventdata.h>
+#include <aglpath.h>
+#include <native_service/ns_np_types.h>
+
+// name of notification file to be saved in persistent memory depending on the persistent type category
+
+#define NOTIFICATIONFILE "PERSISTENT_NOTIFICATION" // stores user notification common to all user
+#define USERNOTIFICATIONFILE "USER_PERSISTENT_NOTIFICATION" // stores user notification specific to particular user
+#define FACTORYNOTIFICATIONFILE "FACTORY_NOTIFICATION" // stores factory notification
+#define FACTORYCUSTOMERNOTIFICATIONFILE "FACTORYCUSTOMER_NOTIFICATION" // stores factorycustomer notification
+#define DEALERNOTIFICATIONFILE "DEALER_NOTIFICATION" // stores dealer notification
+
+// name of persistence folder for persistent type categorization
+#define USERDATA "UserData" // name of folder contatining userdata
+#define FACTORYDATA "FactoryData" // name of folder contatining factory data
+#define FACTORYCUSTOMERDATA "FactoryCustomerData" // name of folder contatining factory customer data
+#define DEALERDATA "DealerData" // name of folder contatining dealer data
+
+// default user name for personalization
+#define DEFAULTUSERNAME "DefaultUser"
+
+// name of NSNPS version file
+#define VERSION_TXT "version.txt"
+
+#define STORAGE_PATH "/nv/BS/ns/npp/rwdata/"
+
+
+typedef enum ENPSLoadType {
+ LOADTYPE_NONE = -1,
+ LOADTYPE_RELEASE = 0, // load file to persistent memory
+ LOADTYPE_LOAD = 1, // load file to temporary memory
+ LOADTYPE_RELOAD = 2, // reload the file.
+} ENPS_Loadtype;
+
+/// \typedef ENotificationpersistentservicePersistType
+/// \brief Persist file types
+typedef enum ENotificationpersistentservicePersistType {
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST = 0, ///< Add values after this value only.
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, ///< Persist a file to a persistent memory
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, ///< Persist a folder to a persistent memory
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE, ///< no type
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST, ///< Add values before this value only.
+} ENotificationpersistentservicePersistType;
+
+typedef enum ENPSPersistenceJobState {
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE = 0, ///< Job is idle. // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS = 1, ///< Job is in process. Either release or load. // NOLINT (readability/naming)
+ ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED = 2, ///< Job release was aborted due to abort shutdown. // NOLINT (readability/naming)
+} ENPSPersistenceJobState;
+
+typedef CHAR CopyInfoStr[MAX_PATH_LENGTH]; ///< Information passed via the framework
+
+
+typedef enum ENPSCopyWorkerProtocol {
+ // > Command(s)
+ CP_WRK_CMD_START = 1500,
+ CP_WRK_CMD_STOP = 1501,
+ CP_WRK_CMD_COPY = 1502,
+ CP_WRK_CMD_RESUME = 1503, // This will release the thread from the abort command.
+
+ // < Command Ack(s)
+ CP_WRK_ACK_CMD_COMPLETE = 1504,
+
+ // < Notification(s)
+ CP_WRK_NTFY = 1505,
+
+ // < Shutdown request command
+ CMD_WRK_SHUTDOWN_REQ = 1506,
+ CMD_WRK_SHUTDOWN_ACK = 1507,
+
+ CMD_DELETE_OLD_DATA = 1508,
+
+ AR_CMD_START = 1400,
+ AR_CMD_STOP = 1401,
+ AR_CMD_ARCHIVE = 1402,
+ AR_CMD_RESUME = 1403, // This will release the thread from the abort command.
+
+ // < Command Ack(s)
+ AR_ACK_CMD_COMPLETE = 1404,
+
+ // < Notification(s)
+ AR_CMD_NTFY = 1405,
+
+ NOR_PERSISTENCE_TIMER_START = 1406,
+ NOR_PERSISTENCE_REGISTER = 1407,
+ NOR_PERSISTENCE_UNREGISTER = 1408,
+ // this cmd is used to tell the NOR thread to stop the timer
+ // for all the the notifications in case of userdata reset during shutdown
+ NOR_PERSISTENCE_ONSHUTDOWN = 1409,
+ // while to persist the data immediately irrespective of delay in case of shutdown without userdata reset.
+ // ack sent to NPPService main thread by Nor worker thread after persisting immediate data
+ NOR_PERSISTENCE_ONSHUTDOWN_ACK = 1410,
+ // message sent by main thread to immediate persistence thread
+ // to change the persistent category of immediate notification
+ NOR_PERSISTENCE_CHANGE_CATEGORY = 1411
+} ENSP_CopyWorkerProtocol, *PENSP_CopyWorkerProtocol, ENPS_ArchiveProtocol;
+
+
+typedef enum ENPSCopyWorkerFailures {
+ // > Failure codes(s)
+ CP_WRK_FAILURE_SRC_NOT_FND = 3500,
+ CP_WRK_FAILURE_DST_CREATE = 3501,
+ CP_WRK_FAILURE_ABORT_DURING_CP = 3502,
+ CP_WRK_FAILURE_ABORT_BEFORE_CP = 3503,
+ CP_WRK_FAILURE_WRITE_ERROR_CP = 3504,
+
+ AR_THREAD_FAILURE_SRC_NOT_FND = 3400,
+ AR_THREAD_FAILURE_DST_CREATE = 3401,
+ AR_THREAD_FAILURE_ABORT_DURING_ARCHIVE = 3402,
+ AR_THREAD_FAILURE_ABORT_BEFORE_ARCHIVE = 3403,
+} ENPS_CopyWorkerFailures, *PENPS_CopyWorkerFailures, ENPS_ArchiveFailures;
+
+typedef struct NPSCopyAckMsg {
+ ENSP_CopyWorkerProtocol m_eworkerprotocol; // Worker Load or Release Protocol Id
+} NSP_CopyAckMsg;
+
+typedef enum NotificationpersistentserviceCompressionType {
+ ENOTIFICATIONPERSISTENTSERVICENONE = 0, /// No Compression before file persistence
+ ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION, /// Compress file before persistence using default compression method
+ ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ /// Compress file before persistence using libz
+} NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE;
+
+typedef struct NPSCopyInfoMsg {
+ CopyInfoStr m_csourcepath; // Source path
+ CopyInfoStr m_cdestinationpath; // Destination path
+ CopyInfoStr m_cpersistenttag; // Tag for Persistence
+ CopyInfoStr m_crequesterappname; // Requester Name
+ ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
+ ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
+} NSP_CopyInfoCmd;
+
+typedef struct NPSCopyStatus {
+ BOOL m_bpersistencechk; // Persistence Success or Failure
+ ENPS_CopyWorkerFailures m_ecopyfailures; // Failure Protocol ID
+ CopyInfoStr m_cpersistenttag; // Tag for Persistence
+ CopyInfoStr m_crequesterappname; // Requester Name
+ ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
+ ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
+ NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
+} NSP_CopyStatusResponse, NSP_CopyCancel;
+
+
+// Structure for Nor Persistent Notification
+typedef struct TNorPersistenceNotifInfoHeader {
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+ UI_32 m_uimaxmsglength; ///< Maximum data length of notification
+ EFrameworkunifiedNotificationType m_epersistenttype; ///< type of notification
+ CHAR m_cpublishername[MAX_NAME_SIZE_APP]; ///< Service Name
+ UI_32 m_uimsgsize; ///< length of message
+ UI_32 m_uidelay; ///< Time delay between persistence
+ EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
+} TNorPersistenceNotifInfoHeader;
+
+typedef struct _TImmediatePersistenceRegisterNotifInfo { // NOLINT (readability/naming)
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+ UI_32 m_uidelay; ///< Time delay between persistence
+ EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
+} TImmediatePersistenceRegisterNotifInfo;
+
+typedef struct _TImmediatePersistenceUnregisterNotifInfo { // NOLINT (readability/naming)
+ CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
+} TImmediatePersistenceUnregisterNotifInfo;
+
+typedef struct _NPS_CopyShutdown { // NOLINT (readability/naming)
+ CopyInfoStr m_crequesterappname;
+} NSP_CopyShutdown, NSP_CopyShutdownAck;
+
+typedef struct _TImmediatePersistenceChangeCategory { // NOLINT (readability/naming)
+ TNorPersistenceNotifInfoHeader m_tnornotifInfoheader; ///< Notification info with new persist category type
+ EFrameworkunifiedPersistCategory m_eoldpersistcategory; ///< Old Persistent Category of notification
+} TImmediatePersistenceChangeCategory;
+
+typedef struct _TImmediateShutdown { // NOLINT (readability/naming)
+ EFrameworkunifiedShutdownType f_eshutdowntype;
+ UI_32 f_uinotificationpersistentservicepersistcategoryflag;
+} TImmediateShutdown;
+
+#endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_