2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef CLIENT_SRC_CONNECTOR_H_
19 #define CLIENT_SRC_CONNECTOR_H_
27 #include "PkgMgrProxy.h"
29 #include "connection_event_listener.hh"
30 #include "signal_receiver.hh"
35 namespace pkg_proxy = rpc_port::PkgMgrProxy::proxy;
36 namespace pp = rpc_port::PkgMgrProxy;
40 Connector(pkgmgr_client_type pc_type) : pc_type_(pc_type),
41 status_type_(PKGMGR_CLIENT_STATUS_ALL) {}
44 virtual pkg_proxy::PkgMgrAdmin* GetAdminProxy();
45 virtual pkg_proxy::PkgMgr* GetInfoProxy();
46 virtual pkg_proxy::PkgMgrForClearCache* GetCacheProxy();
47 virtual pkg_proxy::DelayedResult* GetDelayedResultProxy();
48 virtual const std::unique_ptr<SignalReceiver>& GetSignalReceiver();
49 std::string GenerateRequestId() const;
50 void SetTep(std::string tep_path, bool tep_move);
53 void SetSkipOptimization();
54 void SetStatusType(int status_type);
55 const std::vector<std::string>& GetArgv() const;
56 pkgmgr_client_type GetPcType() const;
57 std::vector<std::string>& GetResRemovePath();
58 std::vector<std::string>& GetResCreateDir();
59 std::vector<pp::ResPath>& GetResCopyPath();
60 const std::string& GetTepPath();
62 void RemoveSignalReceiver();
65 bool ConnectForAdmin();
66 bool ConnectForInfo();
67 bool ConnectForCache();
68 bool ConnectForDelayedResult();
71 pkgmgr_client_type pc_type_;
73 std::unique_ptr<pkg_proxy::PkgMgr> info_proxy_;
74 std::unique_ptr<pkg_proxy::PkgMgrForClearCache> cache_proxy_;
75 std::unique_ptr<pkg_proxy::PkgMgrAdmin> admin_proxy_;
76 std::unique_ptr<pkg_proxy::DelayedResult> delayed_result_proxy_;
77 std::vector<std::string> argv_;
78 ConnectionEventListener<pkg_proxy::PkgMgrAdmin> conn_admin_listener_;
79 ConnectionEventListener<pkg_proxy::PkgMgr> conn_info_listener_;
80 ConnectionEventListener<pkg_proxy::PkgMgrForClearCache> conn_cache_listener_;
81 ConnectionEventListener<pkg_proxy::DelayedResult> conn_delayed_result_listener_;
82 std::unique_ptr<SignalReceiver> signal_receiver_;
83 std::vector<std::string> res_remove_path_;
84 std::vector<std::string> res_create_dir_;
85 std::vector<pp::ResPath> res_copy_path_;
86 std::string tep_path_;
87 bool tep_move_ = false;
93 #endif // CLIENT_SRC_CONNECTOR_H_