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_COMMAND_H 17 #define OHOS_CAMERA_DPS_PHOTO_COMMAND_H 18 19 #include "command.h" 20 #include "ipc_file_descriptor.h" 21 #include "scheduler_manager.h" 22 23 namespace OHOS { 24 namespace CameraStandard { 25 namespace DeferredProcessing { 26 class PhotoCommand : public Command { 27 public: 28 PhotoCommand(const int32_t userId, const std::string& photoId); 29 ~PhotoCommand(); 30 31 protected: 32 int32_t Initialize(); 33 34 const int32_t userId_; 35 const std::string photoId_; 36 std::atomic<bool> initialized_ {false}; 37 std::shared_ptr<SchedulerManager> schedulerManager_ {nullptr}; 38 std::shared_ptr<DeferredPhotoProcessor> processor_ {nullptr}; 39 }; 40 41 class AddPhotoCommand : public PhotoCommand { 42 DECLARE_CMD_CLASS(AddPhotoCommand) 43 public: 44 AddPhotoCommand(const int32_t userId, const std::string& photoId, 45 const DpsMetadata& metadata, const bool discardable); 46 47 protected: 48 int32_t Executing() override; 49 50 DpsMetadata metadata_; 51 const bool discardable_; 52 }; 53 54 class RemovePhotoCommand : public PhotoCommand { 55 DECLARE_CMD_CLASS(RemovePhotoCommand) 56 public: 57 RemovePhotoCommand(const int32_t userId, const std::string& photoId, const bool restorable); 58 59 protected: 60 int32_t Executing() override; 61 62 const bool restorable_; 63 }; 64 65 class RestorePhotoCommand : public PhotoCommand { 66 DECLARE_CMD_CLASS(RestorePhotoCommand) 67 public: 68 using PhotoCommand::PhotoCommand; 69 70 protected: 71 int32_t Executing() override; 72 }; 73 74 class ProcessPhotoCommand : public PhotoCommand { 75 DECLARE_CMD_CLASS(ProcessPhotoCommand) 76 public: 77 ProcessPhotoCommand(const int32_t userId, const std::string& photoId, const std::string& appName); 78 79 protected: 80 int32_t Executing() override; 81 82 const std::string appName_; 83 }; 84 85 class CancelProcessPhotoCommand : public PhotoCommand { 86 DECLARE_CMD_CLASS(CancelProcessPhotoCommand) 87 public: 88 using PhotoCommand::PhotoCommand; 89 90 protected: 91 int32_t Executing() override; 92 }; 93 } // namespace DeferredProcessing 94 } // namespace CameraStandard 95 } // namespace OHOS 96 #endif // OHOS_CAMERA_DPS_PHOTO_COMMAND_H