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_0/id_camera_provider_callback.h" 20 21 namespace OHOS { 22 namespace DistributedHardware { 23 using namespace OHOS::HDI::DistributedCamera::V1_0; 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(); 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 38 private: 39 bool CheckDHBase(const DHBase& dhBase); 40 bool CheckStreamInfo(const DCStreamInfo& stream); 41 bool CheckCaptureInfo(const DCCaptureInfo& captureInfo); 42 43 std::string devId_; 44 std::string dhId_; 45 std::weak_ptr<DCameraSourceDev> sourceDev_; 46 const size_t PARAM_MAX_SIZE = 50 * 1024 * 1024; 47 const size_t DID_MAX_SIZE = 256; 48 const int32_t RESOLUTION_MAX_WIDTH = 10000; 49 const int32_t RESOLUTION_MAX_HEIGHT = 10000; 50 }; 51 } // namespace DistributedHardware 52 } // namespace OHOS 53 #endif // OHOS_DCAMERA_PROVIDER_CALLBACK_IMPL_H 54