• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SYS_INSTALLER_MODULE_UPDATE_STUB_H
17 #define SYS_INSTALLER_MODULE_UPDATE_STUB_H
18 
19 #include <functional>
20 #include <iostream>
21 #include <map>
22 
23 #include "imodule_update.h"
24 #include "iremote_stub.h"
25 
26 namespace OHOS {
27 namespace SysInstaller {
28 class ModuleUpdateStub : public IRemoteStub<IModuleUpdate> {
29 public:
30     using RequestFuncType = std::function<int (ModuleUpdateStub *service,
31         MessageParcel &data, MessageParcel &reply, MessageOption &option)>;
32 
33     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
34         MessageOption &option) override;
35     ModuleUpdateStub();
36     virtual ~ModuleUpdateStub();
37 
38 private:
39     int32_t InstallModulePackageStub(ModuleUpdateStub *service,
40         MessageParcel &data, MessageParcel &reply, MessageOption &option) const;
41     int32_t UninstallModulePackageStub(ModuleUpdateStub *service,
42         MessageParcel &data, MessageParcel &reply, MessageOption &option) const;
43     int32_t GetModulePackageInfoStub(ModuleUpdateStub *service,
44         MessageParcel &data, MessageParcel &reply, MessageOption &option) const;
45     int32_t ReportModuleUpdateStatusStub(ModuleUpdateStub *service,
46         MessageParcel &data, MessageParcel &reply, MessageOption &option) const;
47     int32_t ExitModuleUpdateStub(ModuleUpdateStub *service,
48         MessageParcel &data, MessageParcel &reply, MessageOption &option) const;
49 
50 private:
51     std::unordered_map<uint32_t, RequestFuncType> requestFuncMap_ {};
52 };
53 } // namespace SysInstaller
54 } // namespace OHOS
55 #endif // SYS_INSTALLER_MODULE_UPDATE_STUB_H
56