/* * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file expected 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 UT_COMMON_H #define UT_COMMON_H #include "v1_3/types.h" #include "v1_3/icamera_host.h" #include "v1_3/icamera_device.h" #include "v1_3/istream_operator.h" #include "v1_3/camera_host_proxy.h" #include "hdi_common_v1_2.h" namespace OHOS::Camera { using namespace OHOS::HDI::Camera::V1_3; class HdiCommonV1_3 : public OHOS::Camera::HdiCommonV1_2 { public: void Init(); void Open(int cameraId); void OpenSecureCamera(int cameraId); void Close(); void GetCameraMetadata(int cameraId); void DefaultMeta(std::shared_ptr &infos); void DefaultInfosProfessionalCapture(std::shared_ptr &infos); void DefaultInfosMeta(std::shared_ptr &infos); void StartProfessionalStream(std::vector intents, uint8_t professionalMode); void StartStream(std::vector intents, OHOS::HDI::Camera::V1_3::OperationMode mode = OHOS::HDI::Camera::V1_3::NORMAL); void StartCapture(int streamId, int captureId, bool shutterCallback, bool isStreaming); void StopStream(std::vector& captureIds, std::vector& streamIds); OHOS::sptr serviceV1_3 = nullptr; OHOS::sptr cameraDeviceV1_3 = nullptr; class TestStreamOperatorCallbackV1_3; OHOS::sptr streamOperatorCallbackV1_3 = nullptr; OHOS::sptr streamOperator_V1_3 = nullptr; std::shared_ptr streamInfoMeta = nullptr; int streamIdMeta = 106; int metaWidth = 1280; int metaHeight = 960; int captureIdMeta = 2060; uint32_t itemCapacity = 100; uint32_t dataCapacity = 2000; uint32_t dataCount = 1; class TestStreamOperatorCallbackV1_3 : public OHOS::HDI::Camera::V1_3::IStreamOperatorCallback { public: std::shared_ptr streamResultMeta = nullptr; TestStreamOperatorCallbackV1_3() = default; virtual ~TestStreamOperatorCallbackV1_3() = default; int32_t OnCaptureStarted(int32_t captureId, const std::vector &streamId) override; int32_t OnCaptureEnded(int32_t captureId, const std::vector &infos) override; int32_t OnCaptureEndedExt(int32_t captureId, const std::vector &infos) override; int32_t OnCaptureError(int32_t captureId, const std::vector &infos) override; int32_t OnFrameShutter(int32_t captureId, const std::vector &streamIds, uint64_t timestamp) override; int32_t OnCaptureStarted_V1_2(int32_t captureId, const std::vector &infos) override; int32_t OnCaptureReady(int32_t captureId, const std::vector& streamIds, uint64_t timestamp) override; int32_t OnFrameShutterEnd(int32_t captureId, const std::vector& streamIds, uint64_t timestamp) override; int32_t OnResult(int32_t streamId, const std::vector& result) override; }; using StreamResultCallback = std::function)>; static StreamResultCallback streamResultCallback_; }; } #endif