f20ecc21e61c5fce433c98e9740d9d85c984971f
[framework/web/wrt-installer.git] / src_wearable / wrt-installer / installer_callbacks_translate.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file    api_callbacks_translate.h
18  * @author  Pawel Sikorski (p.sikorski@samsung.com)
19  * @version 1.0
20  * @brief   Header file for api callbacks translate functions
21  */
22 #ifndef WRT_SRC_API_API_CALLBACKS_TRANSLATE_H_
23 #define WRT_SRC_API_API_CALLBACKS_TRANSLATE_H_
24
25 #include <string>
26
27 #include <wrt_common_types.h>
28 #include <widget_install/widget_install_errors.h>
29 #include <widget_uninstall/widget_uninstall_errors.h>
30 #include <plugin_install/plugin_installer_errors.h>
31 #include <job_base.h>
32 #include <wrt_type.h>
33 #include <wrt_install_mode.h>
34 #include <pkgmgr_signal_interface.h>
35
36 typedef void (*WrtInstallerInitCallback)(WrtErrStatus status,
37                                          void *data);
38 typedef void (*WrtPluginInstallerStatusCallback)(WrtErrStatus status,
39                                                  void *data);
40 typedef void (*WrtInstallerStatusCallback)(std::string tizenId,
41                                            WrtErrStatus status,
42                                            void *data);
43 typedef void (*WrtProgressCallback)(float percent,
44                                     const char *description,
45                                     void *data);
46
47
48 namespace InstallerCallbacksTranslate {
49 struct StatusCallbackStruct
50 {
51     void* userdata;
52     WrtInstallerStatusCallback status_callback;
53     WrtProgressCallback progress_callback;
54
55     StatusCallbackStruct(void* u,
56                          WrtInstallerStatusCallback s,
57                          WrtProgressCallback p) :
58         userdata(u),
59         status_callback(s),
60         progress_callback(p)
61     {}
62 };
63
64 struct PluginStatusCallbackStruct
65 {
66     void* userdata;
67     WrtPluginInstallerStatusCallback statusCallback;
68     WrtProgressCallback progressCallback;
69
70     PluginStatusCallbackStruct(void* u,
71                                WrtPluginInstallerStatusCallback s,
72                                WrtProgressCallback p) :
73         userdata(u),
74         statusCallback(s),
75         progressCallback(p)
76     {}
77 };
78
79 void installFinishedCallback(void *userParam,
80                              std::string tizenId,
81                              Jobs::Exceptions::Type status);
82
83 void uninstallFinishedCallback(void *userParam,
84                                std::string tizenId,
85                                Jobs::Exceptions::Type status);
86
87 void pluginInstallFinishedCallback(void *userParam,
88                                    Jobs::Exceptions::Type status);
89
90 // callback for progress of install OR uninstall
91 void installProgressCallback(void *userParam,
92                              ProgressPercent percent,
93                              const ProgressDescription &description);
94 } //namespace
95
96 #endif /* WRT_SRC_API_API_CALLBACKS_TRANSLATE_H_ */