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 "flash_controller.h"
17
18 namespace OHOS::Camera {
FlashController()19 FlashController::FlashController() {}
20
FlashController(std::string hardwareName)21 FlashController::FlashController(std::string hardwareName) : IController(hardwareName) {}
22
~FlashController()23 FlashController::~FlashController() {}
24
Init()25 RetCode FlashController::Init()
26 {
27 return RC_OK;
28 }
29
PowerUp()30 RetCode FlashController::PowerUp()
31 {
32 RetCode rc = RC_OK;
33 if (GetPowerOnState() == false) {
34 SetPowerOnState(true);
35 CAMERA_LOGI("%s Flash Powerup", __FUNCTION__);
36 return rc;
37 }
38 return rc;
39 }
40
PowerDown()41 RetCode FlashController::PowerDown()
42 {
43 RetCode rc = RC_OK;
44 if (GetPowerOnState() == true) {
45 SetPowerOnState(false);
46 CAMERA_LOGI("%s Flash PowerDown", __FUNCTION__);
47 return rc;
48 }
49 return rc;
50 }
51
SetFlashlight(FlashMode flashMode,bool enable)52 RetCode FlashController::SetFlashlight(FlashMode flashMode, bool enable)
53 {
54 CAMERA_LOGD("FlashController::SetFlashlight flashMode is %{public}d and enable is %{public}d", flashMode, enable);
55 return RC_OK;
56 }
57
SetAbilityMetaDataTag(std::vector<int32_t> abilityMetaDataTag)58 void FlashController::SetAbilityMetaDataTag(std::vector<int32_t> abilityMetaDataTag)
59 {
60 if (abilityMetaDataTag.size() == 0) {
61 CAMERA_LOGE("%{public}s abilityMetaDataTag is empty", __FUNCTION__);
62 }
63 }
64
GetAbilityMetaData(std::shared_ptr<CameraMetadata> meta)65 RetCode FlashController::GetAbilityMetaData(std::shared_ptr<CameraMetadata> meta)
66 {
67 if (meta == nullptr || meta->get() == nullptr) {
68 CAMERA_LOGE("FlashController::GetAbilityMetaData meta is invalid");
69 return RC_ERROR;
70 }
71 return RC_OK;
72 }
73 } // namespace OHOS::Camera