2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup tag_NS_NPPService
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup tag_NS_NPPService
28 ////////////////////////////////////////////////////////////////////////////////////////////////////
31 #include <native_service/frameworkunified_multithreading.h>
33 #include "ns_npp_persistence.h"
34 #include "ns_npp_persist_folder.h"
35 #include "ns_npp_registry_entry.h"
37 // Constructor of class CFolderPersistence
38 CFolderPersistence::CFolderPersistence() {
41 // Destructor of class CFolderPersistence
42 CFolderPersistence::~CFolderPersistence() { // LCOV_EXCL_START 14: Resident process, global instance not released
43 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
47 // Method to release folder for persistence.
48 EFrameworkunifiedStatus CFolderPersistence::Release(std::string f_crequesterappname,
50 std::string f_cmempath,
51 EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
52 std::string f_cusername) {
53 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
54 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
56 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]
57 // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cmempath can't be empty
58 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
59 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid folder path, requester or tag.");
60 l_estatus = eFrameworkunifiedStatusInvldParam;
63 // Call to method requesting to release the folder for persistence.
64 l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cmempath, enotificationpersistentservicereleasetype,
68 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
72 // Method to load folder from persistent memory.
73 EFrameworkunifiedStatus CFolderPersistence::Load(std::string f_crequesterappname,
75 std::string f_cretrievepath,
76 std::string f_cusername) {
77 EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
78 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
81 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]
82 // Call to method requesting to load the folder from persistent memory.
83 l_estatus = ProcessLoadRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cretrievepath, f_cusername);
85 // LCOV_EXCL_START 6: f_ctag, f_crequesterappname and f_cretrievepath can't be empty
86 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
87 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid argument passed (RetrievePath:%s ,tag:%s, requester:%s)",
88 f_cretrievepath.c_str(), f_ctag.c_str(), f_crequesterappname.c_str());
90 l_estatus = eFrameworkunifiedStatusInvldParam;
94 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");