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_BACKGROUND_STRATEGY_H 17 #define OHOS_CAMERA_DPS_BACKGROUND_STRATEGY_H 18 19 #include <cstdint> 20 #include <memory> 21 22 #include "istrategy.h" 23 #include "photo_job_repository.h" 24 25 26 namespace OHOS { 27 namespace CameraStandard { 28 namespace DeferredProcessing { 29 class BackgroundStrategy : public IStrategy { 30 public: 31 BackgroundStrategy(std::shared_ptr<PhotoJobRepository> repository); 32 ~BackgroundStrategy(); 33 DeferredPhotoWorkPtr GetWork() override; 34 DeferredPhotoJobPtr GetJob() override; 35 ExecutionMode GetExecutionMode() override; 36 HdiStatus GetHdiStatus(); 37 void NotifyPressureLevelChanged(SystemPressureLevel level); 38 void NotifyHdiStatusChanged(HdiStatus status); 39 void NotifyMediaLibStatusChanged(MediaLibraryStatus status); 40 void NotifyCameraStatusChanged(CameraSessionStatus status); 41 42 private: 43 void StartTrailing(uint64_t duration); 44 void StopTrailing(); 45 void FlashTrailingState(); 46 47 uint64_t trailingStartTimeStamp_; 48 uint64_t remainingTrailingTime_; 49 bool isInTrailing_; 50 CameraSessionStatus cameraSessionStatus_; 51 HdiStatus hdiStatus_; 52 MediaLibraryStatus mediaLibraryStatus_; 53 SystemPressureLevel systemPressureLevel_; 54 std::shared_ptr<PhotoJobRepository> jobRepository_; 55 //Watchdog<std::string> watchdog_; 56 }; 57 } // namespace DeferredProcessing 58 } // namespace CameraStandard 59 } // namespace OHOS 60 #endif // OHOS_CAMERA_DPS_BACKGROUND_STRATEGY_H