• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 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_CONTROLLER_H
17 #define OHOS_MOCK_DCAMERA_SINK_CONTROLLER_H
18 
19 #include "icamera_controller.h"
20 #include "icamera_sink_access_control.h"
21 
22 namespace OHOS {
23 namespace DistributedHardware {
24 extern std::string g_sinkCtrlStr;
25 class MockDCameraSinkController : public ICameraController {
26 public:
MockDCameraSinkController(const std::shared_ptr<ICameraSinkAccessControl> & accessControl)27     explicit MockDCameraSinkController(const std::shared_ptr<ICameraSinkAccessControl>& accessControl)
28     {
29     }
30 
~MockDCameraSinkController()31     ~MockDCameraSinkController()
32     {
33     }
34 
StartCapture(std::vector<std::shared_ptr<DCameraCaptureInfo>> & captureInfos,int32_t sceneMode)35     int32_t StartCapture(std::vector<std::shared_ptr<DCameraCaptureInfo>>& captureInfos, int32_t sceneMode)
36     {
37         return DCAMERA_OK;
38     }
StopCapture()39     int32_t StopCapture()
40     {
41         return DCAMERA_OK;
42     }
ChannelNeg(std::shared_ptr<DCameraChannelInfo> & info)43     int32_t ChannelNeg(std::shared_ptr<DCameraChannelInfo>& info)
44     {
45         if (g_sinkCtrlStr == "test_006") {
46             return DCAMERA_BAD_VALUE;
47         }
48         return DCAMERA_OK;
49     }
DCameraNotify(std::shared_ptr<DCameraEvent> & events)50     int32_t DCameraNotify(std::shared_ptr<DCameraEvent>& events)
51     {
52         return DCAMERA_OK;
53     }
UpdateSettings(std::vector<std::shared_ptr<DCameraSettings>> & settings)54     int32_t UpdateSettings(std::vector<std::shared_ptr<DCameraSettings>>& settings)
55     {
56         return DCAMERA_OK;
57     }
GetCameraInfo(std::shared_ptr<DCameraInfo> & camInfo)58     int32_t GetCameraInfo(std::shared_ptr<DCameraInfo>& camInfo)
59     {
60         if (g_sinkCtrlStr == "test_004") {
61             return DCAMERA_BAD_VALUE;
62         }
63         return DCAMERA_OK;
64     }
OpenChannel(std::shared_ptr<DCameraOpenInfo> & openInfo)65     int32_t OpenChannel(std::shared_ptr<DCameraOpenInfo>& openInfo)
66     {
67         return DCAMERA_OK;
68     }
CloseChannel()69     int32_t CloseChannel()
70     {
71         return DCAMERA_OK;
72     }
Init(std::vector<DCameraIndex> & indexs)73     int32_t Init(std::vector<DCameraIndex>& indexs)
74     {
75         return DCAMERA_OK;
76     }
UnInit()77     int32_t UnInit()
78     {
79         if (g_sinkCtrlStr == "test_001") {
80             return DCAMERA_BAD_VALUE;
81         }
82         return DCAMERA_OK;
83     }
PauseDistributedHardware(const std::string & networkId)84     int32_t PauseDistributedHardware(const std::string &networkId)
85     {
86         return DCAMERA_OK;
87     }
ResumeDistributedHardware(const std::string & networkId)88     int32_t ResumeDistributedHardware(const std::string &networkId)
89     {
90         return DCAMERA_OK;
91     }
StopDistributedHardware(const std::string & networkId)92     int32_t StopDistributedHardware(const std::string &networkId)
93     {
94         return DCAMERA_OK;
95     }
96 };
97 } // namespace DistributedHardware
98 } // namespace OHOS
99 #endif // OHOS_MOCK_DCAMERA_SINK_CONTROLLER_H
100