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_MOCK_DCAMERA_SINK_OUTPUT_H 17 #define OHOS_MOCK_DCAMERA_SINK_OUTPUT_H 18 19 #include "distributed_camera_errno.h" 20 #include "icamera_operator.h" 21 #include "icamera_sink_output.h" 22 23 namespace OHOS { 24 namespace DistributedHardware { 25 extern std::string g_outputStr; 26 class MockDCameraSinkOutput : public ICameraSinkOutput { 27 public: MockDCameraSinkOutput(const std::string & dhId,const std::shared_ptr<ICameraOperator> & cameraOperator)28 explicit MockDCameraSinkOutput(const std::string& dhId, const std::shared_ptr<ICameraOperator>& cameraOperator) 29 { 30 } 31 ~MockDCameraSinkOutput()32 ~MockDCameraSinkOutput() 33 { 34 } 35 Init()36 int32_t Init() 37 { 38 return DCAMERA_OK; 39 } UnInit()40 int32_t UnInit() 41 { 42 if (g_outputStr == "test019") { 43 return DCAMERA_BAD_VALUE; 44 } 45 return DCAMERA_OK; 46 } StartCapture(std::vector<std::shared_ptr<DCameraCaptureInfo>> & captureInfos)47 int32_t StartCapture(std::vector<std::shared_ptr<DCameraCaptureInfo>>& captureInfos) 48 { 49 if (g_outputStr == "test021") { 50 return DCAMERA_BAD_VALUE; 51 } 52 return DCAMERA_OK; 53 } StopCapture()54 int32_t StopCapture() 55 { 56 return DCAMERA_OK; 57 } OpenChannel(std::shared_ptr<DCameraChannelInfo> & info)58 int32_t OpenChannel(std::shared_ptr<DCameraChannelInfo>& info) 59 { 60 return DCAMERA_OK; 61 } CloseChannel()62 int32_t CloseChannel() 63 { 64 if (g_outputStr == "test018") { 65 return DCAMERA_BAD_VALUE; 66 } 67 return DCAMERA_OK; 68 } GetProperty(const std::string & propertyName,PropertyCarrier & propertyCarrier)69 int32_t GetProperty(const std::string& propertyName, PropertyCarrier& propertyCarrier) 70 { 71 return DCAMERA_OK; 72 } 73 }; 74 } // namespace DistributedHardware 75 } // namespace OHOS 76 #endif // OHOS_MOCK_DCAMERA_SINK_OUTPUT_H 77