1 /*
2  * Copyright (c) 2021 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 "isp_controller.h"
17 #include "camera_metadata_info.h"
18 
19 namespace OHOS::Camera {
IspController()20 IspController::IspController() {}
21 
IspController(std::string hardwareName)22 IspController::IspController(std::string hardwareName) : IController(hardwareName) {}
23 
~IspController()24 IspController::~IspController() {}
25 
Init()26 RetCode IspController::Init()
27 {
28     return RC_OK;
29 }
30 
PowerUp()31 RetCode IspController::PowerUp()
32 {
33     RetCode rc = RC_OK;
34     if (GetPowerOnState() == false) {
35         SetPowerOnState(true);
36         CAMERA_LOGI("%s Isp Powerup", __FUNCTION__);
37         return rc;
38     }
39     return rc;
40 }
41 
PowerDown()42 RetCode IspController::PowerDown()
43 {
44     RetCode rc = RC_OK;
45     if (GetPowerOnState() == true) {
46         SetPowerOnState(false);
47         CAMERA_LOGI("%s Isp PowerDown", __FUNCTION__);
48         return rc;
49     }
50     return rc;
51 }
52 
Start()53 RetCode IspController::Start()
54 {
55     std::lock_guard<std::mutex> l(startIsplock_);
56     RetCode rc = RC_OK;
57     if (startIspState_ == false) {
58         startIspState_ = true;
59     }
60     CAMERA_LOGI("%s Isp Start", __FUNCTION__);
61     return rc;
62 }
63 
Stop()64 RetCode IspController::Stop()
65 {
66     std::lock_guard<std::mutex> l(startIsplock_);
67     RetCode rc = RC_OK;
68     if (startIspState_ == true) {
69         startIspState_ = false;
70     }
71     CAMERA_LOGI("%s Isp Stop", __FUNCTION__);
72     return rc;
73 }
74 
Configure(std::shared_ptr<CameraMetadata> meta)75 RetCode IspController::Configure(std::shared_ptr<CameraMetadata> meta)
76 {
77     if (meta == nullptr || meta->get() == nullptr) {
78         CAMERA_LOGE("IspController::Configure meta is invalid");
79         return RC_ERROR;
80     }
81     return RC_OK;
82 }
83 } // namespace OHOS::Camera
84