Init basesystem source codes.
[staging/basesystem.git] / nsframework / framework_unified / client / include / native_service / ns_np_service_nor_persistence_internal.h
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 /// \ingroup  tag_NPServiceIf
19 /// \brief    This file contains the declaration for internal functions to retrieve and store
20 ///           immediate notification data from and to persistent storage.
21 ///
22 ///
23 ///
24 //////////////////////////////////////////////////////////////////////////////////////////////////
25
26 #ifndef FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
27 #define FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
28
29 ///////////////////////////////////////////////////////////////////////////////
30 // Include Files
31 ///////////////////////////////////////////////////////////////////////////////
32 #include <native_service/frameworkunified_types.h>
33 #include <native_service/ns_np_service.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 ////////////////////////////////////////////////////////////////////////////////////////////
40 /// NPSynchronousGetPersistentData
41 /// API to retrieve immediate storage notification data structure.
42 ///
43 ///
44 /// \param [in] pAppName
45 ///         PCSTR - Name of application service
46 /// \param [in] notif_name
47 ///         PCSTR - Name of notification to be written to immediate storage
48 /// \param [in] pData
49 ///         PVOID - Notification data
50 /// \param [in] uiDataSize
51 ///         UI_32 - Size of notification data
52 /// \param [out] ptNorPersistentData
53 ///         NC_NorPersistentData - Immediate notification structure
54 /// \param [in] ePersistCategory
55 ///         const EFrameworkunifiedPersistCategory - Persist Category of Notification.
56 ///
57 /// \return status
58 ///         EFrameworkunifiedStatus - success or error
59 ////////////////////////////////////////////////////////////////////////////////////////////
60 EFrameworkunifiedStatus NPSynchronousGetPersistentData(PCSTR pAppName,
61                                           PCSTR notif_name,
62                                           PVOID pData,
63                                           UI_32 uiDataSize,
64                                           NC_NorPersistentData &ptNorPersistentData,
65                                           const EFrameworkunifiedPersistCategory ePersistCategory);
66
67 ////////////////////////////////////////////////////////////////////////////////////////////
68 /// NPSynchronousGetPersistentDataSize
69 /// API to get immediate storage notification data size.
70 ///
71 /// \param [in] notif_name
72 ///         PCSTR - Name of notification to be read from immediate storage
73 /// \param [out] uiDataSize
74 ///         PUI_32 - notification data size
75 /// \param [in] ePersistCategory
76 ///         const EFrameworkunifiedPersistCategory - Persist Category of Notification.
77 ///
78 /// \return EFrameworkunifiedStatus
79 ///         EFrameworkunifiedStatus - success or failure
80 ////////////////////////////////////////////////////////////////////////////////////////////
81 EFrameworkunifiedStatus NPSynchronousGetPersistentDataSize(PCSTR notif_name,
82                                               PUI_32 uiDataSize,
83                                               const EFrameworkunifiedPersistCategory ePersistCategory);
84
85 ////////////////////////////////////////////////////////////////////////////////////////////
86 /// SynchronousGetPersistentDataSize
87 /// API to write immediate persistence notification data.
88 ///
89 /// \param [in] notif_name
90 ///         PCSTR - Name of notification to be read from immediate storage
91 /// \param [in] ePersistCategory
92 ///         const EFrameworkunifiedPersistCategory - Persist Category of Notification.
93 ///
94 /// \return UI_32
95 ///         UI_32 - size of the data
96 ////////////////////////////////////////////////////////////////////////////////////////////
97 EFrameworkunifiedStatus SynchronousWritePersistentData(PCSTR pAppName,
98                                           PCSTR notif_name,
99                                           PVOID pData,
100                                           const UI_32 uiDataSize,
101                                           const UI_32 uiDelay,
102                                           const UI_32 uiMaxSize,
103                                           const EFrameworkunifiedPersistCategory ePersistCategory);
104
105 ////////////////////////////////////////////////////////////////////////////////////////////
106 /// SynchronousMovePersistentData
107 /// API to move all the immediate notification data from f_cSrcDir directory to
108 /// f_cDestDir directory
109 ///
110 /// \param [in] f_cSrcDir
111 ///         PCSTR - Source directory full path
112 /// \param [in] f_cDestDir
113 ///         PCSTR - Dest directory full path
114 ///
115 /// \return EFrameworkunifiedStatus
116 ///         EFrameworkunifiedStatus - eFrameworkunifiedStatusAccessError if source path not exists
117 ///                      eFrameworkunifiedStatusFileLoadError if unable to access src directory
118 ///                      eFrameworkunifiedStatusInvldParam if invalid parameter is received
119 ///                      eFrameworkunifiedStatusFail if error occurs while copying file
120 ///                      eFrameworkunifiedStatus on success
121 ////////////////////////////////////////////////////////////////////////////////////////////
122 EFrameworkunifiedStatus SynchronousMovePersistentData(PCSTR f_cSrcDir,
123                                          PCSTR f_cDestDir);
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129 #endif  // FRAMEWORK_UNIFIED_CLIENT_NS_NPSERVICEIF_INCLUDE_NS_NP_SERVICE_NOR_PERSISTENCE_INTERNAL_H_
130
131 // EOF