• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 IUPDATER_SERVICE_H
17 #define IUPDATER_SERVICE_H
18 
19 #include <iostream>
20 #include "update_helper.h"
21 #include "iremote_broker.h"
22 #include "iremote_proxy.h"
23 #include "iupdate_callback.h"
24 
25 namespace OHOS {
26 namespace update_engine {
27 class IUpdateService : public OHOS::IRemoteBroker {
28 public:
29     enum {
30         CHECK_VERSION = 1,
31         DOWNLOAD,
32         UPGRADE,
33         SET_POLICY,
34         GET_POLICY,
35         GET_NEW_VERSION,
36         GET_STATUS,
37         REGISTER_CALLBACK,
38         UNREGISTER_CALLBACK,
39         CANCEL,
40         REBOOT_CLEAN,
41         REBOOT_INSTALL,
42         VERIFY_PACKAGE
43     };
44 
45     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Updater.IUpdateService");
46 public:
47     virtual int32_t RegisterUpdateCallback(const UpdateContext &ctx, const sptr<IUpdateCallback>& updateCallback) = 0;
48 
49     virtual int32_t UnregisterUpdateCallback() = 0;
50 
51     virtual int32_t CheckNewVersion() = 0;
52 
53     virtual int32_t DownloadVersion() = 0;
54 
55     virtual int32_t DoUpdate() = 0;
56 
57     virtual int32_t GetNewVersion(VersionInfo &versionInfo) = 0;
58 
59     virtual int32_t GetUpgradeStatus (UpgradeInfo &info) = 0;
60 
61     virtual int32_t SetUpdatePolicy(const UpdatePolicy &policy) = 0;
62 
63     virtual int32_t GetUpdatePolicy(UpdatePolicy &policy) = 0;
64 
65     virtual int32_t Cancel(int32_t service) = 0;
66 
67     virtual int32_t RebootAndClean(const std::string &miscFile, const std::string &cmd) = 0;
68 
69     virtual int32_t RebootAndInstall(const std::string &miscFile, const std::string &packageName) = 0;
70 };
71 } // namespace update_engine
72 } // namespace OHOS
73 #endif // IUPDATER_SERVICE_H
74