/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CAMERA_HOST_SERVICE_H #define CAMERA_HOST_SERVICE_H #include #include "camera.h" #include "hcs_dm_parser.h" #include "v1_0/icamera_device.h" #include "v1_0/icamera_host.h" #include "v1_0/icamera_host_vdi.h" namespace OHOS::Camera { #ifdef CHIP_PROD_CAMERA_HOST_CONFIG #define CONFIG_PATH_NAME HDF_CHIP_PROD_CONFIG_DIR"/camera_host_config.hcb" #else #define CONFIG_PATH_NAME HDF_CONFIG_DIR"/camera_host_config.hcb" #endif using namespace OHOS::HDI::Camera::V1_0; using namespace OHOS::VDI::Camera::V1_0; struct CameraIdInfo { std::string currentCameraId; ICameraHostVdi* cameraHostVdi; std::string vendorCameraId; bool isDeleted; }; class CameraHostService : public ICameraHost { public: static OHOS::sptr GetInstance(); int32_t SetCallback(const sptr &callbackObj) override; int32_t GetCameraIds(std::vector &cameraIds) override; int32_t GetCameraAbility(const std::string &cameraId, std::vector &cameraAbility) override; int32_t OpenCamera(const std::string &cameraId, const sptr &callbackObj, sptr &device) override; int32_t SetFlashlight(const std::string &cameraId, bool isEnable) override; private: CameraHostService(std::vector cameraHostVdiList, std::vector cameraHostVdiLoaderList); virtual ~CameraHostService(); CameraHostService(const CameraHostService &other) = delete; CameraHostService(CameraHostService &&other) = delete; CameraHostService &operator=(const CameraHostService &other) = delete; CameraHostService &operator=(CameraHostService &&other) = delete; static int32_t GetVdiLibList(std::vector &vdiLibList); static void HdfCloseVdiLoaderList(std::vector &cameraHostVdiLoaderList); ICameraHostVdi* GetCameraHostVdi(const std::string ¤tCameraId); const std::string GetVendorCameraId(const std::string ¤tCameraId); int32_t UpdateCameraIdMapList(); std::vector cameraHostVdiList_; std::vector cameraIdInfoList_; std::vector cameraHostVdiLoaderList_; static OHOS::sptr cameraHostService_; }; } // end namespace OHOS::Camera #endif // CAMERA_HOST_SERVICE_H