1 #ifndef PERSISTENCY_CLIENT_LIBRARY_H
2 #define PERSISTENCY_CLIENT_LIBRARY_H
4 /******************************************************************************
7 * Company XS Embedded GmbH
8 *****************************************************************************/
9 /******************************************************************************
10 * This Source Code Form is subject to the terms of the
11 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
12 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
13 ******************************************************************************/
15 * \file persistence_client_library.h
16 * \ingroup Persistence client library
17 * \author Ingo Huerner (XSe) / Guy Sagnes (Continental)
18 * \brief Header of the persistence client library.
19 * Library provides an API to access persistent data
22 * 25/06/13 Ingo Hürner 1.0.0 - Rework of Init functions
23 * 04/11/13 Ingo Hürner 1.3.0 - Added define for shutdown type none
26 /** \ingroup GEN_PERS */
27 /** \defgroup PERS_CLIENT Client: initialisation access
30 /** \defgroup PERS_CLIENT_INTERFACE API document
38 /** \defgroup PCL_DEFINES_API Defines, Struct, Enum
42 #define PERSIST_API_INTERFACE_VERSION (0x01030000U)
47 /** \defgroup SHUTDOWN_TYPE notifications type definitions
48 * according to Node State Manager Component
52 #define PCL_SHUTDOWN_TYPE_FAST 2 /// Client registered for fast lifecycle shutdown
53 #define PCL_SHUTDOWN_TYPE_NORMAL 1 /// Client registered for normal lifecycle shutdown
54 #define PCL_SHUTDOWN_TYPE_NONE 0 /// Client does not register to lifecycle shutdown
58 /** \defgroup PCL_OVERALL functions for Library initialization
59 * The following functions have to be called for library initialization
64 #define PCL_SHUTDOWN 1 /// trigger shutdown
65 #define PCL_SHUTDOWN_CANEL 0 /// cancel shutdown
69 * @brief initialize client library.
70 * This function will be called by the process using the PCL during startup phase.
72 * @attention This function is currently N O T part of the GENIVI compliance specification
74 * @param appname application name, the name must be a unique name in the system
75 * @param shutdownMode shutdown mode ::PCL_SHUTDOWN_TYPE_FAST or ::PCL_SHUTDOWN_TYPE_NORMAL
77 * @return positive value: success;
78 * On error a negative value will be returned with the following error codes:
79 * ::EPERS_NOT_INITIALIZED, ::EPERS_INIT_DBUS_MAINLOOP,
80 * ::EPERS_REGISTER_LIFECYCLE, ::EPERS_REGISTER_ADMIN
82 int pclInitLibrary(const char* appname, int shutdownMode);
86 * @brief deinitialize client library
87 * This function will be called during the shutdown phase of the process which uses the PCL.
89 * @attention This function is currently N O T part of the GENIVI compliance specification
91 * @return positive value: success;
92 * On error a negative value will be returned.
94 int pclDeinitLibrary(void);
100 * @brief pclLifecycleSet client library
101 * This function can be called if to flush and write back the data form cache to memory device.
102 * The function is only available if PCL_SHUTDOWN_TYPE_NONE has been used in pclInitLibrary.
104 * @attention This function is currently N O T part of the GENIVI compliance specification
105 * @attention In order to prevent misuse of this function the cancel shutdown request
106 * can only be called 3 times per lifecycle.
107 * If this function has been called by an application more then 3 times the application
108 * will not be able to store it's data anymore during the current lifecycle.
109 * The application isn't fully operable in this lifecycle anymore.
110 * In the next lifecycle the application can store data again until the limit above
113 * @parm PCL_SHUTDOWN for write back data when shutdown is requested,
114 * and PCL_SHUTDOWN_CANEL when shutdown cancel request has been received.
116 * @return positive value: success;
117 * On error a negative value will be returned with the following error codes:
118 * ::EPERS_COMMON, :.EPERS_MAX_CANCEL_SHUTDOWN, ::EPERS_SHTDWN_NO_PERMIT
120 int pclLifecycleSet(int shutdown);
129 /** \} */ /* End of API */
130 /** \} */ /* End of MODULE */
133 #endif /* PERSISTENCY_CLIENT_LIBRARY_H */