• 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 FIRMWARE_IEXECUTOR_H
17 #define FIRMWARE_IEXECUTOR_H
18 
19 #include "firmware_common.h"
20 #include "firmware_component.h"
21 #include "firmware_log.h"
22 
23 namespace OHOS {
24 namespace UpdateEngine {
25 using FirmwareComponentCallback = std::function<void(
26     CheckStatus status, const Duration &duration, const std::vector<FirmwareComponent> &componentList,
27     const CheckAndAuthInfo &checkAndAuthInfo)>;
28 struct FirmwareCheckComponentCallback {
29     FirmwareComponentCallback firmwareComponentCallback;
30 };
31 
32 using ProgressCallback = std::function<void(const Progress &progress)>;
33 struct FirmwareProgressCallback {
34     ProgressCallback progressCallback;
35 };
36 
37 struct InstallCallbackInfo {
38     Progress progress;
39     ErrorMessage errorMessage;
40 };
41 
42 using InstallCallback = std::function<void(const InstallCallbackInfo &installCallbackInfo)>;
43 struct FirmwareInstallExecutorCallback {
44     InstallCallback installCallback;
45 };
46 
47 using ApplyCallback = std::function<void(bool isSuccess)>;
48 struct FirmwareApplyCallback {
49     ApplyCallback applyCallback;
50 };
51 
52 class FirmwareIExecutor {
53 public:
54     virtual ~FirmwareIExecutor() = default;
55     virtual void Execute() = 0;
56 };
57 } // namespace UpdateEngine
58 } // namespace OHOS
59 #endif // FIRMWARE_IEXECUTOR_H