1 /* 2 * Copyright (c) 2024-2024 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 OHOS_CAMERA_DPS_PHOTO_PROCESS_COMMAND_H 17 #define OHOS_CAMERA_DPS_PHOTO_PROCESS_COMMAND_H 18 19 #include "command.h" 20 #include "photo_post_processor.h" 21 #include "scheduler_manager.h" 22 23 namespace OHOS { 24 namespace CameraStandard { 25 namespace DeferredProcessing { 26 class PhotoProcessCommand : public Command { 27 public: 28 PhotoProcessCommand(const int32_t userId); 29 ~PhotoProcessCommand() override; 30 31 protected: 32 int32_t Initialize(); 33 34 const int32_t userId_; 35 std::atomic<bool> initialized_ {false}; 36 std::shared_ptr<PhotoPostProcessor> postProcessor_ {nullptr}; 37 }; 38 39 class PhotoProcessSuccessCommand : public PhotoProcessCommand { 40 DECLARE_CMD_CLASS(PhotoProcessSuccessCommand); 41 public: 42 PhotoProcessSuccessCommand(const int32_t userId, const std::string& imageId, 43 const std::shared_ptr<BufferInfo>& bufferInfo); 44 ~PhotoProcessSuccessCommand() override = default; 45 46 protected: 47 int32_t Executing() override; 48 49 const std::string imageId_; 50 std::shared_ptr<BufferInfo> bufferInfo_; 51 }; 52 53 class PhotoProcessSuccessExtCommand : public PhotoProcessCommand { 54 DECLARE_CMD_CLASS(PhotoProcessSuccessExtCommand); 55 public: 56 PhotoProcessSuccessExtCommand(const int32_t userId, const std::string& imageId, 57 const std::shared_ptr<BufferInfoExt>& bufferInfo); 58 ~PhotoProcessSuccessExtCommand() override = default; 59 60 protected: 61 int32_t Executing() override; 62 63 const std::string imageId_; 64 std::shared_ptr<BufferInfoExt> bufferInfo_; 65 }; 66 67 class PhotoProcessFailedCommand : public PhotoProcessCommand { 68 DECLARE_CMD_CLASS(PhotoProcessFailedCommand); 69 public: 70 PhotoProcessFailedCommand(const int32_t userId, const std::string& imageId, DpsError errorCode); 71 ~PhotoProcessFailedCommand() override = default; 72 73 protected: 74 int32_t Executing() override; 75 76 const std::string imageId_; 77 DpsError error_; 78 }; 79 80 class PhotoStateChangedCommand : public PhotoProcessCommand { 81 DECLARE_CMD_CLASS(PhotoStateChangedCommand); 82 public: PhotoStateChangedCommand(const int32_t userId,HdiStatus status)83 PhotoStateChangedCommand(const int32_t userId, HdiStatus status) 84 : PhotoProcessCommand(userId), status_(status) 85 { 86 DP_DEBUG_LOG("entered."); 87 } 88 ~PhotoStateChangedCommand() override = default; 89 90 protected: 91 int32_t Executing() override; 92 93 HdiStatus status_; 94 }; 95 } // namespace DeferredProcessing 96 } // namespace CameraStandard 97 } // namespace OHOS 98 #endif // OHOS_CAMERA_DPS_PHOTO_PROCESS_COMMAND_H