summaryrefslogtreecommitdiffstats
path: root/video_in_hal/nsframework/notification_persistent_service
diff options
context:
space:
mode:
Diffstat (limited to 'video_in_hal/nsframework/notification_persistent_service')
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/LICENSE177
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/Makefile.server19
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/Makefile87
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/app_states.h187
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h40
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h296
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h230
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h558
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h111
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h145
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h218
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h323
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h496
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h68
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h94
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h121
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h122
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h365
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h536
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h119
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h165
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h75
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h132
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h34
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h330
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h109
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h177
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h221
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h104
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h73
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h46
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h212
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp2684
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp258
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp131
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp1149
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp846
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp649
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp1153
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp232
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp149
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp747
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp485
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp1558
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp50
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp100
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp96
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp743
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp1132
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp58
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp181
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp333
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp158
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp305
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp402
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp87
-rwxr-xr-xvideo_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp61
57 files changed, 0 insertions, 19737 deletions
diff --git a/video_in_hal/nsframework/notification_persistent_service/LICENSE b/video_in_hal/nsframework/notification_persistent_service/LICENSE
deleted file mode 100755
index f433b1a..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/LICENSE
+++ /dev/null
@@ -1,177 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
diff --git a/video_in_hal/nsframework/notification_persistent_service/Makefile.server b/video_in_hal/nsframework/notification_persistent_service/Makefile.server
deleted file mode 100755
index 1347519..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/Makefile.server
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# @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.
-#
-
-SUBDIRS := server
-
-include ../native_service.mk
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/Makefile b/video_in_hal/nsframework/notification_persistent_service/server/Makefile
deleted file mode 100755
index b5b80cb..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# @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.
-#
-
-######### installed program #############
-INST_PROGS = NS_NPPService
-
-######### add source path #############
-VPATH += ./src
-VPATH += ./include/$(COMPONENT_NAME)
-
-######### installed library(*.a) #############
-#INST_LIBS =
-
-######### installed shared library(*.so) #############
-#INST_SHLIBS =
-
-######### install headers(*.h) #############
-INST_HEADERS = notification_persistent_service.h
-
-######### compiled sources #############
-NS_NPPService_SRCS = app_states.cpp \
- ns_npp.cpp \
- ns_npp_archive.cpp \
- ns_npp_binary_accesser.cpp \
- ns_npp_copy_worker.cpp \
- ns_npp_fs_directory.cpp \
- ns_npp_handlelist.cpp \
- ns_npp_nor_persistence_worker_thread.cpp \
- ns_npp_notification.cpp \
- ns_npp_notification_manager.cpp \
- ns_npp_notification_receiver.cpp \
- ns_npp_persist_file.cpp \
- ns_npp_persist_folder.cpp \
- ns_npp_persistence.cpp \
- ns_npp_persistence_manager.cpp \
- ns_npp_persistent_data.cpp \
- ns_npp_personalization_manager.cpp \
- ns_npp_registry_entry.cpp \
- ns_npp_regular_notification.cpp \
- ns_npp_state_nor_persistence_notification.cpp \
- ns_npp_state_notification.cpp \
- ns_npp_state_persistence_notification.cpp \
- ns_npp_state_persistence_user_notification.cpp \
- notificationpersistentservice_application.cpp \
- notificationpersistentservice_main.cpp
-
-######### add include path #############
-CPPFLAGS += -I./include
-CPPFLAGS += -Wl,--no-undefined
-CPPFLAGS += -Werror=implicit-function-declaration
-CPPFLAGS += -Werror=format-security
-
-CPPFLAGS += -Wconversion
-CPPFLAGS += -Wint-to-pointer-cast
-CPPFLAGS += -Wpointer-arith
-CPPFLAGS += -Wformat
-######### add compile option #############
-ENABLE_PARA_INST += install-prog # PARALLEL MAKE
-CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND
-
-######### linked library #############
-
-######### linked library (dynamic) #############
-LDFLAGS += -Wl,--no-as-needed
-LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
-LDLIBS += -Wl,-Bdynamic -ltar
-LDLIBS += -Wl,-Bdynamic -lz
-LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy #-lPosixBasedOS001ClockCycleApi -lPosixBasedOS001MsgApi -lPosixBasedOS001GetPrioApi -lPosixBasedOS001TimeApi -lPosixBasedOS001SlogApi
-
-LINK_CXX=Y
-
-######### add library path #############
-
-include ../../native_service.mk
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/include/app_states.h b/video_in_hal/nsframework/notification_persistent_service/server/include/app_states.h
deleted file mode 100755
index a7f4b4a..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/app_states.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h b/video_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
deleted file mode 100755
index a7c9f8e..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/native_service/notification_persistent_service.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h
deleted file mode 100755
index f96dd75..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
deleted file mode 100755
index aed4d2a..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_binary_accesser.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
deleted file mode 100755
index 984296f..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_copy_worker.h
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
deleted file mode 100755
index 4f7876d..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_fs_directory.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
deleted file mode 100755
index 30c8a26..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_handlelist.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
deleted file mode 100755
index a3994ca..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_nor_persistence_worker_thread.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
deleted file mode 100755
index 673e54c..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
deleted file mode 100755
index e730d02..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_manager.h
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
deleted file mode 100755
index 09f6b15..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notification_receiver.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
deleted file mode 100755
index e668af6..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_notificationpersistentservicelog.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
deleted file mode 100755
index 04468be..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_file.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
deleted file mode 100755
index 39cf975..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persist_folder.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
deleted file mode 100755
index d84f9fb..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence.h
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
deleted file mode 100755
index 99f98d7..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistence_manager.h
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
deleted file mode 100755
index bfb1538..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_accesser.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
deleted file mode 100755
index 84e2b43..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_persistent_data.h
+++ /dev/null
@@ -1,165 +0,0 @@
- /*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
deleted file mode 100755
index 9ac052f..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personality.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
deleted file mode 100755
index b1042fb..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_personalization_manager.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
deleted file mode 100755
index 13b96a2..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_profiling_protocols_internal.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
deleted file mode 100755
index 3cb475e..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_registry_entry.h
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
deleted file mode 100755
index da5427d..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_regular_notification.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
deleted file mode 100755
index 26edf73..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_nor_persistence_notification.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
deleted file mode 100755
index aaa6992..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_notification.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
deleted file mode 100755
index 1123941..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_notification.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
deleted file mode 100755
index 8423e3e..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_state_persistence_user_notification.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
deleted file mode 100755
index 042e857..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_threads.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * @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/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h b/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h
deleted file mode 100755
index 79a44d7..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/include/ns_npp_types.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * @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_
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp
deleted file mode 100755
index c54508b..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/app_states.cpp
+++ /dev/null
@@ -1,2684 +0,0 @@
-/*
- * @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 implementation of internal transitions of state machine
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include <unistd.h>
-#include <native_service/ns_np_service.h>
-#include <native_service/frameworkunified_framework_if.h>
-#include <native_service/ns_np_service_protocol.h>
-#include <native_service/ns_np_service_notification.h>
-#include <string>
-#include <vector>
-#include "app_states.h"
-#include "ns_npp.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_notification_manager.h"
-#include "ns_npp_persistence_manager.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_personalization_manager.h"
-
-
-#ifdef NPP_PROFILEINFO_ENABLE
-#include <ns_npp_profiling_protocols_internal.h>
-#endif
-
-#ifdef AGL_STUB
-#include <other_service/strlcpy.h>
-#endif
-
-static size_t NppUIToA(unsigned int value, char *buf) {
- static const char c[] = "0123456789";
- char b[12];
- char *p = b + sizeof(b);
- int i = 0;
-
- *--p = '\0';
- do {
- *--p = c[value % 10];
- value /= 10;
- ++i;
- } while (value);
- strcpy(buf, p); // NOLINT (runtime/printf)
-
- return i;
-}
-
-static size_t NppStrlcpy(char *dst, const char *src, size_t siz) {
- size_t ret = strlen(src);
-
- if (siz) { // LCOV_EXCL_BR_LINE 6: siz can't be 0
- size_t len = (ret >= siz) ? siz - 1 : ret;
- memcpy(dst, src, len);
- dst[len] = '\0';
- }
- return ret;
-}
-
-#define NPP_SET_FIXSTR(buf, str) \
- do { \
- strcpy(buf, str); /* NOLINT (runtime/printf) */ \
- buf += sizeof(str) - 1; \
- } while (0)
-
-#define NPP_SET_VARSTR(buf, str, siz) \
- buf += NppStrlcpy(buf, str, siz)
-
-extern CHAR g_csendreadyackto[];
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPRegisterNotifications
-/// The state machine executes this transition when event for registering notification is triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications) { // NOLINT (readability/naming)
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_register_multiple_notif_msg *l_pMsg = NULL;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get app name of message source
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register notifications. Invalid message length received."); // LCOV_EXCL_LINE 6: l_uiMsgLength must be greater than 0 // NOLINT[whitespace/line_length]
- } else {
- std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(
- l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) {
- l_pMsg = reinterpret_cast<NC_register_multiple_notif_msg *>(&l_vData[0]);
-
- if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
- NC_register_notif_msg *l_pEventInfo = NULL;
-
- // register all the notifications
- for (UI_32 l_uiCount = 0;
- l_uiCount < l_pMsg->numNotifications;
- ++l_uiCount) {
- l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
-
- if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Register Notfn request, src=%s, name=%s, len=%d, type=%d",
- l_cMsgSource, l_pEventInfo->notificationName, l_pEventInfo->maxLength, l_pEventInfo->persType);
-
- // register the notification
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
- l_pEventInfo->notificationName,
- l_pEventInfo->maxLength,
- l_pEventInfo->persType)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
- }
- } else {
- // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't register notification from source %s. l_pEventInfo is NULL", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid src mq"); // LCOV_EXCL_LINE 6: l_pMsg can't be NULL
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't register notifications from source %s, Unable to get message data. Error Status: 0x%x",
- l_cMsgSource, l_estatus);
- }
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationManager can't be NULL // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPSubscribeToNotification
-/// The state machine executes this transition when event for subscribing single notification is
-/// triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_subscribe_msg l_objSubscribeMsg;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_subscribe_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- // get the data received
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_objSubscribeMsg), sizeof(NC_subscribe_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
-#ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
- char buf[128];
- char *p = buf;
- NPP_SET_FIXSTR(p, "Subscribing Notfn request, src=");
- NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
- NPP_SET_FIXSTR(p, ", name=");
- strcpy(p, l_objSubscribeMsg.notificationName); // NOLINT (runtime/printf)
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
- /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- * "Subscribing Notfn request, src=%s, name=%s",
- * l_cMsgSource, l_objSubscribeMsg.notificationName);*/
-#endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
-
- // subscribe for notification
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
- l_cMsgSource,
- l_objSubscribeMsg.notificationName)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_objSubscribeMsg.notificationName);
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't subscribe to notification from source %s. Unable to get msg data, status: 0x%x",
- l_cMsgSource, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't subscribe to notification from source %s. Invalid message length received.",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't subscribe to notification from source %s. l_pNotificationManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPSubscribeToNotifications
-/// The state machine executes this transition when event for subscribing multiple notification is
-/// triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_subscribe_multiple_notif_msg *l_pMsg = NULL;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
- // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid msg len");
- // LCOV_EXCL_STOP
- } else {
- std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the data received
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- l_pMsg = reinterpret_cast<NC_subscribe_multiple_notif_msg *>(&l_vData[0]);
-
- if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
- NC_subscribe_msg *l_pEventInfo = NULL;
-
- // subscribe to multiple notifications
- for (UI_32 l_uiCount = 0;
- l_uiCount < l_pMsg->numNotifications;
- ++l_uiCount) {
- l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
-
- if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
-#ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
- char buf[128];
- char *p = buf;
- NPP_SET_FIXSTR(p, "Subscribe Notfn request, src=");
- NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
- NPP_SET_FIXSTR(p, ", name=");
- strcpy(p, l_pEventInfo->notificationName); // NOLINT (runtime/printf)
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
- /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "Subscribe Notfn request, src=%s, name=%s",
- l_cMsgSource,
- l_pEventInfo->notificationName);*/
-#endif // ifdef NPP_PERFORMANCE_ANALYZE_ENABLE
-
- // subscribe to notification
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnSubscribeToEvent(
- l_cMsgSource,
- l_pEventInfo->notificationName)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceServiceOnSubscribeToEvent :: %s", l_pEventInfo->notificationName);
- }
- } else {
- // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Unable to subscribe to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pMsg can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Unable to subscribe to notifications from source %s, Invalid src mq", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
-
- l_vData.clear();
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Unable to subscribe to notifications from source %s, error retrieving message data, status: 0x%x",
- l_cMsgSource,
- l_estatus);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Unable to subscribe to notifications from source %s, l_pNotificationManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPPublishNotification
-/// The state machine executes this transition when event for publishing notification is triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
-
- CHAR l_cData[MAX_SYS_INFO_SIZE];
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get the app name of message source
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- // retrieve notification name
- FrameworkunifiedGetSystemInfo(l_pHApp, l_cData);
-
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- char buf[144];
- char *p = buf;
- NPP_SET_FIXSTR(p, "Publish Notfn request, src=");
- NPP_SET_VARSTR(p, l_cMsgSource, sizeof(buf) - (p - buf));
- NPP_SET_FIXSTR(p, ", name=");
- NPP_SET_VARSTR(p, l_cData, sizeof(buf) - (p - buf));
- NPP_SET_FIXSTR(p, ", len=");
- NppUIToA(l_uiMsgLength, p);
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, buf);
- /* FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "Publish Notfn request, src=%s, name=%s, len=%d",
- l_cMsgSource, l_cData, l_uiMsgLength);*/
-
- if (0 != l_uiMsgLength) {
- std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // publish the notification
- (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData,
- (PVOID)&pMsgData[0], l_uiMsgLength);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't publish notification from source %s, Unable to get messsage data, Error Status: 0x%x",
- l_cMsgSource, l_estatus);
- // LCOV_EXCL_STOP 4: NSFW error case
- }
- } else {
- // publish the notification
- (VOID)l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(l_cMsgSource, l_cData, NULL, l_uiMsgLength);
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification from source %s. l_pNotificationManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPUnSubscribeFromNotification
-/// The state machine executes this transition when event for unsubscribing notification is triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_unsubscribe_frm_notif_msg unsubscribeMsg;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get the msg source name
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 200: l_pNotificationManager can't be NULL
- if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_unsubscribe_frm_notif_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&unsubscribeMsg), sizeof(NC_unsubscribe_frm_notif_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
- unsubscribeMsg.notificationName);
-
- // unsubscribe from notification
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
- l_cMsgSource,
- unsubscribeMsg.notificationName)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s",
- unsubscribeMsg.notificationName);
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "%s is unable to subscribe from notification, error getting message data, status: 0x%x",
- l_cMsgSource, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unsubscribe to notification from source %s, Invalid Message size received.",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unsubscribe to notification from source %s, l_pNotificationManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPUnSubscribeFromNotification
-/// The state machine executes this transition when event for unsubscribing notification is triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_unsubscribe_multiple_notif_msg *l_pMsg = NULL;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
- // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unsubscribe from notifications from source %s. Invalid message length received",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- } else {
- std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the data received
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- l_pMsg = reinterpret_cast<NC_unsubscribe_multiple_notif_msg *>(&l_vData[0]);
-
- if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_pMsg can't be NULL
- NC_unsubscribe_frm_notif_msg *l_pEventInfo = NULL;
-
- // subscribe to multiple notifications
- for (UI_32 l_uiCount = 0;
- l_uiCount < l_pMsg->numNotifications;
- ++l_uiCount) {
- l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
-
- if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source: %s is unsubscribing from notification: %s", l_cMsgSource,
- l_pEventInfo->notificationName);
-
- // unsubscribe from notification
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnSubscribeFromEvent(
- l_cMsgSource,
- l_pEventInfo->notificationName)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceServiceOnUnSubscribeFromEvent :: %s", l_pEventInfo->notificationName);
- }
-
- } else {
- // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unsubscribe from notifications from source %s. l_pEventInfo is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pMsg can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unsubscribe from notifications from source %s. Invalid src mq", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
-
- l_vData.clear();
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unsubscribe from notifications from source %s, error getting message data, status: 0x%x",
- l_cMsgSource,
- l_estatus);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unsubscribe from notifications from source %s. l_pNotificationManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPUnRegisterNotifications
-/// The state machine executes this transition when event for unregistering notifications is triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_unregister_multiple_notif_msg *l_pMsg = NULL;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get the source name
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
- // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unregister to notifications from source %s. Invalid message length received.",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- } else {
- std::vector<CHAR>l_vData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- l_pMsg = reinterpret_cast<NC_unregister_multiple_notif_msg *>(&l_vData[0]);
-
- // unregister multiple notifications
- if (NULL != l_cMsgSource && NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 6: l_cMsgSource and l_pMsg can't be NULL
- NC_unregister_notif_msg *l_pEventInfo = NULL;
-
- for (UI_32 l_uiCount = 0;
- l_uiCount < l_pMsg->numNotifications;
- ++l_uiCount) {
- l_pEventInfo = &l_pMsg->notificationList[l_uiCount];
-
- if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Source %s is unregistering to notification %s", l_cMsgSource,
- l_pEventInfo->notificationName);
-
- // unregister notification
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnUnRegisterEvents(
- l_cMsgSource,
- l_pEventInfo->notificationName)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceServiceOnUnRegisterEvents :: %s", l_pEventInfo->notificationName);
- }
- } else {
- // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unregister to notifications from source %s, l_pEventInfo is NULL", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_cMsgSource and l_pMsg can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unregister to notificationsfrom source %s, Invalid src mq ", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
-
- l_vData.clear();
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unregister to notifications from source %s, Unable to get message data, status: 0x%x",
- l_cMsgSource, l_estatus);
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't unregister to notifications from source %s, l_pNotificationManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPReadPersistedData
-/// The state machine executes this transition when event for getting notification's persistent data
-/// is triggered.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_get_pers_data_msg l_tMsg;
-
- l_tMsg.notificationName[0] = '\0';
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- if (FrameworkunifiedGetMsgLength(l_pHApp) == sizeof(NC_get_pers_data_msg)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- // get the message data received
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_get_pers_data_msg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Source %s is requesting to read data for persistent notification %s",
- l_cMsgSource, l_tMsg.notificationName);
- // get persistent data related to notification
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnGetPersistentData(
- l_tMsg.notificationName,
- l_cMsgSource))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceServiceOnGetPersistentData :: %s", l_tMsg.notificationName);
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't read persistent data for source %s, Error getting message data, status: 0x%x",
- l_cMsgSource, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. Invalid Message size received.",
- l_cMsgSource);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't read persistent data for source %s. l_pNotificationManager is NULL",
- l_cMsgSource);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- // if any error occurs while reading persistent data, send failed ack to the requestor
- if (eFrameworkunifiedStatusOK != l_estatus) {
- HANDLE l_hReceiverMq = McOpenSender(l_cMsgSource);
- if (NULL != l_hReceiverMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- NC_get_persdata_failed_ack gpdFailed = {};
- std::strncpy(&gpdFailed.notificationName[0], l_tMsg.notificationName, MAX_STRING_SIZE_NOTIFICATION);
-
- // send the failure ack to requester
- l_estatus = McSend(l_hReceiverMq, AppName, NPS_GET_PERS_DATA_FAILED_ACK, sizeof(gpdFailed), &gpdFailed); // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "Sent NPS_GET_PERS_DATA_FAILED_ACK to %s. Status: %d.",
- l_cMsgSource, l_estatus);
-
- McClose(l_hReceiverMq);
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in opening sender queue of %s. Can't send NPS_GET_PERS_DATA_FAILED_ACK",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPPublishImmediateNotification
-/// This transition is executed when service updates the immediate notification data
-/// using synchronous API
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- // get the app name of message source
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
- CHKNULL(l_pNotificationManager);
-
- CHAR l_cNotfName[MAX_SYS_INFO_SIZE] = {};
-
- // retrieve notification name
- (VOID)FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotfName);
-
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
- "Warning::Notification %s published using sync API by %s, Data length: %d",
- l_cNotfName,
- l_cMsgSource, l_uiMsgLength);
-
- if (0 != l_uiMsgLength) {
- std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], l_uiMsgLength, eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // publish the notification
- (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, (PVOID)&pMsgData[0],
- l_uiMsgLength);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't publish notification %s from source %s, Unable to get messsage data, Error Status: 0x%x",
- l_cNotfName,
- l_cMsgSource, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // publish the notification
- (VOID)l_pNotificationManager->NotificationpersistentservicePublishImmediateNotification(l_cMsgSource, l_cNotfName, NULL, l_uiMsgLength);
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- f_pSourceState = NULL;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPPersistentSync
-/// Processing which synchronizes by NPPService (syncfs)
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- if (TRUE == l_pnsnpp->Syncfs()) { // LCOV_EXCL_BR_LINE 6: always return true
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "syncfs are processed."); // LCOV_EXCL_LINE 6: always return true
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- NSP_CopyStatusResponse l_tCpStatus = {};
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
-
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)&l_tCpStatus, sizeof(l_tCpStatus), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s for tag: %s sender: %s, persist type:%d",
- (l_tCpStatus.m_bpersistencechk ? "Successful copy" : "Non-Successful copy"),
- l_tCpStatus.m_cpersistenttag, l_tCpStatus.m_crequesterappname, l_tCpStatus.m_eloadtype);
-
- if (LOADTYPE_LOAD == l_tCpStatus.m_eloadtype) { // ack for load file/folder
- HANDLE hMq = NULL;
- NC_LoadPersistedAck l_tMsgAck = {};
-
- // HANDLE hMq = McOpenSender(l_tCpStatus.sender);
- hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_tCpStatus.m_crequesterappname);
-
- // send NC_LoadPersistedAck to the requester
- l_tMsgAck.eStatus = (TRUE == l_tCpStatus.m_bpersistencechk) ? eFrameworkunifiedStatusOK : eFrameworkunifiedStatusFail;
-
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(l_tMsgAck.cTag, l_tCpStatus.m_cpersistenttag, sizeof(l_tMsgAck.cTag));
-#endif
-
- if (NULL == hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // catastrophic failure!
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_tCpStatus.m_crequesterappname); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- } else {
- if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == l_tCpStatus.m_epersisttype) {
- // send ack to requester for file successfully persisted
- if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "ERROR :: Sending NPS_GET_PERS_FILE_ACK message to %s", l_tCpStatus.m_crequesterappname);
- // LCOV_EXCL_STOP
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "NPS_GET_PERS_FILE_ACK is sent to %s for file tag %s and load status: %d.",
- l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
- }
- } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == l_tCpStatus.m_epersisttype) { // LCOV_EXCL_BR_LINE 6: m_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER // NOLINT[whitespace/line_length]
- // send ack to requester for folder successfully persisted
- if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_GET_PERS_FOLDER_ACK, sizeof(l_tMsgAck), &l_tMsgAck)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "ERROR :: Sending NPS_GET_PERS_FOLDER_ACK message to %s", l_tCpStatus.m_crequesterappname);
- // LCOV_EXCL_STOP
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "NPS_GET_PERS_FOLDER_ACK is sent to %s for folder tag %s and load status: %d.",
- l_tCpStatus.m_crequesterappname, l_tMsgAck.cTag, l_tMsgAck.eStatus);
- }
- } else {
- // do nothing
- }
- // close mq
- FrameworkunifiedMcClose(hMq);
- hMq = NULL;
- }
- }
-
- // Update registry
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
- if (l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: unexpected branch can't be NULL
- l_pPersistenceManager->AckReceivedFromWorker(l_tCpStatus.m_crequesterappname,
- l_tCpStatus.m_cpersistenttag,
- l_tCpStatus.m_epersisttype,
- l_tCpStatus.m_bpersistencechk,
- l_tCpStatus.m_eloadtype);
- }
-
- if (LOADTYPE_RELEASE == l_tCpStatus.m_eloadtype) {
- f_pSourceState->FrameworkunifiedPostEvent(EVENT(evCheckAllFilesPersisted));
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "ERROR ::invalid length FrameworkunifiedGetMsgDataOfSize expected(%ld)", static_cast<long int>(sizeof(l_tCpStatus))); // NOLINT (runtime/int)
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnSaveDataAck) { // LCOV_EXCL_START 6: unused code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnUserChange
-/// The state machine executes this transition when event to set or change personality is received
-/// from the system.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- try {
- CHKNULL(f_pSourceState);
- NC_User l_tMsg;
- std::string l_cCurrentUsername;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- // TODO(my_username): Only accept user change from authorized app. Compare l_cMsgSource with authorized source.
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(NC_User), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
- CnotificationpersistentservicePersonalizationManager *l_pPersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
-
- if (NULL != l_pPersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersonalizationManager can't be NULL
- l_pPersonalizationManager->NotificationpersistentserviceGetPersonality(l_cCurrentUsername);
- }
-
- // writes the temporary user files and folders to permanent memory
- if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
- if (!l_cCurrentUsername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_cCurrentUsername can't be empty
- if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentservicePersistAllUserRequests()) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while persisting user files and folders."); // LCOV_EXCL_LINE 6: NotificationpersistentservicePersistAllUserRequests will always return ok // NOLINT[whitespace/line_length]
- }
- }
- }
-
- // save the user persistent notification data
- if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateUserVar)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while NotificationpersistentserviceSaveNotificationPersistentData");
- }
- }
-
- // set new personality
- SetPersonality(l_pHApp, l_tMsg);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
- "Cannot set new personality, error getting message data, status: 0x%x", l_estatus);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-// ===========Shutdown
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout) { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-// LCOV_EXCL_STOP
-
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
- CHKNULL(l_pPersistenceManager);
- if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
- f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceReInitShutdownTimer) { // LCOV_EXCL_START 8: not be used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-// LCOV_EXCL_STOP
-
-CsNotificationpersistentserviceNPPStart::CsNotificationpersistentserviceNPPStart(std::string f_strName): CFrameworkunifiedOrthogonalState(f_strName) {
-}
-
-CsNotificationpersistentserviceNPPStart::~CsNotificationpersistentserviceNPPStart() { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-}
-// LCOV_EXCL_STOP
-
-EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- try {
- HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // Get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- NC_User l_tMsg = {};
-
- // register the user change notification
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(AppName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
- NTFY_NPPService_UserChange,
- sizeof(NC_User),
- eFrameworkunifiedPersistedStateVar)) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in user change notification registration."); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
- }
-
- // Set initial user. By default, NS_NPPService will set the current user as last user. If no
- // last user found set the default user.
- UI_32 l_uiUserNotificationDataSize = 0;
- EFrameworkunifiedStatus l_eGetNotificationDataStatus = eFrameworkunifiedStatusFail;
- l_eGetNotificationDataStatus = l_pNotificationManager->NPGetPersistentNotificationData(
- NTFY_NPPService_UserChange,
- (PVOID)&l_tMsg,
- sizeof(l_tMsg));
-
- if ((eFrameworkunifiedStatusOK != l_eGetNotificationDataStatus) || (l_uiUserNotificationDataSize <= 0)) {
- // set default user
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(l_tMsg.cUsername, DEFAULTUSERNAME, sizeof(l_tMsg.cUsername));
-#endif
- }
-
- l_estatus = SetPersonality(l_pHApp, l_tMsg);
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return l_estatus;
-}
-
-EFrameworkunifiedStatus SetPersonality(HANDLE l_pHApp, NC_User &f_tMsg) { // NOLINT (runtime/references)
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: l_pnsnpp can't be NULL
- // Get the instance of personalization manager
- CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
-
- if (NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL
- // send msg to all notificationpersistentservice apps that user has change.
- // register user change notification
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality :: %s", f_tMsg.cUsername);
-
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceSetPersonality(f_tMsg.cUsername))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Personality not set in Personality Manager :: user : %s", f_tMsg.cUsername);
- } else {
- // Get the instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
- l_pPersistenceManager->SetUserPersistentPath(f_tMsg.cUsername);
-
- // save the user persistent notification data
- if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedPersistedStateUserVar)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while loading user specific notification data.");
- }
-
- // Get instance of notification manager
- CNotificationManager *l_pNotificationManager = NULL;
- l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- // publish the user change notification
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceServiceOnPublishEvent(AppName, NTFY_NPPService_UserChange, (PVOID)&f_tMsg, sizeof(f_tMsg)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in publish user change event."); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- }
- }
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationpersistentservicePersonalizationManager is NULL"); // LCOV_EXCL_LINE 6: l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return l_estatus;
-}
-
-EFrameworkunifiedStatus CsNotificationpersistentserviceNPPStart:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- return eFrameworkunifiedStatusOK;
- // LCOV_EXCL_STOP
-}
-
-CsNotificationpersistentserviceShutdownDataSave::CsNotificationpersistentserviceShutdownDataSave(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
-}
-
-CsNotificationpersistentserviceShutdownDataSave::~CsNotificationpersistentserviceShutdownDataSave() { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-}
-// LCOV_EXCL_STOP
-
-EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- m_cShutdownRequestor = l_cMsgSource;
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NS_NPP received STOP message from %s.", l_cMsgSource);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 6: can't be NULL
- CShutDownMsgData *l_pMsgData = dynamic_cast<CShutDownMsgData *>(f_peventdata.get());
- CHKNULL(l_pMsgData);
-
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Type=%d, Data received with shutdown message:: %x",
- l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData);
-
- // save the persistent data on shutdown
- if (eFrameworkunifiedStatusOK != l_pnsnpp->NotificationpersistentservicePersistAll(l_pMsgData->m_eShutdownType, l_pMsgData->m_uiMsgData)) { // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in NotificationpersistentserviceOnSavePersistentData"); // LCOV_EXCL_LINE 6: always return ok
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return eFrameworkunifiedStatusOK;
-}
-
-EFrameworkunifiedStatus CsNotificationpersistentserviceShutdownDataSave:: FrameworkunifiedOnExit(CEventDataPtr f_peventdata) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- try {
- HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
- CHKNULL(l_pPersistenceManager);
-
- l_pPersistenceManager->ResetPersistFlag();
-
- // before sending shutdown ack, synchronize all the modified block buffers by NPPService for writing
- l_pnsnpp->Syncfs();
-
- // Send shutdown ack response to requester
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Sending shutdown complete message to requestor %s.",
- m_cShutdownRequestor.c_str());
- HANDLE hMq = FrameworkunifiedMcOpenSender(l_pHApp, m_cShutdownRequestor.c_str());
- if (NULL != hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hMq, NPS_NPP_STOP_ACK, 0, NULL)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error sending shutdown complete message to requestor %s.",
- m_cShutdownRequestor.c_str());
- // LCOV_EXCL_STOP
- }
- FrameworkunifiedMcClose(hMq);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in OpenSender for requestor %s.", m_cShutdownRequestor.c_str()); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnRegisterPersistentFile
-/// The state machine executes this transition when event for registering persistent file tag is
-/// received.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
- NC_RegisterPersistentFileMsg l_tMsg = {};
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
-
- if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- std::string l_cName;
- l_cName = l_tMsg.cFileTag;
-
- if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
- l_tMsg.cFileTag,
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
- // l_tMsg.eRegisterType,
- l_tMsg.bIsUserFile)) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence File :: %s", l_tMsg.cFileTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered File %s as TO BE PERSISTED for %s",
- l_tMsg.cFileTag, l_cMsgSource);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. Invalid message size received."); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnReleasePersistentFile
-/// The state machine executes this transition when event for releasing persistent file tag is
-/// received.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- // Check if persistence has been disabled than return immediately
- if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- return f_pSourceState; // LCOV_EXCL_LINE 6: custom command line options
- }
-
- CHKNULL(f_pSourceState);
- NC_ReleasePersistentFileMsg l_tMsg = {};
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get the instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
- // get the instance of persistence manager
- CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
-
- if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- // Check if the filetag is registered as user specific persistence
- if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
- if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
- }
- }
-
- if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
- l_tMsg.cFileTag,
- l_tMsg.cFilePath,
- l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
- l_tMsg.cUsername)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence file :: %s", l_tMsg.cFileTag);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release file %s to tag %s for source %s",
- l_tMsg.cFilePath, l_tMsg.cFileTag, l_cMsgSource);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. Invalid message size received"); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent file. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnLoadPersistentFile
-/// The state machine executes this transition when event for loading persistent file is received.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
- NC_LoadPersistedFileMsg l_tMsg = {};
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
- // get the instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load file %s that was PERSISTED by %s with tag %s",
- l_tMsg.cFilePath, l_cMsgSource, l_tMsg.cFileTag);
-
- // Check if the filetag is registered as user specific persistence
- if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFileTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
- if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
- }
- }
-
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- NC_LoadPersistedAck l_tMsgAck = {};
-
- HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
-
- if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- //// Check if persistence has been disabled than send positive acknowledgement to the application
- if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: custom command line options
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(l_tMsgAck.cTag, l_tMsg.cFileTag, sizeof(l_tMsgAck.cTag));
-#endif
-
- // send ack to requester
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
- }
- // LCOV_EXCL_STOP
- } else {
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
- l_tMsg.cFileTag,
- l_tMsg.cFilePath,
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,
- l_tMsg.cUsername))) {
- if (eFrameworkunifiedStatusFileLoadSuccess == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_tMsgAck.eStatus = eFrameworkunifiedStatusOK; // LCOV_EXCL_LINE 6: l_estatus can't be eFrameworkunifiedStatusFileLoadSuccess
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence File :: %s", l_tMsg.cFileTag);
-
- // return error to requester
- l_tMsgAck.eStatus = l_estatus;
- }
-
- std::strncpy(l_tMsgAck.cTag, l_tMsg.cFileTag, (MAX_PATH_LENGTH - 1));
-
- // send ack to requester
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_PERS_FILE_ACK, sizeof(l_tMsgAck), &l_tMsgAck))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- }
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "NPS_GET_PERS_FILE_ACK is sent to %s. File load status: %d, "
- "message sent status: %d ", l_cMsgSource, l_tMsgAck.eStatus, l_estatus);
- }
- }
-
- FrameworkunifiedMcClose(l_hMq);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // catastrophic failure!
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. Invalid message size received."); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent file. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnRegisterPersistentFolder
-/// The state machine executes this transition when event for registering persistent folder tag is
-/// received.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
- NC_RegisterPersistentFolderMsg l_tMsg = {};
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- if (NULL != l_pPersistenceManager && NULL != l_cMsgSource) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, // LCOV_EXCL_BR_LINE 4: NSFW error case
- static_cast<PVOID>(&l_tMsg),
- sizeof(l_tMsg),
- eSMRRelease)) {
- std::string l_cName;
- l_cName = l_tMsg.cFolderTag;
-
- if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRegister(l_cMsgSource, // LCOV_EXCL_BR_LINE 6: always return ok
- l_tMsg.cFolderTag,
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
- // l_tMsg.eRegisterType,
- l_tMsg.bIsUserFolder)) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Registering Persitence Folder :: %s", l_tMsg.cFolderTag); // LCOV_EXCL_LINE 6: always return ok // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Registered Folder %s as TO BE PERSISTED for %s",
- l_tMsg.cFolderTag, l_cMsgSource);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder. Invalid message size received.");
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't register persistent folder.. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager and l_cMsgSource can't be NULL // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnLoadPersistentFolder
-/// The state machine executes this transition when event for loading persistent folder is received.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
- NC_LoadPersistedFolderMsg l_tMsg = {};
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
-
- // get the instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Load folder %s that was PERSISTED by %s with tag %s",
- l_tMsg.cFolderPath, l_cMsgSource, l_tMsg.cFolderTag);
-
- // Check if the foldertag is registered as user specific persistence
- if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
- if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
- }
- }
-
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- NC_LoadPersistedAck l_tMsgAck = {};
- HANDLE l_hMq = NULL;
- l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
-
- if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- //// Check if persistence has been disabled than send positive acknowledgement to the application
- if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: custom command line options
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_tMsgAck.eStatus = eFrameworkunifiedStatusOK;
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, sizeof(l_tMsgAck.cTag));
-#endif
-
- // send ack to requester
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq,
- NPS_GET_PERS_FOLDER_ACK,
- sizeof(l_tMsgAck), &l_tMsgAck))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
- }
- // LCOV_EXCL_STOP
- } else {
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pPersistenceManager->NotificationpersistentserviceLoad(l_cMsgSource,
- l_tMsg.cFolderTag,
- l_tMsg.cFolderPath,
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
- l_tMsg.cUsername))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Loading Persitence Folder :: %s", l_tMsg.cFolderTag);
-
- // return error to requester
- l_tMsgAck.eStatus = l_estatus;
- std::strncpy(l_tMsgAck.cTag, l_tMsg.cFolderTag, (MAX_PATH_LENGTH - 1));
-
- // send ack to requester
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendMsg(l_hMq, // LCOV_EXCL_BR_LINE 4: NSFW error case
- NPS_GET_PERS_FOLDER_ACK,
- sizeof(l_tMsgAck), &l_tMsgAck))) {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSendMsg returned l_estatus=%d", l_estatus);
- // LCOV_EXCL_STOP
- }
- }
- }
- FrameworkunifiedMcClose(l_hMq);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't send ack NPS_GET_PERS_FOLDER_ACK. McOpenSender failed for %s ", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. Invalid message size received.");
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't load persistent folder. l_pNotificationManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnReleasePersistentFolder
-/// The state machine executes this transition when event for releasing persistent folder tag is
-/// received.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
-
- // Check if persistence has been disabled than return immediately
- if (TRUE == CPersistenceManager::m_bPersistenceDisabled) { // LCOV_EXCL_BR_LINE 6: custom command line options
- // LCOV_EXCL_START 6: custom command line options
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
- // LCOV_EXCL_STOP
- }
-
- NC_ReleasePersistentFolderMsg l_tMsg = {};
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get the instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- CnotificationpersistentservicePersonalizationManager *l_pNotificationpersistentservicePersonalizationManager = l_pnsnpp->m_pPersonalizationManager;
-
- if (NULL != l_pPersistenceManager && NULL != l_cMsgSource && NULL != l_pNotificationpersistentservicePersonalizationManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // Check if the foldertag is registered as user specific persistence
- if (TRUE == l_pPersistenceManager->IsUserPersistence(l_tMsg.cFolderTag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
- if (!l_pNotificationpersistentservicePersonalizationManager->NotificationpersistentserviceIsValidPersonality(l_tMsg.cUsername)) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
- }
- }
- if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceRelease(l_cMsgSource,
- l_tMsg.cFolderTag,
- l_tMsg.cFolderPath,
- l_tMsg.eFrameworkunifiedReleaseType, // NOLINT (readability/naming)
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,
- l_tMsg.cUsername)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in releasing persitence folder :: %s", l_tMsg.cFolderTag);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Release Folder %s to tag %s for source %s",
- l_tMsg.cFolderPath, l_tMsg.cFolderTag, l_cMsgSource);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. Invalid message size received.");
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't release persistent folder. l_pPersistenceManager is NULL"); // LCOV_EXCL_LINE 6: l_pPersistenceManager, l_cMsgSource and l_pNotificationpersistentservicePersonalizationManager can't be NULL // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPGetReadyStatus
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
- if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // send ack to requester
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_GET_READYSTATUS_ACK, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", l_cMsgSource);
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_GET_READYSTATUS_ACK to %s, status: %d", l_cMsgSource,
- l_estatus);
- // LCOV_EXCL_STOP
- }
-
- FrameworkunifiedMcClose(l_hMq);
- l_hMq = NULL;
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // catastrophic failure!
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McOpenSender failed for %s ", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
- NC_register_multiple_immediate_notif_msg *l_pMsg = NULL;
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
-
- // get app name of message source
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- if (l_uiMsgLength <= 0) { // LCOV_EXCL_BR_LINE 6: l_uiMsgLength must be greater than 0
- // LCOV_EXCL_START 6: l_uiMsgLength must be greater than 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't register immediate persistence notification from source %s. Invalid message length.",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- } else {
- std::vector<CHAR> l_vData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &l_vData[0], static_cast<UI_32>(l_vData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- l_pMsg = reinterpret_cast<NC_register_multiple_immediate_notif_msg *>(&l_vData[0]);
-
- if (NULL != l_pMsg) { // LCOV_EXCL_BR_LINE 5: reinterpret_cast's error case.
- NC_register_immediate_notif_msg *l_pEventInfo = NULL;
- UI_32 l_uiCount;
- // register all the notifications
- for (l_uiCount = 0 ; l_uiCount < l_pMsg->numNotifications; ++l_uiCount) {
- l_pEventInfo = &l_pMsg->notifierList[l_uiCount];
-
- if (NULL != l_pEventInfo) { // LCOV_EXCL_BR_LINE 6: l_pEventInfo can't be NULL
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Register immediate persistence notification: "
- "NotificationName[%d] = %s, data length = %d ",
- l_uiCount, l_pEventInfo->notificationName, l_pEventInfo->maxLength);
-
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceServiceOnRegisterEvents(l_cMsgSource,
- l_pEventInfo->notificationName,
- l_pEventInfo->maxLength,
- l_pEventInfo->persType,
- l_pEventInfo->delay)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceServiceOnRegisterEvents :: %s", l_pEventInfo->notificationName);
- }
- } else {
- // LCOV_EXCL_START 6: l_pEventInfo can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't register immediate persistence notification from source %s. l_pEventInfo is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 5: reinterpret_cast's error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't register immediate persistence notification from source %s. Invalid src mq",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't register immediate persistence notification from source %s, "
- "Error getting message data, status: 0x%x",
- l_cMsgSource, l_estatus);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't register immediate persistence notification from source %s. "
- "l_pNotificationManager is NULL", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPClearPersistedData
-/// Deletes NPS Persistent Data and sends the ack back to requester
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
-
- // requeter MsgQ handle for sending Ack
- HANDLE hRequesterAck = NULL;
-
- // Application Handle
- HANDLE l_pHApp = NULL;
-
- // Received request data
- NC_ClearPersistedDataReq l_tMsg = {};
-
- // Ack structure
- NC_ClearPersisteDatadAck l_tMsgAck = {};
-
- // requester name
- PCSTR pRequester = NULL;
-
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- pRequester = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(pRequester);
-
- if (sizeof(NC_ClearPersistedDataReq) == FrameworkunifiedGetMsgLength(l_pHApp)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, (PVOID)(&l_tMsg), sizeof(NC_ClearPersistedDataReq), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Request for deleting the persistent data of type %d received from %s",
- l_tMsg.ePersistenceData, pRequester);
-
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
- CHKNULL(l_pPersistenceManager);
-
- l_estatus = l_pPersistenceManager->ClearPersistenceData(l_tMsg.ePersistenceData);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize Error");
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't delete persistent data. Invalid message size received.");
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- f_pSourceState = NULL;
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- // sending acknowledgement to the requester
-
- // create the requestor handle to send the ack
- hRequesterAck = FrameworkunifiedMcOpenSender(l_pHApp,
- pRequester);
-
- if (NULL != hRequesterAck) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- // set the status
- l_tMsgAck.eStatus = l_estatus;
-
- // send NC_ClearPersisteDatadAck to the requester
- if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hRequesterAck, // LCOV_EXCL_BR_LINE 4: NSFW error case
- NPS_DELETE_PERSISTED_DATA_ACK,
- sizeof(l_tMsgAck),
- &l_tMsgAck)) {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error sending NPS_GET_PERS_FILE_ACK message to %s", pRequester);
- // LCOV_EXCL_STOP
- }
-
- // close handle
- FrameworkunifiedMcClose(hRequesterAck);
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedMcOpenSender failed for %s ", pRequester);
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPSetDefaultPersistentData
-/// Sets the default value of the persistent notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
-
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL
- UI_32 l_uiMsgLength = FrameworkunifiedGetMsgLength(l_pHApp);
-
- CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
-
- // retrieve notification name
- FrameworkunifiedGetSystemInfo(l_pHApp, l_cNotificationName);
-
- if (0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: double check, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "Set default value request for Notification:: %s from :: %s", l_cNotificationName,
- l_cMsgSource);
-
- if (0 != l_uiMsgLength) {
- std::vector<CHAR> pMsgData = std::vector<CHAR>(l_uiMsgLength);
-
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &pMsgData[0], static_cast<UI_32>(pMsgData.size()), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // set the default notification data
- if (eFrameworkunifiedStatusOK != l_pNotificationManager->NotificationpersistentserviceSetDefaultPersistentNotificationData(l_cNotificationName,
- (PVOID)&pMsgData[0],
- l_uiMsgLength)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in NotificationpersistentserviceSetDefaultPersistentNotificationData :: %s", l_cNotificationName);
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Unable to set default persistent notification data for %s, "
- "Error retrieving data from message, status: 0x%x",
- l_cNotificationName, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Not setting default persistent notification data for %s, Data length received is %d",
- l_cNotificationName, l_uiMsgLength);
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_cNotificationName can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Unable to Set DefaultPersistentNotificationData from source %s, Notification name is blank",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't set default value for notification from source %s, l_pNotificationManager is NULL", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPSetNotfnPersistentType
-/// Sets the persist type of notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
-
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- CHAR l_cNotificationName[MAX_SYS_INFO_SIZE] = {};
-
- // retrieve notification name
- FrameworkunifiedGetSystemInfo(l_pHApp,
- l_cNotificationName);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
-
- if (NULL != l_pNotificationManager && 0 != std::strlen(l_cNotificationName)) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for Notification:: %s", l_cNotificationName);
-
- EFrameworkunifiedPersistCategory ePersistCategory = eFrameworkunifiedUserData;
-
- // get the received data
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(l_pHApp, &ePersistCategory, sizeof(EFrameworkunifiedPersistCategory), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // set the notification persist type
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotificationManager->NotificationpersistentserviceSetPersistentCategory(l_cNotificationName, // LCOV_EXCL_BR_LINE 6: always return ok // NOLINT[whitespace/line_length]
- ePersistCategory))) {
- // LCOV_EXCL_START 6: always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in Setting PersistentType for notification :: %s, Status: 0x%x",
- l_cNotificationName, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in getting the PersistentType message data for notification :: %s, Status: 0x%x",
- l_cNotificationName, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager can't be NULL, l_cNotificationName can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't set persist type for notification :: %s", l_cNotificationName);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPSetFilePersistentType
-/// Sets the persist type of file
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
-
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
- NC_SetFilePersistType l_tMsg = {};
-
- // get the received data
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "Set persist type request for file tag:: %s from %s", l_tMsg.cTag, l_cMsgSource);
-
- // set the file persist type
- if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
- l_tMsg.cTag,
- l_tMsg.ePersistType,
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in Setting FilePersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
- l_cMsgSource);
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "set file persistent type request for NULL file tag from source:: %s", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't process request for setting persist type for file from source: %s, l_pPersistenceManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPSetFolderPersistentType
-/// Sets the persist type of folder
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType) {
- try {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
-
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- if (NULL != l_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pPersistenceManager can't be NULL
- NC_SetFolderPersistType l_tMsg = {};
-
- // get the received data
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tMsg), sizeof(l_tMsg), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- if (0 != std::strlen(l_tMsg.cTag)) { // LCOV_EXCL_BR_LINE 6: double check, l_tMsg.cTag can't be empty
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Set persist type request for folder tag:: %s", l_tMsg.cTag);
-
- // set the file persist type
- if (eFrameworkunifiedStatusOK != l_pPersistenceManager->NotificationpersistentserviceSetPersistentCategory(l_cMsgSource,
- l_tMsg.cTag,
- l_tMsg.ePersistType,
- ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error in Setting FolderPersistentType for tag:: %s for request from:: %s", l_tMsg.cTag,
- l_cMsgSource);
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_tMsg.cTag can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "set file persistent type request for NULL folder tag from source:: %s", l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pPersistenceManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't process request for setting persist type for folder from source: %s, l_pPersistenceManager is NULL",
- l_cMsgSource);
- // LCOV_EXCL_STOP
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPShutdown
-/// Internal transition when NPP receives shutdown message
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- try {
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- NC_StopMsgData l_tStopMsgData = {};
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_tStopMsgData), sizeof(l_tStopMsgData), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // make a transition to sNotificationpersistentserviceShutdownDataSave state and pass the message data through event
- CShutDownMsgData *l_pMsgData = new(std::nothrow) CShutDownMsgData(EVENT(evNPShutdownDataSave),
- l_tStopMsgData.eShutdownType,
- l_tStopMsgData.uiStopMsgData);
- CHKNULL(l_pMsgData);
-
- CEventDataPtr l_pData(l_pMsgData);
- f_pSourceState->FrameworkunifiedPostEvent(l_pData);
-
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Shutdown Message received from %s with data: %d", l_cMsgSource,
- l_tStopMsgData.uiStopMsgData);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't process shutdown request from:: %s, Invalid message data", l_cMsgSource); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- f_pSourceState = NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnNPNorDataSaveAck
-/// Internal transition when NPP receives shutdown ack message nor worker thread
-////////////////////////////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- try {
- // data received with ack
- UI_32 l_uiPersistCategoryFlag = 0;
-
- CHKNULL(f_pSourceState);
-
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CHKNULL(l_pNotificationpersistentserviceHSM);
-
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
- CHKNULL(l_pPersistenceManager);
-
- l_pPersistenceManager->SetImmediateDataPersistedStatus(TRUE);
-
- if (eFrameworkunifiedStatusOK == FrameworkunifiedGetMsgDataOfSize(l_pHApp, static_cast<PVOID>(&l_uiPersistCategoryFlag), sizeof(l_uiPersistCategoryFlag), eSMRRelease)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "ShutdownAck received from %s with data: %d", l_cMsgSource,
- l_uiPersistCategoryFlag);
- }
-
- // depending on the flag delete the persisted data from persistent memory
- // which are not to be persisted during shutdown
- l_pnsnpp->DeletePersistedDataFolder(l_uiPersistCategoryFlag);
-
- if (TRUE == l_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: always return ok
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All release requests are processed.");
- f_pSourceState->FrameworkunifiedPostEvent(EVENT(evIdle));
- }
- } catch (std::exception &e) { // LCOV_EXCL_START 5: exception error
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- f_pSourceState = NULL;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-CsNotificationpersistentservicePersistenceReady::CsNotificationpersistentservicePersistenceReady(std::string f_strName): CFrameworkunifiedLeafState(f_strName) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
-}
-
-CsNotificationpersistentservicePersistenceReady::~CsNotificationpersistentservicePersistenceReady() { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnEntry(CEventDataPtr f_peventdata) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
-
- HANDLE l_pHApp = FrameworkunifiedGetAppHandle();
-
- if (NULL != l_pHApp) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- HANDLE l_hMq = FrameworkunifiedMcOpenSender(l_pHApp, g_csendreadyackto);
-
- if (NULL != l_hMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // send ack to requester
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedSendMsg(l_hMq, NPS_NPP_READY_EVENT, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __PRETTY_FUNCTION__, "NPP ready status sent to %s.", g_csendreadyackto);
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error sending NPS_NPP_READY_EVENT to %s, status: %d", g_csendreadyackto,
- l_estatus);
- // LCOV_EXCL_STOP
- }
- FrameworkunifiedMcClose(l_hMq);
- l_hMq = NULL;
- } else {
- // catastrophic failure!
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "McOpenSender failed for %s ", g_csendreadyackto); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return eFrameworkunifiedStatusOK;
-}
-
-EFrameworkunifiedStatus CsNotificationpersistentservicePersistenceReady::FrameworkunifiedOnExit(CEventDataPtr f_peventdata) { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return eFrameworkunifiedStatusOK;
- // LCOV_EXCL_STOP
-}
-
-#ifdef NPP_PROFILEINFO_ENABLE
-
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- try {
- CHKNULL(f_pSourceState);
-
- // get the application handle
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- // get the statemachine pointer of application
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- // get the message source name
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get the message queue handle for sending the response
- HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
- CHKNULL(hSrcMqHandle);
-
- // get instance of notification manager
- CNotificationManager *l_pNotificationManager = l_pnsnpp->m_pNotificationManager;
- CHKNULL(l_pNotificationManager);
-
- std::string l_cNotificationProfileInfo = "";
-
- // get the data from notification manager
- if (eFrameworkunifiedStatusOK == l_pNotificationManager->GetNotificationProfilingData(l_cNotificationProfileInfo)) {
- UI_32 l_uiLength = l_cNotificationProfileInfo.size();
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP Msg Length: %d", l_uiLength);
-
- PCHAR l_pData = new CHAR[l_uiLength];
- std::memset(l_pData, '0', l_uiLength);
-
- std::strncpy(l_pData, l_cNotificationProfileInfo.c_str(), l_cNotificationProfileInfo.size());
-
- if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
- NPS_PROFILE_NOTIFICATION_RESP,
- l_uiLength,
- l_pData)) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__,
- "FrameworkunifiedSendMsg NPS_PROFILE_NOTIFICATION_RESP for Notification Profiling failed.");
- }
-
- delete[] l_pData;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Failed to get Notification profiling data from NSNPP.");
- }
- } catch (std::exception &e) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- f_pSourceState = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-IMPLEMENT_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "+");
- try {
- CHKNULL(f_pSourceState);
-
- // get the application handle
- HANDLE l_pHApp = f_pSourceState->FrameworkunifiedGetAppHandle();
- CHKNULL(l_pHApp);
-
- // get the statemachine pointer of application
- CFrameworkunifiedHSM *l_pNotificationpersistentserviceHSM = FrameworkunifiedGetStateMachine(l_pHApp);
- CNSNPP *l_pnsnpp = static_cast<CNSNPP *>(l_pNotificationpersistentserviceHSM);
- CHKNULL(l_pnsnpp);
-
- // get the message source name
- PCSTR l_cMsgSource = FrameworkunifiedGetMsgSrc(l_pHApp);
- CHKNULL(l_cMsgSource);
-
- // get the message queue handle for sending the response
- HANDLE hSrcMqHandle = FrameworkunifiedMcOpenSender(l_pHApp, l_cMsgSource);
- CHKNULL(hSrcMqHandle);
-
- // get instance of persistence manager
- CPersistenceManager *l_pPersistenceManager = l_pnsnpp->m_pPersistenceManager;
-
- CHKNULL(l_pPersistenceManager);
-
- std::string l_cPersistenceProfileInfo = "";
-
- if (eFrameworkunifiedStatusOK == l_pPersistenceManager->GetPersistenceProfilingData(l_cPersistenceProfileInfo)) {
- UI_32 l_uiLength = l_cPersistenceProfileInfo.size();
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP Msg Length: %d", l_uiLength);
-
- PCHAR l_pData = new CHAR[l_uiLength];
- std::memset(l_pData, '0', l_uiLength);
-
- std::strncpy(l_pData, l_cPersistenceProfileInfo.c_str(), l_cPersistenceProfileInfo.size());
-
- if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSrcMqHandle,
- NPS_PROFILE_PERSISTENCE_RESP,
- l_uiLength,
- l_pData)) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "FrameworkunifiedSendMsg NPS_PROFILE_PERSISTENCE_RESP for Persistence Profiling failed.");
- }
-
- delete[] l_pData;
- }
- } catch (std::exception &e) {
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Exception %s", e.what());
- f_pSourceState = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __PRETTY_FUNCTION__, "-");
- return f_pSourceState;
-}
-
-#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp
deleted file mode 100755
index c1b97f9..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_application.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * @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
-///
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/frameworkunified_application.h>
-#include <native_service/frameworkunified_framework_if.h>
-#include <native_service/ns_np_service_protocol.h>
-#include <native_service/ns_np_service_notification.h>
-
-#include "app_states.h"
-#include "ns_npp.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_persistence_manager.h"
-
-using std::malloc;
-
-#ifdef NPP_PROFILEINFO_ENABLE
-#include "ns_npp_profiling_protocols_internal.h"
-#endif
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnInitialization
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE happ) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != happ) { // LCOV_EXCL_BR_LINE 4: happ can't be null
- FrameworkunifiedProtocolEvent ns_npp_protocol_handlers[] = {
- {NPS_REGISTER_EV_REQ, EVENT(evNPRegisterNotifications)},
- {NPS_PUBLISH_EV_REQ, EVENT(evNPPublishNotification)},
- {NPS_SUBSCRIBE_TO_EV_REQ, EVENT(evNPSubscribeToNotification)},
- {NPS_BATCH_SUBSCRIBE_TO_EV_REQ, EVENT(evNPSubscribeToNotifications)},
- {NPS_UNSUBSCRIBE_FROM_EV_REQ, EVENT(evNPUnSubscribeFromNotification)},
- {NPS_UNREGISTER_EV_REQ, EVENT(evNPUnRegisterNotifications)},
- {NPS_GET_PERS_DATA_REQ, EVENT(evNPReadPersistedData)},
- {NPS_SET_PERSIST_FILE_PATH_REQ, EVENT(evNPRegisterPersistentFile)},
- {NPS_RELEASE_PERS_FILE_REQ, EVENT(evNPReleasePersistentFile)},
- {NPS_GET_PERS_FILE_REQ, EVENT(evNPLoadPersistentFile)},
- {NPS_SET_PERSIST_FOLDER_PATH_REQ, EVENT(evNPRegisterPersistentFolder)},
- {NPS_GET_PERS_FOLDER_REQ, EVENT(evNPLoadPersistentFolder)},
- {NPS_RELEASE_PERS_FOLDER_REQ, EVENT(evNPReleasePersistentFolder)},
- {NPS_CHANGE_PERSONALITY_REQ, EVENT(evUserChange)},
- {NPS_NPP_STOP_REQ, EVENT(evShutdown)},
- {NPS_BATCH_UNSUBSCRIBE_FROM_EV_REQ, EVENT(evNPUnSubscribeFromNotifications)},
- {NPS_GET_READYSTATUS_REQ, EVENT(evNPGetReadyStatus)},
- {NPS_REGISTER_NOR_EV_REQ, EVENT(evNPRegisterImmediateNotifications)},
- {NPS_DELETE_PERSISTED_DATA_REQ, EVENT(evNPClearPersistedData)},
- {NPS_SET_DEFAULT_PERS_DATA, EVENT(evNPSetDefaultPersistentData)},
- {NPS_SET_NOTFN_PERSISTENT_TYPE, EVENT(evNPSetNotfnPersistentType)},
- {NPS_SET_FILE_PERSISTENT_TYPE, EVENT(evNPSetFilePersistentType)},
- {NPS_SET_FOLDER_PERSISTENT_TYPE, EVENT(evNPSetFolderPersistentType)},
- {NPS_SYNCHRONOUS_WRITE_NOTIFY_REQ, EVENT(evNPPublishImmediateNotification)},
- {NPS_NPP_SYNC_REQ, EVENT(evNPPersistentSync)}
- };
-
-#ifdef NPP_PROFILEINFO_ENABLE
-
- FrameworkunifiedProtocolEvent ns_npp_profile_protocol_handlers[] = {
- {NPS_PROFILE_NOTIFICATION_REQ, EVENT(evNPProfileNotification)},
- {NPS_PROFILE_PERSISTENCE_REQ, EVENT(evNPProfilePersistence)},
- };
-
- if (eFrameworkunifiedStatusOK == FrameworkunifiedAttachHSMEventsToDispatcher(happ,
- "NSProfileUtil",
- ns_npp_profile_protocol_handlers,
- _countof(ns_npp_profile_protocol_handlers))) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Profile info messages are attached to events");
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to attach profile info messages to events");
- }
-
-#endif
-
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedAttachHSMEventsToDispatcher(happ, FRAMEWORKUNIFIED_ANY_SOURCE, ns_npp_protocol_handlers, static_cast<UI_32>(_countof(ns_npp_protocol_handlers))))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- CNSNPP *l_pnsnpp = new(std::nothrow) CNSNPP(happ);
- if (NULL != l_pnsnpp) { // LCOV_EXCL_BR_LINE 5: new's error case.
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "l_pnsnpp object created");
-
- if (eFrameworkunifiedStatusOK == (l_estatus = l_pnsnpp->Init(happ))) { // LCOV_EXCL_BR_LINE 200: can't test
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "l_pnsnpp object initialized");
-
- if (eFrameworkunifiedStatusOK == (l_estatus = l_pnsnpp->FrameworkunifiedCreate())) { // LCOV_EXCL_BR_LINE 200: the result of l_pnsnpp->FrameworkunifiedCreate() is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- FrameworkunifiedSetStateMachine(happ, l_pnsnpp);
-
- l_pnsnpp->FrameworkunifiedStart();
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NSNPP statemachine not created, status: 0x%x", l_estatus); // LCOV_EXCL_LINE 200: the result of l_pnsnpp->FrameworkunifiedCreate() is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 200: can't test
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pnsnpp object initialization error, status: %d", l_estatus);
-
- // de-initialize the partially initialize object
- l_pnsnpp->DeInit(happ);
-
- delete l_pnsnpp;
- l_pnsnpp = NULL;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 5: malloc's error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pnsnpp object not created");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedAttachHSMEventsToDispatcher Failed Status:0x%x ", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 4: happ can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Application handle happ is NULL");
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE happ) { // LCOV_EXCL_START 14: Resident process, not called by NSFW
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnDebugDump
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE happ) { // LCOV_EXCL_START 7: debug code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
- /// << Dump internal tables!
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
- return eFrameworkunifiedStatusOK;
-}
-// LCOV_EXCL_STOP
-
-EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE happ) {
- return eFrameworkunifiedStatusOK;
-}
-
-EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE happ) {
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnStart
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE happ) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnStop
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE happ) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnPreStart
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnPreStop
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnBackgroundStart
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : FrameworkunifiedOnBackgroundStop
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "+", __FUNCTION__);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, "-", __FUNCTION__);
- return eFrameworkunifiedStatusOK;
-}
-
-extern const FrameworkunifiedDefaultCallbackHandler kDefaultCbHandler = { // NOLINT (readability/naming)
- FrameworkunifiedOnInitialization,
- FrameworkunifiedOnDestroy,
- FrameworkunifiedOnStart,
- FrameworkunifiedOnStop,
- FrameworkunifiedOnPreStart,
- FrameworkunifiedOnPreStop,
- FrameworkunifiedOnBackgroundStart,
- FrameworkunifiedOnBackgroundStop,
- FrameworkunifiedOnDebugDump,
- FrameworkunifiedCreateStateMachine,
- FrameworkunifiedSSFrameworkInterface
-}; // LCOV_EXCL_BR_LINE 10: The final line
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp
deleted file mode 100755
index fd963c5..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/notificationpersistentservice_main.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * @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
-///
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_version.h>
-#include <native_service/ns_version_if.h>
-#include <native_service/frameworkunified_dispatcher.h>
-#include <native_service/frameworkunified_framework_if.h>
-
-#include <stdlib.h>
-#include <cstdlib>
-#include <iostream>
-
-#include "ns_npp.h" // for static members. Set thread prio.
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_persistence_manager.h" // for static members. Set enable/disable persistence feature.
-
-const CHAR AppName[] = FRAMEWORKUNIFIED_NS_NPSERVICE; // NOLINT (readability/naming)
-CHAR g_csendreadyackto[MAX_QUEUE_NAME_SIZE];
-
-CFrameworkunifiedVersion g_FrameworkunifiedVersion(MAJORNO, MINORNO, REVISION); // NOLINT (readability/naming)
-
-// Argument Parser for NSNPP
-EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue);
-
-FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams = { // NOLINT (readability/naming)
- FRAMEWORKUNIFIEDLOGOPTIONS,
- {
- ZONE_TEXT_10, ZONE_TEXT_11, ZONE_TEXT_12,
- ZONE_TEXT_13, ZONE_TEXT_14, ZONE_TEXT_15,
- ZONE_TEXT_16, ZONE_TEXT_17, ZONE_TEXT_18,
- ZONE_TEXT_19, ZONE_TEXT_20, ZONE_TEXT_21,
- ZONE_TEXT_22, ZONE_TEXT_23, ZONE_TEXT_24,
- ZONE_TEXT_25, ZONE_TEXT_26, ZONE_TEXT_27,
- ZONE_TEXT_28, ZONE_TEXT_29, ZONE_TEXT_30,
- ZONE_TEXT_31,
- },
- FRAMEWORKUNIFIEDLOGZONES
-};
-
-extern const FrameworkunifiedDefaultCallbackHandler kDefaultCbHandler;
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function : main
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-int main(int argc, char *argv[]) {
- FRAMEWORKUNIFIED_SET_ZONES();
- CustomCommandLineOptions l_tcmdlineoptions = { "i:e:w:fa:v:", NULL, NPPArgumentParser};
- EFrameworkunifiedStatus l_estatus = FrameworkunifiedDispatcherWithArguments(AppName, argc, argv, &kDefaultCbHandler, &l_tcmdlineoptions);
-
- return static_cast<SI_32>(l_estatus);
-}
-
-EFrameworkunifiedStatus NPPArgumentParser(SI_32 f_iargument, PCHAR f_pargumentvalue) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- SI_32 l_iTmpArgValue = 0;
- switch (f_iargument) { // LCOV_EXCL_BR_LINE 8: cannot test
- // Disable Persistence
- case 'f': {
- CPersistenceManager::m_bPersistenceDisabled = TRUE;
- break;
- }
- case 'i': {
- l_iTmpArgValue = atoi(f_pargumentvalue);
- if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
- CNSNPP::m_siImmediatePersistenceThreadPrio = l_iTmpArgValue;
- }
- break;
- }
- case 'e': {
- l_iTmpArgValue = atoi(f_pargumentvalue);
- if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
- CNSNPP::m_siReadThreadPrio = l_iTmpArgValue;
- }
- break;
- }
- case 'w': {
- l_iTmpArgValue = atoi(f_pargumentvalue);
- if (l_iTmpArgValue > 0) { // LCOV_EXCL_BR_LINE 8: cannot test
- CNSNPP::m_siWriteThreadPrio = l_iTmpArgValue;
- }
- break;
- }
- case 'a': {
- std::memset(g_csendreadyackto, 0, MAX_QUEUE_NAME_SIZE);
- std::strncpy(g_csendreadyackto, f_pargumentvalue, (MAX_QUEUE_NAME_SIZE - 1));
- break;
- }
- case 'v': {
- l_iTmpArgValue = atoi(f_pargumentvalue);
- CNSNPP::m_siCRCCheckCount = static_cast<UI_16>(l_iTmpArgValue);
- break;
- }
-
- default:
- l_estatus = eFrameworkunifiedStatusFail;
- break;
- }
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp
deleted file mode 100755
index 25b6443..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp.cpp
+++ /dev/null
@@ -1,1149 +0,0 @@
-/*
- * @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_NS_NPPService
-/// \brief
-///
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <time.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/timeb.h>
-#include <sys/types.h>
-
-#include <native_service/frameworkunified_sm_leafstate.h>
-#include <native_service/frameworkunified_multithreading.h>
-#include <native_service/ns_np_service_protocol.h>
-
-#include <string>
-#include <vector>
-
-#include <native_service/ns_np_service_nor_persistence_internal.h>
-#include "app_states.h"
-#include "ns_npp.h"
-#include "ns_npp_types.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_threads.h"
-#include "ns_npp_copy_worker.h"
-#include "ns_npp_fs_directory.h"
-#include "ns_npp_persist_folder.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_persistence_manager.h"
-#include "ns_npp_notification_manager.h"
-#include "ns_npp_personalization_manager.h"
-#include "ns_npp_nor_persistence_worker_thread.h"
-
-#define NPP_VERSION_INVALID 255
-#define NPP_VERSION_0 0
-#define NPP_VERSION_1 1
-
-#define NPP_CONNECT_DEFAULTSTATE(parent, child) \
- FrameworkunifiedConnect(l_p## parent, l_p## child, TRUE);
-
-#define NPP_CONNECT_STATE(parent, child) \
- FrameworkunifiedConnect(l_p## parent, l_p## child);
-
-#define NPP_CONNECT_DEFERREDEVENT(state, eventid, reaction) \
- FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid, TRUE); \
-
-#define NPP_CONNECT_EVENT(state, eventid, reaction) \
- FrameworkunifiedConnect(l_p## state, _## eventid, l_pTrn## reaction, #eventid);
-
-#define NPP_CONNECTROOT(state) \
- FrameworkunifiedConnect(l_p## state);
-
-#define NPP_CONNECT_ORTHOGONAL_REGION(orthogonalstate, orthogonalregion) \
- FrameworkunifiedConnectOrthogonal(l_p## orthogonalstate, l_p## orthogonalregion);
-
-#define NPP_CREATE_STATE(class_name) \
- C## class_name *l_p## class_name = new (std::nothrow) C## class_name(#class_name);
-
-#define NPP_PRINTSTATEMACHINE() \
- FrameworkunifiedPrintAllStates();
-
-// typedef of vector of CNotificationsToPersist
-typedef std::vector<CNotificationsToPersist *> Persistent_Notification_List_Type;
-
-// iterator for CNotificationsToPersist vector
-typedef Persistent_Notification_List_Type::iterator Persistent_Notification_List_Iterator;
-
-// initialize static variables
-SI_32 CNSNPP::m_siWriteThreadPrio = NS_NPP_WRITE_THREAD_PRIO;
-SI_32 CNSNPP::m_siReadThreadPrio = NS_NPP_READ_THREAD_PRIO;
-SI_32 CNSNPP::m_siImmediatePersistenceThreadPrio = NS_NPP_IMMEDIATE_PERSIST_THREAD_PRIO;
-UI_16 CNSNPP::m_siCRCCheckCount = 0;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CNSNPP
-/// Class Constructor
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNSNPP::CNSNPP(PVOID f_happ) : CFrameworkunifiedHSM(f_happ),
- m_cReadThreadName(NS_NPP_READ_THREAD_NAME),
- m_cWriteThreadName(NS_NPP_WRITE_THREAD_NAME),
- m_cImmediatePersistenceThreadName(NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- m_hNSReadThread = NULL;
- m_hNSWriteThread = NULL;
- m_hNSImmediatePersistenceThread = NULL;
-
- m_pNotificationManager = NULL;
- m_pPersonalizationManager = NULL;
- m_pPersistenceManager = NULL;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CNSNPP
-/// Class Destructor
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNSNPP::~CNSNPP() { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pNotificationManager) {
- delete m_pNotificationManager;
- m_pNotificationManager = NULL;
- }
-
- if (NULL != m_pPersonalizationManager) {
- delete m_pPersonalizationManager;
- m_pPersonalizationManager = NULL;
- }
- if (NULL != m_pPersistenceManager) {
- delete m_pPersistenceManager;
- m_pPersistenceManager = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Init
-/// This function is used to allocate dynamic memory for member variables of this class after
-/// creation of object.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::Init(HANDLE f_happ) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FrameworkunifiedProtocolEvent ns_npp_internal_protocol_handlers[] = {
- {CP_WRK_NTFY, EVENT(evNPReleaseLoadAck)}
- };
-
- FrameworkunifiedProtocolEvent immediate_thread_protocol_handlers[] = {
- {NOR_PERSISTENCE_ONSHUTDOWN_ACK, EVENT(evNPNorShutdownAck)},
- };
-
- UI_32 l_uiNPPVersion = NPP_VERSION_INVALID;
-
- // initialize Notification Manager
- m_pNotificationManager = new(std::nothrow) CNotificationManager();
- // initialize Personalization Manager
- m_pPersonalizationManager = new(std::nothrow) CnotificationpersistentservicePersonalizationManager();
- // initialize Persistence Manager
- m_pPersistenceManager = new(std::nothrow) CPersistenceManager();
-
- if ((NULL == f_happ) || (NULL == m_pNotificationManager) || (NULL == m_pPersonalizationManager) || (NULL == m_pPersistenceManager)) { // LCOV_EXCL_BR_LINE 5: f_happ, m_pNotificationManager, m_pPersonalizationManager, m_pPersistenceManager can't be NULL // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 5: f_happ, m_pNotificationManager, m_pPersonalizationManager, m_pPersistenceManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "f_happ or m_pNotificationManager or m_pPersonalizationManager or m_pPersistenceManager is NULL");
-
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- } else {
- if ((eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbackToDispatcher( // LCOV_EXCL_BR_LINE 4: NSFW error case
- f_happ, m_cReadThreadName.c_str(),
- CP_WRK_ACK_CMD_COMPLETE,
- NPServiceOnCpWorkerAckCmd))
- || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachCallbackToDispatcher(
- f_happ, m_cWriteThreadName.c_str(),
- CP_WRK_ACK_CMD_COMPLETE,
- NPServiceOnCpWorkerAckCmd))
- || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
- f_happ, m_cWriteThreadName.c_str(),
- ns_npp_internal_protocol_handlers,
- static_cast<UI_32>(_countof(ns_npp_internal_protocol_handlers))))
- || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
- f_happ, m_cReadThreadName.c_str(),
- ns_npp_internal_protocol_handlers,
- static_cast<UI_32>(_countof(ns_npp_internal_protocol_handlers))))
- || (eFrameworkunifiedStatusOK != FrameworkunifiedAttachHSMEventsToDispatcher(
- f_happ, m_cImmediatePersistenceThreadName.c_str(),
- immediate_thread_protocol_handlers,
- static_cast<UI_32>(_countof(immediate_thread_protocol_handlers))))) {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Attaching callbacks and events failed for protocols CP_WRK_ACK_CMD_COMPLETE, CP_WRK_NTFY");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- l_estatus = CreateAndStartChildThreads(f_happ);
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- if (NPP_VERSION_INVALID != (l_uiNPPVersion = GetNSNPPVersion())) { // LCOV_EXCL_BR_LINE 6: l_uiNPPVersion can't be NPP_VERSION_INVALID // NOLINT[whitespace/line_length]
- if (NPP_VERSION_0 == l_uiNPPVersion) {
- l_estatus = SwitchToFileStructureVersion1(l_uiNPPVersion + 1);
-
- l_estatus = SwitchToFileStructureVersion2(l_uiNPPVersion + 2);
- } else if (NPP_VERSION_1 == l_uiNPPVersion) { // LCOV_EXCL_BR_LINE 200: cannot test code in init sequence
- // LCOV_EXCL_START 200: cannot test code in init sequence
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = SwitchToFileStructureVersion2(l_uiNPPVersion + 1);
-
- // send the message to write worker thread to delete the persistent
- /// which was requested for deletion during previous shutdown
- l_estatus = FrameworkunifiedSendChild(f_happ, m_hNSWriteThread, CMD_DELETE_OLD_DATA, 0, NULL);
- // LCOV_EXCL_STOP
- } else {
- // send the message to write worker thread to delete the persistent
- /// which was requested for deletion during previous shutdown
- l_estatus = FrameworkunifiedSendChild(f_happ, m_hNSWriteThread, CMD_DELETE_OLD_DATA, 0, NULL);
- }
-
- // Try to load persisted notification data
- NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedPersistedStateVar);
-
- // load immediate persistence data as the respective thread is now started.
- NotificationpersistentserviceLoadPersistentNotificationData(eFrameworkunifiedImmediatePersistedStateVar);
- } else {
- // LCOV_EXCL_START 6: l_uiNPPVersion can't be NPP_VERSION_INVALID
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid version of NPPService");
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in creating child threads of NPPService"); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// DeInit
-/// This function is used to deinitialize the NPP object
-////////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CNSNPP::DeInit(HANDLE f_happ) { // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pNotificationManager) {
- delete m_pNotificationManager;
- m_pNotificationManager = NULL;
- }
-
- if (NULL != m_pPersonalizationManager) {
- delete m_pPersonalizationManager;
- m_pPersonalizationManager = NULL;
- }
-
- if (NULL != m_pPersistenceManager) {
- delete m_pPersistenceManager;
- m_pPersistenceManager = NULL;
- }
-
- if (NULL != f_happ) {
- EFrameworkunifiedStatus eStatus;
-
- if (NULL != m_hNSReadThread) {
- if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSReadThread, 0, NULL))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Read Thread Failed. status=%d", eStatus);
- }
- if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSReadThread))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread Read Thread Failed. status=%d", eStatus);
- }
- m_hNSReadThread = NULL;
- }
-
- if (NULL != m_hNSWriteThread) {
- if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSWriteThread, 0, NULL))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread Write Thread Failed. status=%d", eStatus);
- }
- if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSWriteThread))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread Write Thread Failed. status=%d", eStatus);
- }
- m_hNSWriteThread = NULL;
- }
-
- if (NULL != m_hNSImmediatePersistenceThread) {
- if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedStopChildThread(f_happ, m_hNSImmediatePersistenceThread, 0, NULL))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedStopChildThread ImmidatePersistence Thread Failed. status=%d", eStatus);
- }
- if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroyChildThread(f_happ, m_hNSImmediatePersistenceThread))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedDestroyChildThread ImmidatePersistence Thread Failed. status=%d", eStatus);
- }
- m_hNSImmediatePersistenceThread = NULL;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SwitchToFileStructureVersion1
-/// Copy all the user data from old persistent path to new persistent path i.e. UserData folder
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::SwitchToFileStructureVersion1(const UI_32 f_uinppversion) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- std::string l_cSrcPath = "";
- std::string l_cDestPath = "";
-
- std::string l_cNSNPSPath = CPersistence::GetStoragePath();
- std::string l_cUserDataPath = "";
-
- if (CFSDirectory::DoesDirecotryExist(l_cNSNPSPath)) { // LCOV_EXCL_BR_LINE 6: l_cNSNPSPath must exist
- DIR *l_pdir = NULL;
-
- struct dirent *l_pdirent = NULL;
-
- l_pdir = opendir(l_cNSNPSPath.c_str());
-
- if (NULL != l_pdir) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- if (l_cNSNPSPath[l_cNSNPSPath.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: l_cNSNPSPath must has '/'
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_cNSNPSPath.append("/"); // LCOV_EXCL_LINE 6: l_cNSNPSPath must has '/'
- }
-
- // set the userdata folder path
- l_cUserDataPath.assign(l_cNSNPSPath);
- l_cUserDataPath.append(USERDATADIR);
- l_cUserDataPath.append(ALLUSERAPPDATADIR);
-
- // create the userdata directory
- if (!CFSDirectory::DoesDirecotryExist(l_cUserDataPath)) {
- l_estatus = CFSDirectory::CreateDirectory(l_cUserDataPath);
- }
-
- // if directory successfully created or is already present on target
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus must be eFrameworkunifiedStatusOK
- while (NULL != (l_pdirent = readdir(l_pdir))) {
- if (0 != std::strcmp(l_pdirent->d_name, ".") &&
- 0 != std::strcmp(l_pdirent->d_name, "..") &&
- 0 != std::strcmp(l_pdirent->d_name, AppName) &&
- 0 != std::strcmp(l_pdirent->d_name, USERDATA)) {
- l_cSrcPath.assign(l_cNSNPSPath.c_str());
- l_cSrcPath.append(l_pdirent->d_name);
-
- if (CFSDirectory::IsDirectory(l_cSrcPath)) { // LCOV_EXCL_BR_LINE 6: cannot test in init sequence
- l_cDestPath.assign(l_cUserDataPath);
- l_cDestPath.append(l_pdirent->d_name);
-
- // move the old app user data to the UserData fodler
- if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: rename must return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error renaming folder %s to %s",
- l_cSrcPath.c_str(), l_cDestPath.c_str());
- // LCOV_EXCL_STOP
- }
- }
- }
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to create directory:: %s", l_cDestPath.c_str()); // LCOV_EXCL_LINE 6: l_estatus must be eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- }
-
- closedir(l_pdir); // close the directory
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pdir is NULL");
- // LCOV_EXCL_STOP
- }
- }
-
- l_estatus = SetNSNPPVersion(static_cast<UI_8>(f_uinppversion));
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SwitchToFileStructureVersion2
-/// Move immediate notification data files from IMMEDIATE_PERSISTENCE_STORAGE_V1 to
-/// IMMEDIATE_PERSISTENCE_STORAGE_V2/AllUserAppData/UserData
-//// ////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::SwitchToFileStructureVersion2(const UI_32 f_uinppversion) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // immediate notification persistent path for NPPService version 1
- std::string l_cSrcDir = IMMEDIATE_PERSISTENCE_STORAGE_V1;
-
- // immediate notification persistent path for NPPService version 2
- std::string l_cDestDir = IMMEDIATE_PERSISTENCE_STORAGE_V2;
- l_cDestDir.append(USERDATADIR);
- l_cDestDir.append(ALLUSERAPPDATADIR);
- l_cDestDir.append(IMMEDIATEDATADIR);
-
- if (eFrameworkunifiedStatusOK == (l_estatus = SynchronousMovePersistentData(l_cSrcDir.c_str(), l_cDestDir.c_str()))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- if (!CFSDirectory::RemoveDirectory(l_cSrcDir)) { // LCOV_EXCL_BR_LINE 6: cannot test in init sequence
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error deleting old immediate pers. dir %s", l_cSrcDir.c_str());
- }
-
- l_estatus = SetNSNPPVersion(static_cast<UI_8>(f_uinppversion));
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SynchronousMovePersistentData faiure, status=%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-/// GetNSNPPVersion
-/// Get the version of NSNPP from version.txt
-///////////////////////////////////////////////////////////////////////////////////////////
-UI_32 CNSNPP::GetNSNPPVersion() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- UI_32 l_uiVersion = NPP_VERSION_INVALID;
- CHAR l_cVerStr[3] = {};
- FILE *l_pFile = NULL;
-
- std::string l_cVersion = CPersistence::GetStoragePath();
- if (l_cVersion[l_cVersion.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: must has '/'
- l_cVersion += "/";
- }
- l_cVersion.append(VERSION_TXT);
-
- if (NULL != (l_pFile = fopen(l_cVersion.c_str(), "r"))) {
- // read the version from file
- if (NULL == fgets(l_cVerStr, 2, l_pFile)) { // LCOV_EXCL_BR_LINE 6: can't return NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File empty: %s", l_cVersion.c_str()); // LCOV_EXCL_LINE 6: can't return NULL
- } else {
- errno = EOK;
- l_uiVersion = static_cast<UI_32>(strtol(l_cVerStr, NULL, 10));
-
- if (EOK != errno) { // LCOV_EXCL_BR_LINE 6: errno always is EOK
- // LCOV_EXCL_START 6: errno always is EOK
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Error converting string %s to hex, errno=%d", l_cVerStr, errno);
- l_uiVersion = NPP_VERSION_0;
- // LCOV_EXCL_STOP
- }
- }
-
- fclose(l_pFile);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s, errno=%d", l_cVersion.c_str(), errno);
- l_uiVersion = NPP_VERSION_0;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_uiVersion;
-}
-///////////////////////////////////////////////////////////////////////////////////////////
-/// Syncfs
-/// Syncfs is carried out.
-///
-/// \param
-///
-/// \return EFrameworkunifiedStatus
-/// EFrameworkunifiedStatus - Returns status of operation
-///
-///////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::Syncfs() {
- int dfd;
-
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- std::string l_cPath = CPersistence::GetStoragePath();
-
- // create the file
- dfd = open(l_cPath.c_str(), O_RDONLY | O_DIRECTORY);
- if (-1 != dfd) {
- // syncfs()
- if (syncfs(dfd) < 0) { // LCOV_EXCL_BR_LINE 5: syncfs's error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to syncfs: %s errno=%d", l_cPath.c_str(), errno); // LCOV_EXCL_LINE 5: syncfs's error case. // NOLINT[whitespace/line_length]
- }
- close(dfd);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s serrno=%d", l_cPath.c_str(), errno);
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-///////////////////////////////////////////////////////////////////////////////////////////
-/// SetNSNPPVersion
-/// Set the version of NSNPP in version.txt
-///////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::SetNSNPPVersion(UI_8 f_uiversion) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FILE *l_pFile = NULL;
-
- std::string l_cVersion = CPersistence::GetStoragePath();
- if (l_cVersion[l_cVersion.length() - 1] != '/') { // LCOV_EXCL_BR_LINE 6: must has '/'
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_cVersion += "/"; // LCOV_EXCL_LINE 6: must has '/'
- }
- if (!CFSDirectory::DoesDirecotryExist(l_cVersion)) {
- CFSDirectory::CreateDirectory(l_cVersion);
- }
-
- l_cVersion.append(VERSION_TXT);
-
- // create the file and write
- l_pFile = fopen(l_cVersion.c_str(), "w");
- if (NULL != l_pFile) { // LCOV_EXCL_BR_LINE 6: l_pFile can't be NULL
- // write the version to file
- fprintf(l_pFile, "%d", f_uiversion);
- fclose(l_pFile);
- } else {
- // LCOV_EXCL_START 6: l_pFile can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file: %s", l_cVersion.c_str());
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// FrameworkunifiedCreate
-/// In this function, states and events of StateMachine are created and connected.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::FrameworkunifiedCreate(PVOID f_peventdata) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // ========Create states
- NPP_CREATE_STATE(sNotificationpersistentserviceNPPRoot)
- NPP_CREATE_STATE(sNotificationpersistentserviceNPPStart)
- NPP_CREATE_STATE(sNotificationpersistentserviceNPPError)
-
- CREATE_ORTHOGONALREGION(sNotificationpersistentservicePersistence)
- CREATE_ORTHOGONALREGION(sNotificationpersistentserviceShutdown)
- CREATE_ORTHOGONALREGION(sNotificationpersistentserviceNotification)
-
- NPP_CREATE_STATE(sNotificationpersistentservicePersistenceReady)
- NPP_CREATE_STATE(sNotificationpersistentservicePersistenceError)
-
- NPP_CREATE_STATE(sNotificationpersistentserviceNotificationReady)
- NPP_CREATE_STATE(sNotificationpersistentserviceNotificationError)
-
- NPP_CREATE_STATE(sNotificationpersistentserviceShutdownIdle)
- NPP_CREATE_STATE(sNotificationpersistentserviceShutdownDataSave)
-
- // ========Connect states
- NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPStart)
- NPP_CONNECT_STATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPStart)
- NPP_CONNECT_STATE(sNotificationpersistentserviceNPPRoot, sNotificationpersistentserviceNPPError)
-
- NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentservicePersistence)
- NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentserviceShutdown)
- NPP_CONNECT_ORTHOGONAL_REGION(sNotificationpersistentserviceNPPStart, sNotificationpersistentserviceNotification)
-
- NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentservicePersistence, sNotificationpersistentservicePersistenceReady)
- NPP_CONNECT_STATE(sNotificationpersistentservicePersistence, sNotificationpersistentservicePersistenceError)
-
- NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceShutdown, sNotificationpersistentserviceShutdownIdle)
- NPP_CONNECT_STATE(sNotificationpersistentserviceShutdown, sNotificationpersistentserviceShutdownDataSave)
-
- NPP_CONNECT_DEFAULTSTATE(sNotificationpersistentserviceNotification, sNotificationpersistentserviceNotificationReady)
- NPP_CONNECT_STATE(sNotificationpersistentserviceNotification, sNotificationpersistentserviceNotificationError)
-
- // ========Create external transitions
- CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNPPStart)
- CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNPPError)
- CREATE_EXTERNALTRANSITION(sNotificationpersistentservicePersistenceReady)
- CREATE_EXTERNALTRANSITION(sNotificationpersistentservicePersistenceError)
- CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceShutdownIdle)
- CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceShutdownDataSave)
- CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNotificationReady)
- CREATE_EXTERNALTRANSITION(sNotificationpersistentserviceNotificationError)
-
- // ========Create internal transitions
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReadPersistedData)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPReleaseFileAck)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnUserChange)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPNorDataSaveAck)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFile)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFile)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFile)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnRegisterPersistentFolder)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnLoadPersistentFolder)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnReleasePersistentFolder)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFilePersistentType)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetFolderPersistentType)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPersistentSync)
-
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPShutdown)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnShutdownTimeout)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
-
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishNotification)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterNotifications)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotification)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSubscribeToNotifications)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnRegisterNotifications)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotification)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPGetReadyStatus)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPRegisterImmediateNotifications)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPClearPersistedData)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetDefaultPersistentData)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPSetNotfnPersistentType)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPPublishImmediateNotification)
-
-#ifdef NPP_PROFILEINFO_ENABLE
-
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfileNotifications)
- CREATE_INTERNALTRANSITION(NotificationpersistentserviceOnNPProfilePersistence)
-
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPProfileNotification, NotificationpersistentserviceOnNPProfileNotifications)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPProfilePersistence, NotificationpersistentserviceOnNPProfilePersistence)
-
-#endif
-
- // ========Connect events
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPRoot, evNPClearPersistedData, NotificationpersistentserviceOnNPClearPersistedData)
-
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPStart, evError, sNotificationpersistentserviceNPPError)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNPPError, evReady, sNotificationpersistentserviceNPPStart)
-
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evError, sNotificationpersistentservicePersistenceError)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceError, evReady, sNotificationpersistentservicePersistenceReady)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReadPersistedData, NotificationpersistentserviceOnNPReadPersistedData)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleaseLoadAck, NotificationpersistentserviceOnNPReleaseFileAck)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPRegisterPersistentFile, NotificationpersistentserviceOnRegisterPersistentFile)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleasePersistentFile, NotificationpersistentserviceOnReleasePersistentFile)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPLoadPersistentFile, NotificationpersistentserviceOnLoadPersistentFile)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPRegisterPersistentFolder, NotificationpersistentserviceOnRegisterPersistentFolder)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPLoadPersistentFolder, NotificationpersistentserviceOnLoadPersistentFolder)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPReleasePersistentFolder, NotificationpersistentserviceOnReleasePersistentFolder)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPGetReadyStatus, NotificationpersistentserviceOnNPGetReadyStatus)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPSetFilePersistentType, NotificationpersistentserviceOnNPSetFilePersistentType)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPSetFolderPersistentType, NotificationpersistentserviceOnNPSetFolderPersistentType)
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evNPPersistentSync, NotificationpersistentserviceOnNPPersistentSync)
-
- NPP_CONNECT_EVENT(sNotificationpersistentservicePersistenceReady, evUserChange, NotificationpersistentserviceOnUserChange)
-
- NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownIdle, evShutdown, NotificationpersistentserviceOnNPShutdown)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownIdle, evNPShutdownDataSave, sNotificationpersistentserviceShutdownDataSave)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evIdle, sNotificationpersistentserviceShutdownIdle)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evShutdownTimeout, NotificationpersistentserviceOnShutdownTimeout)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evCheckAllFilesPersisted, NotificationpersistentserviceCheckAllReleaseRequestsProcessed)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceShutdownDataSave, evNPNorShutdownAck, NotificationpersistentserviceOnNPNorDataSaveAck)
-
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evError, sNotificationpersistentserviceNotificationError)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationError, evReady, sNotificationpersistentserviceNotificationReady)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPPublishNotification, NotificationpersistentserviceOnNPPublishNotification)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPRegisterNotifications, NotificationpersistentserviceOnNPRegisterNotifications)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSubscribeToNotification, NotificationpersistentserviceOnNPSubscribeToNotification)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSubscribeToNotifications, NotificationpersistentserviceOnNPSubscribeToNotifications)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnRegisterNotifications, NotificationpersistentserviceOnNPUnRegisterNotifications)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnSubscribeFromNotification, NotificationpersistentserviceOnNPUnSubscribeFromNotification)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPUnSubscribeFromNotifications, NotificationpersistentserviceOnNPUnSubscribeFromNotifications)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPRegisterImmediateNotifications, NotificationpersistentserviceOnNPRegisterImmediateNotifications)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSetDefaultPersistentData, NotificationpersistentserviceOnNPSetDefaultPersistentData)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPSetNotfnPersistentType, NotificationpersistentserviceOnNPSetNotfnPersistentType)
- NPP_CONNECT_EVENT(sNotificationpersistentserviceNotificationReady, evNPPublishImmediateNotification, NotificationpersistentserviceOnNPPublishImmediateNotification)
-
- NPP_CONNECTROOT(sNotificationpersistentserviceNPPRoot)
-
- NPP_PRINTSTATEMACHINE() // NOLINT (whitespace/empty_if_body)
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentservicePersistAll
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::NotificationpersistentservicePersistAll(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (eFrameworkunifiedQuickShutdown == f_eshutdowntype) {
- if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
- // set all file persisted status as TRUE
- m_pPersistenceManager->SetFilePersistedStatus(TRUE);
-
- // send request to immediate persistence thread to stop all the immediate notification timer
- m_pPersistenceManager->PersistNORData(f_eshutdowntype, f_uinotificationpersistentservicepersistcategoryflag);
- }
- } else {
- if (eFrameworkunifiedNormalShutdown == f_eshutdowntype) {
- f_uinotificationpersistentservicepersistcategoryflag = 0x0;
- }
-
- // save global notification data of persisted state notification
- if (eFrameworkunifiedStatusOK != NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateVar, f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while saving notification persistent data.");
- // LCOV_EXCL_STOP
- }
-
- // save user notification data for the current user
- if (eFrameworkunifiedStatusOK != NotificationpersistentserviceSaveNotificationPersistentData(eFrameworkunifiedPersistedStateUserVar, f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: NotificationpersistentserviceSaveNotificationPersistentData will always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while saving user notification persistent data.");
- // LCOV_EXCL_STOP
- }
-
- // NOR data is saved immediately,
- // but during shutdown it can be possible that because of delay in consecutive save to NOR
- // the latest data may not get persisted. So if we get shutdown we will need to persist the data immediately.
- if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
- m_pPersistenceManager->PersistNORData(f_eshutdowntype, f_uinotificationpersistentservicepersistcategoryflag);
- }
-
- // delete all persistent files and folders for all applications
- if ((eFrameworkunifiedUserData | eFrameworkunifiedFactoryData | eFrameworkunifiedFactoryCustomerData | eFrameworkunifiedDealerData) == f_uinotificationpersistentservicepersistcategoryflag) {
- if (NULL != m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
- m_pPersistenceManager->SetFilePersistedStatus(TRUE);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: m_pPersistenceManager can't be NULL
- }
- } else {
- // writes the temporary global and user files to permanent memory
- if (m_pPersistenceManager) { // LCOV_EXCL_BR_LINE 6: m_pPersistenceManager can't be NULL
- if (eFrameworkunifiedStatusOK == m_pPersistenceManager->PersistAllReleaseRequests(f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 6: PersistAllReleaseRequests will always return ok // NOLINT[whitespace/line_length]
- // this is needed to check in case when there are no file to persist
- if (TRUE == m_pPersistenceManager->HaveAllReleaseRequestsPersisted()) { // LCOV_EXCL_BR_LINE 6: HaveAllReleaseRequestsPersisted will always return ok // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: HaveAllReleaseRequestsPersisted will always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All file release requests processed");
- m_pPersistenceManager->SetFilePersistedStatus(TRUE);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: PersistAllReleaseRequests will always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while persisting temporary files.");
- // LCOV_EXCL_STOP
- }
- }
- }
- }
-
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// DeletePersistedDataFolder
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::DeletePersistedDataFolder(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- struct timeb timebuf;
- struct tm *theTime;
-
- ftime(&timebuf);
- theTime = gmtime(&timebuf.time); // NOLINT (runtime/threadsafe_fn)
-
- // get the current date and time to append to the folder name
- PCHAR l_cDateTime = new CHAR[MAX_STRING_SIZE_TAG];
- snprintf(l_cDateTime, MAX_STRING_SIZE_TAG, "_%02d%02d%02d_%02d%02d%02d", theTime->tm_mon + 1, theTime->tm_mday,
- theTime->tm_year + 1900, theTime->tm_hour, theTime->tm_min, theTime->tm_sec);
-
- std::string l_cBasePath = CPersistence::GetStoragePath();
- std::string l_cSrcPath = "";
- std::string l_cDestPath = "";
-
- if (eFrameworkunifiedUserData == (eFrameworkunifiedUserData & f_uinotificationpersistentservicepersistcategoryflag)) {
- l_cSrcPath.assign(l_cBasePath);
- l_cSrcPath.append(USERDATA);
-
- if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
- l_cDestPath.assign(l_cSrcPath);
- l_cDestPath.append(l_cDateTime);
-
- // instead of deleting the data, rename the persistence folder before shutdown
- if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
- // LCOV_EXCL_START 6: rename must return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error renaming folder %s to %s, errno = %d",
- l_cSrcPath.c_str(),
- l_cDestPath.c_str(),
- errno);
- // LCOV_EXCL_STOP
- }
- }
- }
- if (eFrameworkunifiedFactoryData == (eFrameworkunifiedFactoryData & f_uinotificationpersistentservicepersistcategoryflag)) {
- l_cSrcPath.assign(l_cBasePath);
- l_cSrcPath.append(FACTORYDATA);
-
- if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
- l_cDestPath.assign(l_cSrcPath);
- l_cDestPath.append(l_cDateTime);
-
- // instead of deleting the data, rename the persistence folder before shutdown
- if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
- // LCOV_EXCL_START 6: rename must return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error renaming folder %s to %s, errno = %d",
- l_cSrcPath.c_str(),
- l_cDestPath.c_str(),
- errno);
- // LCOV_EXCL_STOP
- }
- }
- }
- if (eFrameworkunifiedFactoryCustomerData == (eFrameworkunifiedFactoryCustomerData & f_uinotificationpersistentservicepersistcategoryflag)) {
- l_cSrcPath.assign(l_cBasePath);
- l_cSrcPath.append(FACTORYCUSTOMERDATA);
-
- if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
- l_cDestPath.assign(l_cSrcPath);
- l_cDestPath.append(l_cDateTime);
-
- // instead of deleting the data, rename the persistence folder before shutdown
- if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
- // LCOV_EXCL_START 6: rename must return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error renaming folder %s to %s, errno = %d",
- l_cSrcPath.c_str(),
- l_cDestPath.c_str(),
- errno);
- // LCOV_EXCL_STOP
- }
- }
- }
- if (eFrameworkunifiedDealerData == (eFrameworkunifiedDealerData & f_uinotificationpersistentservicepersistcategoryflag)) {
- l_cSrcPath.assign(l_cBasePath);
- l_cSrcPath.append(DEALERDATA);
-
- if (CFSDirectory::DoesDirecotryExist(l_cSrcPath)) {
- l_cDestPath.assign(l_cSrcPath);
- l_cDestPath.append(l_cDateTime);
-
- // instead of deleting the data, rename the persistence folder before shutdown
- if (0 != rename(l_cSrcPath.c_str(), l_cDestPath.c_str())) { // LCOV_EXCL_BR_LINE 6: rename must return ok
- // LCOV_EXCL_START 6: rename must return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error renaming folder %s to %s, errno = %d",
- l_cSrcPath.c_str(),
- l_cDestPath.c_str(),
- errno);
- // LCOV_EXCL_STOP
- }
- }
- }
-
- if (NULL != l_cDateTime) { // LCOV_EXCL_BR_LINE 6: l_cDateTime can't be NULL
- delete[] l_cDateTime;
- l_cDateTime = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSaveNotificationPersistentData
-/// In this function, all the data related to persistent notification is retrieved from
-/// notification manager and stored in persistent file by persistent manager.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::NotificationpersistentserviceSaveNotificationPersistentData(EFrameworkunifiedNotificationType f_epersistenttype,
- UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // pointer of Notification Manager
- CNotificationManager *l_pNotificationManager = NULL;
-
- // pointer of Persistence Manager
- CPersistenceManager *l_pCNotificationpersistentservicePersistenceManager = NULL;
-
- Persistent_Notification_List_Type *l_vPersistentNotificationList = NULL;
-
- // get the instance of notification manager
- l_pNotificationManager = m_pNotificationManager;
-
- // get the instance of persistence manager
- l_pCNotificationpersistentservicePersistenceManager = m_pPersistenceManager;
-
- if (NULL != l_pNotificationManager && NULL != l_pCNotificationpersistentservicePersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager and l_pCNotificationpersistentservicePersistenceManager can't be NULL // NOLINT[whitespace/line_length]
- // create new vector to retrieve persistent notification data
- l_vPersistentNotificationList = new(std::nothrow) Persistent_Notification_List_Type();
-
- if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
- // get all the persistent notification data in vector from notification manager
- l_pNotificationManager->NotificationpersistentserviceGetPersistentNotificationData(l_vPersistentNotificationList,
- f_epersistenttype,
- f_uinotificationpersistentservicepersistcategoryflag);
- } else {
- // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_vPersistentNotificationList is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
- if (eFrameworkunifiedPersistedStateVar == f_epersistenttype) {
- // save persistent notification data from vector to file
- l_estatus = l_pCNotificationpersistentservicePersistenceManager->NotificationpersistentserviceSaveNotificationData(l_vPersistentNotificationList);
- } else if (eFrameworkunifiedPersistedStateUserVar == f_epersistenttype) { // LCOV_EXCL_BR_LINE 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar // NOLINT[whitespace/line_length]
- l_estatus = l_pCNotificationpersistentservicePersistenceManager->NotificationpersistentserviceSaveUserNotificationData(l_vPersistentNotificationList);
- } else {
- // LCOV_EXCL_START 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Save data for %d PersistentVarType not supported", f_epersistenttype);
- // LCOV_EXCL_STOP
- }
-
-
- // delete the locally created vector
- if (!l_vPersistentNotificationList->empty()) {
- for (UI_32 l_uiCount = 0;
- l_uiCount < l_vPersistentNotificationList->size();
- l_uiCount++) {
- if (NULL != l_vPersistentNotificationList->at(l_uiCount)) { // LCOV_EXCL_BR_LINE 6: can't be NULL
- delete l_vPersistentNotificationList->at(l_uiCount);
- }
- }
-
- // clear the vector
- l_vPersistentNotificationList->clear();
- }
-
- delete l_vPersistentNotificationList;
- l_vPersistentNotificationList = NULL;
- } else {
- // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_vPersistentNotificationList is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager and l_pCNotificationpersistentservicePersistenceManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceOnLoadPersistentData
-/// In this transition, persistent file is loaded by persistent manager and
-/// persistent notifications and its data is stored by notification manager.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::NotificationpersistentserviceLoadPersistentNotificationData(EFrameworkunifiedNotificationType f_epersistenttype) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // pointer of Notification Manager
- CNotificationManager *l_pNotificationManager = NULL;
-
- // pointer of Persistence Manager
- CPersistenceManager *l_pNotificationpersistentservicePersistenceManager = NULL;
-
- // iterator of CNotificationToPersist vector
- Persistent_Notification_List_Type *l_vPersistentNotificationList = NULL;
-
- // get the instance of notification manager
- l_pNotificationManager = m_pNotificationManager;
-
- // get the instance of persistent manager
- l_pNotificationpersistentservicePersistenceManager = m_pPersistenceManager;
-
- // create new vector for persistent notifications
- l_vPersistentNotificationList = new(std::nothrow) Persistent_Notification_List_Type();
-
- if (NULL != l_vPersistentNotificationList) { // LCOV_EXCL_BR_LINE 5: l_vPersistentNotificationList can't be NULL
- if (NULL != l_pNotificationManager && NULL != l_pNotificationpersistentservicePersistenceManager) { // LCOV_EXCL_BR_LINE 6: l_pNotificationManager and l_pNotificationpersistentservicePersistenceManager can't be NULL // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedPersistedStateVar == f_epersistenttype) {
- // read persistent notification data from file and store in vector
- l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadNotificationData(l_vPersistentNotificationList);
- } else if (eFrameworkunifiedPersistedStateUserVar == f_epersistenttype) {
- l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadUserNotificationData(l_vPersistentNotificationList);
- } else if (eFrameworkunifiedImmediatePersistedStateVar == f_epersistenttype) { // LCOV_EXCL_BR_LINE 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
- l_estatus = l_pNotificationpersistentservicePersistenceManager->NotificationpersistentserviceReadNorNotificationData(l_vPersistentNotificationList);
- } else {
- // LCOV_EXCL_START 200: f_epersistenttype must be eFrameworkunifiedPersistedStateVar or eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Read data for %d PersistentVarType not supported", f_epersistenttype);
- // LCOV_EXCL_STOP
- }
-
- if (0 < l_vPersistentNotificationList->size()) {
- // send the notification list to notification manager
- l_estatus = l_pNotificationManager->NotificationpersistentserviceSetPersistentNotificationData(l_vPersistentNotificationList);
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationManager and l_pNotificationpersistentservicePersistenceManager can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationManager or l_pNotificationpersistentservicePersistenceManager is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- if (!l_vPersistentNotificationList->empty()) {
- for (UI_32 l_uiCount = 0;
- l_uiCount < l_vPersistentNotificationList->size();
- l_uiCount++) {
- if (NULL != l_vPersistentNotificationList->at(l_uiCount)) { // LCOV_EXCL_BR_LINE 6: can't be NULL
- delete l_vPersistentNotificationList->at(l_uiCount);
- }
- }
-
- // clear the vector
- l_vPersistentNotificationList->clear();
- }
-
- delete l_vPersistentNotificationList;
- l_vPersistentNotificationList = NULL;
- } else {
- // LCOV_EXCL_START 5: l_vPersistentNotificationList can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for l_vPersistentNotificationList");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CreateAndStartChildThreads
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNSNPP::CreateAndStartChildThreads(HANDLE f_happ) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (NULL == f_happ) { // LCOV_EXCL_BR_LINE 6: f_happ can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_happ can't be NULL
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
- // create reader thread
- if (NULL != (m_hNSReadThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cReadThreadName.c_str(), NSPCopyWorkerOnStart, NSPCopyWorkerOnStop, CNSNPP::m_siReadThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Thread %s created, Prio=%d",
- m_cReadThreadName.c_str(),
- CNSNPP::m_siReadThreadPrio);
-
- // start the reader thread
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSReadThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- m_pPersistenceManager->SetReadThreadHandle(m_hNSReadThread);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start Read Worker thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP Read Worker thread");
- // LCOV_EXCL_STOP
- }
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
- // create writer thread
- if (NULL != (m_hNSWriteThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cWriteThreadName.c_str(), NSPCopyWorkerOnStart, NSPCopyWorkerOnStop, CNSNPP::m_siWriteThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Thread %s created, Prio=%d",
- m_cWriteThreadName.c_str(),
- CNSNPP::m_siWriteThreadPrio);
-
- // start the writer thread
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSWriteThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- m_pPersistenceManager->SetWriteThreadHandle(m_hNSWriteThread);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start Write Worker thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP Write Worker thread");
- // LCOV_EXCL_STOP
- }
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is eFrameworkunifiedStatusOK
- // create immediate Persistence thread
- if (NULL != (m_hNSImmediatePersistenceThread = FrameworkunifiedCreateChildThreadWithPriority(f_happ, m_cImmediatePersistenceThreadName.c_str(), NSPNorPersistenceWorkerOnStart, NSPNorPersistenceWorkerOnStop, CNSNPP::m_siImmediatePersistenceThreadPrio))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Thread %s created, Prio=%d", m_cImmediatePersistenceThreadName.c_str(),
- CNSNPP::m_siImmediatePersistenceThreadPrio);
-
- // start the immediate Persistence thread
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedStartChildThread(f_happ, m_hNSImmediatePersistenceThread, 0, NULL))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- m_pPersistenceManager->SetNorPersistenceThreadHandle(m_hNSImmediatePersistenceThread);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Fail to Start immediate persistence thread. Status:0x%x", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error creating NPP immediate persistence Worker thread");
- // LCOV_EXCL_STOP
- }
- }
-
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp
deleted file mode 100755
index b54faeb..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_archive.cpp
+++ /dev/null
@@ -1,846 +0,0 @@
-/*
- * @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 the implementation for archiving and extracting files and folders.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#ifdef AGL_STUB
-#include <other_service/strlcpy.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <zlib.h>
-#include <dirent.h>
-#include <zconf.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <libtar_listhash.h>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_fs_directory.h"
-#include "ns_npp_copy_worker.h"
-
-
-tartype_t g_gztype = { (openfunc_t) OpenArchive, (closefunc_t) CloseArchive,
- (readfunc_t) ReadArchive, (writefunc_t) WriteArchive
- };
-
-GZFiles g_gzfiles;
-
-// CHUNK Size 256 Kb
-// Buffer size for feeding data to and pulling data from the zlib routines
-const size_t kChunkSize = 1U << 18;
-// buff size 32KB
-const size_t kBufSize = 1U << 15;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CArchive
-/// Constructor of CArchive class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CCopyWorker::CArchive::CArchive() {
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CArchive
-/// Destructor of CArchive class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CCopyWorker::CArchive::~CArchive() {
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// FolderOperation
-/// Method to perform archive or extract operations
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::Archive(NSP_CopyInfoCmd &f_tarchiveinfocmd,
- NSP_CopyStatusResponse &f_tarchivestatusresponse) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- std::string l_pSourcePath = f_tarchiveinfocmd.m_csourcepath;
- std::string l_pDestPath = f_tarchiveinfocmd.m_cdestinationpath;
-
- if (!l_pSourcePath.empty() || !l_pDestPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_pSourcePath and l_pDestPath can't be empty // NOLINT[whitespace/line_length]
- size_t l_ifound = l_pDestPath.rfind("/");
- // get string from start to last occurrence of '/'. Which will return directory path
- std::string l_cOutDirPath = l_pDestPath.substr(0, l_ifound);
- // check for load file or release file
- if (LOADTYPE_RELEASE == f_tarchiveinfocmd.m_eloadtype) {
- if (CFSDirectory::DoesDirecotryExist(l_pSourcePath)) {
- // check if destination directory exist
- if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
- l_cOutDirPath.c_str());
- l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath);
- }
- // Create archive
- if (eFrameworkunifiedStatusOK == (l_estatus = CreateTar(l_pSourcePath, l_pDestPath, // LCOV_EXCL_BR_LINE 6: CreateTar always return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- f_tarchivestatusresponse))) {
- // sync tar file to persistent memory
- SI_32 l_iTarHandle = LIBTARFAIL;
- if (LIBTARFAIL != (l_iTarHandle = open(l_pDestPath.c_str() , O_RDONLY))) {
- struct stat l_objStat;
- if (-1 != fstat(l_iTarHandle , &l_objStat)) { // LCOV_EXCL_BR_LINE 6: fstat always return ok
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %ld, file=%s", l_objStat.st_size,
- l_pDestPath.c_str());
- }
-
- close(l_iTarHandle);
- } else {
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- // LCOV_EXCL_START 6: CreateTar always return eFrameworkunifiedStatusOK
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Create tar Failed.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "CP_WRK_FAILURE_SRC_NOT_FND for %s ",
- l_pSourcePath.c_str());
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- // check if destination directory exist
- if (!CFSDirectory::DoesDirecotryExist(l_pDestPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
- l_pDestPath.c_str());
- l_estatus = CFSDirectory::CreateDirectory(l_pDestPath);
- }
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus will be always eFrameworkunifiedStatusOK
- // Extract archive
- l_estatus = ExtractTar(l_pSourcePath, l_pDestPath, f_tarchivestatusresponse);
- }
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_pSourcePath and l_pDestPath can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// CreateTar
-/// Method to create tar
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::CreateTar(const std::string &f_csourepath,
- const std::string &f_cdestpath,
- NSP_CopyStatusResponse &f_tarchivestatusresponse) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- std::string l_cDestPath = f_cdestpath;
- std::string l_pcRootDirPath = f_csourepath;
-
- libtar_list_t *l_pLibTarList = NULL;
- l_pLibTarList = libtar_list_new(LIST_QUEUE, NULL);
- libtar_list_add(l_pLibTarList, (void *)l_pcRootDirPath.c_str()); // NOLINT (readability/casting)
-
- if (!l_cDestPath.empty() || !l_pcRootDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_cDestPath and l_pcRootDirPath cannot be empty // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK != Create(l_cDestPath, l_pcRootDirPath, l_pLibTarList)) { // LCOV_EXCL_BR_LINE 6: Create always return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: Create always return eFrameworkunifiedStatusOK
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // not copied properly so remove temporary file
- if (TRUE == CFSDirectory::RemoveDirectory(l_cDestPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete persistent directory successful.");
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete persistent directory unsuccessful.");
- }
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archiving fails for %s to %s", l_pcRootDirPath.c_str(),
- l_cDestPath.c_str());
- // LCOV_EXCL_STOP
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Folder archived %s ", l_cDestPath.c_str());
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Source Path %s", l_pcRootDirPath.c_str());
-
- if (TRUE == CFSDirectory::RemoveDirectory(l_pcRootDirPath)) { // LCOV_EXCL_BR_LINE 6: always return true
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete temporary directory successful.");
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete temporary directory unsuccessful."); // LCOV_EXCL_LINE 6: always return true // NOLINT[whitespace/line_length]
- }
- l_estatus = eFrameworkunifiedStatusOK;
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_cDestPath and l_pcRootDirPath cannot be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- libtar_list_free(l_pLibTarList, NULL);
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// ExtractTar
-/// Method to extract tar
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::ExtractTar(const std::string &f_csourepath,
- const std::string &f_cdestpath,
- NSP_CopyStatusResponse &f_tarchivestatusresponse) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- std::string l_pcTarFileDestPath = f_cdestpath;
- std::string l_pcRootDirPath = f_csourepath;
-
- if (!l_pcTarFileDestPath.empty() || !l_pcRootDirPath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be empty // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK != Extract(l_pcRootDirPath, l_pcTarFileDestPath)) {
- // not copied properly so remove temporary file
- if (TRUE == CFSDirectory::RemoveDirectory(l_pcTarFileDestPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return true // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete retrieved directory successful.");
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete retrieved directory unsuccessful."); // LCOV_EXCL_LINE 6: RemoveDirectory always return true // NOLINT[whitespace/line_length]
- }
-
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "ABORT WAS CALLED!");
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Extraction fails for %s to %s",
- l_pcTarFileDestPath.c_str(), l_pcTarFileDestPath.c_str());
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Folder extracted %s ", l_pcTarFileDestPath.c_str());
- l_estatus = eFrameworkunifiedStatusOK;
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// Create
-/// Method to create tar
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::Create(std::string &f_pctarfiledestpath,
- std::string &f_pcrootdirpath,
- libtar_list_t *f_plibtarlist) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (FILEERROR == access(f_pcrootdirpath.c_str(), R_OK)) { // LCOV_EXCL_BR_LINE 6: access always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- return eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 6: access always return ok
- }
-
- TAR *l_pTarInfo = NULL;
- CHAR l_cBuffer[MAX_PATH_LENGTH];
- libtar_listptr_t l_pTarListPtr;
-
- PCHAR l_pcTarFileDestPath = const_cast<PCHAR >(f_pctarfiledestpath.c_str());
- PCHAR l_pcRootDirPath = const_cast<PCHAR >(f_pcrootdirpath.c_str());
-
- CHAR l_temp[] = "/";
-
- if (l_pcTarFileDestPath || l_pcRootDirPath) { // LCOV_EXCL_BR_LINE 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be NULL // NOLINT[whitespace/line_length]
- // open tar archive
- if (LIBTARFAIL == (tar_open(&l_pTarInfo, l_pcTarFileDestPath, &g_gztype, O_WRONLY | O_CREAT, // LCOV_EXCL_BR_LINE 6: tar_open always return ok // NOLINT[whitespace/line_length]
- TARMODE, TAR_GNU))) {
- // LCOV_EXCL_START 6: tar_open always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_open(): %s", std::strerror(errno));
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- libtar_listptr_reset(&l_pTarListPtr);
-
- while (libtar_list_next(f_plibtarlist, &l_pTarListPtr) != LIBTARSUCCESS) {
- if (l_pcRootDirPath[0] != '/') { // LCOV_EXCL_BR_LINE 6: l_pcRootDirPath must begin with '/'
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s", l_pcRootDirPath); // LCOV_EXCL_LINE 6: l_pcRootDirPath must begin with '/' // NOLINT[whitespace/line_length]
- } else {
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(l_cBuffer, l_pcRootDirPath, sizeof(l_cBuffer));
-#endif
- }
-
- if (tar_append_tree(l_pTarInfo, l_cBuffer, l_temp) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_append_tree always return ok // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: tar_append_tree always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__,
- "tar_append_tree(\"%s\", \"%s\"): %s", l_cBuffer,
- l_temp, std::strerror(errno));
- tar_close(l_pTarInfo);
- return eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- }
- if (tar_append_eof(l_pTarInfo) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_append_eof always return ok
- // LCOV_EXCL_START 6: tar_append_eof always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_append_eof(): %s", std::strerror(errno));
- tar_close(l_pTarInfo);
- return eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- if (tar_close(l_pTarInfo) != LIBTARSUCCESS) { // LCOV_EXCL_BR_LINE 6: tar_close always return ok
- // LCOV_EXCL_START 6: tar_close always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_close(): %s", std::strerror(errno));
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_pcTarFileDestPath and l_pcRootDirPath can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// create
-/// Method to extract tar
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::Extract(std::string &f_pcrootdirpath, std::string &f_pctarfiledestpath) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (FILEERROR == access(f_pcrootdirpath.c_str(), R_OK)) { // LCOV_EXCL_BR_LINE 6: access always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- return eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 6: access always return ok
- }
-
- PCHAR l_pcRootDirPath = const_cast<PCHAR >(f_pcrootdirpath.c_str());
- PCHAR l_pcTarFileDestPath = const_cast<PCHAR >(f_pctarfiledestpath.c_str());
-
- TAR *l_pTarInfo = NULL;
-
- if (l_pcRootDirPath || l_pcTarFileDestPath) { // LCOV_EXCL_BR_LINE 6: double check, l_pcRootDirPath and l_pcTarFileDestPath can't be NULL // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Extraction open for %s to ", l_pcRootDirPath);
-
- if (LIBTARFAIL == (tar_open(&l_pTarInfo, l_pcRootDirPath, &g_gztype, O_RDONLY, LIBTARSUCCESS, TAR_GNU))) { // LCOV_EXCL_BR_LINE 6: tar_open always return ok // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: tar_open always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_open(): %s", std::strerror(errno));
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- if (LIBTARSUCCESS != tar_extract_all(l_pTarInfo, l_pcTarFileDestPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_extract_all(): %s", std::strerror(errno));
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- if (LIBTARSUCCESS != tar_close(l_pTarInfo)) { // LCOV_EXCL_BR_LINE 6: tar_close always return ok
- // LCOV_EXCL_START 6: tar_close always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "tar_close(): %s", std::strerror(errno));
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_pcRootDirPath and l_pcTarFileDestPath can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source path or Dest Path empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-SI_32 OpenArchive(PCHAR f_pcpathname, SI_32 f_sioflags, SI_32 f_simode) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- gzFile l_gzfile = Z_NULL;
- SI_32 l_sifiledescriptor = LIBTARFAIL;
- if (f_pcpathname) { // LCOV_EXCL_BR_LINE 6: double check, f_pcpathname can't be NULL
- PCHAR l_pcgzoflags;
-
- switch (f_sioflags & O_ACCMODE) {
- case O_WRONLY: {
- l_pcgzoflags = (PCHAR)"wb";
- break;
- }
- case O_RDONLY: {
- l_pcgzoflags = (PCHAR)"rb";
- break;
- }
- case O_RDWR:
- default: {
- // LCOV_EXCL_START 6: must be O_WRONLY or O_RDONLY
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- errno = EINVAL;
- return LIBTARFAIL;
- // LCOV_EXCL_STOP
- }
- }
-
- l_sifiledescriptor = open(f_pcpathname, f_sioflags, f_simode);
-
- if (LIBTARFAIL == l_sifiledescriptor) { // LCOV_EXCL_BR_LINE 6: l_sifiledescriptor always be ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- return LIBTARFAIL; // LCOV_EXCL_LINE 6: l_sifiledescriptor always be ok
- }
-
- if (((f_sioflags & O_CREAT) && fchmod(l_sifiledescriptor, f_simode))) { // LCOV_EXCL_BR_LINE 6: always be ok
- // LCOV_EXCL_START 6: always be ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- close(l_sifiledescriptor);
- return LIBTARFAIL;
- // LCOV_EXCL_STOP
- }
-
- l_gzfile = gzdopen(l_sifiledescriptor, l_pcgzoflags);
- if (!l_gzfile) { // LCOV_EXCL_BR_LINE 6: l_gzfile always be not null
- // LCOV_EXCL_START 6: l_gzfile always be not null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- close(l_sifiledescriptor);
-
- errno = ENOMEM;
- return LIBTARFAIL;
- // LCOV_EXCL_STOP
- } else {
- g_gzfiles.insert(std::make_pair(l_sifiledescriptor, l_gzfile));
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path empty."); // LCOV_EXCL_LINE 6: double check, f_pcpathname can't be NULL // NOLINT[whitespace/line_length]
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_sifiledescriptor;
-}
-
-int CloseArchive(int fd) {
- int ret;
- gzFile gzfile = Z_NULL;
-
- /* checks */
- if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
- // LCOV_EXCL_START 6: g_gzfiles always be not empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- errno = EBADF;
- return -1;
- // LCOV_EXCL_STOP
- }
-
- GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
- if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
- // LCOV_EXCL_START 6: fd will always be found
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- errno = EINVAL;
- return -1;
- // LCOV_EXCL_STOP
- }
-
- /* call zlib */
- gzfile = gzfiles_it->second;
- ret = gzclose(gzfile);
-
- /* remove gzFile* association from our list */
- g_gzfiles.erase(gzfiles_it);
-
- return ret;
-}
-
-ssize_t ReadArchive(int fd, void *buf, size_t count) {
- gzFile gzfile = Z_NULL;
-
- if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
- // LCOV_EXCL_START 6: g_gzfiles always be not empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- errno = EBADF;
- return -1;
- // LCOV_EXCL_STOP
- }
-
- GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
- if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
- // LCOV_EXCL_START 6: fd will always be found
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- errno = EINVAL;
- return -1;
- // LCOV_EXCL_STOP
- }
-
- gzfile = gzfiles_it->second;
- return gzread(gzfile, buf, static_cast<UI_32>(count));
-}
-
-ssize_t WriteArchive(int fd, const void *buf, size_t count) {
- gzFile gzfile = Z_NULL;
-
- if (g_gzfiles.empty()) { // LCOV_EXCL_BR_LINE 6: g_gzfiles always be not empty
- // LCOV_EXCL_START 6: g_gzfiles always be not empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- errno = EBADF;
- return -1;
- // LCOV_EXCL_STOP
- }
-
- GZFiles::iterator gzfiles_it = g_gzfiles.find(fd);
- if (gzfiles_it == g_gzfiles.end()) { // LCOV_EXCL_BR_LINE 6: fd will always be found
- // LCOV_EXCL_START 6: fd will always be found
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- errno = EINVAL;
- return -1;
- // LCOV_EXCL_STOP
- }
-
- gzfile = gzfiles_it->second;
- return gzwrite(gzfile, buf, static_cast<UI_32>(count));
-}
-
-// LCOV_EXCL_START 6: unused code
-////////////////////////////////////////////////////////////////////////////////////////////
-/// FileOperationUsingLibz
-/// Method to determine whether to compress/decompress file using libz
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::FileOperationUsingLibz(NSP_CopyInfoCmd &f_toperainfocmd,
- NSP_CopyStatusResponse &f_toperarespstatus) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- std::string l_pSourcePath = f_toperainfocmd.m_csourcepath;
- std::string l_pDestPath = f_toperainfocmd.m_cdestinationpath;
-
- if (!l_pSourcePath.empty() || !l_pDestPath.empty()) {
- size_t l_ifound = l_pDestPath.rfind("/");
- // get string from start to last occurrence of '/'. Which will return directory path
- std::string l_cOutDirPath = l_pDestPath.substr(0, l_ifound);
-
- // check if destination directory exist
- if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "%s DOESN'T exist, Creating...",
- l_cOutDirPath.c_str());
- l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath);
- }
-
- // check for load file or release file
- if (LOADTYPE_RELEASE == f_toperainfocmd.m_eloadtype) {
- // Zip
- if (eFrameworkunifiedStatusOK == (l_estatus = CompressUsingZlib(l_pSourcePath, l_pDestPath, Z_BEST_COMPRESSION))) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "File Compression successful.");
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File Compression failed.");
- f_toperarespstatus.m_bpersistencechk = FALSE;
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else if (LOADTYPE_LOAD == f_toperainfocmd.m_eloadtype) {
- // Unzip
- if (eFrameworkunifiedStatusOK == (l_estatus = DeCompressUsingZlib(l_pSourcePath, l_pDestPath))) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "File DeCompression successful.");
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "File DeCompression failed.");
- f_toperarespstatus.m_bpersistencechk = FALSE;
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Wrong Request or No request for compression or decompression!");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START 6: unused code
-////////////////////////////////////////////////////////////////////////////////////////////
-/// CompressUsingZlib
-/// Method to compress file using libz
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::CompressUsingZlib(const std::string &f_csourepath,
- const std::string &f_cdestpath,
- SI_32 f_iziplevel) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (!f_csourepath.empty() || !f_cdestpath.empty()) {
- std::string l_cSourePath = f_csourepath;
- std::string l_cDestPath = f_cdestpath;
-
- std::string l_TempFile = "";
- l_TempFile.append(l_cDestPath.c_str());
- l_TempFile.append(".nps_tmp");
-
- FILE *l_pSrcFilePtr = fopen(l_cSourePath.c_str(), "rb");
-
- if (NULL != l_pSrcFilePtr) {
- FILE *l_pDestFilePtr = fopen(l_TempFile.c_str(), "wb");
- if (NULL != l_pDestFilePtr) {
- setvbuf(l_pSrcFilePtr, NULL, _IOFBF, kBufSize);
- setvbuf(l_pDestFilePtr, NULL, _IOFBF, kBufSize);
-
- // structure used to pass information to and from the zlib routines
- z_stream l_tZstreamInfo = {};
-
- // Allocate deflate state
- l_tZstreamInfo.zalloc = Z_NULL;
- l_tZstreamInfo.zfree = Z_NULL;
- l_tZstreamInfo.opaque = Z_NULL;
-
- // Initialize deflates
- SI_32 l_iDeflateStatus = deflateInit(&l_tZstreamInfo, f_iziplevel);
-
- // Deflate Flush Status to determine end of input file
- SI_32 l_iDeflateFlushState = Z_FINISH;
-
- std::vector< UI_8 > l_vInBuffer(kChunkSize);
- std::vector< UI_8 > l_vOutBuffer(kChunkSize);
-
- // pointer to the read bytes from the input file
- UI_8 *l_pReadBuffer = &l_vInBuffer[0];
- // pointer to the next available byte space to write to output file
- UI_8 *l_pWriteBuffer = &l_vOutBuffer[0];
-
- size_t l_uiDeflateRetData = 0;
-
- if (Z_OK == l_iDeflateStatus) {
- do {
- // bytes read from input file
- l_tZstreamInfo.avail_in = static_cast<uInt>(fread(l_pReadBuffer, 1, kChunkSize, l_pSrcFilePtr));
-
- if (0 == ferror(l_pSrcFilePtr)) {
- // if the eof input file reached set the flush state to Z_FINISH
- // Z_NO_FLUSH to indicate that we still have uncompressed data
- l_iDeflateFlushState = feof(l_pSrcFilePtr) ? Z_FINISH : Z_NO_FLUSH;
- l_tZstreamInfo.next_in = l_pReadBuffer;
-
- // run deflate() on input until output buffer not full, finish
- // compression if all of source has been read in
- do {
- l_tZstreamInfo.avail_out = kChunkSize;
- l_tZstreamInfo.next_out = l_pWriteBuffer;
- // no bad return value
- l_iDeflateStatus = deflate(&l_tZstreamInfo, l_iDeflateFlushState);
- // state not clobbered
- if (Z_STREAM_ERROR == l_iDeflateStatus) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "zlib stream error");
- } else {
- l_uiDeflateRetData = kChunkSize - l_tZstreamInfo.avail_out;
- if ((fwrite(l_pWriteBuffer, 1, l_uiDeflateRetData, l_pDestFilePtr) != l_uiDeflateRetData) ||
- // all data not written properly
- (0 != ferror(l_pDestFilePtr))) { // file error in writing
- deflateEnd(&l_tZstreamInfo);
- l_estatus = eFrameworkunifiedStatusFail;
- l_tZstreamInfo.avail_out = 0;
- l_iDeflateFlushState = Z_FINISH;
- }
- }
- } while (0 == l_tZstreamInfo.avail_out); //<< check if deflate() has no more output
- } else { // by seeing that it did not fill the output buffer
- deflateEnd(&l_tZstreamInfo); // leaving avail_out greater than zero >>//
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- // all input will be used
- if (0 != l_tZstreamInfo.avail_in) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "All inputs in z-stream avail_in not used");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- // done when last data in file processed
- } while (Z_FINISH != l_iDeflateFlushState);
- // stream will be complete
- if (Z_STREAM_END != l_iDeflateStatus) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "z-stream not completed");
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Compressed %lu bytes down to %lu bytes",
- l_tZstreamInfo.total_in, l_tZstreamInfo.total_out);
-
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %lu, file=%s", l_tZstreamInfo.total_out,
- f_cdestpath.c_str());
-
- // clean up and return
- deflateEnd(&l_tZstreamInfo);
- } else {
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "deflateInit Failed");
- }
-
- fclose(l_pDestFilePtr);
-
- if (0 != rename(l_TempFile.c_str(), l_cDestPath.c_str())) {
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error renaming file %s to %s",
- l_TempFile.c_str(), l_cDestPath.c_str());
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Destination File Opening Error");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- fclose(l_pSrcFilePtr);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __PRETTY_FUNCTION__, "Source File Opening Error");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-// LCOV_EXCL_START 6: unused code
-////////////////////////////////////////////////////////////////////////////////////////////
-/// DeCompressUsingZlib
-/// Method to decompress file using libz
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CArchive::DeCompressUsingZlib(const std::string &f_csourepath,
- const std::string &f_cdestpath) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (!f_csourepath.empty() || !f_cdestpath.empty()) {
- std::string l_cSourePath = f_csourepath;
- std::string l_cDestPath = f_cdestpath;
-
- std::string l_TempFile = "";
- l_TempFile.append(l_cDestPath.c_str());
- l_TempFile.append(".nps_tmp");
-
- FILE *l_pSrcFilePtr = fopen(l_cSourePath.c_str(), "rb");
-
- if (NULL != l_pSrcFilePtr) {
- FILE *l_pDestFilePtr = fopen(l_TempFile.c_str(), "wb");
- if (NULL != l_pDestFilePtr) {
- setvbuf(l_pSrcFilePtr, NULL, _IOFBF, kBufSize);
- setvbuf(l_pDestFilePtr, NULL, _IOFBF, kBufSize);
-
- z_stream l_tZstreamInfo = {};
-
- // allocate inflate state
- l_tZstreamInfo.zalloc = Z_NULL;
- l_tZstreamInfo.zfree = Z_NULL;
- l_tZstreamInfo.opaque = Z_NULL;
- l_tZstreamInfo.avail_in = 0;
- l_tZstreamInfo.next_in = Z_NULL;
-
- SI_32 l_iInflateStatus = inflateInit(&l_tZstreamInfo);
-
- if (Z_OK == l_iInflateStatus) {
- std::vector< UI_8 > l_vInBuffer(kChunkSize);
- std::vector< UI_8 > l_vOutBuffer(kChunkSize);
-
- // pointer to the read bytes from the input file
- UI_8 *l_pReadBuffer = &l_vInBuffer[0];
- // pointer to the next available byte space to write to output file
- UI_8 *l_pWriteBuffer = &l_vOutBuffer[0];
-
- size_t l_uiDeflateRetData = 0;
-
- do {
- l_tZstreamInfo.avail_in = static_cast<uInt>(fread(l_pReadBuffer, 1, kChunkSize, l_pSrcFilePtr));
- if (0 == ferror(l_pSrcFilePtr)) {
- if (0 == l_tZstreamInfo.avail_in) {
- break;
- }
- l_tZstreamInfo.next_in = l_pReadBuffer;
- // run inflate() on input until output buffer not full
- do {
- l_tZstreamInfo.avail_out = kChunkSize;
- l_tZstreamInfo.next_out = l_pWriteBuffer;
- l_iInflateStatus = inflate(&l_tZstreamInfo, Z_NO_FLUSH);
-
- // state clobbered
- if (Z_STREAM_ERROR == l_iInflateStatus) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "zlib stream error");
- l_estatus = eFrameworkunifiedStatusFail;
- } else if (Z_NEED_DICT == l_iInflateStatus) {
- l_iInflateStatus = Z_DATA_ERROR;
- l_estatus = eFrameworkunifiedStatusFail;
- } else if (Z_MEM_ERROR == l_iInflateStatus) {
- inflateEnd(&l_tZstreamInfo);
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Out of Memory");
- } else {
- l_uiDeflateRetData = kChunkSize - l_tZstreamInfo.avail_out;
- // all data not written
- if ((fwrite(l_pWriteBuffer, 1, l_uiDeflateRetData, l_pDestFilePtr) != l_uiDeflateRetData) ||
- (0 != ferror(l_pDestFilePtr))) { // or file writing error
- inflateEnd(&l_tZstreamInfo);
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
- } while (0 == l_tZstreamInfo.avail_out);
- } else {
- inflateEnd(&l_tZstreamInfo);
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- // done when inflate() says it's done
- } while (Z_STREAM_END != l_iInflateStatus);
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " De-compressed %lu bytes to %lu bytes",
- l_tZstreamInfo.total_in, l_tZstreamInfo.total_out);
- // clean up and return
- inflateEnd(&l_tZstreamInfo);
- } else {
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- fclose(l_pDestFilePtr);
-
- if (0 != rename(l_TempFile.c_str(), l_cDestPath.c_str())) {
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Error renaming file %s to %s",
- l_TempFile.c_str(), l_cDestPath.c_str());
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Destination File Opening Error");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- fclose(l_pSrcFilePtr);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Source File Opening Error");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Source Path or Destination Path Empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp
deleted file mode 100755
index e0a749f..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_binary_accesser.cpp
+++ /dev/null
@@ -1,649 +0,0 @@
-/*
- * @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 definition of CBinaryAccesser class.
-/// This class stores data in a file in binary format.
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#ifdef AGL_STUB
-#include <other_service/strlcpy.h>
-#endif
-#include <cerrno>
-#include <string>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_fs_directory.h"
-#include "ns_npp_binary_accesser.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_persistent_accesser.h"
-
-struct PersistFileHeder {
- char check_code[4];
- unsigned int crc;
-};
-#define NPP_CHECK_CODE "NPPD"
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CBinaryAccesser
-/// Constructor of CBinaryAccesser class
-////////////////////////////////////////////////////////////////////////////////////////////////
-CBinaryAccesser::CBinaryAccesser() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_uiCurStrOffset = 0;
- m_uiCurStrSize = 0;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CBinaryAccesser
-/// Destructor of CBinaryAccesser class
-////////////////////////////////////////////////////////////////////////////////////////////////
-CBinaryAccesser::~CBinaryAccesser() { // LCOV_EXCL_START 14: Resident process, global instance not released
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// PersistData
-/// Persist data in persistent memory in a file in binary format.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CBinaryAccesser::PersistData(std::string f_cmemfilepath,
- Persistent_Notification_List_Type *f_vdata,
- EFrameworkunifiedNotificationType f_epersistenttype,
- EFrameworkunifiedPersistCategory f_epersistcategory) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- int l_OutFd;
-
- if (NULL != f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
- // Open global file in write mode.
- if ((eFrameworkunifiedStatusOK == OpenFileForWriting(&l_OutFd, f_cmemfilepath))) {
- Persistent_Notification_List_Iterator l_itNotificationList = f_vdata->begin();
-
- // Iterate through a vector f_vdata
- for (; l_itNotificationList != f_vdata->end(); l_itNotificationList++) {
- if (eFrameworkunifiedPersistedStateVar == (*l_itNotificationList)->m_ePersistentType) {
- if (f_epersistcategory == (*l_itNotificationList)->m_ePersistCategory) {
- // write header and data
- if (eFrameworkunifiedStatusOK != WriteHeaderAndData((*l_itNotificationList),
- (*l_itNotificationList)->m_pPersistentData->m_pMessage,
- l_OutFd)) {
- l_estatus = eFrameworkunifiedStatusFail;
- break;
- }
- }
- } else {
- // write header and data
- if (eFrameworkunifiedStatusOK != WriteHeaderAndData((*l_itNotificationList),
- (*l_itNotificationList)->m_pPersistentData->m_pMessage,
- l_OutFd)) {
- l_estatus = eFrameworkunifiedStatusFail;
- break;
- }
- }
- }
-
- if (eFrameworkunifiedStatusOK != WriteFileHeaderAndDuplicate(l_OutFd, f_cmemfilepath)) {
- l_estatus = eFrameworkunifiedStatusFail;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written in NAND memory, %ld, file=%s",
- static_cast<long int>(m_uiCurStrOffset - sizeof(PersistFileHeder)), f_cmemfilepath.c_str()); // NOLINT (runtime/int)
- }
- close(l_OutFd);
- } else {
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file %s", f_cmemfilepath.c_str());
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// RetrieveData
-/// Retrieve data in persistent memory in a file in binary format.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CBinaryAccesser::RetrieveData(std::string f_cmemfilepath,
- Persistent_Notification_List_Type *&f_vdata,
- EFrameworkunifiedPersistCategory f_epersistcategory) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- int l_InFd;
-
- if (NULL != f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
- if ((eFrameworkunifiedStatusOK == (l_estatus = OpenFileForReading(&l_InFd, f_cmemfilepath)))) {
- l_estatus = FillNotificationList(l_InFd, f_vdata, f_epersistcategory);
-
- close(l_InFd);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to open file %s, status=%d", f_cmemfilepath.c_str(), l_estatus);
- }
- } else {
- // LCOV_EXCL_START 6: f_vdata can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// FillNotificationList
-/// This function retrieve the notification data from file and fill it in map.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CBinaryAccesser::FillNotificationList(int f_infd,
- Persistent_Notification_List_Type *&f_vdata,
- EFrameworkunifiedPersistCategory f_epersistcategory) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL == f_vdata) { // LCOV_EXCL_BR_LINE 6: f_vdata can't be NULL
- // LCOV_EXCL_START 6: f_vdata can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- } else {
- while (eFrameworkunifiedStatusOK == l_estatus) {
- CPersistDataHeader l_objCPersistDataHeader;
- CHAR *l_pData = NULL;
-
- // Read header and data.
- l_estatus = ReadHeaderAndData(l_objCPersistDataHeader, l_pData, f_infd);
- if (eFrameworkunifiedStatusOK == l_estatus) {
- CNotificationsToPersist *l_objCNotificationsToPersist = new(std::nothrow) CNotificationsToPersist();
- CPersistentData *l_objCPersistentData = new(std::nothrow) CPersistentData();
-
- // fill the appropriate values in l_objCNotificationsToPersist
- if ((NULL != l_objCPersistentData) && (NULL != l_objCNotificationsToPersist)) { // LCOV_EXCL_BR_LINE 5: new's error case // NOLINT[whitespace/line_length]
- l_objCPersistentData->m_pMessage = new(std::nothrow) CHAR[l_objCPersistDataHeader.m_uiSize];
- if (NULL != l_objCPersistentData->m_pMessage) { // LCOV_EXCL_BR_LINE 5: new's error case
- std::memcpy(l_objCPersistentData->m_pMessage, l_pData, l_objCPersistDataHeader.m_uiSize);
- l_objCPersistentData->m_uiMsgSize = l_objCPersistDataHeader.m_uiSize;
- l_objCNotificationsToPersist->m_ePersistentType = l_objCPersistDataHeader.m_ePersistentType;
- l_objCNotificationsToPersist->m_ePersistCategory = f_epersistcategory;
-
- l_objCNotificationsToPersist->m_cNotificationName = l_objCPersistDataHeader.m_cNotificationName;
- l_objCNotificationsToPersist->m_cPublisherName = l_objCPersistDataHeader.m_cPublisherName;
-
- l_objCNotificationsToPersist->m_pPersistentData = l_objCPersistentData;
-
- l_objCNotificationsToPersist->m_uiMaxMsgLength = l_objCPersistDataHeader.m_uiMaxMsgLength;
- f_vdata->push_back(l_objCNotificationsToPersist);
- } else {
- // LCOV_EXCL_START 5: new's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
- l_estatus = eFrameworkunifiedStatusNullPointer;
- break;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 5: new's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
- l_estatus = eFrameworkunifiedStatusNullPointer;
- break;
- // LCOV_EXCL_STOP
- }
- } else if (eFrameworkunifiedStatusErrOther == l_estatus) {
- // EOF
- l_estatus = eFrameworkunifiedStatusOK;
- break;
- } else {
- std::memset(&l_objCPersistDataHeader, 0, sizeof(CPersistDataHeader));
- break;
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CBinaryAccesser::OpenFileForReading(int *f_infd,
- std::string f_cfilepath) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // raw & raw.bak file unlink
- std::string l_cUnlinkPath(f_cfilepath);
- unlink(l_cUnlinkPath.c_str());
- l_cUnlinkPath.append(".bak");
- unlink(l_cUnlinkPath.c_str());
-
- // add .valid
- std::string l_cValidPath(f_cfilepath);
- l_cValidPath.append(".valid");
-
- if ((*f_infd = open(l_cValidPath.c_str(), O_RDONLY)) >= 0) {
- if (eFrameworkunifiedStatusOK == CheckFileHeader(*f_infd)) {
- struct stat st;
- if (fstat(*f_infd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
- if (st.st_size == 0) {
- // If original file is 0byte, to confirm bak file
- int bak_fd;
- if (eFrameworkunifiedStatusOK == OpenBakFileForReading(&bak_fd, l_cValidPath)) {
- close(*f_infd);
- *f_infd = bak_fd;
- }
- }
- }
- l_estatus = eFrameworkunifiedStatusOK;
- } else {
- close(*f_infd);
- l_estatus = OpenBakFileForReading(f_infd, l_cValidPath);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) fail: %s", l_cValidPath.c_str(), strerror(errno));
- l_estatus = OpenBakFileForReading(f_infd, l_cValidPath);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// OpenFileForWriting
-///
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CBinaryAccesser::OpenFileForWriting(int *f_outfd,
- std::string f_cfilepath) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
-
- std::string l_cPath(f_cfilepath);
- size_t l_ifound = l_cPath.rfind("/");
- std::string l_cOutDirPath = l_cPath.substr(0, l_ifound);
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Path for persistence %s ", l_cOutDirPath.c_str());
-
- // if parent directory path doesn't exists, create it
- if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cOutDirPath.c_str());
- if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath))) { // LCOV_EXCL_BR_LINE 6: CreateDirectory always return ok // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Failed to create %s ", l_cOutDirPath.c_str()); // LCOV_EXCL_LINE 6: CreateDirectory always return ok // NOLINT[whitespace/line_length]
- }
- }
-
- // add .valid
- std::string l_cValidPath(f_cfilepath);
- l_cValidPath.append(".valid");
-
- if ((*f_outfd = open(l_cValidPath.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0660)) >= 0) {
- if (lseek(*f_outfd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
- l_estatus = eFrameworkunifiedStatusOK;
- m_uiCurStrOffset = sizeof(PersistFileHeder);
- } else {
- // LCOV_EXCL_START 5: lseek's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno));
- close(*f_outfd);
- *f_outfd = -1;
- // LCOV_EXCL_STOP
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open(%s) fail: %s", l_cValidPath.c_str(), strerror(errno));
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// WriteHeaderAndData
-/// Write header and data in a file.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CBinaryAccesser::WriteHeaderAndData(CNotificationsToPersist *f_pnotificationstopersist,
- PVOID f_pdata,
- int f_outfd) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
-
- if ((NULL == f_pdata) || (NULL == f_pnotificationstopersist)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_pdata is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- } else {
- CPersistDataHeader l_objCPersistDataHeader;
-
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(l_objCPersistDataHeader.m_cNotificationName, f_pnotificationstopersist->m_cNotificationName.c_str(),
- sizeof(l_objCPersistDataHeader.m_cNotificationName));
- strlcpy(l_objCPersistDataHeader.m_cPublisherName, f_pnotificationstopersist->m_cPublisherName.c_str(),
- sizeof(l_objCPersistDataHeader.m_cPublisherName));
-#endif
-
- // size check
- if (UINT32_MAX >= static_cast<size_t>(sizeof(CPersistDataHeader) + l_objCPersistDataHeader.m_uiSize)) { // LCOV_EXCL_BR_LINE 5: the size is not bigger than UINT32_MAX // NOLINT[whitespace/line_length]
- l_objCPersistDataHeader.m_uiOffset = static_cast<UI_32>(m_uiCurStrOffset + sizeof(CPersistDataHeader));
- l_objCPersistDataHeader.m_uiSize = f_pnotificationstopersist->m_pPersistentData->m_uiMsgSize;
- l_objCPersistDataHeader.m_ePersistentType = f_pnotificationstopersist->m_ePersistentType;
- l_objCPersistDataHeader.m_uiMaxMsgLength = f_pnotificationstopersist->m_uiMaxMsgLength;
-
- // write header
- if (write(f_outfd, (PCHAR)&l_objCPersistDataHeader, sizeof(CPersistDataHeader)) == sizeof(CPersistDataHeader)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
- // write data
- if (write(f_outfd, (PCHAR)f_pdata, // LCOV_EXCL_BR_LINE 5: write's error case
- l_objCPersistDataHeader.m_uiSize) == (ssize_t)l_objCPersistDataHeader.m_uiSize) {
- // save offset of end of current record's data
- m_uiCurStrOffset += static_cast<UI_32>(sizeof(CPersistDataHeader) + l_objCPersistDataHeader.m_uiSize);
- l_estatus = eFrameworkunifiedStatusOK;
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while writing data: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while writing header: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CBinaryAccesser::ReadHeaderAndData(CPersistDataHeader &f_objcpersistdataheader,
- CHAR *&f_pdata, int f_infd) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- static UI_32 l_uisPrevAllocSz = 0;
- ssize_t l_iRet;
-
- // read header
- l_iRet = read(f_infd, (PCHAR)&f_objcpersistdataheader, sizeof(f_objcpersistdataheader));
- if (l_iRet != sizeof(f_objcpersistdataheader)) {
- if (l_iRet < 0) { // LCOV_EXCL_BR_LINE 5: read's error case
- // LCOV_EXCL_START 5: read's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while reading header: %s", strerror(errno));
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- l_estatus = eFrameworkunifiedStatusErrOther; // TODO(my_username): set specific error as eNotificationpersistentserviceStatusEOFReadched
- }
- std::memset(&f_objcpersistdataheader, 0, sizeof(CPersistDataHeader));
- } else { // read data
- m_uiCurStrOffset += static_cast<UI_32>(sizeof(CPersistDataHeader));
- if (static_cast<int>(f_objcpersistdataheader.m_uiSize) > 0 &&
- m_uiCurStrOffset + f_objcpersistdataheader.m_uiSize <= m_uiCurStrSize) {
- // if f_pdata has space allocated and if the allocated size less than new size,
- // free and reallocate
- if ((NULL != f_pdata) && (l_uisPrevAllocSz < f_objcpersistdataheader.m_uiSize)) { // LCOV_EXCL_BR_LINE 6: f_pdata must be null // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: f_pdata must be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- delete[] f_pdata;
- f_pdata = NULL;
- // LCOV_EXCL_STOP
- }
-
- if (NULL == f_pdata) { // LCOV_EXCL_BR_LINE 200: f_pdata must be null
- f_pdata = new(std::nothrow) CHAR[f_objcpersistdataheader.m_uiSize];
- } else {
- // memory already allcoated.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- }
-
- if (NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: f_pdata can't be null
- l_uisPrevAllocSz = f_objcpersistdataheader.m_uiSize;
- l_iRet = read(f_infd, (PCHAR)f_pdata, f_objcpersistdataheader.m_uiSize);
- if (l_iRet == (ssize_t)f_objcpersistdataheader.m_uiSize) { // LCOV_EXCL_BR_LINE 5: read's error case
- m_uiCurStrOffset += f_objcpersistdataheader.m_uiSize;
- l_estatus = eFrameworkunifiedStatusOK;
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error while reading data: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 6: f_pdata can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invlide data size: %u", f_objcpersistdataheader.m_uiSize);
- std::memset(&f_objcpersistdataheader, 0, sizeof(CPersistDataHeader));
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-EFrameworkunifiedStatus CBinaryAccesser::WriteFileHeaderAndDuplicate(int f_outfd, std::string f_cfilepath) {
- EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
- struct stat st;
-
- if (fstat(f_outfd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
- if (st.st_size > static_cast<long>(sizeof(PersistFileHeder))) { // NOLINT (runtime/int)
- size_t body_size = static_cast<size_t>(st.st_size - sizeof(PersistFileHeder));
- char *buf = new(std::nothrow) char[body_size];
- if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
- if (lseek(f_outfd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
- if (read(f_outfd, buf, body_size) == static_cast<ssize_t>(body_size)) { // LCOV_EXCL_BR_LINE 5: read's error case // NOLINT[whitespace/line_length]
- PersistFileHeder f_header;
- std::memcpy(&f_header.check_code, NPP_CHECK_CODE, sizeof(f_header.check_code));
- f_header.crc = static_cast<UI_32>(CalcCRC(buf, static_cast<UI_32>(body_size)));
- if (lseek(f_outfd, 0, SEEK_SET) == 0) { // LCOV_EXCL_BR_LINE 5: lseek's error case
- if (write(f_outfd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
- eStatus = eFrameworkunifiedStatusOK;
-
- // file duplicate
- std::string bak_file_path = f_cfilepath;
- bak_file_path.append(".valid.bak");
- int bak_fd = open(bak_file_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0660);
- if (bak_fd >= 0) { // LCOV_EXCL_BR_LINE 5: open's error case
- if (write(bak_fd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
- if (write(bak_fd, buf, body_size) != static_cast<ssize_t>(body_size)) { // LCOV_EXCL_BR_LINE 5: write's error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
- }
- close(bak_fd);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: open's error case // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "write fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: write's error case // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case
- }
- delete[] buf;
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure"); // LCOV_EXCL_LINE 5: new's error case
- }
- } else {
- // 0byte file through
- eStatus = eFrameworkunifiedStatusOK;
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: fstat's error case
- }
-
- return eStatus;
-}
-
-EFrameworkunifiedStatus CBinaryAccesser::CheckFileHeader(int f_infd) {
- EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
- struct stat st;
-
- if (fstat(f_infd, &st) == 0) { // LCOV_EXCL_BR_LINE 5: fstat's error case
- if (st.st_size > static_cast<long>(sizeof(PersistFileHeder))) { // NOLINT (runtime/int)
- size_t body_size = static_cast<size_t>(st.st_size - sizeof(PersistFileHeder));
- char *buf = new(std::nothrow) char[body_size];
- if (buf != NULL) { // LCOV_EXCL_BR_LINE 5: new's error case
- if (lseek(f_infd, sizeof(PersistFileHeder), SEEK_SET) == sizeof(PersistFileHeder)) { // LCOV_EXCL_BR_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
- if (read(f_infd, buf, body_size) == static_cast<ssize_t>(body_size)) {
- UI_32 crc32 = static_cast<UI_32>(CalcCRC(buf, static_cast<UI_32>(body_size)));
- PersistFileHeder f_header;
- if (lseek(f_infd, 0, SEEK_SET) == 0) { // LCOV_EXCL_BR_LINE 5: lseek's error case
- if (read(f_infd, &f_header, sizeof(f_header)) == sizeof(f_header)) { // LCOV_EXCL_BR_LINE 5: read's error case // NOLINT[whitespace/line_length]
- if (std::memcmp(&f_header.check_code, NPP_CHECK_CODE, sizeof(f_header.check_code)) == 0
- && f_header.crc == crc32) {
- m_uiCurStrOffset = sizeof(f_header);
- m_uiCurStrSize = static_cast<UI_32>(st.st_size);
- eStatus = eFrameworkunifiedStatusOK;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "file header fail: %02x %02x %02x %02x %#x:%#x",
- f_header.check_code[0], f_header.check_code[1],
- f_header.check_code[2], f_header.check_code[3], crc32, f_header.crc);
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: read's error case // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case // NOLINT[whitespace/line_length]
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "read fail: %s", strerror(errno));
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "lseek fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: lseek's error case
- }
- delete[] buf;
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem Allocation failure"); // LCOV_EXCL_LINE 5: new's error case
- }
- } else {
- // 0byte file through
- eStatus = eFrameworkunifiedStatusOK;
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno)); // LCOV_EXCL_LINE 5: fstat's error case
- }
-
- return eStatus;
-}
-
-EFrameworkunifiedStatus CBinaryAccesser::OpenBakFileForReading(int *f_infd, std::string f_cfilepath) {
- EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusFail;
- std::string bak_file_path = f_cfilepath;
- bak_file_path.append(".bak");
-
- *f_infd = open(bak_file_path.c_str(), O_RDONLY);
- if (*f_infd >= 0) {
- struct stat st;
- if (fstat(*f_infd, &st) == 0) {
- // Error if bak file is 0byte
- if (st.st_size > 0) {
- if (eFrameworkunifiedStatusOK == CheckFileHeader(*f_infd)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s fail. bak file correct.", f_cfilepath.c_str());
- eStatus = eFrameworkunifiedStatusOK;
- } else {
- close(*f_infd);
- *f_infd = -1;
- }
- } else {
- close(*f_infd);
- *f_infd = -1;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat fail: %s", strerror(errno));
- close(*f_infd);
- *f_infd = -1;
- }
- }
-
- return eStatus;
-}
-
-/*
- * CRC-32C lookup table
- *
- * Polynomial 0x1EDC6F41
- */
-static const UI_32 crc32_lookup[4][256] = { // NOLINT (readability/naming)
- {
- },
- {
- },
- {
- },
- {
- }
-};
-
-UI_32 CBinaryAccesser::CalcCRC(PVOID f_pdata, UI_32 f_size) {
- UI_32 crc = 0xFFFFFFFF;
- const UI_32 *current = (const UI_32 *)f_pdata;
-
- while (f_size >= 4) {
- UI_32 one = *current++ ^ crc;
- crc = crc32_lookup[0][(one >> 24) & 0xFF] ^
- crc32_lookup[1][(one >> 16) & 0xFF] ^
- crc32_lookup[2][(one >> 8) & 0xFF] ^
- crc32_lookup[3][one & 0xFF];
- f_size -= 4;
- }
-
- const UI_8 *current_char = (const UI_8 *)current;
- while (f_size-- > 0) {
- crc = (crc >> 8) ^ crc32_lookup[0][(crc & 0xFF) ^ *current_char++];
- }
-
- return ~crc;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp
deleted file mode 100755
index 4638a7d..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_copy_worker.cpp
+++ /dev/null
@@ -1,1153 +0,0 @@
-/*
- * @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 implements the CCopyWorker class.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <native_service/ns_util_crc.h>
-#include <native_service/ns_logger_if.h>
-
-// standard headers
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-
-#include <string>
-#include <utility>
-
-// ns headers
-#include "ns_npp_copy_worker.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_fs_directory.h"
-#include "ns_npp_persistence.h"
-#include "ns_npp_threads.h"
-#include "ns_npp.h"
-
-#ifdef AGL_STUB
-#include <other_service/strlcpy.h>
-/*#include "PosixBasedOS001legacy_types.h"*/
-#include <unistd.h>
-#include <sys/syscall.h>
-#endif
-
-#define NS_NPP_WRITESIZE1 4096
-#define NS_NPP_WRITESIZE2 32768
-#define NS_NPP_REMOVE_DIR_DELAY 100 // in ms
-#define NS_NPP_FILEWRITE_DELAY 50 // in ms
-
-pthread_mutex_t g_mutworkerthread = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t CCopyWorker::m_sAbortMutex = PTHREAD_MUTEX_INITIALIZER;
-BOOL CCopyWorker::m_sbAbortCopy = FALSE;
-
-template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus WorkerCallback(HANDLE hthread) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- C *l_pClass = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hthread));
-
- if (l_pClass) { // LCOV_EXCL_BR_LINE 6: l_pClass can't be NULL
- l_estatus = (l_pClass->*M)(hthread);
- }
-
- return l_estatus;
-}
-
-// Initialize static members
-TMServiceTagCRC CCopyWorker::CCopyWorker::g_mservicetagcrc;
-CMutex CCopyWorker::CCopyWorker::g_objmtxservicetag;
-
-static FrameworkunifiedProtocolCallbackHandler aServiceHandlers[] = { // NOLINT (readability/naming) // LCOV_EXCL_BR_LINE 11: unexpected branch
- { CP_WRK_CMD_COPY, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdCopy> },
- { CP_WRK_CMD_RESUME, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdResume> },
- { AR_CMD_ARCHIVE, WorkerCallback<CCopyWorker, &CCopyWorker::OnWrkCmdArchive> },
- { CMD_WRK_SHUTDOWN_REQ, WorkerCallback<CCopyWorker, &CCopyWorker::OnCmdShutdownRequest>},
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CCopyWorker
-/// Constructor of CCopyWorker class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CCopyWorker::CCopyWorker() {
- pthread_mutex_init(&m_sAbortMutex, NULL);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CCopyWorker
-/// Destructor of CCopyWorker class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CCopyWorker::~CCopyWorker() {
- pthread_mutex_destroy(&m_sAbortMutex);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Abort
-/// Method to abort worker thread.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CCopyWorker::Abort() { // LCOV_EXCL_START 8: not used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- pthread_mutex_lock(&m_sAbortMutex);
- m_sbAbortCopy = TRUE;
- pthread_mutex_unlock(&m_sAbortMutex);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// InAbortState
-/// Method to check for abort state.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CCopyWorker::InAbortState() const {
- BOOL l_bAbortStatus = FALSE;
- pthread_mutex_lock(&m_sAbortMutex);
- l_bAbortStatus = m_sbAbortCopy;
- pthread_mutex_unlock(&m_sAbortMutex);
-
- return l_bAbortStatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetCopyStatusToFailure
-/// Method to set the copy status failure.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::SetCopyStatusToFailure(NSP_CopyStatusResponse &f_tcopystatusresponse, // LCOV_EXCL_START 8: not used // NOLINT[whitespace/line_length]
- const ENPS_CopyWorkerFailures f_eworkerfailcmd) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- f_tcopystatusresponse.m_bpersistencechk = FALSE;
- f_tcopystatusresponse.m_ecopyfailures = f_eworkerfailcmd;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return eFrameworkunifiedStatusFail;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnWrkCmdCopy
-/// Callback method on copy command.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::OnWrkCmdCopy(HANDLE hthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- NSP_CopyStatusResponse l_tCopyStatus = {};
- NSP_CopyInfoCmd l_tCopyInfo = {};
- UI_32 l_uiFileSize = 0;
- UI_32 l_ui32FileCRC = 0;
- PSTR l_cTmpStorageFile = NULL;
-
- if (NULL != hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
- if (FrameworkunifiedGetMsgLength(hthread) == sizeof(l_tCopyInfo)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(NSP_CopyInfoCmd) // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tCopyInfo, sizeof(NSP_CopyInfoCmd), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- l_tCopyStatus.m_eloadtype = l_tCopyInfo.m_eloadtype;
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(l_tCopyStatus.m_cpersistenttag, l_tCopyInfo.m_cpersistenttag, sizeof(l_tCopyStatus.m_cpersistenttag));
- strlcpy(l_tCopyStatus.m_crequesterappname,
- l_tCopyInfo.m_crequesterappname,
- sizeof(l_tCopyStatus.m_crequesterappname));
-#endif
-
- l_tCopyStatus.m_epersisttype = l_tCopyInfo.m_epersisttype;
-
- if (ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ == l_tCopyInfo.m_ecompressiontype) { // LCOV_EXCL_BR_LINE 6: l_tCopyInfo.m_ecompressiontype can't be ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: l_tCopyInfo.m_ecompressiontype can't be ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- CCopyWorker::CArchive *l_pCArchive = new(std::nothrow) CCopyWorker::CArchive();
-
- if (NULL != l_pCArchive) {
- // Start the folder archive or extract operation
- if (eFrameworkunifiedStatusOK == (l_estatus = l_pCArchive->FileOperationUsingLibz(l_tCopyInfo, l_tCopyStatus))) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Compress/Decompress Successful");
- } else {
- l_estatus = eFrameworkunifiedStatusFail; // Set the archive status to failure
- }
- delete l_pCArchive;
- l_pCArchive = NULL;
- }
- // LCOV_EXCL_STOP
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Tag: %s SourceFile: %s DestFile: %s",
- l_tCopyInfo.m_cpersistenttag != 0 ? l_tCopyInfo.m_cpersistenttag : NULL,
- l_tCopyInfo.m_csourcepath != 0 ? l_tCopyInfo.m_csourcepath : NULL,
- l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
-
- if (LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) {
- // if release, source file needs to check whether it's changed or not
- l_cTmpStorageFile = l_tCopyInfo.m_csourcepath;
- } else if (LOADTYPE_LOAD == l_tCopyStatus.m_eloadtype) { // LCOV_EXCL_BR_LINE 6: m_eloadtype must be LOADTYPE_RELEASE or LOADTYPE_LOAD // NOLINT[whitespace/line_length]
- // if load, dest file needs to check whether it's changed or not
- l_cTmpStorageFile = l_tCopyInfo.m_cdestinationpath;
-
- // check if file on temporary location exists, then no need to load from persistent memory
- if (0 == access(l_tCopyInfo.m_cdestinationpath, F_OK)) { // LCOV_EXCL_BR_LINE 5: access's error case
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "File to load::%s for source::%s "
- "is already present on path:: %s.",
- l_tCopyInfo.m_cpersistenttag != 0 ? l_tCopyInfo.m_cpersistenttag : NULL,
- l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL,
- l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
- l_estatus = eFrameworkunifiedStatusFileLoadSuccess;
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // let l_cTmpStorageFile be NULL.
- }
-
- if (eFrameworkunifiedStatusFileLoadSuccess == l_estatus) {
- l_estatus = eFrameworkunifiedStatusOK;
- } else {
- if (NULL != l_cTmpStorageFile) { // LCOV_EXCL_BR_LINE 6: l_cTmpStorageFile can't be NULL
- if (!VerifyWithStoredCRC(l_tCopyStatus.m_crequesterappname,
- l_tCopyStatus.m_cpersistenttag,
- l_cTmpStorageFile,
- l_ui32FileCRC)) { // l_ui32FileCRC: out param
- // Check if file release and CRC verification is enabled
- if ((LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) && (CNSNPP::m_siCRCCheckCount > 0)) { // LCOV_EXCL_BR_LINE 200: cannot test code // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 200: cannot test code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = TryFileCopyWithCRCCheck(l_tCopyInfo.m_csourcepath,
- l_tCopyInfo.m_cdestinationpath,
- CNSNPP::m_siCRCCheckCount);
- // LCOV_EXCL_STOP
- } else {
- if (LOADTYPE_RELEASE == l_tCopyStatus.m_eloadtype) {
- l_estatus = CopyFile(l_tCopyInfo.m_csourcepath,
- l_tCopyInfo.m_cdestinationpath,
- l_uiFileSize,
- TRUE);
- } else {
- l_estatus = CopyFile(l_tCopyInfo.m_csourcepath,
- l_tCopyInfo.m_cdestinationpath,
- l_uiFileSize,
- FALSE);
- }
- }
- if (eFrameworkunifiedStatusOK == l_estatus) {
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written:%d file=%s",
- l_uiFileSize, l_tCopyInfo.m_cdestinationpath != 0 ? l_tCopyInfo.m_cdestinationpath : NULL);
- if (0 == l_ui32FileCRC) {
- if (eFrameworkunifiedStatusOK != CalculateCRC32(l_cTmpStorageFile, l_ui32FileCRC)) { // LCOV_EXCL_BR_LINE 200: CalculateCRC32() return ok // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 200: CalculateCRC32() return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warn: getting crc. File:%s, crc:%d",
- l_cTmpStorageFile, l_ui32FileCRC);
- // LCOV_EXCL_STOP
- }
- }
- UpdateTagCRC(l_tCopyStatus.m_crequesterappname, l_tCopyInfo.m_cpersistenttag, l_ui32FileCRC);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FileCopy Error, status : 0x%x", l_estatus);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__,
- "File %s not changed. No copy done. Load type:%d. Tag:%s for Requester:%s.",
- l_cTmpStorageFile,
- l_tCopyStatus.m_eloadtype,
- l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
- l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
- }
- } else {
- // LCOV_EXCL_START 6: l_cTmpStorageFile can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unknown load type:%d, for tag:%s",
- l_tCopyStatus.m_eloadtype,
- l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL);
- // LCOV_EXCL_STOP
- }
- }
- }
-
- if (eFrameworkunifiedStatusOK != l_estatus) {
- l_tCopyStatus.m_bpersistencechk = FALSE;
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "COPY_FAILED_ID sending parent message. Tag:%s for Requester:%s.",
- l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
- l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
-
- FrameworkunifiedSendParent(hthread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tCopyStatus);
- } else {
- l_tCopyStatus.m_bpersistencechk = TRUE;
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "COPY_COMPLETE_ID sending parent message. Tag:%s for Requester:%s.",
- l_tCopyStatus.m_cpersistenttag != 0 ? l_tCopyStatus.m_cpersistenttag : NULL,
- l_tCopyStatus.m_crequesterappname != 0 ? l_tCopyStatus.m_crequesterappname : NULL);
-
- FrameworkunifiedSendParent(hthread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tCopyStatus);
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 200: the size of msg must be sizeof(NSP_CopyInfoCmd)
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
- static_cast<long int>(sizeof(l_tCopyInfo)), FrameworkunifiedGetMsgLength(hthread)); // NOLINT (runtime/int)
- // LCOV_EXCL_STOP
- }
- l_estatus = SendAck(hthread, CP_WRK_CMD_COPY);
- } else {
- // LCOV_EXCL_START 6: hthread can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetCopyBufSize
-/// Get the proper buffer size.
-////////////////////////////////////////////////////////////////////////////////////////////////
-SI_32 CCopyWorker::GetCopyBufSize(SI_32 f_si32openfd, UI_32 &f_ui32filesize) {
- UI_32 l_ui32BufSize = NS_NPP_WRITESIZE1;
- // to get the size of file
- struct stat l_tSrcFstat = {};
-
- if (-1 == fstat(f_si32openfd , &l_tSrcFstat)) { // LCOV_EXCL_BR_LINE 5: fstat's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "fstat failure, errno:%d", errno); // LCOV_EXCL_LINE 5: fstat's error case
- } else {
- f_ui32filesize = static_cast<UI_32>(l_tSrcFstat.st_size); // set out param
- if (l_tSrcFstat.st_size < NS_NPP_WRITESIZE1) {
- l_ui32BufSize = NS_NPP_WRITESIZE1;
- } else {
- l_ui32BufSize = NS_NPP_WRITESIZE2;
- }
- }
- return l_ui32BufSize;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CopyFile
-/// Copy the content of source file f_csrcpath to destination file f_cdestpath
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::CopyFile(PCSTR f_csrcpath, PCSTR f_cdestpath, UI_32 &f_uiNS_NPP_WRITESIZE, BOOL btmpfile) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // declare variables
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- SI_32 l_iSourceFileFd = -1; // file descriptor of source file
- SI_32 l_iDestFileFd = -1; // file descriptor of destination file
- PSTR l_cWriteBuffer = NULL;
- SI_32 l_si32BufSize = NS_NPP_WRITESIZE1;
- size_t l_iReadBuffLength = 0; // size of data read from source file
- UI_32 l_ui32SrcFileSize = 0;
- std::string l_cTempDestPath; // temporary file path
- if (btmpfile == FALSE) {
- l_cTempDestPath = f_cdestpath;
- } else {
- l_cTempDestPath = CPersistence::GetStoragePath(); // LCOV_EXCL_BR_LINE 11: unexpected branch
- if (l_cTempDestPath.length() > 0) { // LCOV_EXCL_BR_LINE 6: l_cTempDestPath.length() is bigger than 0
- l_cTempDestPath.append(RELEASETEMP_DIR); // LCOV_EXCL_BR_LINE 11: unexpected branch
- // create the destination folder path if does not exists
- if (!CFSDirectory::DoesDirecotryExist(l_cTempDestPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cTempDestPath.c_str());
- if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cTempDestPath))) { // LCOV_EXCL_BR_LINE 200: CreateDirectory() is eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 200: CreateDirectory() is eFrameworkunifiedStatusOK
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to create %s, errno:%d", l_cTempDestPath.c_str(), errno);
- return l_estatus;
- // LCOV_EXCL_STOP
- }
- }
- l_cTempDestPath.append(RELEASETEMP_FILENAME);
-
- } else {
- // LCOV_EXCL_START 6: l_cTempDestPath.length() is bigger than 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_cTempDestPath.length():%ld", static_cast<long int>(l_cTempDestPath.length())); // NOLINT (runtime/int)
- return eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- }
- // get the destination folder path from full file path
- std::string l_cOutDirPath(f_cdestpath);
- size_t l_ifound = l_cOutDirPath.rfind("/");
- l_cOutDirPath = l_cOutDirPath.substr(0, l_ifound);
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Full Path for persistence %s.", f_cdestpath);
-
- // create the destination folder path if does not exists
- if (!CFSDirectory::DoesDirecotryExist(l_cOutDirPath)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s DOESN'T exist, Creating...", l_cOutDirPath.c_str());
-
- if (eFrameworkunifiedStatusOK != (l_estatus = CFSDirectory::CreateDirectory(l_cOutDirPath))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to create %s, errno:%d", l_cOutDirPath.c_str(), errno);
- return eFrameworkunifiedStatusFail;
- }
- }
-
- // open source file
- if (-1 == (l_iSourceFileFd = open(f_csrcpath, O_RDONLY, S_IRUSR))) { // LCOV_EXCL_BR_LINE 5: open's error case
- // LCOV_EXCL_START 5: open's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Warning :: CP_WRK_FAILURE_SRC_NOT_FND, errno:%d", errno);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- // open the destination file for writing or create if does not exists
- if (-1 == (l_iDestFileFd = open(l_cTempDestPath.c_str(), O_WRONLY | O_CREAT | O_TRUNC, // LCOV_EXCL_BR_LINE 5: open's error case // NOLINT[whitespace/line_length]
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH))) {
- // LCOV_EXCL_START 5: open's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_DST_CREATE, errno:%d", errno);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- l_si32BufSize = GetCopyBufSize(l_iSourceFileFd, l_ui32SrcFileSize);
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Src file:%s, size:%d", f_csrcpath, l_ui32SrcFileSize);
- l_cWriteBuffer = (PSTR) std::malloc(l_si32BufSize);
- f_uiNS_NPP_WRITESIZE = 0;
-
- if (NULL != l_cWriteBuffer) { // LCOV_EXCL_BR_LINE 5: malloc's error case
-#ifdef AGL_STUB
- while (1) {
- std::memset(l_cWriteBuffer, 0, l_si32BufSize);
- l_iReadBuffLength = read(l_iSourceFileFd, l_cWriteBuffer, l_si32BufSize);
- if (0 == l_iReadBuffLength) {
- break;
- } else if (0 < l_iReadBuffLength) { // LCOV_EXCL_BR_LINE 5: read's error case
- f_uiNS_NPP_WRITESIZE += static_cast<UI_32>(l_iReadBuffLength);
-
- if (-1 == write(l_iDestFileFd, l_cWriteBuffer, l_iReadBuffLength)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_WRITE_ERROR_CP, errno:%d", errno);
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- if (InAbortState()) { // LCOV_EXCL_START 200: the state can't be aborted
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_ABORT_DURING_CP");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- // LCOV_EXCL_STOP
- } else {
- // LCOV_EXCL_START 5: read's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error reading from source file, errno:%d", errno);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- if (eFrameworkunifiedStatusOK != l_estatus) {
- break;
- }
- }
-#else
- while (!eof(l_iSourceFileFd)) {
- std::memset(l_cWriteBuffer, 0, l_si32BufSize);
- if (-1 != (l_iReadBuffLength = read(l_iSourceFileFd, l_cWriteBuffer, l_si32BufSize))) {
- f_uiNS_NPP_WRITESIZE += static_cast<UI_32>(l_iReadBuffLength);
-
- if (-1 == write(l_iDestFileFd, l_cWriteBuffer, l_iReadBuffLength)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_WRITE_ERROR_CP, errno:%d", errno);
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- if (InAbortState()) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CP_WRK_FAILURE_ABORT_DURING_CP");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error reading from source file, errno:%d", errno);
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- if (eFrameworkunifiedStatusOK != l_estatus) {
- break;
- }
- }
-#endif
-
- free(l_cWriteBuffer);
- l_cWriteBuffer = NULL;
- } else {
- // LCOV_EXCL_START 5: malloc's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Mem alloc error for l_cWriteBuffer");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- close(l_iDestFileFd);
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- if (btmpfile == TRUE) {
- if (0 != rename(l_cTempDestPath.c_str(), f_cdestpath)) { // LCOV_EXCL_START 5: rename's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
- "Error renaming file %s to %s, errno: %d", l_cTempDestPath.c_str(), f_cdestpath,
- errno);
- }
- // LCOV_EXCL_STOP
- }
- } else {
- // remove the source file after successful copy
- if (0 != remove(l_cTempDestPath.c_str())) {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Temporary file not deleted::%s, errno:%d", l_cTempDestPath.c_str(), errno);
- }
- }
- }
-
- close(l_iSourceFileFd);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnWrkCmdResume
-/// Callback on resume worker thread command
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::OnWrkCmdResume(HANDLE hthread) { // LCOV_EXCL_START 8: not used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (hthread) {
- pthread_mutex_lock(&m_sAbortMutex);
- m_sbAbortCopy = FALSE;
- pthread_mutex_unlock(&m_sAbortMutex);
- l_estatus = SendAck(hthread, CP_WRK_CMD_RESUME);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnWrkCmdStart
-/// Callback method on start worker thread command.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::OnWrkCmdStart(HANDLE hthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (hthread) { // LCOV_EXCL_BR_LINE 6:hthread can't be NULL
- l_estatus = SendAck(hthread, CP_WRK_CMD_START);
- } else {
- // LCOV_EXCL_START 6:hthread can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnWrkCmdStop
-/// Callback method on stop worker thread command.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::OnWrkCmdStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (hthread) {
- l_estatus = SendAck(hthread, CP_WRK_CMD_STOP);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnCmdShutdownRequest
-/// Callback method for shutdown request command.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::OnCmdShutdownRequest(HANDLE hthread) { // LCOV_EXCL_START 8: not used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- if (hthread) {
- NSP_CopyShutdownAck l_tCopyShutdownAck = {};
- if (FrameworkunifiedGetMsgLength(hthread) == sizeof(l_tCopyShutdownAck)) {
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tCopyShutdownAck, sizeof(NSP_CopyShutdownAck),
- eSMRRelease))) {
- FrameworkunifiedSendParent(hthread, CMD_WRK_SHUTDOWN_ACK, sizeof(NSP_CopyShutdown), &l_tCopyShutdownAck);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
- static_cast<long int>(sizeof(l_tCopyShutdownAck)), FrameworkunifiedGetMsgLength(hthread)); // NOLINT (runtime/int)
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SendAck
-/// Method to send ack to the parent thread
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::SendAck(HANDLE hthread, const ENSP_CopyWorkerProtocol &f_eworkercmd) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
- NSP_CopyAckMsg l_tCopyAckMs = {};
- l_tCopyAckMs.m_eworkerprotocol = f_eworkercmd;
- l_estatus = FrameworkunifiedSendParent(hthread, CP_WRK_ACK_CMD_COMPLETE, sizeof(l_tCopyAckMs), &l_tCopyAckMs);
- } else {
- // LCOV_EXCL_START 6: hthread can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnWrkCmdArchive
-/// Callback method on archive command
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::OnWrkCmdArchive(HANDLE f_hThread) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- // Archive response struct
- NSP_CopyStatusResponse l_tArchiveStatusResponse;
-
- if (f_hThread) { // LCOV_EXCL_BR_LINE 6: f_hThread can't be NULL
- // Archive info struct
- NSP_CopyInfoCmd l_tArchiveInfo = {};
-
- if (FrameworkunifiedGetMsgLength(f_hThread) == sizeof(l_tArchiveInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, &l_tArchiveInfo, sizeof(NSP_CopyInfoCmd), // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- eSMRRelease))) {
- // Copy archive status response
- l_tArchiveStatusResponse.m_eloadtype = l_tArchiveInfo.m_eloadtype;
- l_tArchiveStatusResponse.m_epersisttype = l_tArchiveInfo.m_epersisttype;
- std::strncpy(l_tArchiveStatusResponse.m_cpersistenttag, l_tArchiveInfo.m_cpersistenttag, (MAX_PATH_LENGTH - 1));
- std::strncpy(l_tArchiveStatusResponse.m_crequesterappname,
- l_tArchiveInfo.m_crequesterappname, (MAX_PATH_LENGTH - 1));
-
- CCopyWorker::CArchive *l_pCArchive = new CCopyWorker::CArchive();
-
- // Start the folder archive or extract operation
- if (eFrameworkunifiedStatusOK == (l_estatus = l_pCArchive->Archive(l_tArchiveInfo, l_tArchiveStatusResponse))) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract Successful!");
- } else {
- // Set the archive status to failure
- l_estatus = eFrameworkunifiedStatusFail;
- }
- if (NULL != l_pCArchive) { // LCOV_EXCL_BR_LINE 5: l_pCArchive can't be null
- delete l_pCArchive;
- l_pCArchive = NULL;
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:FrameworkunifiedGetMsgDataOfSize returned:%d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:MsgLength: Expected:%ld, Received:%d.",
- static_cast<long int>(sizeof(l_tArchiveInfo)), FrameworkunifiedGetMsgLength(f_hThread)); // NOLINT (runtime/int)
- // LCOV_EXCL_STOP
- }
-
- if (eFrameworkunifiedStatusOK != l_estatus) {
- l_tArchiveStatusResponse.m_bpersistencechk = FALSE;
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract fail.Sending parent message!");
- } else {
- l_tArchiveStatusResponse.m_bpersistencechk = TRUE;
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Archive/Extract success.Sending parent message!");
- }
-
- FrameworkunifiedSendParent(f_hThread, CP_WRK_NTFY, sizeof(NSP_CopyStatusResponse), &l_tArchiveStatusResponse);
- } else {
- // LCOV_EXCL_START 6: f_hThread can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread Application Handle NULL");
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NSPCopyWorkerOnStart
-/// Callback method on start of worker thread
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus NSPCopyWorkerOnStart(HANDLE hthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
- pthread_mutex_lock(&g_mutworkerthread);
-
- // Note: this variable is made static just to ignore the resource leak showing in coverity analysis
- static CCopyWorker *l_pccopyworker = NULL;
-
- l_pccopyworker = new(std::nothrow) CCopyWorker; // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- if (NULL != l_pccopyworker) { // LCOV_EXCL_BR_LINE 5: l_pccopyworker can't be NULL
- if (eFrameworkunifiedStatusOK == (l_estatus = l_pccopyworker->OnWrkCmdStart(hthread))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, l_pccopyworker);
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- l_estatus = FrameworkunifiedAttachCallbacksToDispatcher(
- hthread, AppName, aServiceHandlers, static_cast<UI_32>(_countof(aServiceHandlers)));
-
- if (0 == std::strcmp(NS_NPP_WRITE_THREAD_NAME, FrameworkunifiedGetAppName(hthread))) {
- l_estatus = FrameworkunifiedAttachCallbackToDispatcher(hthread, AppName,
- CMD_DELETE_OLD_DATA, NPServiceOnDeleteOldDataCmd);
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- delete l_pccopyworker;
- l_pccopyworker = NULL;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- delete l_pccopyworker;
- l_pccopyworker = NULL;
-
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread Start failed.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 5: l_pccopyworker can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null.");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- pthread_mutex_unlock(&g_mutworkerthread);
- } else {
- // LCOV_EXCL_START 6: hthread can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NSPCopyWorkerOnStop
-/// Callback method on stop of worker thread
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus NSPCopyWorkerOnStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (NULL != hthread) {
- pthread_mutex_lock(&g_mutworkerthread);
- CCopyWorker *l_pccopyworker = static_cast<CCopyWorker *>(FrameworkunifiedGetThreadSpecificData(hthread));
-
- if (NULL != l_pccopyworker) {
- l_pccopyworker->OnWrkCmdStop(hthread);
-
- delete l_pccopyworker;
- l_pccopyworker = NULL;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
-
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, NULL))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSetThreadSpecificData Error, status=%d", l_estatus);
- }
-
- PCSTR l_cservice = FrameworkunifiedGetAppName(hthread);
- if (NULL != l_cservice) {
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedDetachServiceFromDispatcher(hthread, l_cservice))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Detaching service %s from dispatcher, status=%d", l_cservice, l_estatus);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetAppName returned NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
-
- pthread_mutex_unlock(&g_mutworkerthread);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// NPServiceOnDeleteOldDataCmd
-/// This callback is used to delete the data which was requested to be deleted during
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus NPServiceOnDeleteOldDataCmd(HANDLE f_happ) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- SI_32 l_ithreadcreate = 0;
- pthread_attr_t l_tattr;
- struct sched_param l_tschedparam = {};
-
- // thread id
- pthread_t childthread = 0;
-
- if (EOK == pthread_attr_init(&l_tattr)) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
- // detach the thread from parent thread
- if (EOK != pthread_attr_setdetachstate(&l_tattr, PTHREAD_CREATE_DETACHED)) { // LCOV_EXCL_BR_LINE 11:except,C++ STL
- // LCOV_EXCL_START 11:except,C++ STL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error setting detach state attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
- // set the schedule property of thread
- if (EOK != pthread_attr_setinheritsched(&l_tattr, PTHREAD_EXPLICIT_SCHED)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 5:except,C++ STL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error setting inherit schedule attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
- if (EOK != pthread_attr_getschedparam(&l_tattr, &l_tschedparam)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL
- // LCOV_EXCL_START 5:except,C++ STL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error getting schedule param attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
- // set the schedule priority of thread
- l_tschedparam.sched_priority = NS_NPP_DATA_RESET_THREAD_PRIO;
- if (EOK != pthread_attr_setschedparam(&l_tattr, &l_tschedparam)) { // LCOV_EXCL_BR_LINE 5:except,C++ STL
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error setting schedule param attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- // start the child thread
- if (EOK == (l_ithreadcreate = pthread_create(&childthread, &l_tattr, NSPDataResetThreadCallback, NULL))) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Thread id %ld created, name=%s, prio=%d", childthread, NS_NPP_DATA_RESET_THREAD_NAME,
- NS_NPP_DATA_RESET_THREAD_PRIO);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "pthread_create failed for %s, error = %d", NS_NPP_DATA_RESET_THREAD_NAME,
- l_ithreadcreate);
- }
- }
-
- // release the thread attribute object
- pthread_attr_destroy(&l_tattr);
- } else {
- // LCOV_EXCL_START 11:except,C++ STL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to initialize attribute for thread %s", NS_NPP_DATA_RESET_THREAD_NAME);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// NSPDataResetThreadCallback
-/// Callback of data reset thread.
-///////////////////////////////////////////////////////////////////////////////////////////
-PVOID NSPDataResetThreadCallback(PVOID f_parg) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- std::string f_csourcepath = "";
- std::string f_ctargetpath = "";
- std::string l_ctargetdir = "";
-
- DIR *l_pdir = NULL;
- struct dirent *l_pdirent = NULL;
-
- // set the name of thread
- if (EOK == pthread_setname_np(0, NS_NPP_DATA_RESET_THREAD_NAME)) { // LCOV_EXCL_BR_LINE 5:pthread_setname_np's error case // NOLINT[whitespace/line_length]
-#ifdef AGL_STUB
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Name of thread id %ld set to %s",
- syscall(__NR_gettid), NS_NPP_DATA_RESET_THREAD_NAME);
-#else
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Name of thread id %d set to %s", gettid(), NS_NPP_DATA_RESET_THREAD_NAME);
-#endif
- } else {
- // LCOV_EXCL_START 5:pthread_setname_np's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-#ifdef AGL_STUB
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error setting name %s for thread-id %ld", NS_NPP_DATA_RESET_THREAD_NAME,
- syscall(__NR_gettid));
-#else
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error setting name %s for thread-id %d", NS_NPP_DATA_RESET_THREAD_NAME, gettid());
-#endif
- // LCOV_EXCL_STOP
- }
-
- f_csourcepath = CPersistence::GetStoragePath();
- l_pdir = opendir(f_csourcepath.c_str());
-
- if (NULL != l_pdir) { // LCOV_EXCL_BR_LINE 5:opendir's error case
- if ('/' != f_csourcepath[f_csourcepath.length() - 1]) { // LCOV_EXCL_BR_LINE 200: there must be '/' in f_csourcepath // NOLINT[whitespace/line_length]
- f_csourcepath.append("/");
- }
-
- /*
- * Old Persistent data folders which needs to be deleted are renamed with the orignal folder name
- * followed by underscore and date and time.
- */
- std::string l_colduserdata = USERDATA;
- l_colduserdata.append("_");
-
- std::string l_coldfactorydata = FACTORYDATA;
- l_coldfactorydata.append("_");
-
- std::string l_coldfactorycustomerdata = FACTORYCUSTOMERDATA;
- l_coldfactorycustomerdata.append("_");
-
- std::string l_colddealerdata = DEALERDATA;
- l_colddealerdata.append("_");
-
- while (NULL != (l_pdirent = readdir(l_pdir))) {
- l_ctargetdir = l_pdirent->d_name;
-
- if (0 == l_ctargetdir.find(l_colduserdata) ||
- 0 == l_ctargetdir.find(l_coldfactorydata) ||
- 0 == l_ctargetdir.find(l_coldfactorycustomerdata) ||
- 0 == l_ctargetdir.find(l_colddealerdata)) {
- f_ctargetpath.assign(f_csourcepath);
- f_ctargetpath.append(l_ctargetdir);
-
- if (!CFSDirectory::RemoveDirectory(f_ctargetpath, NS_NPP_REMOVE_DIR_DELAY)) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to delete directory :: %s", f_ctargetpath.c_str());
- }
- }
- }
- closedir(l_pdir); // close the directory
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory does not exists :: %s", f_csourcepath.c_str()); // LCOV_EXCL_LINE 5:opendir's error case // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// VerifyWithStoredCRC
-/// Check if crc of the file passed matches with existing crc of a file
-///////////////////////////////////////////////////////////////////////////////////////////
-BOOL CCopyWorker::VerifyWithStoredCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, PCSTR f_cFile,
- UI_32 &f_ui32crc) {
- UI_32 l_ui32StoredCrc = 0;
- BOOL l_bRet = FALSE;
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- TMServiceTagCRC::iterator l_itServiceTag;
- TMTagCRC::iterator l_itTagCRC;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- f_ui32crc = 0; // initialize with default
-
- if ((NULL != f_crequesterappname) && (NULL != f_cpersistenttag) && (NULL != f_cFile)) { // LCOV_EXCL_BR_LINE 6: f_crequesterappname, f_cpersistenttag, f_cFile can't be null // NOLINT[whitespace/line_length]
- // Get the existing crc of a file from the map
- CCopyWorker::g_objmtxservicetag.ReadLock();
- l_itServiceTag = CCopyWorker::g_mservicetagcrc.find(f_crequesterappname);
- if (l_itServiceTag != CCopyWorker::g_mservicetagcrc.end()) {
- l_itTagCRC = (l_itServiceTag->second).find(f_cpersistenttag);
- if (l_itTagCRC != (l_itServiceTag->second).end()) {
- l_ui32StoredCrc = (l_itTagCRC->second);
- l_estatus = eFrameworkunifiedStatusOK;
- } else {
- // Do nothing.
- }
- } else {
- // Do nothing.
- }
- CCopyWorker::g_objmtxservicetag.Unlock();
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- // get the crc of a file
- l_estatus = CalculateCRC32(f_cFile, f_ui32crc);
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: CalculateCRC32() return ok
- if (f_ui32crc == l_ui32StoredCrc) {
- l_bRet = TRUE;
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CRC matched. crc:%u", l_ui32StoredCrc);
- } else {
- // Do nothing. Return value already set.
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CRC different. stored:%u, new:%u",
- l_ui32StoredCrc, f_ui32crc);
- }
- } else {
- // LCOV_EXCL_START: CalculateCRC32() return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warn: getting crc:file:%s, status:%d, errno:%d",
- f_cFile, l_estatus, errno);
- // LCOV_EXCL_STOP
- }
- } else {
- // Do nothing. Return value already set.
- }
- } else {
- // LCOV_EXCL_START 6: f_crequesterappname, f_cpersistenttag, f_cFile can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid param::f_crequesterappname:%p, f_cpersistenttag:%p, f_cFile:%p",
- f_crequesterappname, f_cpersistenttag, f_cFile);
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bRet;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// UpdateTagCRC
-/// Update the internal map with new crc
-///////////////////////////////////////////////////////////////////////////////////////////
-VOID CCopyWorker::UpdateTagCRC(PCSTR f_crequesterappname, PCSTR f_cpersistenttag, UI_32 f_ui32crc) {
- TMServiceTagCRC::iterator l_itServiceTag;
- TMTagCRC::iterator l_itTagCRC;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CCopyWorker::g_objmtxservicetag.ReadLock();
- l_itServiceTag = CCopyWorker::g_mservicetagcrc.find(f_crequesterappname);
- if (l_itServiceTag != CCopyWorker::g_mservicetagcrc.end()) {
- l_itTagCRC = (l_itServiceTag->second).find(f_cpersistenttag);
- if (l_itTagCRC != (l_itServiceTag->second).end()) {
- l_itTagCRC->second = f_ui32crc;
- } else {
- (l_itServiceTag->second).insert(std::make_pair(f_cpersistenttag, f_ui32crc));
- }
- } else {
- TMTagCRC l_mTagCRC;
- l_mTagCRC.insert(std::make_pair(f_cpersistenttag, f_ui32crc));
- CCopyWorker::g_mservicetagcrc.insert(std::make_pair(f_crequesterappname, l_mTagCRC));
- }
- CCopyWorker::g_objmtxservicetag.Unlock();
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// TryFileCopyWithCRCCheck
-/// Try file copy with CRC validation
-///////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CCopyWorker::TryFileCopyWithCRCCheck(PCSTR f_csource, PCSTR f_cdest, UI_32 f_ui32checkcount) { // LCOV_EXCL_START 200: cannot test code // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- UI_32 l_uiSrcFileCrc = 0;
- UI_32 l_uiDestFileCrc = 0;
- UI_32 l_uiFileSize = 0;
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- for (UI_16 l_uiCrcCnt = 1; l_uiCrcCnt <= CNSNPP::m_siCRCCheckCount; l_uiCrcCnt++) {
- l_uiSrcFileCrc = 0;
- l_uiDestFileCrc = 0;
- l_uiFileSize = 0;
-
- l_estatus = CopyFile(f_csource, f_cdest, l_uiFileSize, TRUE);
- if (eFrameworkunifiedStatusOK == l_estatus) {
- // calculate crc of file in temp memory(RAM)
- l_estatus = CalculateCRC32(f_csource, l_uiSrcFileCrc);
- if (eFrameworkunifiedStatusOK == l_estatus) {
- // calculate crc of file stored in persistent memory
- l_estatus = CalculateCRC32(f_cdest, l_uiDestFileCrc);
- if (eFrameworkunifiedStatusOK == l_estatus) {
- if (l_uiSrcFileCrc == l_uiDestFileCrc) { // if checksum matches for both the files
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CRC Checksum matches for file:%s :: 0x%x", f_csource, l_uiSrcFileCrc);
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO3, __FUNCTION__, "Bytes written:%d file=%s",
- l_uiFileSize, f_cdest);
- break;
- } else { // else delete the file from target
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "CRC doesn't match for src:%s::0x%x and dest:%s::0x%x, CRC cnt=%d",
- f_csource, l_uiSrcFileCrc, f_cdest, l_uiDestFileCrc, l_uiCrcCnt);
- // if the checksum does not matches even for the last time, do not delete the file from target
- if (l_uiCrcCnt < (CNSNPP::m_siCRCCheckCount)) {
- if (0 != remove(f_cdest)) {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Error deleting file:%s, errno:%d", f_cdest, errno);
- }
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Calculating Checksum for DestFile:%s",
- f_cdest != 0 ? f_cdest : NULL);
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Calculating Checksum for SrcFile:%s",
- f_csource != 0 ? f_csource : NULL);
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FileCopy Error:%d", l_estatus);
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp
deleted file mode 100755
index 8f4f98a..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_fs_directory.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * @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 the implementation for class CFSDirectory.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef AGL_STUB
-#include <other_service/PosixBasedOS001TimeApi.h>
-#endif
-
-#include <stdio.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifdef AGL_STUB
-#include <cstring>
-#endif
-#include <string>
-
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_types.h"
-#include "ns_npp_fs_directory.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CFSDirectory
-/// Constructor of CFSDirectory class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CFSDirectory::CFSDirectory() { // LCOV_EXCL_START 8: all methods are static
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CFSDirectory
-/// Destructor of CFSDirectory class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CFSDirectory::~CFSDirectory() { // LCOV_EXCL_START 8: all methods are static
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CreateDirectory
-/// Method to create a directory.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CFSDirectory::CreateDirectory(const std::string &f_cdirpath) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (!f_cdirpath.empty()) {
- PSTR l_cTempDirPath;
- PSTR l_cParsedDirPath;
- PCSTR l_cCopypath = f_cdirpath.c_str();
-
- l_cTempDirPath = const_cast<PSTR >(f_cdirpath.c_str());
- while (l_estatus == eFrameworkunifiedStatusOK && (l_cParsedDirPath = std::strchr(l_cTempDirPath, '/')) != 0) {
- if (l_cParsedDirPath != l_cTempDirPath) {
- /* Neither root nor double slash in path */
- *l_cParsedDirPath = '\0';
- if (0 != mkdir(l_cCopypath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { // LCOV_EXCL_BR_LINE 5: mkdir's error case // NOLINT[whitespace/line_length]
- if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 5: errno can't be changed
- // LCOV_EXCL_START 5: errno can't be changed
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s", l_cCopypath);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- // file already exist
- }
- }
- *l_cParsedDirPath = '/';
- }
- l_cTempDirPath = l_cParsedDirPath + 1;
- }
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 200: l_estatus must be eFrameworkunifiedStatusOK
- if (0 != mkdir(l_cCopypath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { // LCOV_EXCL_BR_LINE 5: mkdir's error case // NOLINT[whitespace/line_length]
- if (EEXIST != errno) { // LCOV_EXCL_BR_LINE 5: errno can't be changed
- // LCOV_EXCL_START 5: errno can't be changed
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error Cannot Create directory %s", l_cCopypath);
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- // file already exist
- }
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty.");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// DoesDirecotryExist
-/// Method to check if a directory exists.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CFSDirectory::DoesDirecotryExist(const std::string &f_cdirpath) {
- DIR *l_pDirDescriptor = opendir(f_cdirpath.c_str());
- if (NULL != l_pDirDescriptor) {
- closedir(l_pDirDescriptor);
- return TRUE;
- }
- return FALSE;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// IsDirectory
-/// Method to check if the entity is a directory.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CFSDirectory::IsDirectory(const std::string &f_cpath) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- BOOL l_bReturn = FALSE;
-
- if (!f_cpath.empty()) { // LCOV_EXCL_BR_LINE 200: f_cpath can't be empty
- struct stat st_buf;
-
- if (0 == stat(f_cpath.c_str(), &st_buf)) { // LCOV_EXCL_BR_LINE 5: stat's error case
- // Get the status of the file
- if (S_ISREG(st_buf.st_mode)) {
- l_bReturn = FALSE; // return false if f_cpath is a regular file
- }
- if (S_ISDIR(st_buf.st_mode)) {
- l_bReturn = TRUE; // return true if f_cpath is a directory
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving status of path : %s", f_cpath.c_str()); // LCOV_EXCL_LINE 5: stat's error case // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty."); // LCOV_EXCL_LINE 200: f_cpath can't be empty
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bReturn;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// RemoveDirectory
-/// Method to remove a directory.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CFSDirectory::RemoveDirectory(std::string f_cpath, const UI_32 f_uidelay) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- BOOL l_bReturn = FALSE;
-
- if (!f_cpath.empty()) { // LCOV_EXCL_BR_LINE 200: f_cpath can't be empty.
- std::string l_cFilePath = "";
-
- struct dirent *l_pdirent = NULL;
- DIR *l_pdir = NULL;
-
- l_pdir = opendir(f_cpath.c_str()); // LCOV_EXCL_BR_LINE 11:unexpected branch
- if (NULL != l_pdir) {
- if ('/' != f_cpath[f_cpath.length() - 1]) {
- f_cpath.append("/");
- }
-
- while (NULL != (l_pdirent = readdir(l_pdir))) {
- if (0 != std::strcmp(l_pdirent->d_name, ".") &&
- 0 != std::strcmp(l_pdirent->d_name, "..")) {
- l_cFilePath.assign(f_cpath);
- l_cFilePath.append(l_pdirent->d_name); // concatenate the strings to get the complete f_cpath
-
- if (TRUE == IsDirectory(l_cFilePath)) {
- (void)RemoveDirectory(l_cFilePath, f_uidelay);
- } else {
- // it's a file, we can use unlink
- unlink(l_cFilePath.c_str());
-
- if (0 < f_uidelay) { // LCOV_EXCL_START 200: f_uidelay is 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- delay(f_uidelay);
-#endif
- }
- // LCOV_EXCL_STOP
- }
- }
- }
- closedir(l_pdir); // close the directory
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pdir is NULL");
- }
-
- // delete the directory
- if (0 == rmdir(f_cpath.c_str())) {
- if (0 < f_uidelay) { // LCOV_EXCL_START 200: f_uidelay is 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- delay(f_uidelay);
-#endif
- }
- // LCOV_EXCL_STOP
- l_bReturn = TRUE;
- }
- } else {
- // LCOV_EXCL_START 200: f_cpath can't be empty.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Directory path is empty.");
- l_bReturn = FALSE;
- // LCOV_EXCL_STOP
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bReturn;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp
deleted file mode 100755
index c9e88a8..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_handlelist.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * @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.
-//////////////////////////////////////////////////////////////////////////////////////////////////
-#include <utility>
-#include <string>
-#include "ns_npp_handlelist.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-
-// define static member of class CHandleList
-CHandleList *CHandleList::m_psHandleList = NULL;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CHandleList
-/// Class Constructor
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CHandleList::CHandleList() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CHandleList
-/// Class Destructor
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CHandleList::~CHandleList() { // LCOV_EXCL_START 14: Resident process, global instance not released
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetHandleList
-/// This function is used to get the singleton instance of class.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CHandleList *CHandleList::GetHandleList() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // create the instance of class
- if (NULL == m_psHandleList) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Creating handle list."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- m_psHandleList = new(std::nothrow) CHandleList(); // LCOV_EXCL_BR_LINE 11: unexpected branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return m_psHandleList;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ReleaseHandleList
-/// This function is used to release the instance of class.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CHandleList::ReleaseHandleList() { // LCOV_EXCL_START 100: not used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_psHandleList) {
- delete m_psHandleList;
- m_psHandleList = NULL;
- } else {
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddHandleInList
-/// Add pair of subscriber name and corresponding handle in map.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CHandleList::AddHandleInList(std::string f_csubscribername, HANDLE f_hmqhandle) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- HandleListRetStatus_Type l_prRetValue;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- l_prRetValue = m_mHandleList.insert(make_pair(f_csubscribername, f_hmqhandle));
- if (false == l_prRetValue.second) {
- l_estatus = eFrameworkunifiedStatusDuplicate;
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Handle exists in list for %s.", f_csubscribername.c_str());
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Handle added in list for %s.", f_csubscribername.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- }
-
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// RemoveHandleFromList
-/// Remove handle for subscriber from the list.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CHandleList::RemoveHandleFromList(std::string f_csubscribername) { // LCOV_EXCL_START 100: not used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // TODO(my_username): Implementation of this function.
- // NOTE: Right now this feature is not required. Let the NS_NPPService hold one handle for
- // each subscriber, even if all the notifications are unsubscribed by subscriber.
- return eFrameworkunifiedStatusOK;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetSubscriberMqHandle
-/// Get the message queue handle of a subscriber.
-////////////////////////////////////////////////////////////////////////////////////////////////
-HANDLE CHandleList::GetSubscriberMqHandle(std::string f_csubscribername) {
- HANDLE l_hMqHandle = NULL;
- HandleList_Type::iterator l_itHandleList;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- l_itHandleList = m_mHandleList.find(f_csubscribername);
- if (l_itHandleList != m_mHandleList.end()) {
- l_hMqHandle = l_itHandleList->second;
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_hMqHandle;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp
deleted file mode 100755
index d4b1604..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_nor_persistence_worker_thread.cpp
+++ /dev/null
@@ -1,747 +0,0 @@
-/*
- * @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 CNorPersistenceWorker and CArchive.
-/// Class CNorPersistenceWorker holds the implementation for worker thread.
-/// Class CArchive holds the implementation for archive.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include <native_service/ns_timer_if.hpp>
-#include <native_service/ns_np_service_if.h>
-#include <native_service/ns_utility_sys.hpp>
-#include <native_service/frameworkunified_framework_if.h>
-#include <native_service/frameworkunified_multithreading.h>
-#include <native_service/frameworkunified_service_protocol.h>
-#include <native_service/ns_np_service_protocol.h>
-#include <native_service/ns_np_service_nor_persistence.h>
-
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <boost/bind.hpp>
-#include <map>
-#include <utility>
-#include <string>
-
-#include <native_service/ns_np_service_nor_persistence_internal.h>
-#include "ns_npp_types.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_fs_directory.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_nor_persistence_worker_thread.h"
-
-
-
-typedef std::string NotificationName;
-typedef std::map<NotificationName, CTimerHelper *> TTimerList;
-static TTimerList g_mtimers; /// List of all the timers for immediate persistence notifications
-CMutex g_objmutextimerdata; /// Mutex object on g_mtimers
-
-// Template function for NorWorkerCallback
-template <typename C, eFrameworkunifiedStatus(C::*M)(HANDLE)> EFrameworkunifiedStatus NorWorkerCallback(HANDLE hthread) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- C *l_pClass = static_cast<C *>(FrameworkunifiedGetThreadSpecificData(hthread));
-
- if (l_pClass) { // LCOV_EXCL_BR_LINE 6: l_pClass can't be NULL
- l_estatus = (l_pClass->*M)(hthread);
- }
- return l_estatus;
-}
-
-static FrameworkunifiedProtocolCallbackHandler aServiceHandlers[] = { // NOLINT (readability/naming)
- { NOR_PERSISTENCE_TIMER_START, NorWorkerCallback<CNorPersistenceWorker,
- &CNorPersistenceWorker::OnNorPersistenceTimerStart>},
- { NOR_PERSISTENCE_REGISTER, NorWorkerCallback<CNorPersistenceWorker,
- &CNorPersistenceWorker::RegisterImmediatePersistNotification>},
- { NOR_PERSISTENCE_UNREGISTER, NorWorkerCallback<CNorPersistenceWorker,
- &CNorPersistenceWorker::UnregisterImmediatePersistNotification>},
- { NOR_PERSISTENCE_ONSHUTDOWN, NorWorkerCallback<CNorPersistenceWorker,
- &CNorPersistenceWorker::OnShutdown>},
- { NOR_PERSISTENCE_CHANGE_CATEGORY, NorWorkerCallback<CNorPersistenceWorker,
- &CNorPersistenceWorker::OnCategoryChange>}
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NSPNorPersistenceWorkerOnStart
-/// Callback method on start of worker thread
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStart(HANDLE hthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (NULL != hthread) { // LCOV_EXCL_BR_LINE 6: hthread can't be NULL
- // Note: this variable is made static just to ignore the resource leak showing in coverity analysis
- static CNorPersistenceWorker *l_pcnorpersistenceworker = new(std::nothrow) CNorPersistenceWorker;
-
- if (NULL != l_pcnorpersistenceworker) { // LCOV_EXCL_BR_LINE 5: new's error case
- l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, l_pcnorpersistenceworker);
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- l_estatus = FrameworkunifiedAttachCallbacksToDispatcher(
- hthread, AppName, aServiceHandlers, static_cast<UI_32>(_countof(aServiceHandlers)));
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- delete l_pcnorpersistenceworker;
- l_pcnorpersistenceworker = NULL;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 5: new's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null.");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: hthread can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NSPNorPersistenceWorkerOnStop
-/// Callback method on stop of worker thread
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus NSPNorPersistenceWorkerOnStop(HANDLE hthread) { // LCOV_EXCL_START 200: can't test
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (NULL != hthread) {
- CNorPersistenceWorker *l_pcnorpersistenceworker = static_cast<CNorPersistenceWorker *>(FrameworkunifiedGetThreadSpecificData(
- hthread));
-
- if (NULL != l_pcnorpersistenceworker) {
- delete l_pcnorpersistenceworker;
- l_pcnorpersistenceworker = NULL;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Worker Object Null");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
-
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSetThreadSpecificData(hthread, NULL))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSetThreadSpecificData error, status=%d", l_estatus);
- }
-
- PCSTR l_cservice = FrameworkunifiedGetAppName(hthread);
- if (NULL != l_cservice) {
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedDetachServiceFromDispatcher(hthread, l_cservice))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error detaching service %s from dispatcher, status=%d", l_cservice, l_estatus);
- }
- } else {
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetAppName returned NULL");
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Thread App Handle Null.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Class : CNorPersistenceWorker
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CNorPersistenceWorker
-/// Constructor of CNorPersistenceWorker class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNorPersistenceWorker::CNorPersistenceWorker() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CNorPersistenceWorker
-/// Destructor of CNorPersistenceWorker class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNorPersistenceWorker::~CNorPersistenceWorker() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnNorPersistenceTimerStart
-/// This function starts the respective timer of the notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNorPersistenceWorker::OnNorPersistenceTimerStart(HANDLE f_hThread) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- TNorPersistenceNotifInfoHeader *l_ptNorPersistentData = NULL;
- UI_32 l_ui32ReceivedDataLength = FrameworkunifiedGetMsgLength(f_hThread);
- UI_8 *l_pui32ReceivedData = new(std::nothrow) UI_8[l_ui32ReceivedDataLength];
-
- if (l_ui32ReceivedDataLength >= sizeof(TNorPersistenceNotifInfoHeader)) { // LCOV_EXCL_BR_LINE 200: l_ui32ReceivedDataLength is bigger than sizeof(TNorPersistenceNotifInfoHeader) // NOLINT[whitespace/line_length]
- if (NULL != l_pui32ReceivedData) { // LCOV_EXCL_BR_LINE 5: new's error case
- std::memset(l_pui32ReceivedData, 0, l_ui32ReceivedDataLength);
- l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, l_pui32ReceivedData, l_ui32ReceivedDataLength, eSMRRelease);
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- TTimerList::iterator l_itTimerList;
- l_ptNorPersistentData = static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(l_pui32ReceivedData));
-
- g_objmutextimerdata.WriteLock();
- // find the corresponding timer object in the list of timers
- l_itTimerList = g_mtimers.find(l_ptNorPersistentData->m_cnotificationname);
- if (g_mtimers.end() != l_itTimerList) { // LCOV_EXCL_BR_LINE 200: the notification must be registered
- if (NULL != (l_itTimerList->second)) { // LCOV_EXCL_BR_LINE 200: l_itTimerList->second can't be null
- if (NULL != (l_itTimerList->second)->m_pui8HeaderAndData) {
- delete[](l_itTimerList->second)->m_pui8HeaderAndData;
- (l_itTimerList->second)->m_pui8HeaderAndData = NULL;
- }
-
- // Update specific immediate persistence notification data
- (l_itTimerList->second)->m_pui8HeaderAndData = l_pui32ReceivedData;
-
- // if corresponding timer is not already running start it.
- if (!(l_itTimerList->second)->IsRunning()) {
- (l_itTimerList->second)->Start();
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Timer started, Notfn=%s", l_ptNorPersistentData->m_cnotificationname);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Timer already running for notfn %s. Data updated",
- l_ptNorPersistentData->m_cnotificationname);
- }
-
- l_estatus = eFrameworkunifiedStatusOK;
- } else {
- // LCOV_EXCL_START 200: l_itTimerList->second can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate persistence: Timer object NULL for Notfn:%s.",
- l_ptNorPersistentData->m_cnotificationname);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 200: the notification must be registered
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate persistence notification not registered. Notification: %s ",
- l_ptNorPersistentData->m_cnotificationname != 0 ? l_ptNorPersistentData->m_cnotificationname : NULL);
- // LCOV_EXCL_STOP
- }
- g_objmutextimerdata.Unlock();
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "FrameworkunifiedGetMsgDataOfSize failed while retrieving immediate persistence notfn data. Status:0x%x ", l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 5: new's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to allocate data. Can't persist.");
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 200: l_ui32ReceivedDataLength is bigger than sizeof(TNorPersistenceNotifInfoHeader)
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldBuf;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid data length received. Can't persist.");
- // LCOV_EXCL_STOP
- }
-
- if ((eFrameworkunifiedStatusOK != l_estatus) && (NULL != l_pui32ReceivedData)) {
- delete[] l_pui32ReceivedData;
- l_pui32ReceivedData = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// RegisterImmediatePersistNotification
-/// It creates a timer corresponding to the notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNorPersistenceWorker::RegisterImmediatePersistNotification(HANDLE hthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- TImmediatePersistenceRegisterNotifInfo l_tRegisterNotifInfo = {};
-
- if (sizeof(l_tRegisterNotifInfo) == FrameworkunifiedGetMsgLength(hthread)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo) // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tRegisterNotifInfo, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- sizeof(TImmediatePersistenceRegisterNotifInfo), eSMRRelease))) {
- g_objmutextimerdata.WriteLock();
-
- TTimerList::iterator l_itTimerList = g_mtimers.find(l_tRegisterNotifInfo.m_cnotificationname);
- if (l_itTimerList != g_mtimers.end()) { // LCOV_EXCL_BR_LINE 6: notification can't be registered again
- // LCOV_EXCL_START 6: notification can't be registered again
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s is already registered for immediate data persistence ",
- l_tRegisterNotifInfo.m_cnotificationname);
- // LCOV_EXCL_STOP
- } else {
- // create timer corresponding to notification
- CTimerHelper *l_pTimerHelper = new CTimerHelper();
- if (NULL != l_pTimerHelper) { // LCOV_EXCL_BR_LINE 5: new's error case
- l_pTimerHelper->SetTime(l_tRegisterNotifInfo.m_uidelay, 0);
- // todo: modify SetNotifyMethod of timer NSTimer class to accept sender handle as well.
- // This will help to have only one handle, instead of one handle per timer.
- l_pTimerHelper->SetNotifyMethod(static_cast<UI_16>(l_pTimerHelper->GetCmdId()), FrameworkunifiedGetAppName(hthread));
-
- // associate timer's timeout with the callback function.
- FrameworkunifiedAttachCallbackToDispatcher(hthread, TIMER_QUE, l_pTimerHelper->GetCmdId(),
- boost::bind(&CTimerHelper::OnTimeOut, l_pTimerHelper, hthread));
- // add created timer in timers list
- g_mtimers.insert(std::make_pair(l_tRegisterNotifInfo.m_cnotificationname, l_pTimerHelper));
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s is registered for immediate data persistence ",
- l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL);
- }
- }
-
- g_objmutextimerdata.Unlock();
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error getting message data for registering Immediate persistent notification, status: 0x%x", l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo)
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "FrameworkunifiedGetMsgLength and size of TImmediatePersistenceRegisterNotifInfo mismatched."
- "Length received %d, buffer available: %ld ",
- FrameworkunifiedGetMsgLength(hthread), static_cast<long int>(sizeof(TImmediatePersistenceRegisterNotifInfo))); // NOLINT (runtime/int)
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// UnregisterImmediatePersistNotification
-/// It deletes a timer corresponding to the notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNorPersistenceWorker::UnregisterImmediatePersistNotification(HANDLE hthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- TImmediatePersistenceUnregisterNotifInfo l_tRegisterNotifInfo = {};
-
- if (sizeof(l_tRegisterNotifInfo) == FrameworkunifiedGetMsgLength(hthread)) { // LCOV_EXCL_BR_LINE 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo) // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, &l_tRegisterNotifInfo, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- sizeof(TImmediatePersistenceUnregisterNotifInfo), eSMRRelease))) {
- g_objmutextimerdata.WriteLock();
-
- TTimerList::iterator l_itTimerList = g_mtimers.find(l_tRegisterNotifInfo.m_cnotificationname);
- if (l_itTimerList != g_mtimers.end()) { // LCOV_EXCL_BR_LINE 6: notification can't be unregistered again
- if (NULL != (l_itTimerList->second)) { // LCOV_EXCL_BR_LINE 200: l_itTimerList->second can't be null
- EFrameworkunifiedStatus eStatus;
- // detach callbacks
- if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbackFromDispatcher(hthread, TIMER_QUE, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- (l_itTimerList->second)->GetCmdId()))) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedDetachCallbackFromDispatcher Failed Status:0x%x ", eStatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- delete l_itTimerList->second;
- l_itTimerList->second = NULL;
- }
- g_mtimers.erase(l_itTimerList);
- } else {
- // LCOV_EXCL_START 6: notification can't be registered again
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Can't unregister. Notification %s is not a registered notification for immediate data persistence.",
- l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL);
- // LCOV_EXCL_STOP
- }
-
- g_objmutextimerdata.Unlock();
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Notification %s is unregistered for immediate data persistence, FrameworkunifiedGetMsgDataOfSize Error, status: 0x%x",
- l_tRegisterNotifInfo.m_cnotificationname != 0 ? l_tRegisterNotifInfo.m_cnotificationname : NULL,
- l_estatus);
- }
- } else {
- // LCOV_EXCL_START 200: the size of msg must be sizeof(TImmediatePersistenceUnregisterNotifInfo)
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "FrameworkunifiedGetMsgLength and size of TImmediatePersistenceUnregisterNotifInfo mismatched."
- "Length received %d, buffer available: %ld ",
- FrameworkunifiedGetMsgLength(hthread), static_cast<long int>(sizeof(TImmediatePersistenceUnregisterNotifInfo))); // NOLINT (runtime/int)
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnShutdown
-/// This API saves or deletes the data of NOR irrespective of delay depending on the message data
-/// received from parent thread during shutdown.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNorPersistenceWorker::OnShutdown(HANDLE f_hThread) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- UI_32 l_uiPersistCategoryFlag = 0;
-
- TImmediateShutdown l_tImmShutdown = {};
-
- CTimerHelper *l_pTimerHelper = NULL;
-
- // iterator of list of nor notifications and its timers
- TTimerList::iterator l_itTimerList;
-
- TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader = NULL;
-
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_hThread, &l_tImmShutdown, sizeof(l_tImmShutdown), // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- eSMRRelease))) {
- l_uiPersistCategoryFlag = l_tImmShutdown.f_uinotificationpersistentservicepersistcategoryflag;
-
- // if quick shutdown is received then just stop the timer and dont save the data
- if (eFrameworkunifiedQuickShutdown == l_tImmShutdown.f_eshutdowntype) {
- for (l_itTimerList = g_mtimers.begin(); l_itTimerList != g_mtimers.end(); l_itTimerList++) {
- l_pTimerHelper = l_itTimerList->second;
-
- if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
- // stop the timer
- l_pTimerHelper->Stop();
- }
- }
- } else { // stop the timer and save the data
- for (l_itTimerList = g_mtimers.begin(); l_itTimerList != g_mtimers.end(); l_itTimerList++) {
- l_pTimerHelper = l_itTimerList->second;
-
- if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
- // stop the timer
- l_pTimerHelper->Stop();
-
- l_ptImmediateNotfnHeader = static_cast<TNorPersistenceNotifInfoHeader *>
- (static_cast<PVOID>(l_pTimerHelper->m_pui8HeaderAndData));
-
- if (NULL != l_ptImmediateNotfnHeader) { // LCOV_EXCL_BR_LINE 200: l_ptImmediateNotfnHeader can't be null
- if (eFrameworkunifiedUserData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
- eFrameworkunifiedFactoryData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
- eFrameworkunifiedFactoryCustomerData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag) &&
- eFrameworkunifiedDealerData != (l_ptImmediateNotfnHeader->m_epersistcategory & l_uiPersistCategoryFlag)) {
- // save the new data to persistent memory
- l_pTimerHelper->OnTimeOut(f_hThread);
- }
- } else {
- // LCOV_EXCL_START 200: l_ptImmediateNotfnHeader can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Immediate notification data header is NULL");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- }
- }
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed for protocol NOR_PERSISTENCE_ONSHUTDOWN, status : %d",
- l_estatus);
- // LCOV_EXCL_STOP
- }
-
- if (eFrameworkunifiedStatusOK != (l_estatus = FrameworkunifiedSendParent(f_hThread, NOR_PERSISTENCE_ONSHUTDOWN_ACK, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- sizeof(l_uiPersistCategoryFlag), &l_uiPersistCategoryFlag))) {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendParent failed for protocol NOR_PERSISTENCE_ONSHUTDOWN_ACK, status : %d",
- l_estatus);
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnCategoryChange
-/// This callback is called when category of immediate persistence is changed
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNorPersistenceWorker::OnCategoryChange(HANDLE hthread) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != hthread) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- UI_32 l_ui32ReceivedDataLength = FrameworkunifiedGetMsgLength(hthread);
-
- if (l_ui32ReceivedDataLength >= sizeof(TImmediatePersistenceChangeCategory)) { // LCOV_EXCL_BR_LINE 200: l_ui32ReceivedDataLength is bigger than sizeof(TImmediatePersistenceChangeCategory) // NOLINT[whitespace/line_length]
- UI_8 *l_pui32ReceivedData = new(std::nothrow) UI_8[l_ui32ReceivedDataLength];
-
- if (NULL != l_pui32ReceivedData) { // LCOV_EXCL_BR_LINE 5: new's error case
- std::memset(l_pui32ReceivedData, 0, l_ui32ReceivedDataLength);
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(hthread, l_pui32ReceivedData, l_ui32ReceivedDataLength, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- eSMRRelease))) {
- TImmediatePersistenceChangeCategory *l_pChangePersistentCategory =
- static_cast<TImmediatePersistenceChangeCategory *>(static_cast<PVOID>(l_pui32ReceivedData));
- PUI_8 l_pui8Data = l_pui32ReceivedData + sizeof(TImmediatePersistenceChangeCategory);
-
- TTimerList::iterator l_itTimerList;
-
- g_objmutextimerdata.WriteLock();
- // find the corresponding timer object in the list of timers
- l_itTimerList = g_mtimers.find(l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname);
- if (g_mtimers.end() != l_itTimerList) { // LCOV_EXCL_BR_LINE 6: notification must be in list
- CTimerHelper *l_pTimerHelper = l_itTimerList->second;
-
- if (NULL != l_pTimerHelper && l_pTimerHelper->IsRunning()) {
- TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader =
- static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(l_pTimerHelper->m_pui8HeaderAndData));
-
- if (NULL != l_ptImmediateNotfnHeader) { // LCOV_EXCL_BR_LINE 200: l_ptImmediateNotfnHeader can't be null
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing category from %d to %d for notfn %s in dataHdr",
- l_ptImmediateNotfnHeader->m_epersistcategory,
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory,
- l_ptImmediateNotfnHeader->m_cnotificationname);
-
- l_ptImmediateNotfnHeader->m_epersistcategory =
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory;
- }
- }
-
- EFrameworkunifiedPersistCategory l_eOldPersistCategory = l_pChangePersistentCategory->m_eoldpersistcategory;
-
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Changing persist category of %s from %d to %d",
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname,
- l_eOldPersistCategory,
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory);
-
- // write data to emmc
- l_estatus = SynchronousWritePersistentData(
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_cpublishername,
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname,
- static_cast<PVOID>(l_pui8Data),
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_uimsgsize,
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_uidelay,
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_uimaxmsglength,
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_epersistcategory);
-
- // Create the old file path string to be removed
- std::string l_cPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
- std::string l_cTempPath = l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname;
- size_t l_uiTempPathSize = 0;
-
- // replace all '/' by '_'
- l_uiTempPathSize = l_cTempPath.find_first_of("/");
- while (std::string::npos != l_uiTempPathSize) {
- l_cTempPath[l_uiTempPathSize] = '_';
- l_uiTempPathSize = l_cTempPath.find_first_of("/", l_uiTempPathSize + 1);
- }
-
- switch (l_eOldPersistCategory) {
- case eFrameworkunifiedFactoryData:
- l_cPath.append(FACTORYDATADIR);
- break;
- case eFrameworkunifiedFactoryCustomerData:
- l_cPath.append(FACTORYCUSTOMERDATADIR);
- break;
- case eFrameworkunifiedDealerData:
- l_cPath.append(DEALERDATADIR);
- break;
- case eFrameworkunifiedUserData:
- default: {
- l_cPath.append(USERDATADIR);
- l_cPath.append(ALLUSERAPPDATADIR);
- }
- break;
- }
-
- l_cPath.append(IMMEDIATEDATADIR);
- l_cPath.append(l_cTempPath);
-
- l_cPath.append(l_pChangePersistentCategory->m_tnornotifInfoheader.m_cpublishername);
-
- if (0 != unlink(l_cPath.c_str())) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error deleting file %s, errno=%d", l_cPath.c_str(), errno);
- }
- } else {
- // LCOV_EXCL_START 6: notification must be in list
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't update persistent category, notfn %s not found in g_mtimers map",
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname != 0 ?
- l_pChangePersistentCategory->m_tnornotifInfoheader.m_cnotificationname : NULL);
- // LCOV_EXCL_STOP
- }
- g_objmutextimerdata.Unlock();
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed while retrieving"
- "immediate persistence notfn data. Status:0x%x ", l_estatus);
- // LCOV_EXCL_STOP
- }
-
- delete[] l_pui32ReceivedData;
- l_pui32ReceivedData = NULL;
- } else {
- // LCOV_EXCL_START 5: new's error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to allocate data. Can't persist, errno=%d", errno);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 200: l_ui32ReceivedDataLength is bigger than sizeof(TImmediatePersistenceChangeCategory)
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldBuf;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid data length received %d. Can't persist.", l_ui32ReceivedDataLength);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid param, hthread is NULL");
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-/////////////////////////////
-/// Class: CTimerHelper
-/////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CTimerHelper
-/// Constructor of CTimerHelper class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CTimerHelper::CTimerHelper() {
- static UI_32 l_uiTimerCounter = PROTOCOL_FRAMEWORKUNIFIED_BASE_CMD;
- l_uiTimerCounter++;
- m_uiCmdId = l_uiTimerCounter;
- m_pui8HeaderAndData = NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CTimerHelper
-/// Destructor of CTimerHelper class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CTimerHelper::~CTimerHelper() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pui8HeaderAndData) {
- delete[] m_pui8HeaderAndData;
- m_pui8HeaderAndData = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetCmdId
-/// Returns id for timer
-////////////////////////////////////////////////////////////////////////////////////////////////////
-UI_32 CTimerHelper::GetCmdId() {
- return m_uiCmdId;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// OnTimeOut
-/// This function writes the corresponding data in NOR when timer expires.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CTimerHelper::OnTimeOut(HANDLE hthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- g_objmutextimerdata.ReadLock();
- if (NULL != m_pui8HeaderAndData) { // LCOV_EXCL_BR_LINE 200: m_pui8HeaderAndData can't be null
- TNorPersistenceNotifInfoHeader *l_ptImmediateNotfnHeader =
- static_cast<TNorPersistenceNotifInfoHeader *>(static_cast<PVOID>(m_pui8HeaderAndData));
- PUI_8 l_pui8Data = m_pui8HeaderAndData + sizeof(TNorPersistenceNotifInfoHeader);
- HANDLE l_hReceiverMq = McOpenSender(l_ptImmediateNotfnHeader->m_cpublishername);
-
- // write data to emmc
- l_estatus = SynchronousWritePersistentData(l_ptImmediateNotfnHeader->m_cpublishername,
- l_ptImmediateNotfnHeader->m_cnotificationname,
- static_cast<PVOID>(l_pui8Data),
- l_ptImmediateNotfnHeader->m_uimsgsize,
- l_ptImmediateNotfnHeader->m_uidelay,
- l_ptImmediateNotfnHeader->m_uimaxmsglength,
- l_ptImmediateNotfnHeader->m_epersistcategory);
-
- // update corresponding application about data written status.
- if (NULL != l_hReceiverMq) { // LCOV_EXCL_BR_LINE 5: NSFW error case
- NC_ImmediateWriteAck l_tWriteAck = {};
- std::strncpy(l_tWriteAck.notificationName, l_ptImmediateNotfnHeader->m_cnotificationname,
- sizeof(l_tWriteAck.notificationName) - 1);
- l_tWriteAck.eStatus = l_estatus;
-
- if (eFrameworkunifiedStatusOK != (l_estatus = McSend(l_hReceiverMq, AppName, NPS_IMMEDIATE_WRITE_ACK, sizeof(l_tWriteAck), // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- &l_tWriteAck))) {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error Sending NPS_IMMEDIATE_WRITE_ACK to %s for %s, Status: %d",
- l_ptImmediateNotfnHeader->m_cpublishername != 0 ? l_ptImmediateNotfnHeader->m_cpublishername : NULL,
- l_ptImmediateNotfnHeader->m_cnotificationname != 0 ?
- l_ptImmediateNotfnHeader->m_cnotificationname : NULL,
- l_estatus);
- // LCOV_EXCL_STOP
- }
- McClose(l_hReceiverMq);
- l_hReceiverMq = NULL;
- } else {
- // LCOV_EXCL_START 5: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error creating sender handle for service %s, Notification name %s Write Status: %d",
- l_ptImmediateNotfnHeader->m_cpublishername != 0 ? l_ptImmediateNotfnHeader->m_cpublishername : NULL,
- l_ptImmediateNotfnHeader->m_cnotificationname != 0 ?
- l_ptImmediateNotfnHeader->m_cnotificationname : NULL,
- l_estatus);
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 200: m_pui8HeaderAndData can't be null
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Not writing immediate persistence data. Data is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // LCOV_EXCL_STOP
- }
- g_objmutextimerdata.Unlock();
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-/// EOF
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp
deleted file mode 100755
index 8e2bb2d..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification.cpp
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * @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_NS_NPPService
-/// \brief This file contains implementation of CNotification class.
-/// It define functionalities common to all types of notification.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include <native_service/frameworkunified_framework_if.h>
-#include <native_service/ns_message_center_if.h>
-#include <native_service/ns_np_service_protocol.h>
-#include <utility>
-#include <iostream>
-#include <string>
-#include <native_service/ns_mc_system_info.h>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_handlelist.h"
-#include "ns_npp_notification.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CNotification
-/// Constructor of CNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotification::CNotification() { // LCOV_EXCL_START 8: dead code
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_cNotificationName = "";
- m_uiMaxMsgSize = 0;
- m_ePersistentType = eFrameworkunifiedUnknown;
-
- m_cServiceName = "";
-
- m_pmSubscribersList = NULL;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CNotification
-/// Constructor of CNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotification::CNotification(const std::string &f_cnotificationname,
- const UI_32 f_uimaxmsgsize) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_cNotificationName = "";
- m_uiMaxMsgSize = 0;
- m_ePersistentType = eFrameworkunifiedUnknown;
- m_pmSubscribersList = NULL;
-
- if (!f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 200: f_cnotificationname can't be empty
- m_cNotificationName = f_cnotificationname;
- m_uiMaxMsgSize = f_uimaxmsgsize;
-// m_ePersistentType = eFrameworkunifiedUnknown;
-
- m_cServiceName = "";
-
- m_pmSubscribersList = new(std::nothrow) NotifReceiver_Type(); // LCOV_EXCL_BR_LINE 11:unexpected branch
- } else {
- // LCOV_EXCL_START 200: f_cnotificationname can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification String is Empty");
-
- CNotification();
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CNotification
-/// Destructor of CNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotification::~CNotification() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // iterator of CNotificationReceiver map
- NotifReceiver_Iterator_Type l_itNotifReceiver;
-
- CNotificationReceiver *l_pNotificationReceiver = NULL;
-
- if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
- if (!m_pmSubscribersList->empty()) {
- for (l_itNotifReceiver = m_pmSubscribersList->begin();
- l_itNotifReceiver != m_pmSubscribersList->end();
- l_itNotifReceiver++) {
- l_pNotificationReceiver = (*l_itNotifReceiver).second;
-
- if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
- // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
- // is available. To find the reason why it is not implemented, see the function definition.
- // CHandleList *l_hHandleList = CHandleList::GetHandleList();
- // l_hHandleList->RemoveHandleFromList((*l_itNotifReceiver).first);
-
- delete l_pNotificationReceiver; // LCOV_EXCL_BR_LINE 11: unexpected branch
- l_pNotificationReceiver = NULL;
- }
- }
-
- // clear the map
- m_pmSubscribersList->clear();
- }
-
- delete m_pmSubscribersList; // LCOV_EXCL_BR_LINE 11: unexpected branch
- m_pmSubscribersList = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddEventReciever
-/// This function adds the name of the application to receiver list of particular notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::AddEventReciever(const std::string &f_csubscribername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: f_csubscribername can't be empty
- l_estatus = AddReceiverInMap(f_csubscribername);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Publish
-/// This function publishes the notification to subscribed clients.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::Publish(const std::string &f_cservicename,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return eFrameworkunifiedStatusFail;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// DeleteEventReciever
-/// This function deletes the name of application from receivers list.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::DeleteEventReciever(const std::string &f_csubscribername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // iterator of CNotificationReceiver map
- NotifReceiver_Iterator_Type l_iterator;
-
- CNotificationReceiver *l_pNotificationReceiver = NULL;
-
- if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
- l_iterator = m_pmSubscribersList->find(f_csubscribername);
-
-
- if (l_iterator != m_pmSubscribersList->end()) {
- l_pNotificationReceiver = (*l_iterator).second;
-
- if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
- // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
- // is available. To find the reason why it is not implemented, see the function definition.
- // CHandleList *l_hHandleList = CHandleList::GetHandleList();
- // l_hHandleList->RemoveHandleFromList((*l_iterator).first);
-
- delete l_pNotificationReceiver; // LCOV_EXCL_BR_LINE 11: unexpected branch
- l_pNotificationReceiver = NULL;
- }
-
- m_pmSubscribersList->erase(l_iterator);
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Subscriber successfully deleted"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Invalid Iterator");
- }
- } else {
- // LCOV_EXCL_START 6: double check, f_csubscribername can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscriber Name String is Empty");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetNewSubscribersList
-/// This function sets the subscribers list of notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::SetNewSubscribersList(CNotification *f_pnotification) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // iterator of CNotificationReceiver map
- NotifReceiver_Iterator_Type l_itNotifReceiver;
-
- std::string l_cSubscriberName;
-
- if (NULL != f_pnotification && NULL != f_pnotification->m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: f_pnotification and f_pnotification->m_pmSubscribersList can't be empty // NOLINT[whitespace/line_length]
- if (!f_pnotification->m_pmSubscribersList->empty()) {
- for (l_itNotifReceiver = f_pnotification->m_pmSubscribersList->begin();
- l_itNotifReceiver != f_pnotification->m_pmSubscribersList->end();
- l_itNotifReceiver++) {
- l_cSubscriberName = (*l_itNotifReceiver).first;
- AddReceiverInMap(l_cSubscriberName); // LCOV_EXCL_BR_LINE 11: unexpected branch
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscriber List Empty");
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pnotification and f_pnotification->m_pmSubscribersList can't be empty // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetEventPublisher
-/// This function set the publisher name to current received service name
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::SetEventPublisher(const std::string &f_cservicename) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (!f_cservicename.empty()) {
- m_cServiceName = f_cservicename;
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Service successfully set"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service Name String is Empty");
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ResetEventPublisher
-/// This function resets the publisher name
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::ResetEventPublisher(const std::string &f_cservicename) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (f_cservicename.empty()) { // LCOV_EXCL_BR_LINE 6: f_cservicename can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_cservicename can't be empty
- } else {
- if (0 == m_cServiceName.compare(f_cservicename)) {
- m_cServiceName = "";
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Service successfully reset"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service Name Not Registered"); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-EFrameworkunifiedStatus CNotification::AddReceiverInMap(const std::string &f_csubscribername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // Message Queue Handle for passsing messages
- HANDLE l_hMsgSenQueHandle = NULL;
-
- // Pointer to class CNotificationReceiver
- CNotificationReceiver *l_pCNotificationReceiver = NULL;
-
- // Iterator for Notification Receiver map
- NotifReceiver_Iterator_Type l_itrNotifReceiver;
-
- if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: f_csubscribername can't be empty
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Message Queue Handle Set"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- CHandleList *l_hHandleList = CHandleList::GetHandleList();
-
- l_hMsgSenQueHandle = l_hHandleList->GetSubscriberMqHandle(f_csubscribername); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
-
- // If handle not found
- if (NULL == l_hMsgSenQueHandle) {
- // Open a handle for sending messages to another message queue
- l_hMsgSenQueHandle = McOpenSender(f_csubscribername.c_str());
- l_hHandleList->AddHandleInList(f_csubscribername, l_hMsgSenQueHandle); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- }
-
- if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
- l_pCNotificationReceiver = new(std::nothrow) CNotificationReceiver(); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- if (NULL != l_pCNotificationReceiver) { // LCOV_EXCL_BR_LINE 5: l_pCNotificationReceiver can't be NULL
- l_pCNotificationReceiver->m_MsgQHandle = l_hMsgSenQueHandle;
-
- // Insert Subscriber name and associated message queue handle in the map
- m_pmSubscribersList->insert(make_pair(f_csubscribername, l_pCNotificationReceiver));
- } else {
- // LCOV_EXCL_START 5: l_pCNotificationReceiver can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pCNotificationReceiver is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: m_pmSubscribersList can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_pmSubscribersList is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- if (eFrameworkunifiedStatusNullPointer == l_estatus) {
- // close the queue handle
- // NOTE: Uncomment following code when implementation of the function RemoveHandleFromList
- // is available. To find the reason why it is not implemented, see the function definition.
- // CHandleList *l_hHandleList = CHandleList::GetHandleList();
- // l_hHandleList->RemoveHandleFromList(f_csubscribername);
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// PublishData
-/// This function publishes the notification to client.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::PublishData(HANDLE f_hmsgqhandle,
- const PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != f_hmsgqhandle) { // LCOV_EXCL_BR_LINE 6: f_hmsgqhandle can't be NULL
- // Notification Name
- PSTR l_cNotificationName = const_cast<PSTR>(m_cNotificationName.c_str());
-
- if (eFrameworkunifiedStatusOK != (l_estatus = McSendWithSysInfo(f_hmsgqhandle, AppName, NPS_NOTIFY_EV_REQ, l_cNotificationName, f_uimsgsize, f_pmessage, 0))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PublishData failed while McSend for Notification %s, Error Status: 0x%x",
- l_cNotificationName, l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: f_hmsgqhandle can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// IsServiceRegistered
-/// This function checks whether the notification is registered with any service or not.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CNotification::IsServiceRegistered() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (!m_cServiceName.empty()) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// IsSubscribersListEmpty
-/// This function is used to check whether any service is subscribed to notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CNotification::IsSubscribersListEmpty() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pmSubscribersList) { // LCOV_EXCL_BR_LINE 6: m_pmSubscribersList can't be NULL
- if (m_pmSubscribersList->empty()) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetNotificationName
-/// This function is used to get the notification name.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-std::string CNotification::GetNotificationName() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- return m_cNotificationName;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPublisherName
-/// This function is used to get the publisher name of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-std::string CNotification::GetPublisherName() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- return m_cServiceName;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistenceType
-/// This function is used to get the type of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedNotificationType CNotification::GetNotificationType() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- return m_ePersistentType;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetMaxMessageSize
-/// This function is used to get the max size of data of notification message.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-UI_32 CNotification::GetMaxMessageSize() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- return m_uiMaxMsgSize;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ResetMaxMessageSize
-/// This function reset the max size of data that can be published with notification.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotification::ResetMaxMessageSize(const UI_32 f_uilength) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_uiMaxMsgSize = f_uilength;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-#ifdef NPP_PROFILEINFO_ENABLE
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetSubscriberList
-/// Returns the list of subscribers subscribed to notification
-////////////////////////////////////////////////////////////////////////////////////////////////
-NotifReceiver_Type *CNotification::GetSubscriberList() {
- return m_pmSubscribersList;
-}
-
-#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp
deleted file mode 100755
index 73ce838..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_manager.cpp
+++ /dev/null
@@ -1,1558 +0,0 @@
-/*
- * @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 implementation of singleton class CNotificationManager.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include <native_service/ns_np_service.h>
-#include <native_service/ns_message_center_if.h>
-#include <native_service/ns_np_service_protocol.h>
-#include <algorithm>
-#include <utility>
-#include <string>
-#include <vector>
-#include "ns_npp_types.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_threads.h"
-#include "ns_npp_notification.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_state_notification.h"
-#include "ns_npp_regular_notification.h"
-#include "ns_npp_notification_manager.h"
-#include "ns_npp_state_persistence_notification.h"
-#include "ns_npp_state_nor_persistence_notification.h"
-#include "ns_npp_state_persistence_user_notification.h"
-
-#ifdef NPP_PROFILEINFO_ENABLE
-#include <sstream>
-#endif
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CNotificationManager
-/// Constructor of CNotificationManager class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotificationManager::CNotificationManager() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_pmNotificationList = new(std::nothrow) Notification_Type(); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- m_pvPersistentList = new(std::nothrow) std::vector<std::string>(); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- m_pvUserPersistentList = new(std::nothrow) std::vector<std::string>(); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- if (NULL == CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread =
- McOpenSender(NS_NPP_IMMEDIATE_PERSIST_THREAD_NAME);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CNotificationManager
-/// Destructor of CNotificationManager class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotificationManager::~CNotificationManager() { // LCOV_EXCL_START 14: Resident process, global instance not released
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // iterator to find notification from map of notifications
- Notification_Iterator_Type l_itNotification;
-
- CNotification *l_pNotification = NULL;
-
- // delete the members in map of Notification
- if (NULL != m_pmNotificationList) {
- if (!m_pmNotificationList->empty()) {
- for (l_itNotification = m_pmNotificationList->begin();
- l_itNotification != m_pmNotificationList->end();
- l_itNotification++) {
- l_pNotification = (*l_itNotification).second;
-
- if (NULL != l_pNotification) {
- delete l_pNotification;
- l_pNotification = NULL;
- }
- }
-
- // clear the map
- m_pmNotificationList->clear();
- }
-
- delete m_pmNotificationList;
- m_pmNotificationList = NULL;
- }
-
- // delete the members in vector of persistent notification
- if (NULL != m_pvPersistentList) {
- if (!m_pvPersistentList->empty()) {
- // clear the vector
- m_pvPersistentList->clear();
- }
-
- delete m_pvPersistentList;
- m_pvPersistentList = NULL;
- }
-
- // delete the members in vector of user persistent notification
- if (NULL != m_pvUserPersistentList) {
- if (!m_pvUserPersistentList->empty()) {
- // clear the vector
- m_pvUserPersistentList->clear();
- }
-
- delete m_pvUserPersistentList;
- m_pvUserPersistentList = NULL;
- }
-
- if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) {
- McClose(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread);
- CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CreateNotificationObject
-/// This function is used to get notification object from map. If doesn't exists, it create new
-/// object as per type of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotification *CNotificationManager::CreateNotificationObject(const std::string &f_cnotificationname,
- const UI_32 f_uimsglength,
- const EFrameworkunifiedNotificationType f_enotificationtype,
- const UI_32 f_uidelay) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // pointer of notification object
- CNotification *l_pNotification = NULL;
-
- // iterator to find notification from map of CNotification
- Notification_Iterator_Type l_itNotification;
-
- if (NULL == m_pmNotificationList || NULL == m_pvPersistentList || NULL == m_pvUserPersistentList) { // LCOV_EXCL_START 6: double check, m_pmNotificationList, m_pvPersistentList, m_pvUserPersistentList can't be NULL // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map/vector object is NULL"); // LCOV_EXCL_LINE 6: m_pmNotificationList, m_pvPersistentList, m_pvUserPersistentList can't be NULL // NOLINT[whitespace/line_length]
- return NULL;
- }
- // LCOV_EXCL_STOP
-
- // check if notification already exists
- l_itNotification = m_pmNotificationList->find(f_cnotificationname);
-
- // if exists remove previous entry
- if (m_pmNotificationList->end() != l_itNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Removing previous entry of notification %s from map", f_cnotificationname.c_str());
- m_pmNotificationList->erase(l_itNotification);
- }
-
- switch (f_enotificationtype) {
- // if notification is regular notification
- case eFrameworkunifiedNotificationVar: {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Regular Notification :: %s", f_cnotificationname.c_str());
- l_pNotification = new(std::nothrow) CRegularNotification(f_cnotificationname,
- f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- break;
- }
-
- // if notification is state notification
- case eFrameworkunifiedStateVar: {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "State Notification :: %s", f_cnotificationname.c_str());
- l_pNotification = new(std::nothrow) CStateNotification(f_cnotificationname,
- f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- break;
- }
-
- // if notification is persistence notification
- case eFrameworkunifiedPersistedStateVar: {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "PersistedState Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- l_pNotification = new(std::nothrow) CStatePersistenceNotification(f_cnotificationname,
- f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
- // insert notification in persistent notification vector
- m_pvPersistentList->push_back(f_cnotificationname);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory not allocated"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
- }
-
- break;
- }
-
- // if notification is user persistence notification
- case eFrameworkunifiedPersistedStateUserVar: {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "PersistedStateUser Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- l_pNotification = new(std::nothrow) CStatePersistenceUserNotification(f_cnotificationname,
- f_uimsglength); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
- // insert notification in user persistent notification vector
- m_pvUserPersistentList->push_back(f_cnotificationname);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NULL pointer error"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
- }
-
- break;
- }
-
- // if notification is immediate persistence notification
- case eFrameworkunifiedImmediatePersistedStateVar: {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Immediate PersistedState Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- l_pNotification = new(std::nothrow) CStateNorPersistenceNotification(f_cnotificationname,
- f_uimsglength,
- f_uidelay); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- break;
- }
-
- default:
- break;
- }
-
- if (NULL != l_pNotification) {
- // insert notification in notification map
- m_pmNotificationList->insert(make_pair(f_cnotificationname, l_pNotification));
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object creation failed for %s.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pNotification;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SearchNotification
-/// This function is used to search whether notification object is present in map or not.
-/// If present it sends the reference.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotification *CNotificationManager::SearchNotification(const std::string &f_cnotificationname) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
-
- // iterator to find notification from map of notifications
- Notification_Iterator_Type l_itNotification;
-
- if (NULL == m_pmNotificationList || f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 6: double check, m_pmNotificationList can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map pointer is NULL"); // LCOV_EXCL_LINE 6: m_pmNotificationList can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
- } else {
- // check if this notification's object present in map
- l_itNotification = m_pmNotificationList->find(f_cnotificationname);
-
- // if notification found in map
- if (m_pmNotificationList->end() != l_itNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification found in map :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- // get the notification object pointer from map
- l_pNotification = (*l_itNotification).second;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Notification not found :: %s", f_cnotificationname.c_str());
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pNotification;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SearchPersistenceNotification
-/// This function is used to search for the given persistent notification in map.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStateNotification *CNotificationManager::SearchPersistenceNotification(const std::string &f_cnotificationname) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // pointer of notification object
- CNotification *l_pNotification = NULL;
- CStateNotification *l_pStateNotification = NULL;
-
- // search the notification in the map
- l_pNotification = SearchNotification(f_cnotificationname);
-
- if (NULL != l_pNotification) {
- if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType() ||
- eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType() ||
- eFrameworkunifiedImmediatePersistedStateVar == l_pNotification->GetNotificationType()) {
- l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "There is no persistence notification registered with name :: %s",
- f_cnotificationname.c_str());
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pStateNotification;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// 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.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::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) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
-
- if (f_cservicename.empty() || f_cnotificationname.empty()) {
- l_estatus = eFrameworkunifiedStatusInvldParam;
- } else {
- // get the notification object from map or create new object
- l_pNotification = SearchNotification(f_cnotificationname);
-
- // if new notification is registered
- if (NULL == l_pNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Create new notification object :: %s", f_cnotificationname.c_str());
-
- // create the new notification object depending on type and insert in map and vector
- l_pNotification = CreateNotificationObject(f_cnotificationname,
- f_uimsglength,
- f_enotificationtype,
- f_uidelay);
-
- if (NULL != l_pNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Set Notification publisher %s for notification %s", f_cservicename.c_str(),
- f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
-
- // set publisher name
- l_estatus = l_pNotification->SetEventPublisher(f_cservicename);
- }
- } else { // if notification object already exists
- EFrameworkunifiedNotificationType l_eNotificationType = l_pNotification->GetNotificationType();
-
- // <<notification type is eFrameworkunifiedUnknown
- // if some service had already subscribed to the notification before registering it.>>
- if (eFrameworkunifiedUnknown == l_eNotificationType) {
- // creates new notification object depending on the type and insert it in notification map
- l_estatus = ChangeNotificationType(l_pNotification, f_cservicename, f_cnotificationname, f_uimsglength,
- f_enotificationtype, f_uidelay);
-
- // delete the old notification object
- delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
- l_pNotification = NULL;
- } else { // notification is already registered by some service
- // update the notification property, if re-registered by the same publisher
- if (f_cservicename == l_pNotification->GetPublisherName() || // if re-register by service
- "" == l_pNotification->GetPublisherName()) { // if previously unregistered by service
- // if type is same just update the length of notification data
- if (l_eNotificationType == f_enotificationtype) {
- if (l_pNotification->GetMaxMessageSize() != f_uimsglength) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Updating max size of notification %s to %d from %d", f_cnotificationname.c_str(),
- f_uimsglength, l_pNotification->GetMaxMessageSize());
- l_estatus = l_pNotification->ResetMaxMessageSize(f_uimsglength);
- }
-
- if ("" == l_pNotification->GetPublisherName()) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Updating publisher name of notification %s to %s from %s", f_cservicename.c_str(),
- f_cnotificationname.c_str(), l_pNotification->GetPublisherName().c_str());
- l_pNotification->SetEventPublisher(f_cservicename);
- }
- } else if (eFrameworkunifiedImmediatePersistedStateVar != l_eNotificationType &&
- eFrameworkunifiedImmediatePersistedStateVar != f_enotificationtype) {
- // else create new notification object depending on the type and delete the old one
- // note: do not change immediate notification type
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing type of notfn %s from %d to %d", f_cnotificationname.c_str(),
- l_eNotificationType, f_enotificationtype);
-
- std::vector<std::string>::iterator l_itNotificationName;
-
- // remove the notification name from the persistent list of notification(if any)
- if (eFrameworkunifiedPersistedStateVar == l_eNotificationType) {
- l_itNotificationName = find(m_pvPersistentList->begin(), m_pvPersistentList->end(), f_cnotificationname);
-
- if (m_pvPersistentList->end() != l_itNotificationName) {
- m_pvPersistentList->erase(l_itNotificationName);
- }
- } else if (eFrameworkunifiedPersistedStateUserVar == l_eNotificationType) {
- l_itNotificationName = find(m_pvUserPersistentList->begin(),
- m_pvUserPersistentList->end(),
- f_cnotificationname);
-
- if (m_pvUserPersistentList->end() != l_itNotificationName) {
- m_pvUserPersistentList->erase(l_itNotificationName);
- }
- } else {
- // do nothing
- }
-
- // creates new notification object depending on the new type and insert it in map and delete the old one
- l_estatus = ChangeNotificationType(l_pNotification, f_cservicename, f_cnotificationname, f_uimsglength,
- f_enotificationtype, f_uidelay);
-
- // delete the old notification object
- delete l_pNotification;
- l_pNotification = NULL;
- } else {
- // do nothing
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notfn: %s already registered by %s, skipping register request by %s",
- f_cnotificationname.c_str(), l_pNotification->GetPublisherName().c_str(), f_cservicename.c_str());
-
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ChangeNotificationType
-/// This function creates new notification object depending on the type and replaces the old one.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::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) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNewNotification = NULL;
-
- if (NULL != f_pnotification) { // LCOV_EXCL_BR_LINE 6: f_pnotification can't be NULL
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Create New Notification :: %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- // create new notification object as per notification type
- l_pNewNotification = CreateNotificationObject(f_cnotificationname, f_uimsglength, f_enotificationtype, f_uidelay);
-
- if (NULL != l_pNewNotification) {
- l_estatus = l_pNewNotification->SetEventPublisher(f_cservicename);
-
- // assign subscribers list to newly created notification
- l_pNewNotification->SetNewSubscribersList(f_pnotification);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error creating notification object for notification:%s",
- f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pnotification can't be NULL
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceServiceOnUnRegisterEvents
-/// This function removes the name of the service from the notification object.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnUnRegisterEvents(const std::string &f_cservicename,
- const std::string &f_cnotificationname) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
- std::vector<std::string> *l_pvPersistentList = NULL;
-
- // iterator to find notification from map of notifications
- Notification_Iterator_Type l_itNotification;
-
- if (f_cservicename.empty() || f_cnotificationname.empty()) {
- l_estatus = eFrameworkunifiedStatusInvldParam;
- } else {
- // check if this notification's object present in map
- l_itNotification = m_pmNotificationList->find(f_cnotificationname);
-
- // if notification found in map
- if (m_pmNotificationList->end() != l_itNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification found in map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- // get the notification object pointer from map
- l_pNotification = (*l_itNotification).second;
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: f_pnotification can't be NULL
- if (eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType()) {
- l_pvPersistentList = m_pvUserPersistentList;
- } else if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType()) {
- l_pvPersistentList = m_pvPersistentList;
- }
-
- // reset the publisher name
- l_estatus = l_pNotification->ResetEventPublisher(f_cservicename);
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- // if no other service is subscribed to this notification and no service is registered
- // to this notification remove the notification object from map
- if (!l_pNotification->IsServiceRegistered() &&
- l_pNotification->IsSubscribersListEmpty()) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Deleting Notification Object"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- // delete the notification
- delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
- l_pNotification = NULL;
-
- m_pmNotificationList->erase(l_itNotification);
-
- if (l_pvPersistentList) {
- // find the notification in vector
- std::vector<std::string>::iterator l_itNotificationName;
-
- l_itNotificationName = find(l_pvPersistentList->begin(),
- l_pvPersistentList->end(),
- f_cnotificationname);
-
- if (l_pvPersistentList->end() != l_itNotificationName) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification name from vector");
- l_pvPersistentList->erase(l_itNotificationName);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Persistent list empty"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Services still registered or subscriber list empty"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s is not registered by service %s",
- f_cnotificationname.c_str(), f_cservicename.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 6: f_pnotification can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not registered", f_cnotificationname.c_str());
-
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceServiceOnPublishEvent
-/// This function stores the published data in the notification object in case of state and
-/// persistent notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnPublishEvent(const std::string &f_cservicename,
- const std::string &f_cnotificationname,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
-
- if (f_cservicename.empty() || f_cnotificationname.empty()) { // LCOV_EXCL_BR_LINE 6: f_cservicename and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_cservicename and f_cnotificationname can't be empty
- } else {
- // get the notification object from map
- l_pNotification = SearchNotification(f_cnotificationname);
-
- if (NULL != l_pNotification) {
- // publish the notification
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pNotification->Publish(f_cservicename,
- f_pmessage,
- f_uimsgsize))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error publishing notification %s published by %s, status: %d",
- f_cnotificationname.c_str(), f_cservicename.c_str(), l_estatus); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification not registered"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
- }
-
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceServiceOnSubscribeToEvent
-/// This function adds the name of the application to subscribers list in notification object.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnSubscribeToEvent(const std::string &f_csubscribername,
- const std::string &f_cnotificationname) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // iterator to find notification from map of notifications
- Notification_Iterator_Type l_itNotification;
-
- CNotification *l_pNotification = NULL;
-
- if (f_cnotificationname.empty() || f_csubscribername.empty()) {
- l_estatus = eFrameworkunifiedStatusInvldParam;
- } else if (NULL == m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6 m_pmNotificationList can't be NULL
- // LCOV_EXCL_START 6: m_pmNotificationList can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map pointer is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- } else {
- // get the notification object from map or create new object
- l_pNotification = SearchNotification(f_cnotificationname);
-
- if (NULL == l_pNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "CNotification object created for %s", f_cnotificationname.c_str());
-
- l_pNotification = new(std::nothrow) CNotification(f_cnotificationname, 0); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
-
- m_pmNotificationList->insert(make_pair(f_cnotificationname, l_pNotification));
- }
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotification can't be NULL
- // add subscribers name in subscribers list of notification
- l_estatus = l_pNotification->AddEventReciever(f_csubscribername);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory not allocated for l_pNotification"); // LCOV_EXCL_LINE 6: double check, l_pNotification can't be NULL // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceServiceOnUnSubscribeFromEvent
-/// This function removes the name of the application from the subscribers list in notification object.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnUnSubscribeFromEvent(const std::string &f_csubscribername,
- const std::string &f_cnotificationname) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
-
- // iterator to find notification from map of notifications
- Notification_Iterator_Type l_itNotificationType;
-
- std::vector<std::string> *l_pvPersistentList = NULL;
-
- if (f_cnotificationname.empty() || f_csubscribername.empty()) {
- l_estatus = eFrameworkunifiedStatusInvldParam;
- } else if (NULL == m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6: m_pmNotificationList can't be NULL
- // LCOV_EXCL_START 6: m_pmNotificationList can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification list pointer is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- } else {
- // check if this notification's object present in map
- l_itNotificationType = m_pmNotificationList->find(f_cnotificationname);
-
- // if notification found in map
- if (m_pmNotificationList->end() != l_itNotificationType) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Notification %s found in map", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- l_pNotification = (*l_itNotificationType).second;
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
- if (eFrameworkunifiedPersistedStateUserVar == l_pNotification->GetNotificationType()) {
- l_pvPersistentList = m_pvUserPersistentList;
- } else if (eFrameworkunifiedPersistedStateVar == l_pNotification->GetNotificationType()) {
- l_pvPersistentList = m_pvPersistentList;
- }
-
- // removes the subscribers name from subscribers list of notification
- l_estatus = l_pNotification->DeleteEventReciever(f_csubscribername);
-
- // if no other service is subscribed to this notification and no service is registered
- // to this notification remove the notification object from map
- if (!l_pNotification->IsServiceRegistered() &&
- l_pNotification->IsSubscribersListEmpty()) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification Object from map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- // delete notification object from map
- delete l_pNotification; // LCOV_EXCL_BR_LINE 11: unexpected branch
- l_pNotification = NULL;
-
- m_pmNotificationList->erase(l_itNotificationType);
-
- if (l_pvPersistentList) {
- // find notification in vector
- std::vector<std::string>::iterator l_itNotificationName;
- l_itNotificationName = find(l_pvPersistentList->begin(),
- l_pvPersistentList->end(),
- f_cnotificationname);
-
- if (l_pvPersistentList->end() != l_itNotificationName) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification from vector"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- l_pvPersistentList->erase(l_itNotificationName);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Persistent list Empty."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotification can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Notification %s not registered", f_cnotificationname.c_str());
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NPGetPersistentNotificationData
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NPGetPersistentNotificationData(const std::string &f_cnotificationname,
- PVOID f_pnotificationdata,
- const UI_32 f_uidatasize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
- CStateNotification *l_pStateNotification = NULL;
- const CPersistentData *l_pPersistentData = NULL;
-
- if (f_cnotificationname.empty() || NULL == f_pnotificationdata) { // LCOV_EXCL_BR_LINE 6: f_pnotificationdata can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_pnotificationdata can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
- } else {
- l_pNotification = SearchNotification(f_cnotificationname);
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 200: f_cnotificationname must be NTFY_NPPService_UserChange, NTFY_NPPService_UserChange must be registered in FrameworkunifiedOnEntry() by itself. // NOLINT[whitespace/line_length]
- const EFrameworkunifiedNotificationType l_eNotificationType = l_pNotification->GetNotificationType();
-
- if (eFrameworkunifiedStateVar == l_eNotificationType ||
- eFrameworkunifiedPersistedStateVar == l_eNotificationType ||
- eFrameworkunifiedPersistedStateUserVar == l_eNotificationType ||
- eFrameworkunifiedImmediatePersistedStateVar == l_eNotificationType) { // LCOV_EXCL_BR_LINE 200: NTFY_NPPService_UserChange's type is eFrameworkunifiedPersistedStateVar. // NOLINT[whitespace/line_length]
- l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
-
- l_pPersistentData = l_pStateNotification->GetPersistentData();
-
- if (NULL != l_pPersistentData) {
- if (f_uidatasize >= l_pPersistentData->m_uiMsgSize) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data Size %d", l_pPersistentData->m_uiMsgSize);
-
- if (NULL != l_pPersistentData->m_pMessage) {
- std::memcpy(f_pnotificationdata, l_pPersistentData->m_pMessage, l_pPersistentData->m_uiMsgSize);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification data is NULL");
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Smaller buffer size %d is received for notification data of size %d", f_uidatasize,
- l_pPersistentData->m_uiMsgSize);
- }
- } else {
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Persistent data object is NULL for notification %s", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 200: NTFY_NPPService_UserChange's type is eFrameworkunifiedPersistedStateVar.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Get notification data failed, Notification %s is registered as type %d",
- f_cnotificationname.c_str(), l_eNotificationType);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 200: f_cnotificationname must be NTFY_NPPService_UserChange, NTFY_NPPService_UserChange must be registered in FrameworkunifiedOnEntry() by itself. // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found.", f_cnotificationname.c_str());
- // LCOV_EXCL_STOP
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceServiceOnGetPersistentData
-/// This function is used to get the persistent data stored related to notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceServiceOnGetPersistentData(const std::string &f_cnotificationname,
- const std::string &f_creceivername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
- CStateNotification *l_pStateNotification = NULL;
- const CPersistentData *l_pPersistentData = NULL;
-
- if (f_cnotificationname.empty() || f_creceivername.empty()) { // LCOV_EXCL_BR_LINE 6: f_creceivername can't be NULL and f_cnotificationname can't be empty // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: f_creceivername can't be NULL and f_cnotificationname can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- } else {
- // open the receiver message queue
- HANDLE l_hReceiverMq = McOpenSender(f_creceivername.c_str());
-
- if (NULL == l_hReceiverMq) { // LCOV_EXCL_BR_LINE 4: NSFW error case
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- // catastrophic failure!
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to open MessageQ %s ", f_creceivername.c_str());
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- // get the notification object from map or create new object
- l_pNotification = SearchNotification(f_cnotificationname);
-
- if (NULL != l_pNotification) {
- l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
-
- if (NULL != l_pStateNotification) { // LCOV_EXCL_BR_LINE 5: fail safe for static_cast<CStateNotification *>
- l_pPersistentData = l_pStateNotification->GetPersistentData();
-
- if (NULL != l_pPersistentData) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data Size %d", l_pPersistentData->m_uiMsgSize);
-
- if (NULL == l_pPersistentData->m_pMessage) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending Data is NULL");
- }
-
- // sent the notification data to requester
- l_estatus = McSend(l_hReceiverMq,
- AppName,
- NPS_GET_PERS_DATA_ACK,
- l_pPersistentData->m_uiMsgSize,
- l_pPersistentData->m_pMessage);
- FRAMEWORKUNIFIEDLOG(ZONE_PRD_INFO2, __FUNCTION__, "Persistent data found for notification %s. "
- "Sent NPS_GET_PERS_DATA_ACK to %s. Status: %d."
- , f_cnotificationname.c_str(), f_creceivername.c_str(), l_estatus);
- } else { // In case of failure, we send back a failure ACK
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No persistent data found for notification %s. "
- , f_cnotificationname.c_str());
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not found", f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
- // Close the mq handle
- McClose(l_hReceiverMq);
- l_hReceiverMq = NULL;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceGetPersistentNotificationData
-/// This function is used to get the list of persistent notifications and data associated with it.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceGetPersistentNotificationData(std::vector<CNotificationsToPersist *>
- *f_pvpersistnotification,
- const EFrameworkunifiedNotificationType f_enotificationtype,
- UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
- CStateNotification *l_pStateNotification = NULL;
- CStatePersistenceNotification *l_pStatePersistenceNotification = NULL;
-
- std::string l_cNotificationName = "";
- CNotificationsToPersist *l_pNotificationsToPersist = NULL;
- const CPersistentData *l_pPData = NULL;
-
- std::vector<std::string> *l_pvPersistentList = NULL;
-
- // iterator for retrieving notifications from map of notifications
- Notification_Iterator_Type l_itNotification;
-
- if (eFrameworkunifiedPersistedStateUserVar == f_enotificationtype) {
- l_pvPersistentList = m_pvUserPersistentList;
- } else if (eFrameworkunifiedPersistedStateVar == f_enotificationtype) { // LCOV_EXCL_BR_LINE 6: f_enotificationtype must be eFrameworkunifiedPersistedStateUserVar or eFrameworkunifiedPersistedStateVar // NOLINT[whitespace/line_length]
- l_pvPersistentList = m_pvPersistentList;
- }
-
- // copy all the notification data in map to received vector
- if (NULL != f_pvpersistnotification && NULL != l_pvPersistentList) { // LCOV_EXCL_BR_LINE 6: f_pvpersistnotification and l_pvPersistentList can't be null // NOLINT[whitespace/line_length]
- for (UI_32 l_uiCount = 0;
- l_uiCount < l_pvPersistentList->size();
- l_uiCount++) {
- // get the persistent notification name from vector
- l_cNotificationName = l_pvPersistentList->at(l_uiCount);
-
- // search for notification in map
- l_itNotification = m_pmNotificationList->find(l_cNotificationName);
-
- // notification found in map
- if (m_pmNotificationList->end() != l_itNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Persistent Notification: %s", l_cNotificationName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- // get notification object from map
- l_pNotification = (*l_itNotification).second;
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
- if (eFrameworkunifiedPersistedStateVar == f_enotificationtype) {
- l_pStatePersistenceNotification = static_cast<CStatePersistenceNotification *>(l_pNotification);
-
- // get the notification's default data
- if ((eFrameworkunifiedUserData == l_pStatePersistenceNotification->GetPersistentCategory() &&
- (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedUserData)) ||
- (eFrameworkunifiedFactoryData == l_pStatePersistenceNotification->GetPersistentCategory() &&
- (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedFactoryData)) ||
- (eFrameworkunifiedFactoryCustomerData == l_pStatePersistenceNotification->GetPersistentCategory() &&
- (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedFactoryCustomerData)) ||
- (eFrameworkunifiedDealerData == l_pStatePersistenceNotification->GetPersistentCategory() &&
- (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedDealerData))) {
- l_pPData = l_pStatePersistenceNotification->GetDefaultPersistentData();
- } else {
- l_pStateNotification = l_pStatePersistenceNotification;
-
- // get the published notification data
- if (l_pStateNotification->IsPublished()) {
- l_pPData = l_pStateNotification->GetPersistentData();
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification not published");
- }
- }
- } else {
- l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
-
- // if not to reset userdata
- if (0 == (f_uinotificationpersistentservicepersistcategoryflag & eFrameworkunifiedUserData)) {
- if (l_pStateNotification->IsPublished()) {
- l_pPData = l_pStateNotification->GetPersistentData();
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification not published");
- }
- }
- }
-
- if ((NULL != l_pStateNotification) && (NULL != l_pPData)) {
- l_pNotificationsToPersist = CreateNotificationObjectToPersist(l_pStateNotification, l_pPData); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
-
- // insert the persistent data in map
- f_pvpersistnotification->push_back(l_pNotificationsToPersist); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- l_pPData = NULL;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "no data is stored in notification %s", l_cNotificationName.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object is NULL for %s", l_cNotificationName.c_str()); // LCOV_EXCL_LINE 6: l_pNotification can't be NULL // NOLINT[whitespace/line_length]
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Non Persistent Notification: %s", l_cNotificationName.c_str());
- }
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 6: f_pvpersistnotification and l_pvPersistentList can't be null // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CreateNotificationObjectToPersist
-/// Creates the CNotificationsToPersist object from notification object and the persistent data.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotificationsToPersist *CNotificationManager::CreateNotificationObjectToPersist(CStateNotification
- *f_pStateNotification,
- const CPersistentData *f_pdata) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotificationsToPersist *l_pNotificationsToPersist = NULL;
- CPersistentData *l_pData = NULL;
-
- if (NULL != f_pStateNotification && NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: f_pStateNotification and f_pdata can't be NULL // NOLINT[whitespace/line_length]
- if (f_pStateNotification->GetMaxMessageSize() >= f_pdata->m_uiMsgSize) {
- l_pNotificationsToPersist = new(std::nothrow) CNotificationsToPersist(); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
-
- if (NULL != l_pNotificationsToPersist) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
- l_pNotificationsToPersist->m_pPersistentData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- l_pData = l_pNotificationsToPersist->m_pPersistentData;
-
- if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
- l_pNotificationsToPersist->m_cNotificationName = f_pStateNotification->GetNotificationName();
- l_pNotificationsToPersist->m_uiMaxMsgLength = f_pStateNotification->GetMaxMessageSize();
- l_pNotificationsToPersist->m_ePersistentType = f_pStateNotification->GetNotificationType();
-
- if (eFrameworkunifiedPersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) {
- l_pNotificationsToPersist->m_ePersistCategory = (static_cast<CStatePersistenceNotification *>
- (f_pStateNotification))->GetPersistentCategory();
- }
-
- l_pNotificationsToPersist->m_cPublisherName = f_pStateNotification->GetPublisherName();
-
- l_pData->m_uiMsgSize = f_pdata->m_uiMsgSize;
- l_pData->m_pMessage = new(std::nothrow) CHAR[l_pNotificationsToPersist->m_uiMaxMsgLength];
-
- if (NULL != l_pData->m_pMessage) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
- std::memset(l_pData->m_pMessage, 0, l_pNotificationsToPersist->m_uiMaxMsgLength);
- std::memcpy(l_pData->m_pMessage, f_pdata->m_pMessage, f_pdata->m_uiMsgSize);
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "memory not allocated for l_pNotificationsToPersist"); // LCOV_EXCL_LINE 5: It's impossible to mock new() function // NOLINT[whitespace/line_length]
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error persisting notfn, Data size of notification %s is %d greater than max registered size %d",
- f_pStateNotification->GetNotificationName().c_str(),
- f_pdata->m_uiMsgSize, f_pStateNotification->GetMaxMessageSize());
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid parameter received"); // LCOV_EXCL_LINE 6: f_pStateNotification and f_pdata can't be NULL // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_pNotificationsToPersist;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSetPersistentNotificationData
-/// This function is used to create the persistent notifications object and fill the data related
-/// with it on system load.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetPersistentNotificationData(std::vector<CNotificationsToPersist *>
- *f_pvpersistnotification) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CStateNotification *l_pNotification = NULL;
- CNotificationsToPersist *l_pNotificationsToPersist = NULL;
-
- std::vector<std::string> *l_pvPersistentList = NULL;
-
- Persistent_Iterator_Type l_itPersistentData;
-
- // store all the notification data received in vector to map of CNotification and to vector of
- // persistent notification in case of persistent and user persistent notification
- if (NULL != f_pvpersistnotification) { // LCOV_EXCL_BR_LINE 6: double check, f_pvpersistnotification can't be NULL
- for (UI_32 l_uiCount = 0;
- l_uiCount < f_pvpersistnotification->size();
- l_uiCount++) {
- // get the persistent data object
- l_pNotificationsToPersist = f_pvpersistnotification->at(l_uiCount);
-
- if (NULL != l_pNotificationsToPersist) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotificationsToPersist can't be NULL // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Persistent Type %d", l_pNotificationsToPersist->m_ePersistentType);
-
- if (eFrameworkunifiedPersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentState Notification");
-
- l_pNotification = new(std::nothrow) CStatePersistenceNotification(
- l_pNotificationsToPersist->m_cNotificationName,
- l_pNotificationsToPersist->m_uiMaxMsgLength,
- l_pNotificationsToPersist->m_ePersistCategory);
-
- l_pvPersistentList = m_pvPersistentList;
- } else if (eFrameworkunifiedPersistedStateUserVar == l_pNotificationsToPersist->m_ePersistentType) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentStateUser Notification");
-
- l_pNotification = new(std::nothrow) CStatePersistenceUserNotification(
- l_pNotificationsToPersist->m_cNotificationName,
- l_pNotificationsToPersist->m_uiMaxMsgLength);
-
- l_pvPersistentList = m_pvUserPersistentList;
- } else if (eFrameworkunifiedImmediatePersistedStateVar == l_pNotificationsToPersist->m_ePersistentType) { // LCOV_EXCL_BR_LINE 6: l_pNotificationsToPersist->m_ePersistentType must be eFrameworkunifiedPersistedStateVar, eFrameworkunifiedPersistedStateUserVar, eFrameworkunifiedImmediatePersistedStateVar // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "PersistentStateUser Notification");
-
- l_pNotification = new(std::nothrow) CStateNorPersistenceNotification(
- l_pNotificationsToPersist->m_cNotificationName,
- l_pNotificationsToPersist->m_uiMaxMsgLength,
- l_pNotificationsToPersist->m_uiDelay,
- l_pNotificationsToPersist->m_ePersistCategory);
- }
-
- if (NULL != l_pNotification) { // LCOV_EXCL_BR_LINE 6: l_pNotification can't be NULL
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Insert persistent notification object in map");
-
- l_pNotification->SetPersistentData(l_pNotificationsToPersist->m_pPersistentData->m_pMessage,
- l_pNotificationsToPersist->m_pPersistentData->m_uiMsgSize);
-
- l_pNotification->SetEventPublisher(l_pNotificationsToPersist->m_cPublisherName);
-
- if (NULL != m_pmNotificationList) { // LCOV_EXCL_BR_LINE 6: double check, m_pmNotificationList can't be NULL
- m_pmNotificationList->insert(make_pair(l_pNotificationsToPersist->m_cNotificationName, l_pNotification));
-
- if (NULL != l_pvPersistentList) {
- l_pvPersistentList->push_back(l_pNotificationsToPersist->m_cNotificationName);
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Inserted persistent notification object in map");
- }
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Inserted persistent notification object in vector");
- } else {
- // LCOV_EXCL_START 6: double check, m_pmNotificationList can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- delete l_pNotification;
- l_pNotification = NULL;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object not inserted in map/vector");
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotification can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "notification object is NULL");
-
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_pNotificationsToPersist can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationsToPersist is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- // LCOV_EXCL_START 6: double check, f_pvpersistnotification can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent data pointer is NULL");
-
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// RemoveUserSpecificNotificationEntry
-/// This function is used to remove the user persistent notifications entry
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::RemoveUserSpecificNotificationEntry() { // LCOV_EXCL_START 100: never be used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- std::string l_cNotificationName;
-
- std::vector<std::string>::iterator l_itNotificationName;
-
- // iterator to find notification from map of notifications
- Notification_Iterator_Type l_itNotification;
-
- CNotification *l_pNotification = NULL;
-
- for (l_itNotificationName = m_pvUserPersistentList->begin() ; l_itNotificationName < m_pvUserPersistentList->end() ;
- l_itNotificationName++) {
- l_cNotificationName = *(l_itNotificationName);
-
- // check if this notification's object present in map
- l_itNotification = m_pmNotificationList->find(l_cNotificationName);
-
- if (m_pmNotificationList->end() != l_itNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification found in map");
-
- // get the notification object pointer from map
- l_pNotification = (*l_itNotification).second;
-
- if (NULL != l_pNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification Object");
-
- // delete the notification
- delete l_pNotification;
- l_pNotification = NULL;
-
- m_pmNotificationList->erase(l_itNotification);
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Deleting Notification name from vector");
- m_pvUserPersistentList->erase(l_itNotificationName);
-
- l_itNotificationName = m_pvUserPersistentList->begin();
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification not found.");
-
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-EFrameworkunifiedStatus CNotificationManager::GetNotificationInfo(const std::string &f_cnotificationname, // LCOV_EXCL_START 100: never be used // NOLINT[whitespace/line_length]
- CNotificationsToPersist *&f_pnotificationstopersist) {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification *l_pNotification = NULL;
- CStateNotification *l_pStateNotification = NULL;
- const CPersistentData *l_pPData = NULL;
-
- l_pNotification = SearchNotification(f_cnotificationname);
- l_pStateNotification = static_cast<CStateNotification *>(l_pNotification);
-
- if (NULL != l_pStateNotification) {
- if (l_pStateNotification->IsPublished()) {
- l_pPData = l_pStateNotification->GetPersistentData();
-
- if (NULL != l_pPData) {
- f_pnotificationstopersist = new(std::nothrow) CNotificationsToPersist();
-
- if (NULL == f_pnotificationstopersist) {
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for f_pnotificationstopersist");
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- f_pnotificationstopersist->m_pPersistentData = new(std::nothrow) CPersistentData();
-
- if (NULL == f_pnotificationstopersist->m_pPersistentData) {
- l_estatus = eFrameworkunifiedStatusNullPointer;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error for f_pnotificationstopersist->m_pPersistentData");
- }
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- f_pnotificationstopersist->m_cNotificationName = l_pStateNotification->GetNotificationName();
- f_pnotificationstopersist->m_uiMaxMsgLength = l_pStateNotification->GetMaxMessageSize();
- f_pnotificationstopersist->m_cPublisherName = l_pStateNotification->GetPublisherName();
- f_pnotificationstopersist->m_ePersistentType = l_pStateNotification->GetNotificationType();
-
- if (eFrameworkunifiedPersistedStateVar == f_pnotificationstopersist->m_ePersistentType) {
- f_pnotificationstopersist->m_ePersistCategory = (static_cast<CStatePersistenceNotification *>
- (l_pStateNotification))->GetPersistentCategory();
- }
-
- if (eFrameworkunifiedImmediatePersistedStateVar == f_pnotificationstopersist->m_ePersistentType) {
- CStateNorPersistenceNotification *l_pStateNorPersistenceNotification =
- static_cast<CStateNorPersistenceNotification *>(l_pStateNotification);
- f_pnotificationstopersist->m_uiDelay = l_pStateNorPersistenceNotification->GetPersistenceDelay();
- f_pnotificationstopersist->m_ePersistCategory = (static_cast<CStateNorPersistenceNotification *>
- (l_pStateNotification))->GetPersistentCategory();
- }
-
- f_pnotificationstopersist->m_pPersistentData->m_pMessage = new(std::nothrow)
- CHAR[f_pnotificationstopersist->m_uiMaxMsgLength];
- std::memset(f_pnotificationstopersist->m_pPersistentData->m_pMessage, 0,
- f_pnotificationstopersist->m_uiMaxMsgLength);
- std::memcpy(f_pnotificationstopersist->m_pPersistentData->m_pMessage,
- l_pPData->m_pMessage, l_pPData->m_uiMsgSize);
-
- f_pnotificationstopersist->m_pPersistentData->m_uiMsgSize = l_pPData->m_uiMsgSize;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No data is stored in notification %s", f_cnotificationname.c_str());
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notification %s not published", f_cnotificationname.c_str());
- }
- } else {
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSetDefaultPersistentNotificationData
-/// This function is used to set the default data of persistent notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetDefaultPersistentNotificationData(const std::string &f_cnotificationname,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // pointer of notification object
- CStateNotification *l_pStateNotification = SearchPersistenceNotification(f_cnotificationname);
-
- if (NULL != l_pStateNotification) {
- l_estatus = l_pStateNotification->SetDefaultPersistentData(f_pmessage, f_uimsgsize);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to set default notification data for %s, notification does not exists",
- f_cnotificationname.c_str());
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSetPersistentCategory
-/// This function is used to set the persistent type of persistent notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentserviceSetPersistentCategory(const std::string &f_cnotificationname,
- const EFrameworkunifiedPersistCategory f_epersistcategory) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // pointer of notification object
- CStateNotification *l_pStateNotification = SearchPersistenceNotification(f_cnotificationname);
-
- if (NULL != l_pStateNotification) {
- EFrameworkunifiedNotificationType l_eNotificationType = l_pStateNotification->GetNotificationType();
-
- if (eFrameworkunifiedPersistedStateVar == l_eNotificationType) {
- l_estatus = (static_cast<CStatePersistenceNotification *>(l_pStateNotification))->SetPersistentCategory(
- f_epersistcategory);
- } else if (eFrameworkunifiedImmediatePersistedStateVar == l_eNotificationType) {
- l_estatus = (static_cast<CStateNorPersistenceNotification *>(l_pStateNotification))->SetPersistentCategory(
- f_epersistcategory);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Cannot set category %d for notification %s of type %d", f_epersistcategory,
- f_cnotificationname.c_str(), l_eNotificationType);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Cannot set category %d for %s, Either not registered or not a persistent notification",
- f_epersistcategory, f_cnotificationname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// 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.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CNotificationManager::NotificationpersistentservicePublishImmediateNotification(const std::string &f_cservicename,
- const std::string &f_cnotificationname,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (f_cservicename.empty() || f_cnotificationname.empty()) {
- l_estatus = eFrameworkunifiedStatusInvldParam;
- } else {
- // get the notification object from map
- CStateNotification *l_pStateNotf = SearchPersistenceNotification(f_cnotificationname);
-
- if (NULL != l_pStateNotf) {
- if (eFrameworkunifiedImmediatePersistedStateVar == l_pStateNotf->GetNotificationType()) {
- CStateNorPersistenceNotification *l_pImmediateNotf =
- static_cast<CStateNorPersistenceNotification *>(l_pStateNotf);
-
- // publish the notification
- if (eFrameworkunifiedStatusOK != (l_estatus = l_pImmediateNotf->PublishNotification(f_cservicename,
- f_pmessage,
- f_uimsgsize))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error publishing notification %s published by %s, status: %d",
- f_cnotificationname.c_str(), f_cservicename.c_str(), l_estatus);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s is not registered as immediate persistence by service %s",
- f_cnotificationname.c_str(), f_cservicename.c_str());
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification %s not registered by service %s", f_cnotificationname.c_str(),
- f_cservicename.c_str());
-
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-#ifdef NPP_PROFILEINFO_ENABLE
-
-EFrameworkunifiedStatus CNotificationManager::GetNotificationProfilingData(std::string &f_cnotificationprofileInfo) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- Notification_Iterator_Type l_itNotification;
- NotifReceiver_Iterator_Type l_itNotifReceiver_Iterator;
-
- CNotification *l_pNotification = NULL;
- NotifReceiver_Type *l_pSubscriberList = NULL;
-
- std::stringstream ss;
- UI_32 l_uiSubscriberCnt = 0;
-
- std::string l_cPublisher = "";
- std::string l_cNotification = "";
-
- try {
- if (NULL == m_pmNotificationList) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification List m_pmNotificationList is NULL in notification manager");
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus && m_pmNotificationList->empty()) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification List m_pmNotificationList Empty in notification manager");
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- f_cnotificationprofileInfo.append("Application Name,");
- f_cnotificationprofileInfo.append("Notification Name,");
- f_cnotificationprofileInfo.append("Type,");
- f_cnotificationprofileInfo.append("Length,");
- f_cnotificationprofileInfo.append("Subscribed By,");
- f_cnotificationprofileInfo.append("Subscribers Count");
-
- for (l_itNotification = m_pmNotificationList->begin();
- l_itNotification != m_pmNotificationList->end();
- l_itNotification++) {
- l_pNotification = (*l_itNotification).second;
- if (NULL == l_pNotification) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification object ptr is NULL");
- l_estatus = eFrameworkunifiedStatusFail;
- } else {
- l_cPublisher = l_pNotification->GetPublisherName();
- if (l_cPublisher.empty()) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Publisher name empty");
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- l_cNotification = l_pNotification->GetNotificationName();
- if (l_cNotification.empty()) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification name empty");
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- l_pSubscriberList = l_pNotification->GetSubscriberList();
- if (NULL == l_pSubscriberList) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Subscribers List ptr is NULL");
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) {
- f_cnotificationprofileInfo.append("\n");
-
- f_cnotificationprofileInfo.append(l_cPublisher);
- f_cnotificationprofileInfo.append(",");
-
- f_cnotificationprofileInfo.append(l_cNotification);
- f_cnotificationprofileInfo.append(",");
-
- switch (l_pNotification->GetNotificationType()) {
- case eFrameworkunifiedNotificationVar : {
- f_cnotificationprofileInfo.append("Regular");
- }
- break;
-
- case eFrameworkunifiedStateVar : {
- f_cnotificationprofileInfo.append("State");
- }
- break;
-
- case eFrameworkunifiedPersistedStateVar : {
- f_cnotificationprofileInfo.append("PersistenceState");
- }
- break;
-
- case eFrameworkunifiedPersistedStateUserVar : {
- f_cnotificationprofileInfo.append("UserPersistenceState");
- }
- break;
-
- case eFrameworkunifiedImmediatePersistedStateVar : {
- f_cnotificationprofileInfo.append("ImmediatePersistenceState");
- }
- break;
-
- case eFrameworkunifiedUnknown: {
- f_cnotificationprofileInfo.append("Unknown");
- }
- break;
-
- default:
- break;
- }
- f_cnotificationprofileInfo.append(",");
-
- ss << l_pNotification->GetMaxMessageSize();
- f_cnotificationprofileInfo.append(ss.str());
- ss.str("");
- f_cnotificationprofileInfo.append(",\"");
-
- l_uiSubscriberCnt = 0;
- for (l_itNotifReceiver_Iterator = l_pSubscriberList->begin();
- l_pSubscriberList->end() != l_itNotifReceiver_Iterator;) {
- f_cnotificationprofileInfo.append(l_itNotifReceiver_Iterator->first);
- ++l_uiSubscriberCnt;
-
- ++l_itNotifReceiver_Iterator;
-
- if (l_pSubscriberList->end() != l_itNotifReceiver_Iterator) {
- f_cnotificationprofileInfo.append(",");
- }
- }
-
- f_cnotificationprofileInfo.append("\",");
-
- ss << l_uiSubscriberCnt;
- f_cnotificationprofileInfo.append(ss.str());
- ss.str("");
- }
-
- l_estatus = eFrameworkunifiedStatusOK;
- }
- }
- } catch (std::exception &exp) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Exception:: %s", exp.what());
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp
deleted file mode 100755
index 53b9eab..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_notification_receiver.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * @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 implementation of class CNotificationReceiver.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include "ns_npp_notification_receiver.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CNotificationReceiver
-/// Constructor of CNotificationReceiver class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotificationReceiver::CNotificationReceiver() {
- m_MsgQHandle = NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CNotificationReceiver
-/// Destructor of CNotificationReceiver class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CNotificationReceiver::~CNotificationReceiver() {
- m_MsgQHandle = NULL;
-}
-
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp
deleted file mode 100755
index 4b0e452..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_file.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * @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 definition of CFilePersistence class.
-/// This class is responsible for persisting and retrieving of files.
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <unistd.h>
-#include <string>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_copy_worker.h"
-#include "ns_npp_persist_file.h"
-#include "ns_npp_registry_entry.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CFilePersistence
-/// Constructor of CFilePersistence class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CFilePersistence::CFilePersistence() {
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CFilePersistence
-/// Destructor of CFilePersistence class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CFilePersistence::~CFilePersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Release
-/// Entry for the file is stored in map for persistence.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CFilePersistence::Release(std::string f_crequesterappname,
- std::string f_ctag,
- std::string f_cmempath,
- EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
- std::string f_cusername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cmempath, f_crequesterappname and f_ctag can't be empty
- // LCOV_EXCL_START 6: f_cmempath, f_crequesterappname and f_ctag can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid file path, requester or tag.");
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- } else {
- l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, f_cmempath, enotificationpersistentservicereleasetype,
- f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Load
-/// Load file from persistent memory to the specified location.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CFilePersistence::Load(std::string f_crequesterappname,
- std::string f_ctag,
- std::string f_cretrievepath,
- std::string f_cusername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
-
- if (!f_ctag.empty() && !f_crequesterappname.empty() && !f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_ctag, f_crequesterappname and f_cretrievepath can't be empty
- l_estatus = ProcessLoadRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, f_cretrievepath, f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
- } else {
- // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cretrievepath can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
- f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
-
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp
deleted file mode 100755
index 87b1ed4..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persist_folder.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * @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
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include <unistd.h>
-#include <native_service/frameworkunified_multithreading.h>
-#include <string>
-#include "ns_npp_persistence.h"
-#include "ns_npp_persist_folder.h"
-#include "ns_npp_registry_entry.h"
-
-// Constructor of class CFolderPersistence
-CFolderPersistence::CFolderPersistence() {
-}
-
-// Destructor of class CFolderPersistence
-CFolderPersistence::~CFolderPersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-}
-// LCOV_EXCL_STOP
-
-// Method to release folder for persistence.
-EFrameworkunifiedStatus CFolderPersistence::Release(std::string f_crequesterappname,
- std::string f_ctag,
- std::string f_cmempath,
- EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
- std::string f_cusername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cmempath, f_crequesterappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cmempath can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid folder path, requester or tag.");
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- } else {
- // Call to method requesting to release the folder for persistence.
- l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cmempath, enotificationpersistentservicereleasetype,
- f_cusername);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
- return l_estatus;
-}
-
-// Method to load folder from persistent memory.
-EFrameworkunifiedStatus CFolderPersistence::Load(std::string f_crequesterappname,
- std::string f_ctag,
- std::string f_cretrievepath,
- std::string f_cusername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
-
- if (!f_ctag.empty() && !f_crequesterappname.empty() && !f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cretrievepath, f_crequesterappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
- // Call to method requesting to load the folder from persistent memory.
- l_estatus = ProcessLoadRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cretrievepath, f_cusername);
- } else {
- // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cretrievepath can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
- f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
-
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp
deleted file mode 100755
index a39b836..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence.cpp
+++ /dev/null
@@ -1,743 +0,0 @@
-/*
- * @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 implementation of class CPersistence.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#ifdef AGL_STUB
-#include <other_service/strlcpy.h>
-// #include "frameworkunified_stub.h"
-#endif
-#include <unistd.h>
-#include <stdlib.h> // for getenv()
-#ifdef AGL_STUB
-#include <cstdio>
-#endif
-#include <utility>
-#include <string>
-#include "ns_npp_persistence.h"
-#include "ns_npp_registry_entry.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CPersistence
-/// Constructor of CPersistence class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CPersistence::CPersistence():
- m_cStoragePath(GetStoragePath()),
- m_eCompressionType(ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION),
- m_hNSWriteToPersistentMem(NULL),
- m_hNSReadFromPersistentMem(NULL),
- m_hAppHandle(NULL),
- m_bPersist(FALSE),
- m_uiNotificationpersistentservicePersistCategoryFlag(0) {
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CPersistence
-/// Destructor of CPersistence class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CPersistence::~CPersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetReadThreadHandle
-/// Set read thread handle.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistence::SetReadThreadHandle(HANDLE f_hreadthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- m_hNSReadFromPersistentMem = f_hreadthread;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetWriteThreadHandle
-/// Set write thread handle.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistence::SetWriteThreadHandle(HANDLE f_hwritethread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- m_hNSWriteToPersistentMem = f_hwritethread;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetStoragePath
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-std::string CPersistence::GetStoragePath() {
- std::string l_cStoragePath(STORAGE_PATH);
-
- return l_cStoragePath;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Register
-/// Register tag for persistence.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistence::Register(std::string f_crequestorappname, std::string f_ctag, BOOL bisuserpersistence) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- if (f_ctag.empty() || f_crequestorappname.empty()) { // LCOV_EXCL_BR_LINE 6: f_ctag and f_crequestorappname can't be empty // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: f_ctag and f_crequestorappname can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid tag or requester.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- } else {
- TSourceRegistryListItr l_itRegistry = m_mPersistRegistry.find(f_crequestorappname);
- if (l_itRegistry != m_mPersistRegistry.end()) {
- // source available, check for file/folder availability
- TTagRegistryListItr l_itRegistryList = (l_itRegistry->second).find(f_ctag);
- if (l_itRegistryList != (l_itRegistry->second).end()) {
- // found already in the registry
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Already exists %s , %s", f_ctag.c_str(), f_crequestorappname.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- } else {
- // tag not found .. so add to the registry
- CRegistryEntry l_objRegistryEntry(f_ctag, f_crequestorappname, m_cStoragePath,
- bisuserpersistence); // f_eRegisterType, f_cUser);
-
- (l_itRegistry->second).insert(make_pair(f_ctag, l_objRegistryEntry));
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s found adding tag %s", f_crequestorappname.c_str(), f_ctag.c_str());
- }
- } else {
- // source not found, so creating a new entry
- CRegistryEntry l_objRegistryEntry(f_ctag, f_crequestorappname, m_cStoragePath,
- bisuserpersistence); // f_eRegisterType, f_cUser);
-
- TTagRegistryList l_mRegList;
- l_mRegList.insert(make_pair(f_ctag, l_objRegistryEntry)); // LCOV_EXCL_BR_LINE 11:except,C++ STL
-
- m_mPersistRegistry.insert(std::make_pair(f_crequestorappname, l_mRegList)); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "none exists %s , %s. So, added entry.", // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- f_ctag.c_str(), f_crequestorappname.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
-
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ProcessReleaseRequest
-/// Persist file/folder that need to be persisted.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistence::ProcessReleaseRequest(std::string f_crequesterappname,
- std::string f_ctag,
- ENotificationpersistentservicePersistType f_epersisttype,
- std::string f_cmempath,
- EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
- std::string f_cusername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (f_cmempath.empty() || f_crequesterappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6:f_cmempath, f_crequesterappname and f_ctag can`t be empty // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: f_cmempath, f_crequesterappname and f_ctag can`t be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG0(ZONE_ERR, __FUNCTION__, "Invalid file path, requester or tag.");
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- } else {
- // Persistence Registry map iterator
- TSourceRegistryListItr l_itTSourceRegistryListItr = m_mPersistRegistry.find(f_crequesterappname);
-
- if (l_itTSourceRegistryListItr != m_mPersistRegistry.end()) {
- // source available, check for file if registered
- TTagRegistryListItr l_itTRegistryList = (l_itTSourceRegistryListItr->second).find(f_ctag);
- if (l_itTRegistryList != (l_itTSourceRegistryListItr->second).end()) {
- if (eFrameworkunifiedNotOnRelease != enotificationpersistentservicereleasetype) {
- // Set release path
- l_itTRegistryList->second.SetReleasePath(f_cmempath);
- // Set persist path
- l_itTRegistryList->second.SetPersistProperties(f_epersisttype, f_cusername); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
-
- // file/folder found in registry
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "%s released %s. Found in registry. queued up to persist from %s",
- f_crequesterappname.c_str(), f_ctag.c_str(), l_itTRegistryList->second.GetReleasePath().c_str());
-
- // check if persist flag is set due to shutdown or user change
- if ((m_bPersist // It will be set to TRUE either on shutdown or userchange
- && l_itTRegistryList->second.HasntBeenPersisted()) // File/Folder persisted or not
- || (eFrameworkunifiedPersistInstantly == enotificationpersistentservicereleasetype)) {
- // reset the data
- if (((eFrameworkunifiedUserData == l_itTRegistryList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedUserData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
- ((eFrameworkunifiedFactoryData == l_itTRegistryList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedFactoryData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
- ((eFrameworkunifiedFactoryCustomerData == l_itTRegistryList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedFactoryCustomerData & m_uiNotificationpersistentservicePersistCategoryFlag)) ||
- ((eFrameworkunifiedDealerData == l_itTRegistryList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedDealerData & m_uiNotificationpersistentservicePersistCategoryFlag))) {
- // set the status of file/folder persisted as reset has been called on these data
- l_itTRegistryList->second.SetCurrentAction(LOADTYPE_RELEASE);
- l_itTRegistryList->second.SetBeingPersisted();
- } else { // persist the data
- if (eFrameworkunifiedStatusOK != (l_estatus = Persist(static_cast<CRegistryEntry &>(l_itTRegistryList->second)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
- }
- }
- } else {
- // Don't persist now. Persist on shutdown.
- }
- } else { // not on release
- // set the status of file/folder as released and persisted as these data need not to be persisted on shutdown
- l_itTRegistryList->second.SetReleasePath("");
- l_itTRegistryList->second.SetCurrentAction(LOADTYPE_RELEASE);
- l_itTRegistryList->second.SetBeingPersisted();
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s didn't register %s, not persisting",
- f_crequesterappname.c_str(), f_ctag.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
- } else {
- // source not registered, cannot persist
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s is not registered ignoring release of %s",
- f_ctag.c_str(), f_crequesterappname.c_str());
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
- }
- return l_estatus;
-}
-
-EFrameworkunifiedStatus CPersistence::Persist(CRegistryEntry &f_objregistryentry) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // Persistence Info Structure
- NSP_CopyInfoCmd l_tCpInfo = {};
-
-
- std::string l_cSourcePath = f_objregistryentry.GetReleasePath();
- std::string l_cPersistPath = f_objregistryentry.GetPersistPath(); // LCOV_EXCL_BR_LINE 11:except,C++ STL
-
- // Fill the persistence info structure
- AddRequestData(l_tCpInfo,
- l_cSourcePath,
- l_cPersistPath,
- f_objregistryentry.GetRequester(),
- f_objregistryentry.GetTag(),
- LOADTYPE_RELEASE,
- f_objregistryentry.GetPersistType());
-
- // Persist only if file was released.
- // Release means application has asked NPPService to persist file at shutdown.)
- // Persist means actual persisting a file at persistent storage
- if (f_objregistryentry.IsReleased()) {
- if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS == f_objregistryentry.m_eJobState) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Another job with source: %s and tag %s is in process. "
- "Therefore adding release request to the pending queue.",
- f_objregistryentry.GetRequester().c_str(), f_objregistryentry.GetTag().c_str());
- // if job corresponding to the tag is already in process, add it in pending queue
- m_lPendingJobs.push_back(l_tCpInfo);
- } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE == f_objregistryentry.m_eJobState) {
- if (eFrameworkunifiedStatusOK == (SendRequestMessage(l_tCpInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Release message passed to writer thread."); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- f_objregistryentry.SetCurrentAction(LOADTYPE_RELEASE);
- f_objregistryentry.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing release message to writer thread.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File/Folder not released yet.");
- }
-
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ProcessLoadRequest
-/// Load persisted file/folder.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistence::ProcessLoadRequest(std::string f_crequesterappname,
- std::string f_ctag,
- ENotificationpersistentservicePersistType f_epersisttype,
- std::string f_cretrievepath,
- std::string f_cusername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // file/folder found in registry
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
- "Load request received: Requester: %s and Tag: %s Load at: %s.",
- f_crequesterappname.c_str(), f_ctag.c_str(), f_cretrievepath.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
-
- if (f_ctag.empty() || f_crequesterappname.empty() || f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: both f_ctag and f_crequesterappname and f_cretrievepath can`t be empty // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: both f_ctag and f_crequesterappname and f_cretrievepath can`t be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
- f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- } else {
- // Persistence Registry Map Iterator
- TSourceRegistryListItr l_itTRegistry = m_mPersistRegistry.find(f_crequesterappname);
-
- // Persistence Info Struct
- NSP_CopyInfoCmd l_tCopyInfo = {};
-
- if (l_itTRegistry != m_mPersistRegistry.end()) {
- // source available, check for file/folder
- TTagRegistryListItr l_itTRegistryList = (l_itTRegistry->second).find(f_ctag);
- if (l_itTRegistryList != (l_itTRegistry->second).end()) {
- if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED == l_itTRegistryList->second.m_eJobState)) { // LCOV_EXCL_BR_LINE 6: m_eJobState can`t be ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 6: m_eJobState can`t be ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- std::string l_cReleasePath(l_itTRegistryList->second.GetReleasePath());
- // if job was aborted due to some reason like abort shutdown.
- // Then persistent storage doesn't have updated file/folder. Just restore
- // aborted released file.
- // just rename it
- if (0 == std::rename(l_cReleasePath.c_str(), f_cretrievepath.c_str())) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File loaded at requested location.");
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error while processing load request when tried to move. source: %s dest: %s",
- l_cReleasePath.c_str(), f_cretrievepath.c_str());
- l_estatus = eFrameworkunifiedStatusFail;
- }
- l_itTRegistryList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE;
- // LCOV_EXCL_STOP
- } else {
- std::string l_cLoadPath(l_itTRegistryList->second.GetLoadPath(f_epersisttype, f_cusername)); // LCOV_EXCL_BR_LINE 11:except,C++ STL // NOLINT[whitespace/line_length]
-
- if (0 == access(l_cLoadPath.c_str(), R_OK)) {
- // file/folder found in registry
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Found in registry. checking in persistence...(%s)", l_cLoadPath.c_str());
-
- AddRequestData(l_tCopyInfo,
- l_cLoadPath,
- f_cretrievepath,
- f_crequesterappname,
- f_ctag,
- LOADTYPE_LOAD,
- f_epersisttype);
-
- if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS == (l_itTRegistryList->second).m_eJobState) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Another job with source: %s and tag %s is in process. "
- "Therefore adding load request to the pending queue.",
- f_crequesterappname.c_str(), f_ctag.c_str());
- m_lPendingJobs.push_back(l_tCopyInfo);
- } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE == (l_itTRegistryList->second).m_eJobState) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Found in persistence.");
- if (eFrameworkunifiedStatusOK == (SendRequestMessage(l_tCopyInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Load message passed to reader thread. Retrieving..");
- // file/folder is requested for loading so reset the persisted flag.
- l_itTRegistryList->second.ResetPersistedFlag();
- l_itTRegistryList->second.SetCurrentAction(LOADTYPE_LOAD);
- l_itTRegistryList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing load message to reader thread.");
- l_estatus = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s requested by %s. Not found in persistence memory.", // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- f_ctag.c_str(), f_crequesterappname.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- l_estatus = eFrameworkunifiedStatusAccessError;
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s requesting %s .. Tag not found",
- f_crequesterappname.c_str(), f_ctag.c_str()); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- // source not found
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s requesting %s .. Requester not found",
- f_crequesterappname.c_str(), f_ctag.c_str());
- l_estatus = eFrameworkunifiedStatusFail;
- }
- }
- return l_estatus;
-}
-
-VOID CPersistence::AddRequestData(NSP_CopyInfoCmd &f_tcpinfo,
- std::string f_sourcepath,
- std::string f_destpath,
- std::string f_crequesterappname,
- std::string f_ctag,
- ENPS_Loadtype f_eloadtype,
- ENotificationpersistentservicePersistType f_epersisttype) {
-#ifdef AGL_PosixBasedOS001LEGACY_USED
- strlcpy(f_tcpinfo.m_csourcepath, f_sourcepath.c_str(), sizeof(f_tcpinfo.m_csourcepath));
- strlcpy(f_tcpinfo.m_cdestinationpath, f_destpath.c_str(), sizeof(f_tcpinfo.m_cdestinationpath));
- strlcpy(f_tcpinfo.m_crequesterappname, f_crequesterappname.c_str(), sizeof(f_tcpinfo.m_crequesterappname));
- strlcpy(f_tcpinfo.m_cpersistenttag, f_ctag.c_str(), sizeof(f_tcpinfo.m_cpersistenttag));
-#endif
- f_tcpinfo.m_eloadtype = f_eloadtype;
- f_tcpinfo.m_epersisttype = f_epersisttype;
- // f_tcpinfo.m_eCompressionType = ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ;
-}
-
-EFrameworkunifiedStatus CPersistence::SendRequestMessage(NSP_CopyInfoCmd &f_tcpinfo) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- HANDLE l_hThreadHandle = NULL;
- // Worker Command Protocol
- ENSP_CopyWorkerProtocol l_eWorkerProtocol = CP_WRK_CMD_COPY;
-
- if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_tcpinfo.m_epersisttype) {
- l_eWorkerProtocol = CP_WRK_CMD_COPY;
- } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_tcpinfo.m_epersisttype) {
- l_eWorkerProtocol = AR_CMD_ARCHIVE;
- }
-
- if (LOADTYPE_RELEASE == f_tcpinfo.m_eloadtype) {
- l_hThreadHandle = m_hNSWriteToPersistentMem;
- } else if (LOADTYPE_LOAD == f_tcpinfo.m_eloadtype) {
- l_hThreadHandle = m_hNSReadFromPersistentMem;
- }
-
- if (l_hThreadHandle) {
- // issue a copy to the worker thread
- if (eFrameworkunifiedStatusOK != (l_estatus = McSend(l_hThreadHandle, AppName, l_eWorkerProtocol, sizeof(NSP_CopyInfoCmd), &f_tcpinfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for thread failed %d", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case.
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// AckReceivedFromWorker
-/// This is callback function for ack that file is released to persistenet memory.
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistence::AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, BOOL f_bcopystatus,
- ENPS_Loadtype f_eloadtype) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus retVal = eFrameworkunifiedStatusOK;
-
- std::string l_cRequester(f_csource);
- std::string l_cTag(f_ctag); // LCOV_EXCL_BR_LINE 11:except,C++ STL
-
- TSourceRegistryListItr l_itTReg = m_mPersistRegistry.find(l_cRequester);
- if (l_itTReg != m_mPersistRegistry.end()) {
- // source available, check for file
- TTagRegistryListItr l_itTRegList = (l_itTReg->second).find(l_cTag);
- if (l_itTRegList != (l_itTReg->second).end()) {
- if (LOADTYPE_RELEASE == f_eloadtype) {
- l_itTRegList->second.SetBeingPersisted(); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- if (f_bcopystatus) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "File persisted %s / %s", f_csource, f_ctag);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"
- "File not persisted %s / %s, Negative ack received from copy worker thread",
- f_csource,
- f_ctag); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- }
- }
-
- // Job processed. Set job state as idle
- l_itTRegList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE;
-
- // check if there are any pending jobs for corresponding source and tag
- if (!m_lPendingJobs.empty()) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Retrieving next pending job for persistence...");
- TPendingJobsItr l_itrPendingJobs;
- for (l_itrPendingJobs = m_lPendingJobs.begin(); l_itrPendingJobs != m_lPendingJobs.end(); ++l_itrPendingJobs) {
- if (0 == std::strcmp((*l_itrPendingJobs).m_crequesterappname, f_csource)
- && (0 == std::strcmp((*l_itrPendingJobs).m_cpersistenttag, f_ctag))) {
- if (eFrameworkunifiedStatusOK == (retVal = (SendRequestMessage((*l_itrPendingJobs))))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- // set job state as processing
- l_itTRegList->second.m_eJobState = ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS;
- // set current action
- l_itTRegList->second.SetCurrentAction((*l_itrPendingJobs).m_eloadtype);
- // Reset persisted flag. It requires to process release request for this tag.
- // Because, file will be persisted only once. Unless, anyone loads the file again.
- if (LOADTYPE_LOAD == (*l_itrPendingJobs).m_eloadtype) {
- l_itTRegList->second.ResetPersistedFlag();
- }
-
- // remove job from pending list
- m_lPendingJobs.erase(l_itrPendingJobs);
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failure in passing load/release message to the worker threads.");
- retVal = eFrameworkunifiedStatusFail;
- // LCOV_EXCL_STOP
- }
-
- break;
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No pending jobs"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- } else {
- // tag not found ..
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " ERROR %s, tag %s not found ", f_csource, f_ctag);
- }
- } else {
- // source not found
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ERROR none exists %s , %s", f_csource, f_ctag);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return retVal;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// PersistAllReleaseRequests
-/// Persist all files which are not persisted yet.
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistence::PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- m_bPersist = TRUE; // set to true because persist of all release requests have been triggered.
- // Trigger reason: shutdown
-
- m_uiNotificationpersistentservicePersistCategoryFlag = f_uinotificationpersistentservicepersistcategoryflag;
-
- TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
-
- for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
- TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
- for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
- if (l_itTRegList->second.HasntBeenPersisted()) {
- // reset the data
- if (((eFrameworkunifiedUserData == l_itTRegList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedUserData & f_uinotificationpersistentservicepersistcategoryflag)) ||
- ((eFrameworkunifiedFactoryData == l_itTRegList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedFactoryData & f_uinotificationpersistentservicepersistcategoryflag)) ||
- ((eFrameworkunifiedFactoryCustomerData == l_itTRegList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedFactoryCustomerData & f_uinotificationpersistentservicepersistcategoryflag)) ||
- ((eFrameworkunifiedDealerData == l_itTRegList->second.GetPersistentCategory()) &&
- (eFrameworkunifiedDealerData & f_uinotificationpersistentservicepersistcategoryflag))) {
- // set the status of file/folder as released and persisted as these data need not to be persisted on shutdown
- l_itTRegList->second.SetCurrentAction(LOADTYPE_RELEASE);
- l_itTRegList->second.SetBeingPersisted();
- } else { // persist the data
- if (eFrameworkunifiedStatusOK != Persist(static_cast<CRegistryEntry &>(l_itTRegList->second))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
- }
- }
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-BOOL CPersistence::HaveAllReleaseRequestsPersisted(std::string &f_ctagnotreleased) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- BOOL l_bRetVal = TRUE;
-
- TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
-
- f_ctagnotreleased.assign("");
-
- for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
- TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
- for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
- if (l_itTRegList->second.HasntBeenPersisted()) {
- l_bRetVal = FALSE;
-
- if (!l_itTRegList->second.IsReleased()) {
- f_ctagnotreleased.append("\n");
- f_ctagnotreleased.append(l_itTRegList->second.GetTag());
- f_ctagnotreleased.append(" [");
- f_ctagnotreleased.append(l_itTRegList->second.GetRequester());
- f_ctagnotreleased.append("]");
- }
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bRetVal;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// PersistAllUserRequests
-/// Persist all user files which are not persisted yet.
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistence::PersistAllUserRequests() {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- // TODO(my_username): Persist data on userchange. Uncomment following.
- // m_bPersist = TRUE; // set to true because persist of all user release requests have been triggered.
- // Trigger reason: user change
-
- TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
-
- for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
- TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
- for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
- if (l_itTRegList->second.IsUserPersistence()) {
- if (eFrameworkunifiedStatusOK != Persist(static_cast<CRegistryEntry &>(l_itTRegList->second))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
- }
- }
- }
- }
- return l_estatus;
-}
-
-BOOL CPersistence::IsUserPersistence(std::string f_ctag) {
- BOOL l_bUserPersistence = FALSE;
-
- TSourceRegistryListItr l_itTReg = m_mPersistRegistry.begin();
-
- for (; l_itTReg != m_mPersistRegistry.end(); ++l_itTReg) {
- TTagRegistryListItr l_itTRegList = (l_itTReg->second).begin();
- for (; l_itTRegList != (l_itTReg->second).end(); ++l_itTRegList) {
- if (l_itTRegList->second.GetTag() == f_ctag) {
- if (l_itTRegList->second.IsUserPersistence()) {
- l_bUserPersistence = TRUE;
- }
- break;
- }
- }
- }
-
- return l_bUserPersistence;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetPersistentCategory
-/// Sets the persist type of file/folder
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistence::SetPersistentCategory(const std::string &f_crequesterappname,
- const std::string &f_ctag,
- EFrameworkunifiedPersistCategory f_epersistcategory) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // Persistence Registry map iterator
- TSourceRegistryListItr l_itTSourceRegistryListItr = m_mPersistRegistry.find(f_crequesterappname);
-
- if (m_mPersistRegistry.end() != l_itTSourceRegistryListItr) {
- // source available, check for file if registered
- TTagRegistryListItr l_itTRegistryList = (l_itTSourceRegistryListItr->second).find(f_ctag);
-
- if ((l_itTSourceRegistryListItr->second).end() != l_itTRegistryList) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppName:: %s, Tag:: %s found in registry", f_crequesterappname.c_str(),
- f_ctag.c_str());
-
- l_estatus = (l_itTRegistryList->second).SetPersistentCategory(f_epersistcategory);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s didn't register %s", f_crequesterappname.c_str(), f_ctag.c_str());
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
- } else {
- // source not registered, cannot persist
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Warning: %s is not registered", f_ctag.c_str());
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// ResetPersistFlag
-/// Resets the persist flag.
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistence::ResetPersistFlag() {
- m_bPersist = FALSE;
-
- m_uiNotificationpersistentservicePersistCategoryFlag = 0;
-}
-
-#ifdef NPP_PROFILEINFO_ENABLE
-
-EFrameworkunifiedStatus CPersistence::GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- TSourceRegistryListItr l_itrTSourceRegistryListItr;
- TTagRegistryListItr l_itrTTagRegistryListItr;
-
- for (l_itrTSourceRegistryListItr = m_mPersistRegistry.begin();
- l_itrTSourceRegistryListItr != m_mPersistRegistry.end();
- l_itrTSourceRegistryListItr++) {
- for (l_itrTTagRegistryListItr = (l_itrTSourceRegistryListItr->second).begin();
- l_itrTTagRegistryListItr != (l_itrTSourceRegistryListItr->second).end();
- l_itrTTagRegistryListItr++) {
- f_cpersistenceprofileinfo.append("\n");
- f_cpersistenceprofileinfo.append((*l_itrTSourceRegistryListItr).first);
- f_cpersistenceprofileinfo.append(",");
-
- f_cpersistenceprofileinfo.append(l_itrTTagRegistryListItr->first);
- f_cpersistenceprofileinfo.append(",");
-
- switch ((l_itrTTagRegistryListItr->second).GetPersistType()) {
- case ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE: {
- f_cpersistenceprofileinfo.append("File,");
- }
- break;
-
- case ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER: {
- f_cpersistenceprofileinfo.append("Folder,");
- }
- break;
-
- default: {
- f_cpersistenceprofileinfo.append(",");
- }
- break;
- }
-
- if ((l_itrTTagRegistryListItr->second).IsUserPersistence()) {
- f_cpersistenceprofileinfo.append("Yes,");
- } else {
- f_cpersistenceprofileinfo.append("No,");
- }
-
- if ((l_itrTTagRegistryListItr->second).IsReleased()) {
- f_cpersistenceprofileinfo.append("Yes,");
- } else {
- f_cpersistenceprofileinfo.append("No,");
- }
-
- if ((l_itrTTagRegistryListItr->second).IsPersisted()) {
- f_cpersistenceprofileinfo.append("Yes");
- } else {
- f_cpersistenceprofileinfo.append("No");
- }
- }
- }
- return l_estatus;
-}
-
-#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp
deleted file mode 100755
index 7f5d292..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistence_manager.cpp
+++ /dev/null
@@ -1,1132 +0,0 @@
-/*
- * @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 This file contains implementation of class CPersistenceManager.
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <native_service/ns_np_service.h>
-#include <native_service/ns_np_service_if.h>
-#include <native_service/ns_util_directory.h>
-#include <native_service/ns_np_service_protocol.h>
-#include <native_service/frameworkunified_sm_framework_dispatch.h>
-#include <string>
-#include <native_service/ns_np_service_nor_persistence_internal.h>
-#include "ns_npp.h"
-#include "ns_npp_types.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_copy_worker.h"
-#include "ns_npp_persistence.h"
-#include "ns_npp_persist_file.h"
-#include "ns_npp_fs_directory.h"
-#include "ns_npp_persist_folder.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_binary_accesser.h"
-#include "ns_npp_persistence_manager.h"
-#include "ns_npp_nor_persistence_worker_thread.h"
-#include "ns_npp_state_nor_persistence_notification.h"
-
-extern const CHAR AppName[]; // NOLINT (readability/naming)
-
-// Initialisation of static class member for disabling persistence
-BOOL CPersistenceManager::m_bPersistenceDisabled = FALSE;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CPersistenceManager
-/// Constructor of CPersistenceManager class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CPersistenceManager::CPersistenceManager() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_cUserNotificationTag = USERNOTIFICATIONFILE;
-
- m_poDataAccesser = NULL;
-
- m_cNotificationPersistFilepath = CPersistence::GetStoragePath(); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Storage path for persistence=%s", m_cNotificationPersistFilepath.c_str()); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
-
- m_cNotificationPersistFilepath += AppName;
- m_cNotificationPersistFilepath += "/";
-
- m_hNSImmediatePersistenceThread = NULL;
- m_bAllFilePersisted = FALSE;
- m_bImmediatedDataPersisted = FALSE;
-
- if (eFrameworkunifiedStatusOK != Init()) { // LCOV_EXCL_BR_LINE 6: Init() must be return eFrameworkunifiedStatusOK
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to initialize Persistent Manager."); // LCOV_EXCL_LINE 6: Init() must be return eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CPersistenceManager
-/// Destructor of CPersistenceManager class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CPersistenceManager::~CPersistenceManager() { // LCOV_EXCL_START 14: Resident process, global instance not released
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_poDataAccesser) {
- delete m_poDataAccesser;
- }
-
- Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
- // Remove memory allocated for persistence objects
- for (; l_itPersist_Type != m_mPersist_Type.end(); ++l_itPersist_Type) {
- if (NULL != (*l_itPersist_Type).second) {
- delete(*l_itPersist_Type).second;
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-EFrameworkunifiedStatus CPersistenceManager::Init() {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE] = new(std::nothrow) CFilePersistence(); // LCOV_EXCL_BR_LINE 11:unexpected branch
-
- m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER] = new(std::nothrow) CFolderPersistence(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
-
- m_poDataAccesser = new(std::nothrow) CBinaryAccesser(); // Save data in binary format. // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
-
- // check if all object creation is successful
- if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 5:m_poDataAccesser can`t be NULL
- Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
-
- // check if all object creation is successful
- for (; l_itPersist_Type != m_mPersist_Type.end();
- ++l_itPersist_Type) {
- if (NULL == (*l_itPersist_Type).second) { // LCOV_EXCL_START 6:(*l_itPersist_Type).second can`t be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- break;
- }
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 5: m_poDataAccesser can`t be NULL
- }
-
- if (eFrameworkunifiedStatusOK != l_estatus) { // LCOV_EXCL_START 6: l_estatus must be eFrameworkunifiedStatusOK
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- if (NULL != m_poDataAccesser) {
- delete m_poDataAccesser;
- }
-
- Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
- // check if all object creation is successful
- for (; l_itPersist_Type != m_mPersist_Type.end(); ++l_itPersist_Type) {
- if (NULL != (*l_itPersist_Type).second) {
- delete(*l_itPersist_Type).second;
- }
- }
- // LCOV_EXCL_STOP
- }
- std::string f_csourcepath = CPersistence::GetStoragePath();
- if (f_csourcepath.length() > 0) { // LCOV_EXCL_BR_LINE 6: f_csourcepath.length() is always bigger then 0
- f_csourcepath.append(RELEASETEMP_DIR); // LCOV_EXCL_BR_LINE 11:unexpected branch
- if (CFSDirectory::DoesDirecotryExist(f_csourcepath)) {
- f_csourcepath.append(RELEASETEMP_FILENAME);
- if (0 != remove(f_csourcepath.c_str())) {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Temporary file not deleted::%s, errno:%d", f_csourcepath.c_str(), errno);
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceRegister
-/// Registers a tag for the file/folder. This tag will be used for releasing or loading
-/// a file/folder.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceRegister(std::string f_cappname,
- std::string f_ctag,
- ENotificationpersistentservicePersistType f_epersisttype,
- BOOL bisuserpersistence) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
-
- if (f_cappname.empty() || f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname & tag should not be empty."); // LCOV_EXCL_LINE 6: f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
- } else {
- // check boundary conditions
- if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
- // register tag
- l_estatus = m_mPersist_Type[f_epersisttype]->Register(f_cappname, f_ctag,
- bisuserpersistence); // f_eRegisterType, f_cUser); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- // m_mPersist_Type[f_ePersistFileType]->ListAllInMap();
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always biger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceRelease
-/// Entry for the file/folder is stored in map for persistence.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceRelease(std::string f_cappname,
- std::string f_ctag,
- std::string f_cmempath,
- EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
- ENotificationpersistentservicePersistType f_epersisttype,
- std::string f_cusername) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
-
- if (f_cappname.empty() || f_ctag.empty() || f_cmempath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cappname, f_cmempath and f_ctag can't be empty // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname & tag should not be empty."); // LCOV_EXCL_LINE 6: double check, f_cappname, f_cmempath and f_ctag can't be empty // NOLINT[whitespace/line_length]
- } else {
- // check boundary conditions
- if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- // release file
- if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
- l_estatus = m_mPersist_Type[f_epersisttype]->Release(f_cappname,
- f_ctag,
- f_cmempath,
- enotificationpersistentservicereleasetype,
- f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceLoad
-/// Load file/folder from persistent memory to the specified location.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceLoad(std::string f_cappname,
- std::string f_ctag,
- std::string f_cretrievepath,
- ENotificationpersistentservicePersistType f_epersisttype,
- std::string f_cusername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (f_cappname.empty() || f_ctag.empty() || f_cretrievepath.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_cretrievepath, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Appname, tag & retrieve path should not be empty."); // LCOV_EXCL_LINE 6: double check, f_cretrievepath, f_cappname and f_ctag can't be empty // NOLINT[whitespace/line_length]
- } else {
- // check boundary conditions
- if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
- // load file
- l_estatus = m_mPersist_Type[f_epersisttype]->Load(f_cappname, f_ctag, f_cretrievepath, f_cusername); // LCOV_EXCL_BR_LINE 11: unexpected branch // NOLINT[whitespace/line_length]
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] would not be null // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// AckReceivedFromWorker
-/// Send release ack to file/folder persistence object.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::AckReceivedFromWorker(PCSTR f_csource, PCSTR f_ctag, ENotificationpersistentservicePersistType f_epersisttype,
- BOOL f_bcopystatus, ENPS_Loadtype f_eloadtype) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if ((NULL == f_csource) || (NULL == f_ctag)) { // LCOV_EXCL_BR_LINE 6: f_csource and f_ctag can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "f_csource or f_ctag is NULL."); // LCOV_EXCL_LINE 6: f_csource and f_ctag can't be NULL // NOLINT[whitespace/line_length]
- } else {
- // check boundary conditions
- if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- if (NULL != m_mPersist_Type[f_epersisttype]) {
- // Send release ack to file/folder persistence object.
- l_estatus = m_mPersist_Type[f_epersisttype]->AckReceivedFromWorker(f_csource, f_ctag,
- f_bcopystatus, f_eloadtype);
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype);
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- }
- }
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSaveNotificationData
-/// Save notification data in a persistent file.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSaveNotificationData(Persistent_Notification_List_Type
- *f_vpersistentnotificationlist) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if ((NULL == m_poDataAccesser) || (NULL == f_vpersistentnotificationlist)) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_poDataAccesser or f_vpersistentnotificationlist is NULL."); // LCOV_EXCL_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
- } else {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- std::string l_cNotificationFilePath = "";
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += NOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedPersistedStateVar,
- eFrameworkunifiedUserData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += FACTORYNOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedPersistedStateVar,
- eFrameworkunifiedFactoryData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += FACTORYCUSTOMERNOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedPersistedStateVar,
- eFrameworkunifiedFactoryCustomerData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += DEALERNOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->PersistData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedPersistedStateVar,
- eFrameworkunifiedDealerData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSaveUserNotificationData
-/// Save user notification data in a persistent file.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSaveUserNotificationData(Persistent_Notification_List_Type
- *f_vpersistentnotificationlist) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if ((NULL == m_poDataAccesser) || (NULL == f_vpersistentnotificationlist)) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_poDataAccesser or f_vpersistentnotificationlist is NULL."); // LCOV_EXCL_LINE 6: m_poDataAccesser and f_vpersistentnotificationlist would not be null // NOLINT[whitespace/line_length]
- } else {
- l_estatus = m_poDataAccesser->PersistData(m_cNotificationUserMemFilepath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedPersistedStateUserVar); // LCOV_EXCL_BR_LINE 11: unexpected branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceReadNotificationData
-/// Get the list of all persistent notifications from a persistent memory and store it in a map.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadNotificationData(Persistent_Notification_List_Type
- * &f_vpersistentnotificationlist) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser would not be null
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- std::string l_cNotificationFilePath = "";
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += NOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedUserData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += FACTORYNOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedFactoryData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += FACTORYCUSTOMERNOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedFactoryCustomerData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
-
- l_cNotificationFilePath = m_cNotificationPersistFilepath;
- l_cNotificationFilePath += DEALERNOTIFICATIONFILE;
- if (eFrameworkunifiedStatusOK != (l_estatus = m_poDataAccesser->RetrieveData(l_cNotificationFilePath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedDealerData))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error retrieving notification data from file : %s, status: %d",
- l_cNotificationFilePath.c_str(), l_estatus);
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return eFrameworkunifiedStatusOK;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceReadUserNotificationData
-/// Get the list of all user persistent notifications from a persistent memory and store it in a map.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadUserNotificationData(Persistent_Notification_List_Type
- * &f_vpersistentnotificationlist) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_poDataAccesser) { // LCOV_EXCL_BR_LINE 6: m_poDataAccesser would not be null
- l_estatus = m_poDataAccesser->RetrieveData(m_cNotificationUserMemFilepath,
- f_vpersistentnotificationlist,
- eFrameworkunifiedUserData); // LCOV_EXCL_BR_LINE 11:unexpected branch
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// PersistAllReleaseRequests
-/// Persist all released files and folder contained in the map in persistent memory.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::PersistAllReleaseRequests(UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
-
- // Persist all i.e files and folders
- while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
- if (NULL != m_mPersist_Type[l_ePersistType]) {
- if (eFrameworkunifiedStatusFail == m_mPersist_Type[l_ePersistType]->PersistAllReleaseRequests(f_uinotificationpersistentservicepersistcategoryflag)) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail; // LCOV_EXCL_LINE 4: NSFW error case.
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentservicePersistAllUserRequests
-/// Persist all user files and folder contained in the map in persistent memory.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentservicePersistAllUserRequests() {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
-
- // Persist all i.e files and folders
- while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
- if (NULL != m_mPersist_Type[l_ePersistType]) {
- l_estatus = m_mPersist_Type[l_ePersistType]->PersistAllUserRequests();
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType);
- }
-
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetReadThreadHandle
-/// Pass the handle of the read thread to the object of file/folder persistence
-////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistenceManager::SetReadThreadHandle(HANDLE f_hreadthread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (f_hreadthread != NULL) { // LCOV_EXCL_BR_LINE 6: f_hreadthread would not be null
- // Set thread handle for object persistfile objects. i.e. for file/folder
- for (Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
- l_itPersist_Type != m_mPersist_Type.end();
- ++l_itPersist_Type) {
- if (NULL != (*l_itPersist_Type).second) { // LCOV_EXCL_BR_LINE 6: (*l_itPersist_Type).second can't be NULL
- (*l_itPersist_Type).second->SetReadThreadHandle(f_hreadthread);
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetWriteThreadHandle
-/// Pass the handle of the write thread to the object of file/folder persistence
-////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistenceManager::SetWriteThreadHandle(HANDLE f_hwritethread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != f_hwritethread) { // LCOV_EXCL_BR_LINE 6: f_hwritethread would not be null
- // Set thread handle for object persist objects. i.e. for file/folder
- for (Persist_Type_Iter l_itPersist_Type = m_mPersist_Type.begin();
- l_itPersist_Type != m_mPersist_Type.end();
- ++l_itPersist_Type) {
- if (NULL != (*l_itPersist_Type).second) { // LCOV_EXCL_BR_LINE 6: (*l_itPersist_Type).second can't be NULL
- (*l_itPersist_Type).second->SetWriteThreadHandle(f_hwritethread);
- }
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetWriteThreadHandle
-/// Pass the handle of the write thread to the object of file/folder persistence
-////////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistenceManager::SetNorPersistenceThreadHandle(HANDLE f_hwritethread) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != f_hwritethread) { // LCOV_EXCL_BR_LINE 6: f_hwritethread would not be null
- m_hNSImmediatePersistenceThread = f_hwritethread;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// NPServiceOnCpWorkerAckCmd
-/// Handles when the CopyWorker sends an ack back for a message received .
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus NPServiceOnCpWorkerAckCmd(HANDLE f_happ) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- NSP_CopyAckMsg l_tack = {};
- if (f_happ) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- if (eFrameworkunifiedStatusOK == (l_estatus = FrameworkunifiedGetMsgDataOfSize(f_happ, (PVOID)&l_tack, sizeof(NSP_CopyAckMsg), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length] // NOLINT[whitespace/line_length]
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "CP_WRK_ACK_CMD_COMPLETE for cmd 0x%X", l_tack.m_eworkerprotocol); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Unable to get message data in NPServiceOnCpWorkerAckCmd, status : 0x%x", l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer; // LCOV_EXCL_LINE 4: NSFW error case.
- }
-
- return l_estatus;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetUserPersistentPath
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistenceManager::SetUserPersistentPath(std::string f_cusername) {
- m_cNotificationUserMemFilepath = CPersistence::GetStoragePath();
- m_cNotificationUserMemFilepath += AppName;
- m_cNotificationUserMemFilepath += "/";
- m_cNotificationUserMemFilepath += f_cusername;
- m_cNotificationUserMemFilepath += "/";
- m_cNotificationUserMemFilepath += m_cUserNotificationTag;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// IsUserPersistence
-/// Check if tag is user persistence
-////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CPersistenceManager::IsUserPersistence(std::string f_ctag, ENotificationpersistentservicePersistType f_epersisttype) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- BOOL l_bUserPersistence = FALSE;
-
- // check boundary conditions
- if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
- // load file
- l_bUserPersistence = m_mPersist_Type[f_epersisttype]->IsUserPersistence(f_ctag); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT[whitespace/line_length]
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bUserPersistence;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// HaveAllReleaseRequestsPersisted
-/// Check if all release requests processed or not
-////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CPersistenceManager::HaveAllReleaseRequestsPersisted() {
- BOOL l_bRetVal = TRUE;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // check if all files are persisted
- if (FALSE == m_bAllFilePersisted) {
- ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
-
- std::string l_cTagNotReleased = "";
- std::string l_cTagList = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
-
- // Persist all i.e files and folders
- while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
- if (NULL != m_mPersist_Type[l_ePersistType]) {
- l_cTagNotReleased.assign(""); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- // if(eFrameworkunifiedStatusFail == m_mPersist_Type[l_ePersistType]->PersistAllReleaseRequests())
- if (FALSE == m_mPersist_Type[l_ePersistType]->HaveAllReleaseRequestsPersisted(l_cTagNotReleased)) {
- l_bRetVal = FALSE;
- l_cTagList.append(l_cTagNotReleased);
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
- }
-
- if (0 != l_cTagList.size()) {
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Tags not released:: %s", l_cTagList.c_str());
- }
- }
-
- if (TRUE == l_bRetVal) {
- m_bAllFilePersisted = TRUE;
-
- // if all files are persisted set the return value to the status of immediate data persistency
- l_bRetVal = m_bImmediatedDataPersisted;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_bRetVal;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// ResetPersistFlag
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistenceManager::ResetPersistFlag() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- ENotificationpersistentservicePersistType l_ePersistType = ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST;
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
-
- // Persist all i.e files and folders
- while (l_ePersistType < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) {
- if (NULL != m_mPersist_Type[l_ePersistType]) {
- m_mPersist_Type[l_ePersistType]->ResetPersistFlag();
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", l_ePersistType); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- l_ePersistType = (ENotificationpersistentservicePersistType)(l_ePersistType + 1);
- }
-
- m_bAllFilePersisted = FALSE;
-
- m_bImmediatedDataPersisted = FALSE;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceReadNorNotificationData
-/// Get the list of all user persistent notifications from a persistent memory and store it in a map.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceReadNorNotificationData(Persistent_Notification_List_Type
- * &f_vpersistentnotificationlist) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedUserData)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate User data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedFactoryData)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Factory data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedFactoryCustomerData)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Factory Customer data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- if (eFrameworkunifiedStatusOK != ReadImmediateNotificationData(f_vpersistentnotificationlist, eFrameworkunifiedDealerData)) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "No Immediate Dealer data in persistent memory"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ClearPersistenceData
-/// Deletes the data from the persistent memory.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::ClearPersistenceData(const EFrameworkunifiedClearPersistence &f_enotificationpersistentserviceclearpersistencescope) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- // persistence memory path to be cleared
- std::string l_cPath = "";
-
- switch (f_enotificationpersistentserviceclearpersistencescope) { // LCOV_EXCL_BR_LINE 6: f_enotificationpersistentserviceclearpersistencescope must be eFrameworkunifiedClearAllData, eFrameworkunifiedClearAllApplicationData, eFrameworkunifiedClearAllNotificationData, eFrameworkunifiedClearCurrentUserData, eFrameworkunifiedClearCurrentUserApplicationData, eFrameworkunifiedClearCurrentUserNotificationData. // NOLINT[whitespace/line_length]
- case eFrameworkunifiedClearAllData: {
- // clears all the data from the persistent memory
- l_cPath.append(CPersistence::GetStoragePath());
- }
- break;
-
- case eFrameworkunifiedClearAllApplicationData: {
- // TODO(my_username): clears all the application folder in persistence memory
- // don't delete the NS_NPS folder
- }
- break;
-
- case eFrameworkunifiedClearAllNotificationData: {
- // TODO(my_username): deletes the NS_NPS folder
- }
- break;
-
- case eFrameworkunifiedClearCurrentUserData: {
- // TODO(my_username): deletes the user folder from all the application folder in persisted memory
- // as well as from the NS_NPS folder
- }
- break;
-
- case eFrameworkunifiedClearCurrentUserApplicationData: {
- // TODO(my_username): deletes the user folder from all the application folder
- }
- break;
-
- case eFrameworkunifiedClearCurrentUserNotificationData: {
- // TODO(my_username): deletes the user folder from the NS_NPS folder
- }
- break;
-
- default: {
- // LCOV_EXCL_START 6: f_enotificationpersistentserviceclearpersistencescope must be eFrameworkunifiedClearAllData, eFrameworkunifiedClearAllApplicationData, eFrameworkunifiedClearAllNotificationData, eFrameworkunifiedClearCurrentUserData, eFrameworkunifiedClearCurrentUserApplicationData, eFrameworkunifiedClearCurrentUserNotificationData. // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_NS_ERR, __FUNCTION__, "Invalid _EFrameworkunifiedClearPersistence Parameter:: %d", f_enotificationpersistentserviceclearpersistencescope);
- l_estatus = eFrameworkunifiedStatusInvldParam;
- // LCOV_EXCL_STOP
- }
- break;
- }
-
- if (0 != l_cPath.size()) {
- if (CFSDirectory::DoesDirecotryExist(l_cPath)) {
- if (TRUE == CFSDirectory::RemoveDirectory(l_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return ok
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete persistent directory successful : %s", l_cPath.c_str());
- } else {
- // LCOV_EXCL_START 6: RemoveDirectory always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete persistent directory unsuccessful : %s", l_cPath.c_str());
- l_estatus = eFrameworkunifiedStatusErrOther;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- l_estatus = eFrameworkunifiedStatusErrOther;
- }
-
- // delete NOR data
- l_cPath.clear();
- l_cPath.append(IMMEDIATE_PERSISTENCE_STORAGE_V2);
- if (0 != l_cPath.size()) { // LCOV_EXCL_BR_LINE 6: l_cPath.size can't be 0
- if (CFSDirectory::DoesDirecotryExist(l_cPath)) {
- if (TRUE == CFSDirectory::RemoveDirectory(l_cPath)) { // LCOV_EXCL_BR_LINE 6: RemoveDirectory always return ok
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Delete nor persistent directory successful : %s", l_cPath.c_str());
- } else {
- // LCOV_EXCL_START 6: RemoveDirectory always return ok
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Delete nor persistent directory unsuccessful : %s", l_cPath.c_str());
- l_estatus = eFrameworkunifiedStatusErrOther;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusErrOther; // LCOV_EXCL_LINE 6: l_cPath.size can't be 0
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSetPersistentCategory
-/// Sets the persist type of file or folder.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::NotificationpersistentserviceSetPersistentCategory(std::string f_crequestorname,
- std::string f_ctag,
- EFrameworkunifiedPersistCategory f_epersistcategory,
- ENotificationpersistentservicePersistType f_epersisttype) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- if (f_ctag.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_ctag.size can't be empty
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag name is empty."); // LCOV_EXCL_LINE 6: double check, f_ctag.size can't be empty
- } else {
- // check boundary conditions
- if ((ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST < f_epersisttype) && (f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST)) { // LCOV_EXCL_BR_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- if (NULL != m_mPersist_Type[f_epersisttype]) { // LCOV_EXCL_BR_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
- // set the persist type
- l_estatus = m_mPersist_Type[f_epersisttype]->SetPersistentCategory(f_crequestorname,
- f_ctag,
- f_epersistcategory);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistence object for %d is null.", f_epersisttype); // LCOV_EXCL_LINE 6: m_mPersist_Type[f_epersisttype] can't be null // NOLINT[whitespace/line_length]
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Enum value %d is out of bound.", f_epersisttype); // LCOV_EXCL_LINE 6: f_epersisttype is always bigger then ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST and less then ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// 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.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::PersistNORData(EFrameworkunifiedShutdownType f_eshutdowntype, UI_32 f_uinotificationpersistentservicepersistcategoryflag) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- TImmediateShutdown l_tImmShutdown = {};
- l_tImmShutdown.f_eshutdowntype = f_eshutdowntype;
- l_tImmShutdown.f_uinotificationpersistentservicepersistcategoryflag = f_uinotificationpersistentservicepersistcategoryflag;
-
- // send the message to NOR to persist or reset the data during shutdown
- if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_ONSHUTDOWN, sizeof(l_tImmShutdown), &l_tImmShutdown))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_ONSHUTDOWN); // LCOV_EXCL_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetImmediateDataPersistedStatus
-/// Set/Reset the persistence status of immediate persistence data
-///////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistenceManager::SetImmediateDataPersistedStatus(BOOL f_bstatus) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_bImmediatedDataPersisted = f_bstatus;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetFilePersistedStatus
-/// Set/Reset the persistence status of files and folders
-///////////////////////////////////////////////////////////////////////////////////////////
-VOID CPersistenceManager::SetFilePersistedStatus(BOOL f_bstatus) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_bAllFilePersisted = f_bstatus;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ReadImmediateNotificationData
-/// Get the list of all immediate persistent notifications of f_epersistcategory from a
-/// persistent memory and store it in a map.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CPersistenceManager::ReadImmediateNotificationData(Persistent_Notification_List_Type
- * &f_vpersistentnotificationlist,
- const EFrameworkunifiedPersistCategory f_epersistcategory) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- std::string l_pcPath = IMMEDIATE_PERSISTENCE_STORAGE_V2;
- std::string l_cNotificationName = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
- // stores the list of invalid immediate notification files at persistent location
- std::string l_cInvalidFileList = ""; // LCOV_EXCL_BR_LINE 11:except,C++ STL
-
- PCSTR l_pPublisherName = NULL;
- PSTR l_pData = NULL;
- UI_32 l_uiDataSize = 0;
-
- NC_NorPersistentData l_ptNorPersistentData = {};
-
- TFileList l_pTFileList;
-
- if ('/' != l_pcPath[l_pcPath.length() - 1]) { // LCOV_EXCL_BR_LINE 6: the last char is always '/'
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_pcPath.append("/"); // LCOV_EXCL_LINE 6: the last char is always '/'
- }
-
- switch (f_epersistcategory) {
- case eFrameworkunifiedFactoryData: {
- l_pcPath.append(FACTORYDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- }
- break;
-
- case eFrameworkunifiedFactoryCustomerData: {
- l_pcPath.append(FACTORYCUSTOMERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- }
- break;
-
- case eFrameworkunifiedDealerData: {
- l_pcPath.append(DEALERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- }
- break;
-
- case eFrameworkunifiedUserData:
- default: {
- l_pcPath.append(USERDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- l_pcPath.append(ALLUSERAPPDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
- }
- break;
- }
-
- l_pcPath.append(IMMEDIATEDATADIR); // LCOV_EXCL_BR_LINE 11:except,C++ STL
-
- if (eFrameworkunifiedStatusOK == GetFileList(&l_pTFileList, l_pcPath.c_str())) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
- if (!l_pTFileList.empty()) { // LCOV_EXCL_BR_LINE 200: if GetFileList() returns eFrameworkunifiedStatusOK, l_pTFileList can't be empty // NOLINT[whitespace/line_length]
- for (UI_32 l_uiCount = 0; l_uiCount < l_pTFileList.size(); l_uiCount++) {
- l_uiDataSize = 0;
-
- // get the persistent notification name from vector
- l_cNotificationName = l_pTFileList.at(l_uiCount);
-
- if (eFrameworkunifiedStatusOK == NPSynchronousGetPersistentDataSize(l_cNotificationName.c_str(), &l_uiDataSize, // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- f_epersistcategory) && (0 != l_uiDataSize)) {
- l_pData = new(std::nothrow) CHAR[l_uiDataSize];
- std::memset(l_pData, 0, l_uiDataSize);
-
- if (NULL != l_pData) { // LCOV_EXCL_BR_LINE 6: l_pData can't be null
- l_pPublisherName = NULL;
-
- // clear the memory
- std::memset(&l_ptNorPersistentData, 0, sizeof(NC_NorPersistentData));
-
- // As NS_NPP does a recursive filename read from directory it has the complete filename.
- // So it does not require to pass the Publisher name i.e. l_pPublisherName.So it is being passed as NULL.
- if (eFrameworkunifiedStatusOK == NPSynchronousGetPersistentData(l_pPublisherName, // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
- l_cNotificationName.c_str(),
- (PVOID)l_pData,
- l_uiDataSize,
- l_ptNorPersistentData,
- f_epersistcategory)) {
- CNotificationsToPersist *l_objCNotificationsToPersist = new(std::nothrow) CNotificationsToPersist();
- if (NULL != l_objCNotificationsToPersist) { // LCOV_EXCL_BR_LINE 6: l_objCNotificationsToPersist can't be null // NOLINT[whitespace/line_length]
- CPersistentData *l_objCPersistentData = new(std::nothrow) CPersistentData();
-
- // fill the appropriate values in l_objCNotificationsToPersist
- if (NULL != l_objCPersistentData) { // LCOV_EXCL_BR_LINE 6: l_objCPersistentData can't be null
- l_objCPersistentData->m_pMessage = new(std::nothrow) CHAR[l_ptNorPersistentData.dataSize];
- std::memset(l_objCPersistentData->m_pMessage, 0, l_ptNorPersistentData.dataSize);
-
- if (NULL != l_objCPersistentData->m_pMessage) { // LCOV_EXCL_BR_LINE 6: l_objCPersistentData->m_pMessage can't be null // NOLINT[whitespace/line_length]
- std::memcpy(l_objCPersistentData->m_pMessage, l_pData, l_ptNorPersistentData.dataSize);
-
- l_objCNotificationsToPersist->m_uiMaxMsgLength = l_ptNorPersistentData.uiMaxSize;
- l_objCPersistentData->m_uiMsgSize = l_ptNorPersistentData.dataSize;
- l_objCNotificationsToPersist->m_ePersistentType = eFrameworkunifiedImmediatePersistedStateVar;
-
- l_objCNotificationsToPersist->m_cNotificationName = l_ptNorPersistentData.notificationName;
- l_objCNotificationsToPersist->m_cPublisherName = l_ptNorPersistentData.pPublisherName;
- l_objCNotificationsToPersist->m_uiDelay = l_ptNorPersistentData.uiDelay;
-
- l_objCNotificationsToPersist->m_pPersistentData = l_objCPersistentData;
-
- l_objCNotificationsToPersist->m_ePersistCategory = f_epersistcategory;
-
- f_vpersistentnotificationlist->push_back(l_objCNotificationsToPersist);
- } else {
- // LCOV_EXCL_START 6: l_objCPersistentData->m_pMessage can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for notification data of size %d",
- l_ptNorPersistentData.dataSize);
-
- if (NULL != l_objCNotificationsToPersist) {
- delete l_objCNotificationsToPersist;
- l_objCNotificationsToPersist = NULL;
- }
-
- if (NULL != l_objCPersistentData) {
- delete l_objCPersistentData;
- l_objCPersistentData = NULL;
- }
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_objCPersistentData can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for CPersistentData object");
-
- if (NULL != l_objCNotificationsToPersist) {
- delete l_objCNotificationsToPersist;
- l_objCNotificationsToPersist = NULL;
- }
- // LCOV_EXCL_STOP
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Memory allocation error for CNotificationsToPersist object"); // LCOV_EXCL_LINE 6: l_objCNotificationsToPersist can't be null // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_cInvalidFileList.append(l_cNotificationName);
- l_cInvalidFileList.append(",");
- // LCOV_EXCL_STOP
- }
-
- delete[] l_pData;
- l_pData = NULL;
- } else {
- // LCOV_EXCL_START 6: l_pData can't be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "Persistent data received as NULL from immediate notification file :: %s",
- l_cNotificationName.c_str());
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 4: NSFW error case.
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_cInvalidFileList.append(l_cNotificationName);
- l_cInvalidFileList.append(",");
- // LCOV_EXCL_STOP
- }
- }
-
- if (0 != l_cInvalidFileList.size()) { // LCOV_EXCL_START 200: l_cInvalidFileList's size must be 0
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
- "Unable to get persistent data for following immediate notification files :: %s",
- l_cInvalidFileList.c_str());
- }
- // LCOV_EXCL_STOP
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "No Immediate persistence data available at :: %s", l_pcPath.c_str()); // LCOV_EXCL_LINE 200: if GetFileList() returns eFrameworkunifiedStatusOK, l_pTFileList can't be empty // NOLINT[whitespace/line_length]
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to get the list of files from Immediate persistent location :: %s",
- l_pcPath.c_str());
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-#ifdef NPP_PROFILEINFO_ENABLE
-
-EFrameworkunifiedStatus CPersistenceManager::GetPersistenceProfilingData(std::string &f_cpersistenceprofileinfo) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- f_cpersistenceprofileinfo.append("Application Name,");
- f_cpersistenceprofileinfo.append("Tag Name,");
- f_cpersistenceprofileinfo.append("Type,");
- f_cpersistenceprofileinfo.append("UserSpecific,");
- f_cpersistenceprofileinfo.append("Released,");
- f_cpersistenceprofileinfo.append("Persisted");
-
- CPersistence *l_pPersistence = m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE];
- l_pPersistence->GetPersistenceProfilingData(f_cpersistenceprofileinfo);
-
- l_pPersistence = m_mPersist_Type[ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER];
- l_pPersistence->GetPersistenceProfilingData(f_cpersistenceprofileinfo);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-#endif
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp
deleted file mode 100755
index 8a9127e..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_persistent_data.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * @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 implementation of class CPersistentData.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include "ns_npp_persistent_data.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// CPersistentData
-/// Constructor of CPersistentData class
-////////////////////////////////////////////////////////////////////////////////////////////////
-CPersistentData::CPersistentData() {
- m_pMessage = NULL;
- m_uiMsgSize = 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CPersistentData
-/// Destructor of CPersistentData class
-////////////////////////////////////////////////////////////////////////////////////////////////
-CPersistentData::~CPersistentData() {
- if (NULL != m_pMessage) {
- delete[](static_cast<PCHAR>(m_pMessage)); // LCOV_EXCL_BR_LINE 11: unexpected branch
- m_pMessage = NULL;
- }
-}
-
-
-
-
-
-
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp
deleted file mode 100755
index 4371465..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_personalization_manager.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * @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 implementation of class CnotificationpersistentservicePersonalizationManager.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <utility>
-#include <string>
-#ifdef AGL_STUB
-#include "ns_npp_personalization_manager.h"
-#else
-#include "ns_npp_Personalization_manager.h"
-#endif
-#include "ns_npp_notificationpersistentservicelog.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CnotificationpersistentservicePersonalizationManager
-/// Constructor of CnotificationpersistentservicePersonalizationManager class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CnotificationpersistentservicePersonalizationManager::CnotificationpersistentservicePersonalizationManager() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_uiUserId = 0;
-
- m_cCurrentPersonality.clear();
-
- m_pmPersonality = new(std::nothrow) Personality_Type(); // LCOV_EXCL_BR_LINE 11: except,C++ STL
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CnotificationpersistentservicePersonalizationManager
-/// Destructor of CnotificationpersistentservicePersonalizationManager class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CnotificationpersistentservicePersonalizationManager::~CnotificationpersistentservicePersonalizationManager() { // LCOV_EXCL_START 14: Resident process, global instance not released // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pmPersonality) {
- m_pmPersonality->clear();
-
- delete m_pmPersonality;
- m_pmPersonality = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceGetPersonality
-/// This function is used to get the current personality.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceGetPersonality(std::string &f_cpersonalityname) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- f_cpersonalityname = m_cCurrentPersonality;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceSetPersonality
-/// This function is used to set the new personality.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceSetPersonality(const std::string f_cpersonalityname) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // iterator to find personality name from map of personality
- Personality_Type::iterator l_itPersonality;
-
- if (!f_cpersonalityname.empty()) {
- if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: double check, m_pmPersonality can't be NULL
- l_itPersonality = m_pmPersonality->find(f_cpersonalityname);
-
- // if personality found in map
- if (m_pmPersonality->end() != l_itPersonality) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality found in map");
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality not found in map");
-
- l_estatus = CreatePersonality(f_cpersonalityname);
- }
-
- m_cCurrentPersonality = f_cpersonalityname;
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL"); // LCOV_EXCL_LINE 6: m_pmPersonality can't be NULL
- }
- } else {
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CreatePersonality
-/// This function is used to create new Personality.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CnotificationpersistentservicePersonalizationManager::CreatePersonality(const std::string &f_cpersonalityname) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: m_pmPersonality can't be NULL
- CNotificationpersistentservicePersonality *l_pPersonality = new(std::nothrow) CNotificationpersistentservicePersonality(); // LCOV_EXCL_BR_LINE 11: unexpected branch
-
- if (NULL != l_pPersonality) { // LCOV_EXCL_BR_LINE 5: It's impossible to mock new() function
- l_pPersonality->m_uiUserId = ++m_uiUserId;
- l_pPersonality->m_cUserName = f_cpersonalityname;
-
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Inserting new personality in map"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- m_pmPersonality->insert(make_pair(f_cpersonalityname, l_pPersonality));
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL"); // LCOV_EXCL_LINE 6: m_pmPersonality can't be NULL
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// NotificationpersistentserviceIsValidPersonality
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CnotificationpersistentservicePersonalizationManager::NotificationpersistentserviceIsValidPersonality(const std::string f_cpersonalityname) {
- BOOL l_bReturnValue = FALSE;
- // iterator to find personality name from map of personality
- Personality_Type::iterator l_itPersonality;
- if (NULL != m_pmPersonality) { // LCOV_EXCL_BR_LINE 6: m_pmPersonality can't be NULL
- l_itPersonality = m_pmPersonality->find(f_cpersonalityname);
-
- // if personality found in map
- if (m_pmPersonality->end() != l_itPersonality) {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality found in map");
- l_bReturnValue = TRUE;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Personality not found in map");
- }
- } else {
- // LCOV_EXCL_START 6: m_pmPersonality can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "map object is NULL");
- // LCOV_EXCL_STOP
- }
-
- return l_bReturnValue;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp
deleted file mode 100755
index dc74580..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_registry_entry.cpp
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * @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.
-///
-///
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <string>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_registry_entry.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// Constructor
-////////////////////////////////////////////////////////////////////////////////////////////
-CRegistryEntry::CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester,
- const std::string &f_cstoragepath,
- const BOOL f_bisuserpersistence):
- m_eJobState(ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE),
- m_cTag(f_ctag),
- m_cRequestor(f_crequester),
- m_bIsReleased(FALSE),
- m_bIsPersisted(FALSE),
- m_bIsUserPersistence(f_bisuserpersistence),
- m_eCurrentAction(LOADTYPE_NONE),
- m_ePersistType(ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE),
- m_ePersistCategory(eFrameworkunifiedUserData) {
- m_cBasePath.clear();
-
- // set base path.
- m_cBasePath += f_cstoragepath;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// Copy Constructor
-////////////////////////////////////////////////////////////////////////////////////////////
-CRegistryEntry::CRegistryEntry(const CRegistryEntry &in):
- m_eJobState(ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE),
- m_cTag(in.m_cTag),
- m_cRequestor(in.m_cRequestor),
- m_bIsReleased(in.m_bIsReleased),
- m_bIsPersisted(in.m_bIsPersisted),
- m_cPersistPath(in.m_cPersistPath),
- m_cBasePath(in.m_cBasePath),
- m_bIsUserPersistence(in.m_bIsUserPersistence),
- m_eCurrentAction(in.m_eCurrentAction),
- m_ePersistType(in.m_ePersistType),
- m_ePersistCategory(in.m_ePersistCategory) {
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// Operator overload
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-CRegistryEntry &CRegistryEntry::operator=(const CRegistryEntry &in) { // LCOV_EXCL_START 8: never be used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- if (this != &in) {
- m_eJobState = in.m_eJobState;
- m_cTag = in.m_cTag;
- m_cRequestor = in.m_cRequestor;
- m_bIsReleased = in.m_bIsReleased;
- m_bIsPersisted = in.m_bIsPersisted;
- m_cPersistPath = in.m_cPersistPath;
- m_cBasePath = in.m_cBasePath;
- m_bIsUserPersistence = in.m_bIsUserPersistence;
- m_ePersistType = in.m_ePersistType;
- }
- return *this;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetReleasePath
-/// Set release path.
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CRegistryEntry::SetReleasePath(const std::string &f_creleasepath) {
- m_bIsReleased = TRUE;
- m_cReleasePath = f_creleasepath;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetBeingPersisted
-/// Set the file/folder is being persisted.
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CRegistryEntry::SetBeingPersisted() {
- if (LOADTYPE_RELEASE == m_eCurrentAction) {
- m_bIsPersisted = TRUE;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// IsReleased
-/// File/folder released or not.
-////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CRegistryEntry::IsReleased() const {
- return m_bIsReleased;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// HasntBeenPersisted
-/// File/Folder persisted or not
-////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CRegistryEntry::HasntBeenPersisted() const {
- return !m_bIsPersisted;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// IsPersisted
-/// File persisted or not
-////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CRegistryEntry::IsPersisted() const {
- return m_bIsPersisted;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistPath
-/// Get the persist path.
-////////////////////////////////////////////////////////////////////////////////////////////
-std::string CRegistryEntry::GetPersistPath() const {
- return m_cPersistPath;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// GetReleasePath
-/// Get the release path.
-////////////////////////////////////////////////////////////////////////////////////////////
-std::string CRegistryEntry::GetReleasePath() const {
- return m_cReleasePath;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// GetLoadPath
-/// Get the load path.
-////////////////////////////////////////////////////////////////////////////////////////////
-std::string CRegistryEntry::GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const {
- std::string l_cLoadPath = "";
-
- if (f_epersisttype > ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST && f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be in range. // NOLINT[whitespace/line_length]
- l_cLoadPath = m_cBasePath;
-
- switch (m_ePersistCategory) {
- case eFrameworkunifiedUserData: {
- l_cLoadPath += USERDATADIR;
-
- // Check if to persist for user
- if (m_bIsUserPersistence) {
- // if its a user file, user name can't be empty
- if (!f_cusername.empty()) { // LCOV_EXCL_BR_LINE 6: f_cusername can't be empty
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag %s is registered for user %s", m_cTag.c_str(), f_cusername.c_str());
- l_cLoadPath += f_cusername;
- l_cLoadPath += "/";
- }
- } else {
- l_cLoadPath += ALLUSERAPPDATADIR;
- }
-
- break;
- }
- case eFrameworkunifiedFactoryData: {
- l_cLoadPath += FACTORYDATADIR;
- break;
- }
- case eFrameworkunifiedFactoryCustomerData: {
- l_cLoadPath += FACTORYCUSTOMERDATADIR;
- break;
- }
- case eFrameworkunifiedDealerData: {
- l_cLoadPath += DEALERDATADIR;
- break;
- }
- }
-
- l_cLoadPath += m_cRequestor;
- l_cLoadPath += "/";
-
- // file and folder persistency has different storage paths mapped
- if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_epersisttype) {
- l_cLoadPath += "NSFile/";
- } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_epersisttype) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER. // NOLINT[whitespace/line_length]
- l_cLoadPath += "NSFolder/";
- }
-
- l_cLoadPath += m_cTag;
- }
-
- return l_cLoadPath;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// GetRequester
-/// Get the name of requester.
-////////////////////////////////////////////////////////////////////////////////////////////
-std::string CRegistryEntry::GetRequester() const {
- return m_cRequestor;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// GetTag
-/// Get the tag.
-////////////////////////////////////////////////////////////////////////////////////////////
-std::string CRegistryEntry::GetTag() const {
- return m_cTag;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// IsUserPersistence
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CRegistryEntry::IsUserPersistence() {
- return m_bIsUserPersistence;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetCurrentAction
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CRegistryEntry::SetCurrentAction(ENPS_Loadtype f_ecurrentaction) {
- m_eCurrentAction = f_ecurrentaction;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// ResetPersistedFlag
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CRegistryEntry::ResetPersistedFlag() {
- m_bIsPersisted = FALSE;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetPersistProperties
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-VOID CRegistryEntry::SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) {
- if (f_epersisttype > ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST && f_epersisttype < ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be in range. // NOLINT[whitespace/line_length]
- // set the persist type
- m_ePersistType = f_epersisttype;
-
- // set the persist file based on the persist type and username (if a user file)
- m_cPersistPath = m_cBasePath;
-
- switch (m_ePersistCategory) {
- case eFrameworkunifiedUserData: {
- m_cPersistPath += USERDATADIR;
-
- // Check if to persist for user
- if (m_bIsUserPersistence) {
- // if its a user file, user name can't be empty
- if (!f_cusername.empty()) { // LCOV_EXCL_BR_LINE 6: f_cusername can't be empty
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Tag %s is registered for user %s", m_cTag.c_str(), f_cusername.c_str());
- m_cPersistPath += f_cusername;
- m_cPersistPath += "/";
- }
- } else {
- m_cPersistPath += ALLUSERAPPDATADIR;
- }
-
- break;
- }
- case eFrameworkunifiedFactoryData: {
- m_cPersistPath += FACTORYDATADIR;
- break;
- }
- case eFrameworkunifiedFactoryCustomerData: {
- m_cPersistPath += FACTORYCUSTOMERDATADIR;
- break;
- }
- case eFrameworkunifiedDealerData: {
- m_cPersistPath += DEALERDATADIR;
- break;
- }
- }
-
- m_cPersistPath += m_cRequestor;
- m_cPersistPath += "/";
-
- // file and folder persistency has different storage paths mapped
- if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE == f_epersisttype) {
- m_cPersistPath += "NSFile/";
- } else if (ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER == f_epersisttype) { // LCOV_EXCL_BR_LINE 6: f_epersisttype must be ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE or ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER. // NOLINT[whitespace/line_length]
- m_cPersistPath += "NSFolder/";
- }
-
- m_cPersistPath += m_cTag;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistType
-///
-////////////////////////////////////////////////////////////////////////////////////////////
-ENotificationpersistentservicePersistType CRegistryEntry::GetPersistType() const {
- return m_ePersistType;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// SetPersistentCategory
-/// Sets the persistent type related to tag
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CRegistryEntry::SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
-
- m_ePersistCategory = f_epersistcategory;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistentCategory
-/// Gets the persistent type of a tag
-////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedPersistCategory CRegistryEntry::GetPersistentCategory() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return m_ePersistCategory;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp
deleted file mode 100755
index 6d75091..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_regular_notification.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * @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 implementation of class CRegularNotification.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-#include <native_service/frameworkunified_framework_if.h>
-#include <native_service/ns_message_center_if.h>
-#include <native_service/ns_np_service_protocol.h>
-#include <mqueue.h>
-#include <iostream>
-#include <string>
-#include <native_service/ns_mc_system_info.h>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_regular_notification.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CRegularNotification
-/// Constructor of CRegularNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CRegularNotification::CRegularNotification(const std::string &f_cnotificationname,
- const UI_32 f_uimaxmsgsize):
- CNotification(f_cnotificationname, f_uimaxmsgsize) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_ePersistentType = eFrameworkunifiedNotificationVar;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CRegularNotification
-/// Destructor of CRegularNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CRegularNotification::~CRegularNotification() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddEventReciever
-/// This function adds the name of the application to receiver list of particular notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CRegularNotification::AddEventReciever(const std::string &f_csubscribername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
- l_estatus = AddReceiverInMap(f_csubscribername);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: f_csubscribername can't be empty
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Publish
-/// This function publishes the notification to subscribed clients.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CRegularNotification::Publish(const std::string &f_cservicename,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // Message Queue Handle
- HANDLE l_hMsgQHandle = NULL;
-
- // Pointer to class CNotificationReceiver
- CNotificationReceiver *l_pNotificationReceiver = NULL;
-
- // Iterator for Notification Receiver map
- NotifReceiver_Iterator_Type l_itrNotifReceiver;
-
- if (m_uiMaxMsgSize >= f_uimsgsize) {
- if (0 == m_cServiceName.compare(f_cservicename)) {
- for (l_itrNotifReceiver = m_pmSubscribersList->begin();
- l_itrNotifReceiver != m_pmSubscribersList->end();
- l_itrNotifReceiver++) {
- l_pNotificationReceiver = l_itrNotifReceiver->second;
-
- if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: l_pNotificationReceiver can't be NULL
- l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
-
- if (NULL != l_hMsgQHandle) { // LCOV_EXCL_BR_LINE 6: l_hMsgQHandle can't be NULL
- if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_hMsgQHandle, f_pmessage, f_uimsgsize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error Publishing notification %s to %s published by %s, error status: 0x%x",
- m_cNotificationName.c_str(), l_itrNotifReceiver->first.c_str(), f_cservicename.c_str(), l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_hMsgQHandle can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: l_pNotificationReceiver can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification %s. Registered by %s and published by %s.",
- m_cNotificationName.c_str(), m_cServiceName.c_str(), f_cservicename.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in "native_service/ns_logger_if.h"
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't publish notification %s. Message data size (%d) is greater than maximum registered data size (%d)",
- m_cNotificationName.c_str(), f_uimsgsize, m_uiMaxMsgSize);
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp
deleted file mode 100755
index 7898f38..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_nor_persistence_notification.cpp
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * @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 implementation of class CStateNorPersistenceNotification.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <errno.h>
-#include <native_service/ns_message_center_if.h>
-#include <string>
-#include <iostream>
-
-#include "ns_npp_types.h"
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_state_nor_persistence_notification.h"
-
-HANDLE CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread = NULL;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CStateNorPersistenceNotification
-/// Constructor of CStateNorPersistenceNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStateNorPersistenceNotification::CStateNorPersistenceNotification(const std::string &f_cnotificationname,
- const UI_32 f_uimaxmsgsize,
- const UI_32 f_uidelay,
- const EFrameworkunifiedPersistCategory f_epersistcategory):
- CStateNotification(f_cnotificationname, f_uimaxmsgsize),
- m_uiDelay(f_uidelay),
- m_ePersistCategory(f_epersistcategory) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_ePersistentType = eFrameworkunifiedImmediatePersistedStateVar;
-
- // also, register the notification with worker thread responsible for writing notification data
- if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
- TImmediatePersistenceRegisterNotifInfo l_tRegisterNotifInfo = {};
- std::strncpy(l_tRegisterNotifInfo.m_cnotificationname,
- f_cnotificationname.c_str(),
- sizeof(l_tRegisterNotifInfo.m_cnotificationname) - 1);
- l_tRegisterNotifInfo.m_uidelay = f_uidelay;
- l_tRegisterNotifInfo.m_epersistcategory = f_epersistcategory;
-
- if (eFrameworkunifiedStatusOK != McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_REGISTER, sizeof(l_tRegisterNotifInfo), &l_tRegisterNotifInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_REGISTER); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CStateNorPersistenceNotification
-/// Constructor of CStateNorPersistenceNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStateNorPersistenceNotification::~CStateNorPersistenceNotification() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // also, unregister the notification with worker thread responsible for writing notification data
- if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
- TImmediatePersistenceUnregisterNotifInfo l_tUnregisterNotifInfo = {};
- std::strncpy(l_tUnregisterNotifInfo.m_cnotificationname,
- GetNotificationName().c_str(), // LCOV_EXCL_BR_LINE 11: except,C++ STL
- sizeof(l_tUnregisterNotifInfo.m_cnotificationname) - 1);
-
- if (eFrameworkunifiedStatusOK != McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_UNREGISTER, sizeof(l_tUnregisterNotifInfo), &l_tUnregisterNotifInfo)) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for cmd 0x%X failed", NOR_PERSISTENCE_UNREGISTER); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistenceDelay
-/// Method to get the persistence time delay.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-UI_32 CStateNorPersistenceNotification::GetPersistenceDelay() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return m_uiDelay;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Publish
-/// This function publishes the notification to subscribed clients and saves the data
-/// immediately to persistent memory.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNorPersistenceNotification::Publish(const std::string &f_cservicename,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (eFrameworkunifiedStatusOK == (l_estatus = PublishNotification(f_cservicename,
- f_pmessage,
- f_uimsgsize))) {
- if (eFrameworkunifiedStatusOK != (l_estatus = SaveDataToNor(f_pmessage, f_uimsgsize))) {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error in saving persistent data on nor for %s published by %s, status: %d",
- m_cNotificationName.c_str(), f_cservicename.c_str(), l_estatus); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// PublishNotification
-/// This function publishes the notification to subscribed clients.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNorPersistenceNotification::PublishNotification(const std::string &f_cservicename,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- l_estatus = CStateNotification::Publish(f_cservicename, f_pmessage, f_uimsgsize);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SaveDataToNor
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNorPersistenceNotification::SaveDataToNor(PVOID f_pmessage, const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != f_pmessage && f_uimsgsize > 0) {
- TNorPersistenceNotifInfoHeader l_tNorPersistentData = {};
- UI_32 l_ui32SendDataTotalLength = static_cast<UI_32>(sizeof(TNorPersistenceNotifInfoHeader) + f_uimsgsize);
- UI_8 *l_ui8SendData = new(std::nothrow) UI_8[l_ui32SendDataTotalLength];
- UI_8 *l_ui8TmpOffset = l_ui8SendData;
-
- if (NULL != l_ui8SendData) { // LCOV_EXCL_BR_LINE 6: l_ui8SendData can't be NULL
- std::strncpy(l_tNorPersistentData.m_cnotificationname,
- this->GetNotificationName().c_str(),
- sizeof(l_tNorPersistentData.m_cnotificationname) - 1);
- std::strncpy(l_tNorPersistentData.m_cpublishername,
- this->GetPublisherName().c_str(),
- sizeof(l_tNorPersistentData.m_cpublishername) - 1);
- l_tNorPersistentData.m_epersistenttype = this->GetNotificationType();
- l_tNorPersistentData.m_uimaxmsglength = this->GetMaxMessageSize();
- l_tNorPersistentData.m_uidelay = this->GetPersistenceDelay();
- l_tNorPersistentData.m_uimsgsize = f_uimsgsize;
- l_tNorPersistentData.m_epersistcategory = m_ePersistCategory;
-
- std::memset(l_ui8SendData, 0, l_ui32SendDataTotalLength);
- std::memcpy(l_ui8SendData, &l_tNorPersistentData, sizeof(l_tNorPersistentData));
- l_ui8TmpOffset += sizeof(l_tNorPersistentData);
- std::memcpy(l_ui8TmpOffset, f_pmessage, f_uimsgsize);
-
- // issue a copy to the worker thread
- if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, AppName, NOR_PERSISTENCE_TIMER_START, l_ui32SendDataTotalLength, l_ui8SendData))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "McSend for nor worker thread failed %d ", l_estatus); // LCOV_EXCL_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- }
- } else {
- // LCOV_EXCL_START 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Sender handle of nor worker thread is NULL. Can't send message.");
- // LCOV_EXCL_STOP
- }
-
- delete[] l_ui8SendData; // LCOV_EXCL_BR_LINE 11: unexpected branch
- l_ui8SendData = NULL;
- } else {
- // LCOV_EXCL_START 6: l_ui8SendData can not be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- l_estatus = eFrameworkunifiedStatusInvldParam;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Notification data is NULL, size is %d", f_uimsgsize); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistentCategory
-/// Gets the persist type of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedPersistCategory CStateNorPersistenceNotification::GetPersistentCategory() { // LCOV_EXCL_START 100: never be used
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return m_ePersistCategory;
-}
-// LCOV_EXCL_STOP
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetPersistentCategory
-/// Sets the persist type of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNorPersistenceNotification::SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (f_epersistcategory != m_ePersistCategory) {
- if (NULL != m_pData && NULL != m_pData->m_pMessage) { // LCOV_EXCL_BR_LINE 6: if m_pData is not null, the m_pData->m_pMessage can not be null // NOLINT[whitespace/line_length]
- if (NULL != CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread) { // LCOV_EXCL_BR_LINE 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null // NOLINT[whitespace/line_length]
- TImmediatePersistenceChangeCategory l_tChangeCategory = {};
- UI_32 l_ui32SendDataTotalLength =
- static_cast<UI_32>(sizeof(TImmediatePersistenceChangeCategory) + m_pData->m_uiMsgSize);
- UI_8 *l_ui8SendData = new(std::nothrow) UI_8[l_ui32SendDataTotalLength];
- UI_8 *l_ui8TmpOffset = l_ui8SendData;
-
- if (NULL != l_ui8SendData) { // LCOV_EXCL_BR_LINE 6: l_ui8SendData can't be NULL
- std::strncpy(l_tChangeCategory.m_tnornotifInfoheader.m_cnotificationname, this->GetNotificationName().c_str(),
- sizeof(l_tChangeCategory.m_tnornotifInfoheader.m_cnotificationname) - 1);
- std::strncpy(l_tChangeCategory.m_tnornotifInfoheader.m_cpublishername, this->GetPublisherName().c_str(),
- sizeof(l_tChangeCategory.m_tnornotifInfoheader.m_cpublishername) - 1);
- l_tChangeCategory.m_tnornotifInfoheader.m_epersistenttype = this->GetNotificationType();
- l_tChangeCategory.m_tnornotifInfoheader.m_uimaxmsglength = this->GetMaxMessageSize();
- l_tChangeCategory.m_tnornotifInfoheader.m_uidelay = this->GetPersistenceDelay();
- l_tChangeCategory.m_tnornotifInfoheader.m_uimsgsize = m_pData->m_uiMsgSize;
- l_tChangeCategory.m_tnornotifInfoheader.m_epersistcategory = f_epersistcategory;
-
- l_tChangeCategory.m_eoldpersistcategory = m_ePersistCategory;
-
- std::memset(l_ui8SendData, 0, l_ui32SendDataTotalLength);
- std::memcpy(l_ui8SendData, &l_tChangeCategory, sizeof(l_tChangeCategory));
- l_ui8TmpOffset += sizeof(l_tChangeCategory);
- std::memcpy(l_ui8TmpOffset, m_pData->m_pMessage, m_pData->m_uiMsgSize);
-
- // issue a copy to the worker thread
- if (eFrameworkunifiedStatusOK != (l_estatus = McSend(CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread, // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- AppName,
- NOR_PERSISTENCE_CHANGE_CATEGORY,
- l_ui32SendDataTotalLength,
- l_ui8SendData))) {
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "McSend failed while changing category for notfn %s from %d to %d, status=%d",
- m_cNotificationName.c_str(), m_ePersistCategory, f_epersistcategory, l_estatus);
- // LCOV_EXCL_STOP
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__,
- "Msg sent to immediate pers. thread to change persist category of %s from %d to %d",
- m_cNotificationName.c_str(), m_ePersistCategory, f_epersistcategory);
- }
-
- delete[] l_ui8SendData;
- l_ui8SendData = NULL;
- } else {
- // LCOV_EXCL_START 6: l_ui8SendData can not be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory alloc error for l_ui8SendData, errno=%d", errno);
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: CStateNorPersistenceNotification::m_hNSImmediatePersistenceThread can not be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Sender handle of nor worker thread is NULL. Can't send message.");
- l_estatus = eFrameworkunifiedStatusInvldHandle;
- // LCOV_EXCL_STOP
- }
- } else { // no data is persisted in emmc for this notfn, so no need to send msg to worker thread
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Notfn %s has no data to persist", m_cNotificationName.c_str());
- }
-
- m_ePersistCategory = f_epersistcategory;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp
deleted file mode 100755
index ff8f054..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_notification.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * @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 implementation of class CStateNotification.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <iostream>
-#include <string>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_persistent_data.h"
-#include "ns_npp_state_notification.h"
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CStateNotification
-/// Constructor of CStateNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStateNotification::CStateNotification(const std::string &f_cnotificationname,
- const UI_32 f_uimaxmsgsize):
- CNotification(f_cnotificationname, f_uimaxmsgsize),
- m_pData(NULL),
- m_pDefaultData(NULL),
- m_bWasPublished(FALSE) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_ePersistentType = eFrameworkunifiedStateVar;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CStateNotification
-/// Destructor of CStateNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStateNotification::~CStateNotification() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != m_pData) {
- delete m_pData; // LCOV_EXCL_BR_LINE 11: unexpected branch
- m_pData = NULL;
- }
-
- if (NULL != m_pDefaultData) {
- delete m_pDefaultData;
- m_pDefaultData = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistentData
-/// This function is used to get the persistent data pointer
-////////////////////////////////////////////////////////////////////////////////////////////////////
-const CPersistentData *CStateNotification::GetPersistentData() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-
- return m_pData;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetPersistentData
-/// This function is used to set the data related to notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNotification::SetPersistentData(PVOID f_pmessage,
- const UI_32 f_msgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL == m_pData) {
- m_pData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: unexpected branch
- }
-
- l_estatus = SetData(m_pData, f_pmessage, f_msgsize);
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetDefaultPersistentData
-/// This function get the default data(if any) related to notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-const CPersistentData *CStateNotification::GetDefaultPersistentData() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-
- return m_pDefaultData;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetDefaultPersistentData
-/// This function is used to set the default data related to notification
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNotification::SetDefaultPersistentData(PVOID f_pmessage,
- const UI_32 f_msgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL == m_pDefaultData) {
- m_pDefaultData = new(std::nothrow) CPersistentData(); // LCOV_EXCL_BR_LINE 11: except,C++ STL
- }
-
- // set the default persistent data
- if (eFrameworkunifiedStatusOK == (l_estatus = SetData(m_pDefaultData, f_pmessage, f_msgsize))) {
- if (NULL == m_pData) {
- // set the default data as persistent data if notification is not yet published
- l_estatus = SetPersistentData(f_pmessage, f_msgsize);
- FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Setting Persistent data");
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent data already set");
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error setting default persistent data for notification:: %s",
- m_cNotificationName.c_str());
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetData
-/// This function is used to set the persistent data
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNotification::SetData(CPersistentData *f_pdata,
- PVOID f_pmessage,
- const UI_32 f_msgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- if (NULL != f_pdata) { // LCOV_EXCL_BR_LINE 6: double check, f_pdata can't be NULL
- if (m_uiMaxMsgSize >= f_msgsize) {
- f_pdata->m_uiMsgSize = f_msgsize;
-
- if (NULL != f_pmessage && 0 != f_msgsize) {
- if (NULL == f_pdata->m_pMessage) {
- f_pdata->m_pMessage = new(std::nothrow) CHAR[m_uiMaxMsgSize];
- }
-
- if (NULL != f_pdata->m_pMessage) { // LCOV_EXCL_BR_LINE 5: new error case
- std::memset(f_pdata->m_pMessage, 0, m_uiMaxMsgSize);
- std::memcpy(f_pdata->m_pMessage, f_pmessage, f_msgsize);
- } else {
- // LCOV_EXCL_START 5: new error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Memory allocation error, unable to set persistent data for notification: %s",
- m_cNotificationName.c_str());
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- if (NULL != f_pdata->m_pMessage) {
- delete[](static_cast<PCHAR>(f_pdata->m_pMessage));
- f_pdata->m_pMessage = NULL;
- }
- }
-
- m_bWasPublished = TRUE;
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't set notification data. Message data size (%d) is greater than maximum registered data size (%d)"
- " of notification (%s).", f_msgsize, m_uiMaxMsgSize, GetNotificationName().c_str());
- l_estatus = eFrameworkunifiedStatusFail;
- }
- } else {
- // LCOV_EXCL_START 6: double check, f_pdata can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Unable to set persistent data for notification: %s, persistent object is NULL",
- m_cNotificationName.c_str());
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// AddEventReciever
-/// This function adds the name of the application to receiver list of particular notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNotification::AddEventReciever(const std::string &f_csubscribername) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // Message Queue Handle
- HANDLE l_hMsgQHandle = NULL;
-
- // iterator of CNotificationReceiver map
- NotifReceiver_Iterator_Type l_iterator;
-
- CNotificationReceiver *l_pNotificationReceiver = NULL;
-
- if (!f_csubscribername.empty()) { // LCOV_EXCL_BR_LINE 6: double check, f_csubscribername can't be empty
- l_estatus = AddReceiverInMap(f_csubscribername);
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusInvldParam; // LCOV_EXCL_LINE 6: double check, f_csubscribername can't be empty
- }
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: double check, l_estatus must be eFrameworkunifiedStatusOK
- if (m_bWasPublished) {
- FRAMEWORKUNIFIEDLOG(ZONE_NPP_INFO, __FUNCTION__, "Republish Notification to subscriber :: %s", f_csubscribername.c_str()); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
-
- if (NULL != m_pData) {
- l_iterator = m_pmSubscribersList->find(f_csubscribername);
-
- if (m_pmSubscribersList->end() != l_iterator) {
- l_pNotificationReceiver = (*l_iterator).second;
-
- if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6: double check, l_pNotificationReceiver can't be NULL // NOLINT[whitespace/line_length]
- l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
-
- if (NULL != l_hMsgQHandle) { // LCOV_EXCL_BR_LINE 6: double check, l_hMsgQHandle can't be NULL
- if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_pNotificationReceiver->m_MsgQHandle, m_pData->m_pMessage, m_pData->m_uiMsgSize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error Publishing notification %s to %s published by %s, error status: 0x%x",
- m_cNotificationName.c_str(), l_iterator->first.c_str(), m_cServiceName.c_str(), l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_hMsgQHandle can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_pNotificationReceiver can't be NULL
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "m_pData pointer is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Subscribing Notfn, src=%s name=%s. Notification not published.",
- f_csubscribername.c_str(), m_cNotificationName.c_str());
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_estatus must be eFrameworkunifiedStatusOK
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- l_estatus = eFrameworkunifiedStatusFail;
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Receiver Not Added in map");
- // LCOV_EXCL_STOP
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Publish
-/// This function publishes the notification to subscribed clients.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNotification::Publish(const std::string &f_cservicename,
- PVOID f_pmessage,
- const UI_32 f_uimsgsize) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- // Message Queue Handle
- HANDLE l_hMsgQHandle = NULL;
-
- // Pointer to class CNotificationReceiver
- CNotificationReceiver *l_pNotificationReceiver = NULL;
-
- // Iterator for Notification Receiver map
- NotifReceiver_Iterator_Type l_itrNotifReceiver;
-
- if (m_uiMaxMsgSize >= f_uimsgsize) {
- if (0 == m_cServiceName.compare(f_cservicename)) {
- l_estatus = SetPersistentData(f_pmessage,
- f_uimsgsize);
-
- if (eFrameworkunifiedStatusOK == l_estatus) { // LCOV_EXCL_BR_LINE 6: l_estatus is always eFrameworkunifiedStatusOK
- for (l_itrNotifReceiver = m_pmSubscribersList->begin();
- l_itrNotifReceiver != m_pmSubscribersList->end();
- l_itrNotifReceiver++) {
- l_pNotificationReceiver = l_itrNotifReceiver->second;
-
- if (NULL != l_pNotificationReceiver) { // LCOV_EXCL_BR_LINE 6:double check, l_pNotificationReceiver can not be null // NOLINT[whitespace/line_length]
- l_hMsgQHandle = l_pNotificationReceiver->m_MsgQHandle;
-
- if (NULL != l_hMsgQHandle && NULL != m_pData) { // LCOV_EXCL_BR_LINE 6:double check, l_hMsgQHandle and m_pData can not be null // NOLINT[whitespace/line_length]
- if (eFrameworkunifiedStatusOK != (l_estatus = PublishData(l_hMsgQHandle, m_pData->m_pMessage, f_uimsgsize))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT[whitespace/line_length]
- // LCOV_EXCL_START 4: NSFW error case
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Error Publishing notification %s to %s published by %s, error status: 0x%x",
- m_cNotificationName.c_str(),
- l_itrNotifReceiver->first.c_str(),
- f_cservicename.c_str(), l_estatus);
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_hMsgQHandle and m_pData can not be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "MsgQ Handle NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- } else {
- // LCOV_EXCL_START 6: double check, l_pNotificationReceiver can not be null
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "l_pNotificationReceiver is NULL");
- l_estatus = eFrameworkunifiedStatusNullPointer;
- // LCOV_EXCL_STOP
- }
- }
- } else {
- AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Persistent Data Not Set"); // LCOV_EXCL_LINE 6: double check, l_estatus is always eFrameworkunifiedStatusOK // NOLINT[whitespace/line_length]
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Can't publish notification %s. Registered by %s and published by %s.",
- GetNotificationName().c_str(), m_cServiceName.c_str(), f_cservicename.c_str());
- l_estatus = eFrameworkunifiedStatusInvldParam;
- }
- } else {
- FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
- "Can't publish notification %s. Message data size (%d) is greater than maximum registered data size (%d)",
- GetNotificationName().c_str(), f_uimsgsize, m_uiMaxMsgSize);
- l_estatus = eFrameworkunifiedStatusFail;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// IsPublished
-/// This functions returns the published status of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-BOOL CStateNotification::IsPublished() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- return m_bWasPublished;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-/// ResetMaxMessageSize
-/// This function reset the max size of data that can be published with notification.
-/// Also deletes the old persistent data and default data.
-////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStateNotification::ResetMaxMessageSize(const UI_32 f_uilength) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- CNotification::ResetMaxMessageSize(f_uilength);
-
- // delete the old data as the size is changed the data may become invalid
- if (NULL != m_pData) {
- delete m_pData;
- m_pData = NULL;
- }
-
- if (NULL != m_pDefaultData) {
- delete m_pDefaultData;
- m_pDefaultData = NULL;
- }
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp
deleted file mode 100755
index 1bb9dd1..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_notification.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * @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 implementation of class CStatePersistenceNotification.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <iostream>
-#include <string>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_state_persistence_notification.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CStatePersistenceNotification
-/// Constructor of CStatePersistenceNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStatePersistenceNotification::CStatePersistenceNotification(const std::string &f_cnotificationname,
- const UI_32 f_uimaxmsgsize,
- const EFrameworkunifiedPersistCategory f_epersistcategory):
- CStateNotification(f_cnotificationname, f_uimaxmsgsize),
- m_ePersistCategory(f_epersistcategory) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_ePersistentType = eFrameworkunifiedPersistedStateVar;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CStatePersistenceNotification
-/// Constructor of CStatePersistenceNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStatePersistenceNotification::~CStatePersistenceNotification() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// GetPersistentCategory
-/// Gets the persist type of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedPersistCategory CStatePersistenceNotification::GetPersistentCategory() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return m_ePersistCategory;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// SetPersistentCategory
-/// Sets the persist type of notification.
-////////////////////////////////////////////////////////////////////////////////////////////////////
-EFrameworkunifiedStatus CStatePersistenceNotification::SetPersistentCategory(const EFrameworkunifiedPersistCategory f_epersistcategory) {
- EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_ePersistCategory = f_epersistcategory;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
- return l_estatus;
-}
diff --git a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp b/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp
deleted file mode 100755
index 222ada3..0000000
--- a/video_in_hal/nsframework/notification_persistent_service/server/src/ns_npp_state_persistence_user_notification.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * @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 implementation of class CStatePersistenceUserNotification.
-///
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Include Files
-////////////////////////////////////////////////////////////////////////////////////////////////////
-#include <iostream>
-#include <string>
-#include "ns_npp_notificationpersistentservicelog.h"
-#include "ns_npp_state_persistence_user_notification.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// CStatePersistenceUserNotification
-/// Constructor of CStatePersistenceUserNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStatePersistenceUserNotification::CStatePersistenceUserNotification(const std::string &f_cnotificationname,
- const UI_32 f_uimaxmsgsize):
- CStateNotification(f_cnotificationname, f_uimaxmsgsize) {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
- m_ePersistentType = eFrameworkunifiedPersistedStateUserVar;
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// ~CStatePersistenceUserNotification
-/// Destructor of CStatePersistenceUserNotification class
-////////////////////////////////////////////////////////////////////////////////////////////////////
-CStatePersistenceUserNotification::~CStatePersistenceUserNotification() {
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
-
-
- FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
-}