• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #include "notify_job_changed_command.h"
17 
18 #include "dps.h"
19 
20 namespace OHOS {
21 namespace CameraStandard {
22 namespace DeferredProcessing {
NotifyJobChangedCommand(const int32_t userId)23 NotifyJobChangedCommand::NotifyJobChangedCommand(const int32_t userId) : userId_(userId)
24 {
25     DP_DEBUG_LOG("entered. userId: %{public}d", userId_);
26 }
27 
Initialize()28 int32_t NotifyJobChangedCommand::Initialize()
29 {
30     DP_CHECK_RETURN_RET(initialized_.load(), DP_OK);
31 
32     auto schedulerManager = DPS_GetSchedulerManager();
33     DP_CHECK_ERROR_RETURN_RET_LOG(schedulerManager == nullptr, DP_NULL_POINTER, "SchedulerManager is nullptr.");
34     controller_ = schedulerManager->GetPhotoController(userId_);
35     DP_CHECK_ERROR_RETURN_RET_LOG(controller_ == nullptr, DP_NULL_POINTER, "DeferredPhotoController is nullptr.");
36     initialized_.store(true);
37     return DP_OK;
38 }
39 
Executing()40 int32_t NotifyJobChangedCommand::Executing()
41 {
42     if (int32_t ret = Initialize() != DP_OK) {
43         return ret;
44     }
45 
46     controller_->OnPhotoJobChanged();
47     return DP_OK;
48 }
49 } // namespace DeferredProcessing
50 } // namespace CameraStandard
51 } // namespace OHOS