6c4e043586efa8fcd80d0d8da20490909f6de3c4
[framework/web/wrt-installer.git] / src / pkg-manager / pkgmgr_signal.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  * @author      Yunchan Cho (yunchan.cho@samsung.com)
18  * @version     0.1
19  * @brief
20  */
21
22 #ifndef WRT_PKGMGR_SIGNAL_H_
23 #define WRT_PKGMGR_SINGAL_H_
24
25 #include <dpl/singleton.h>
26 #include <pkgmgr_installer.h>
27
28 namespace PackageManager{
29
30 #define PKGMGR_WEBAPP_TYPE          "wgt"
31 #define PKGMGR_START_KEY            "start"
32 #define PKGMGR_START_INSTALL        "install"
33 #define PKGMGR_START_UNINSTALL      "uninstall"
34 #define PKGMGR_END_KEY              "end"
35 #define PKGMGR_END_SUCCESS          "ok"
36 #define PKGMGR_END_FAILURE          "fail"
37 #define PKGMGR_PROGRESS_KEY         "install_percent"
38
39 typedef pkgmgr_installer* PkgmgrHandle;
40
41 class PkgmgrSignal
42 {
43     public:
44         bool initialize(int argc, char* argv[]);
45         bool deinitialize();
46         bool setPkgname(std::string name);
47         bool sendSignal(std::string key, std::string value) const;
48         std::string getPkgname() const;
49         int getRequestedType() const;
50         bool isNoPopupRequired() const;
51
52     private:
53         bool m_initialized;
54         PkgmgrHandle m_handle;
55         std::string m_type;
56         std::string m_pkgname;
57         bool m_noPopup;
58         int m_reqType;
59
60         PkgmgrSignal();
61         ~PkgmgrSignal();
62
63         friend class DPL::Singleton<PkgmgrSignal>;
64 };
65
66 typedef DPL::Singleton<PkgmgrSignal> PkgmgrSignalSingleton;
67
68 } // PackageManager
69
70 #endif // WRT_PKGMGR_SIGNAL_H_
71