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 #ifndef OHOS_DCAMERA_PROVIDER_CALLBACK_IMPL_H 17 #define OHOS_DCAMERA_PROVIDER_CALLBACK_IMPL_H 18 19 #include "v1_1/id_camera_provider_callback.h" 20 21 namespace OHOS { 22 namespace DistributedHardware { 23 using namespace OHOS::HDI::DistributedCamera::V1_1; 24 class DCameraSourceDev; 25 class DCameraProviderCallbackImpl : public IDCameraProviderCallback { 26 public: 27 DCameraProviderCallbackImpl(std::string devId, std::string dhId, std::shared_ptr<DCameraSourceDev>& sourceDev); 28 ~DCameraProviderCallbackImpl() override; 29 30 int32_t OpenSession(const DHBase& dhBase) override; 31 int32_t CloseSession(const DHBase& dhBase) override; 32 int32_t ConfigureStreams(const DHBase& dhBase, const std::vector<DCStreamInfo>& streamInfos) override; 33 int32_t ReleaseStreams(const DHBase& dhBase, const std::vector<int>& streamIds) override; 34 int32_t StartCapture(const DHBase& dhBase, const std::vector<DCCaptureInfo>& captureInfos) override; 35 int32_t StopCapture(const DHBase& dhBase, const std::vector<int>& streamIds) override; 36 int32_t UpdateSettings(const DHBase& dhBase, const std::vector<DCameraSettings>& settings) override; 37 int32_t NotifyEvent(const DHBase& dhBase, const DCameraHDFEvent& event) override; 38 39 private: 40 bool CheckDHBase(const DHBase& dhBase); 41 bool CheckStreamInfo(const DCStreamInfo& stream); 42 bool CheckCaptureInfo(const DCCaptureInfo& captureInfo); 43 44 std::string devId_; 45 std::string dhId_; 46 std::weak_ptr<DCameraSourceDev> sourceDev_; 47 const size_t PARAM_MAX_SIZE = 50 * 1024 * 1024; 48 const size_t DID_MAX_SIZE = 256; 49 const int32_t RESOLUTION_MAX_WIDTH = 10000; 50 const int32_t RESOLUTION_MAX_HEIGHT = 10000; 51 }; 52 } // namespace DistributedHardware 53 } // namespace OHOS 54 #endif // OHOS_DCAMERA_PROVIDER_CALLBACK_IMPL_H 55