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