10a5c7a17Sopenharmony_ci/*
20a5c7a17Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
30a5c7a17Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
40a5c7a17Sopenharmony_ci * you may not use this file except in compliance with the License.
50a5c7a17Sopenharmony_ci * You may obtain a copy of the License at
60a5c7a17Sopenharmony_ci *
70a5c7a17Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
80a5c7a17Sopenharmony_ci *
90a5c7a17Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
100a5c7a17Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
110a5c7a17Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120a5c7a17Sopenharmony_ci * See the License for the specific language governing permissions and
130a5c7a17Sopenharmony_ci * limitations under the License.
140a5c7a17Sopenharmony_ci */
150a5c7a17Sopenharmony_ci#ifndef OHOS_CAMERA_IMPL_H
160a5c7a17Sopenharmony_ci#define OHOS_CAMERA_IMPL_H
170a5c7a17Sopenharmony_ci
180a5c7a17Sopenharmony_ci#include "camera.h"
190a5c7a17Sopenharmony_ci#include "camera_ability.h"
200a5c7a17Sopenharmony_ci#include "camera_info.h"
210a5c7a17Sopenharmony_ci#include "camera_device_client.h"
220a5c7a17Sopenharmony_ci#include "camera_state_callback.h"
230a5c7a17Sopenharmony_ci
240a5c7a17Sopenharmony_cinamespace OHOS {
250a5c7a17Sopenharmony_cinamespace Media {
260a5c7a17Sopenharmony_ciclass CameraImpl : public Camera {
270a5c7a17Sopenharmony_cipublic:
280a5c7a17Sopenharmony_ci    CameraImpl() = delete;
290a5c7a17Sopenharmony_ci    CameraImpl(const std::string &id, const CameraAbility *ability, const CameraInfo *info);
300a5c7a17Sopenharmony_ci    ~CameraImpl() = default;
310a5c7a17Sopenharmony_ci
320a5c7a17Sopenharmony_ci    std::string GetCameraId() override;
330a5c7a17Sopenharmony_ci    const CameraConfig *GetCameraConfig() const override;
340a5c7a17Sopenharmony_ci    FrameConfig *GetFrameConfig(int32_t type) override;
350a5c7a17Sopenharmony_ci
360a5c7a17Sopenharmony_ci    void Configure(CameraConfig &config) override;
370a5c7a17Sopenharmony_ci    void Release() override;
380a5c7a17Sopenharmony_ci
390a5c7a17Sopenharmony_ci    int32_t TriggerLoopingCapture(FrameConfig &fc) override;
400a5c7a17Sopenharmony_ci    void StopLoopingCapture(int32_t type) override;
410a5c7a17Sopenharmony_ci    int32_t TriggerSingleCapture(FrameConfig &fc) override;
420a5c7a17Sopenharmony_ci
430a5c7a17Sopenharmony_ci    const CameraAbility *GetAbility();
440a5c7a17Sopenharmony_ci    const CameraInfo *GetInfo();
450a5c7a17Sopenharmony_ci    void OnCreate(std::string cameraId);
460a5c7a17Sopenharmony_ci    void OnCreateFailed();
470a5c7a17Sopenharmony_ci    void OnFrameFinished(int32_t ret, FrameConfig &fc);
480a5c7a17Sopenharmony_ci    void OnConfigured(int32_t ret, CameraConfig &config);
490a5c7a17Sopenharmony_ci    void RegistCb(CameraStateCallback &callback, EventHandler &handler);
500a5c7a17Sopenharmony_ci
510a5c7a17Sopenharmony_ciprivate:
520a5c7a17Sopenharmony_ci    std::string id_;
530a5c7a17Sopenharmony_ci    std::list<FrameConfig *> frameConfigs_;
540a5c7a17Sopenharmony_ci    CameraConfig *config_ = nullptr;
550a5c7a17Sopenharmony_ci    CameraStateCallback *stateCb_ = nullptr;
560a5c7a17Sopenharmony_ci    EventHandler *handler_ = nullptr;
570a5c7a17Sopenharmony_ci    const CameraAbility *ability_ = nullptr;
580a5c7a17Sopenharmony_ci    const CameraInfo *info_ = nullptr;
590a5c7a17Sopenharmony_ci    CameraDeviceClient *deviceClient_ = nullptr;
600a5c7a17Sopenharmony_ci};
610a5c7a17Sopenharmony_ci} // namespace Media
620a5c7a17Sopenharmony_ci} // namespace OHOS
630a5c7a17Sopenharmony_ci#endif // OHOS_CAMERA_IMPL_H