Release version 0.22.21
[platform/core/appfw/pkgmgr-info.git] / src / client / pkginfo_client.hh
1 // Copyright (c) 2021 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.
4
5 #ifndef CLIENT_PKGINFO_CLIENT_HH_
6 #define CLIENT_PKGINFO_CLIENT_HH_
7
8 #include "abstract_parcelable.hh"
9 #include "client_socket.hh"
10 #include "request_type.hh"
11
12 #include <string>
13
14 namespace pkgmgr_client {
15
16 class PkgInfoClient {
17  public:
18   PkgInfoClient(
19       std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> parcel,
20       uid_t uid, pkgmgr_common::ReqType req_type);
21   ~PkgInfoClient() = default;
22   bool SendRequest();
23   std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> GetResultParcel();
24
25  private:
26   bool RequestHandlerDirectAccess(const std::vector<uint8_t>& raw);
27
28   std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> parcel_;
29   std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> result_parcel_;
30   std::unique_ptr<pkgmgr_common::socket::ClientSocket> socket_;
31   uid_t uid_;
32   pkgmgr_common::ReqType req_type_;
33   bool is_offline_;
34 };
35
36 }  // namespace pkgmgr_client
37
38 #endif  // CLIENT_PKGINFO_CLIENT_HH_