1 /* 2 * Copyright (c) 2023-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 OHOS_CAMERA_DPS_USERINITIATED_STRATEGY_H 17 #define OHOS_CAMERA_DPS_USERINITIATED_STRATEGY_H 18 19 #include <memory> 20 21 #include "istrategy.h" 22 #include "photo_job_repository.h" 23 24 namespace OHOS { 25 namespace CameraStandard { 26 namespace DeferredProcessing { 27 /* 28 用户前台调度关注的事件: 29 是否有ready状态的高优先级任务 30 其余温度是否超标 hal是否可用 统统不关注。下发任务,如果无法处理 则返回失败 31 */ 32 class UserInitiatedStrategy : public IStrategy { 33 public: 34 UserInitiatedStrategy(std::shared_ptr<PhotoJobRepository> photoJobRepository); 35 ~UserInitiatedStrategy(); 36 DeferredPhotoWorkPtr GetWork() override; 37 DeferredPhotoJobPtr GetJob() override; 38 ExecutionMode GetExecutionMode() override; 39 void NotifyHdiStatusChanged(HdiStatus status); 40 void NotifyMediaLibStatusChanged(MediaLibraryStatus status); 41 void NotifyCameraStatusChanged(CameraSessionStatus status); 42 43 private: 44 std::shared_ptr<PhotoJobRepository> photoJobRepository_; 45 CameraSessionStatus cameraSessionStatus_ {CameraSessionStatus::NORMAL_CAMERA_CLOSED}; 46 HdiStatus hdiStatus_ {HdiStatus::HDI_READY}; 47 MediaLibraryStatus mediaLibraryStatus_ {MediaLibraryStatus::MEDIA_LIBRARY_AVAILABLE}; 48 }; 49 } // namespace DeferredProcessing 50 } // namespace CameraStandard 51 } // namespace OHOS 52 #endif // OHOS_CAMERA_DPS_USERINITIATED_STRATEGY_H