Remove unused directories and files in video_in_hal
[staging/basesystem.git] / nsframework / notification_persistent_service / server / src / ns_npp_persist_folder.cpp
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup  tag_NS_NPPService
20 /// .
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
22
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup  tag_NS_NPPService
25 /// \brief
26 ///
27 ///
28 ////////////////////////////////////////////////////////////////////////////////////////////////////
29
30 #include <unistd.h>
31 #include <native_service/frameworkunified_multithreading.h>
32 #include <string>
33 #include "ns_npp_persistence.h"
34 #include "ns_npp_persist_folder.h"
35 #include "ns_npp_registry_entry.h"
36
37 // Constructor of class CFolderPersistence
38 CFolderPersistence::CFolderPersistence() {
39 }
40
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
44 }
45 // LCOV_EXCL_STOP
46
47 // Method to release folder for persistence.
48 EFrameworkunifiedStatus CFolderPersistence::Release(std::string f_crequesterappname,
49                                        std::string f_ctag,
50                                        std::string f_cmempath,
51                                        EFrameworkunifiedReleaseType enotificationpersistentservicereleasetype,
52                                        std::string f_cusername) {
53   EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
54   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
55
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;
61     // LCOV_EXCL_STOP
62   } else {
63     // Call to method requesting to release the folder for persistence.
64     l_estatus = ProcessReleaseRequest(f_crequesterappname, f_ctag, ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, f_cmempath, enotificationpersistentservicereleasetype,
65                                       f_cusername);
66   }
67
68   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "- l_estatus:0x%x", l_estatus);
69   return l_estatus;
70 }
71
72 // Method to load folder from persistent memory.
73 EFrameworkunifiedStatus CFolderPersistence::Load(std::string f_crequesterappname,
74                                     std::string f_ctag,
75                                     std::string f_cretrievepath,
76                                     std::string f_cusername) {
77   EFrameworkunifiedStatus l_estatus = eFrameworkunifiedStatusOK;
78   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
79
80
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);
84   } else {
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());
89
90     l_estatus = eFrameworkunifiedStatusInvldParam;
91     // LCOV_EXCL_STOP
92   }
93
94   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
95   return l_estatus;
96 }