mirror of
https://github.com/openharmony/multimedia_camera_lite.git
synced 2026-07-15 06:07:13 -04:00
71 lines
2.0 KiB
C++
Executable File
71 lines
2.0 KiB
C++
Executable File
/*
|
|
* Copyright (c) 2020-2021 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.
|
|
*/
|
|
#include "camera_kit.h"
|
|
#include "camera_manager.h"
|
|
#include "pms_interface.h"
|
|
|
|
using namespace std;
|
|
namespace OHOS {
|
|
namespace Media {
|
|
CameraManager *cameraManager_ = nullptr;
|
|
CameraKit::CameraKit()
|
|
{
|
|
cameraManager_ = CameraManager::GetInstance();
|
|
}
|
|
|
|
CameraKit::~CameraKit() {}
|
|
|
|
CameraKit *CameraKit::GetInstance()
|
|
{
|
|
if (CheckSelfPermission("ohos.permission.CAMERA") != GRANTED) {
|
|
MEDIA_WARNING_LOG("Process can not access camera.");
|
|
return nullptr;
|
|
}
|
|
static CameraKit kit;
|
|
return &kit;
|
|
}
|
|
|
|
list<string> CameraKit::GetCameraIds()
|
|
{
|
|
return cameraManager_->GetCameraIds();
|
|
}
|
|
|
|
const CameraAbility *CameraKit::GetCameraAbility(string cameraId)
|
|
{
|
|
return cameraManager_->GetCameraAbility(cameraId);
|
|
}
|
|
|
|
const CameraInfo *CameraKit::GetCameraInfo(string cameraId)
|
|
{
|
|
return cameraManager_->GetCameraInfo(cameraId);
|
|
}
|
|
|
|
void CameraKit::RegisterCameraDeviceCallback(CameraDeviceCallback &callback, EventHandler &handler)
|
|
{
|
|
cameraManager_->RegisterCameraDeviceCallback(callback, handler);
|
|
}
|
|
|
|
void CameraKit::UnregisterCameraDeviceCallback(CameraDeviceCallback &callback)
|
|
{
|
|
cameraManager_->UnregisterCameraDeviceCallback(callback);
|
|
}
|
|
|
|
void CameraKit::CreateCamera(const string &cameraId, CameraStateCallback &callback, EventHandler &handler)
|
|
{
|
|
cameraManager_->CreateCamera(cameraId, callback, handler);
|
|
}
|
|
} // namespace Media
|
|
} // namespace OHOS
|