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 INSTALLER_SRC_CONTROL_H_
19 #define INSTALLER_SRC_CONTROL_H_
27 #include "PkgSignal.h"
33 namespace pkg_group = rpc_port::PkgSignal::group;
37 Control(bool offline = false);
39 int SetRequestFromArgv(const int argc, char** argv);
40 const std::unique_ptr<Request>& GetRequest() const;
41 int SendSignal(std::string pkg_type, std::string pkgid,
42 std::string appid, std::string key, std::string val);
43 int SendSignals(std::string key, std::string val);
44 int SendSignalForResource(std::string pkgid, std::string status,
45 rpc_port::PkgSignal::ExtraData* event_info);
46 int SendSignalForUid(uid_t uid, std::string pkg_type, std::string pkgid,
47 std::string appid, std::string key, std::string val);
48 int SendSignalsForUid(uid_t uid, std::string key, std::string val);
49 int SendSignalForResourceForUid(uid_t uid, std::string pkgid,
50 std::string status, rpc_port::PkgSignal::ExtraData* event_info);
51 void AddPkg(std::string pkgid, std::string pkg_type);
54 void ParseMultiplePkgs(const std::unique_ptr<Request>& req);
57 std::unique_ptr<Request> request_;
58 std::unique_ptr<pkg_group::PkgSignal> signal_;
59 std::map<int, std::function<int(const std::unique_ptr<Request>&)>>
61 std::vector<rpc_port::PkgSignal::PkgInfo> pkgs_;
63 char** argv_ = nullptr;
67 } // namespace installer
70 #endif // INSTALLER_SRC_CONTROL_H_