• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2025 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_DEFERRED_PHOTO_CONTROLLER_H
17 #define OHOS_CAMERA_DPS_DEFERRED_PHOTO_CONTROLLER_H
18 
19 #include "deferred_photo_processor.h"
20 #include "enable_shared_create.h"
21 #include "photo_strategy_center.h"
22 
23 namespace OHOS {
24 namespace CameraStandard {
25 namespace DeferredProcessing {
26 class DeferredPhotoController : public EnableSharedCreateInit<DeferredPhotoController> {
27 public:
28     ~DeferredPhotoController();
29 
30     int32_t Initialize() override;
31     std::shared_ptr<DeferredPhotoProcessor> GetPhotoProcessor();
32     void OnPhotoJobChanged();
33 
34 protected:
35     DeferredPhotoController(const int32_t userId, const std::shared_ptr<DeferredPhotoProcessor>& processor);
36 
37 private:
38     class StateListener;
39     class PhotoJobRepositoryListener;
40 
41     void OnSchedulerChanged(const SchedulerType& type, const SchedulerInfo& scheduleInfo);
42     void TryDoSchedule();
43     void DoProcess(const DeferredPhotoJobPtr& job);
44     void SetDefaultExecutionMode();
45     void NotifyScheduleState(bool workAvailable);
46 
47     const int32_t userId_;
48     DpsStatus scheduleState_ {DpsStatus::DPS_SESSION_STATE_IDLE};
49     std::shared_ptr<DeferredPhotoProcessor> photoProcessor_;
50     std::shared_ptr<PhotoStrategyCenter> photoStrategyCenter_ {nullptr};
51     std::shared_ptr<StateListener> photoStateChangeListener_ {nullptr};
52 };
53 } // namespace DeferredProcessing
54 } // namespace CameraStandard
55 } // namespace OHOS
56 #endif // OHOS_CAMERA_DPS_DEFERRED_PHOTO_CONTROLLER_H