1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache 2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_PKGMGR_INTERFACE_H_
6 #define COMMON_PKGMGR_INTERFACE_H_
8 #include <pkgmgr_installer.h>
12 #include "utils/macros.h"
13 #include "utils/logging.h"
15 namespace common_installer {
17 class PkgMgrInterface;
18 typedef std::shared_ptr<PkgMgrInterface> PkgMgrPtr;
20 /** Class that covers pkgmgr_installer basic platform calls.
22 * PkgMgr covers all pkgmgr_installer platform calls (and manages its
23 * creation/destruction.
25 class PkgMgrInterface {
27 /** Request type received from pkgmgr_installer
37 /** Returns Request type passed from pkgmgr_installer
39 PkgMgrInterface::Type GetRequestType() const;
41 /** Returns Request info passed from pkgmgr_installer
43 const char *GetRequestInfo() const;
45 /** Returns instance of PkgrMgr (Singleton pattern).
47 * However, Init method has to be called first (otherwise, this Instance
50 * @see PkgMgr::Init(int argc, char** argv)
52 static PkgMgrPtr Instance();
54 /** Initialize PkgMgrInterface.
56 static int Init(int argc, char** argv);
58 /** Get Raw pointer to pkgmgr_installer object
60 * It should not be used (PkgMgrInterface can destroy it
62 DEPRECATED pkgmgr_installer *GetRawPi() const { return pi_; }
64 /** PkgMgrInstance destructor.
70 PkgMgrInterface() :pi_(nullptr) {}
71 int InitInternal(int argc, char** argv);
73 pkgmgr_installer* pi_;
74 static PkgMgrPtr instance_;
76 SCOPE_LOG_TAG(PkgMgrInterface)
77 DISALLOW_COPY_AND_ASSIGN(PkgMgrInterface);
80 } // namespace common_installer
82 #endif // COMMON_PKGMGR_INTERFACE_H_