Move from mulit-threaded to single-threaded dbus communication
[profile/ivi/persistence-client-library.git] / include / persistence_client_custom.h
1 #ifndef PERSISTENCE_CLIENT_LIBRARY_CUSTOM_H
2 #define PERSISTENCE_CLIENT_LIBRARY_CUSTOM_H
3
4 /****************************************************
5  *  persistence_custom.h                                         
6  *  Created on: 09-Jul-2012 11:38:03                      
7  *  Implementation of the Interface PersCustom       
8  *  Original author: ihuerner, G.Sagnes
9  *
10  *  \file   persistence_client_custom.h
11  *  \brief  Implementation of the Interface PersCustom
12  *
13  *  \par Responsibility
14  *   - SW-Subsystem:         EG-SI
15  *   - SW-Domain:            Persistence
16  *   - Interface Visibility: Protected
17  *  \par change history
18  *  \verbatim
19  *  Date       Author    Version  Description 
20  *  2013.06.26 ihuerner  1.5.0.0  added description of parameters
21  *  2013.01.06 ihuerner  1.4.0.0  plugin_handle_open and plugin_set_data changed from char* to const char*
22  *  2012.11.22 gsagnes   1.3.0.0  add the handle_get_size, correct the type to int
23  *  2012.10.16 gsagnes   1.2.0.0  add get_size, create_backup, restore_backup
24  *  2012.10.04 gsagnes   1.1.0.0  add deinitialisation functionality (call during shutdown)
25  *  2012.07.14 ihuerner  1.0.0.0  Initial version of the interface
26  *  \endverbatim
27  *
28  ****************************************************/
29  
30 /** \ingroup GEN_PERS_CLIENTLIB_INTERFACE API document
31  *  \{
32  */
33
34 /** Module version
35 The lower significant byte is equal 0 for released version only
36 */
37 #define     PERSIST_CUSTOMER_INTERFACE_VERSION            (0x01050000U)\r
38
39 /**
40  * <b>Plugin interface:</b>
41  * All plugins in a specual location will be loaded, and according
42  * to the plugin name  functions will created.
43  * Example:
44  * function name: plugin_open
45  * Loaded plugin name: hwi
46  * Generated function: hwi_plugin_open
47  */
48  
49 /**
50  * @brief create backup
51  *
52  * @param backup_id Name of the backup / identifier
53  *
54  * @return positive value: backup success (size of backup, bytes); negative value: error
55  */
56 int plugin_create_backup(const char* backup_id);
57
58  /**
59  * @brief deinitialize plugin (during shutdown)
60  *
61  * @return positive value: init success; negative value: error
62  */
63 int plugin_deinit();
64
65 /**
66  * @brief delete data
67  *
68  * @param path the path to the data to delete
69  *
70  * @return positive value: delete success; negative value: error
71  */
72 int plugin_delete_data(const char* path);
73
74 /**
75  * @brief get backup name
76  *
77  * @param backup_id Name of the backup / identifier
78  * @param size size of the buffer to return the identifier
79  *
80  * @return positive value: success, length of identifier; negative value: error
81  */
82 int plugin_get_backup(char* backup_id, int size);
83
84 /**
85  * @brief gets the size of persistent data in bytes
86  *
87  * @param path the path to the data
88  *
89  * @return positive value: the size; negative value: error code
90  */
91 int plugin_get_size(const char* path);
92
93 /**
94  * @brief get data
95  *
96  * @param path the path to the resource to get
97  * @param buffer the buffer to store data
98  * @param size the number of bytes to get data
99  *
100  * @return positive value: size data read in bytes; negative value: error
101  */
102 int plugin_get_data(const char* path, char* buffer, int size);
103  
104 /**
105  * @brief close the given handle
106  *
107  * @param handle the handle to close
108  *
109  * @return positive value: successfully closed; negative value: error
110  */
111 int plugin_handle_close(int handle);
112
113 /**
114  * @brief get data
115  *
116  * @param handle the handle returned from open
117  * @param buffer the buffer to store data
118  * @param size the number of bytes to get data
119  *
120  * @return positive value: size data read in bytes; negative value: error
121  */
122 int plugin_handle_get_data(int handle, char* buffer, int size);
123
124 /**
125  * @brief open a resource
126  *
127  * @param path the path to the resource to open
128  * @param flag open flags
129  * @param mode the open mode
130  *
131  * @return positive value: handle; negative value: error
132  */
133 int plugin_handle_open(const char* path, int flag, int mode);
134
135 /**
136  * @brief set data
137  *
138  * @param handle the handle given by open
139  * @param buffer the data to write
140  * @param size the number of bytes to write
141  *
142  * @return positive size data set; negative value: error
143  */
144 int plugin_handle_set_data(int handle, char* buffer, int size);
145
146 /**
147  * @brief initialize plugin
148  *
149  * @return positive value: init success; negative value: error
150  */
151 int plugin_init();
152
153 /**
154  * @brief restore backup
155  *
156  * @param backup_id Name of the backup / identifier
157  *
158  * @return positive value: backup success (size of backup, bytes); negative value: error
159  */
160 int plugin_restore_backup(const char* backup_id);
161
162 /**
163  * @brief set data
164  *
165  * @param path the path to the resource to set
166  * @param buffer the data to write
167  * @param size the number of bytes to write
168  *
169  * @return positive size data set; negative value: error
170  */
171 int plugin_set_data(const char* path, char* buffer, int size);
172
173 /**
174  * @brief typdef of callback function prototype
175  *
176  * @param int pass a statusId to the function
177  * @param void* pass an argument to the function
178  */
179 typedef int (*plugin_callback_t) (int, void*);
180
181 /**
182  * @brief registercallback for status notifications
183  *
184  * @param pFunct the callback
185  *
186  * @return positive value: register success; negative value error
187  */
188 int plugin_get_status_notification_clbk(plugin_callback_t pFunct);
189
190 /**
191  * @brief get size
192  *
193  * @param handle the handle given by open
194  *
195  * @return positive value: the size; negative value: error code
196  */
197 int plugin_handle_get_size(int handle);
198
199 #endif /* PERSISTENCE_CLIENT_LIBRARY_CUSTOM_H */
200 /** \} */ /* End of INTERFACE */
201