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_DISTRIBUTED_CAMERA_MOCKSOURCE_DEV_H
17 #define OHOS_DISTRIBUTED_CAMERA_MOCKSOURCE_DEV_H
18 
19 #include "dcamera_source_dev.h"
20 
21 #include "distributed_camera_errno.h"
22 #include "idistributed_camera_source.h"
23 
24 namespace OHOS {
25 namespace DistributedHardware {
26 class MockDCameraSourceDev : public DCameraSourceDev {
27 public:
MockDCameraSourceDev(std::string devId,std::string dhId,std::shared_ptr<ICameraStateListener> & stateLisener)28     MockDCameraSourceDev(std::string devId, std::string dhId, std::shared_ptr<ICameraStateListener>& stateLisener)
29         : DCameraSourceDev(devId, dhId, stateLisener) {};
30     ~MockDCameraSourceDev() = default;
31 
Register(std::shared_ptr<DCameraRegistParam> & param)32     int32_t Register(std::shared_ptr<DCameraRegistParam>& param)
33     {
34         return DCAMERA_OK;
35     }
UnRegister(std::shared_ptr<DCameraRegistParam> & param)36     int32_t UnRegister(std::shared_ptr<DCameraRegistParam>& param)
37     {
38         return DCAMERA_OK;
39     }
OpenCamera()40     int32_t OpenCamera()
41     {
42         return DCAMERA_OK;
43     }
CloseCamera()44     int32_t CloseCamera()
45     {
46         return DCAMERA_OK;
47     }
ConfigStreams(std::vector<std::shared_ptr<DCStreamInfo>> & streamInfos)48     int32_t ConfigStreams(std::vector<std::shared_ptr<DCStreamInfo>>& streamInfos)
49     {
50         return DCAMERA_OK;
51     }
ReleaseStreams(std::vector<int> & streamIds,bool & isAllRelease)52     int32_t ReleaseStreams(std::vector<int>& streamIds, bool& isAllRelease)
53     {
54         isAllRelease = true;
55         return DCAMERA_OK;
56     }
ReleaseAllStreams()57     int32_t ReleaseAllStreams()
58     {
59         return DCAMERA_OK;
60     }
StartCapture(std::vector<std::shared_ptr<DCCaptureInfo>> & captureInfos)61     int32_t StartCapture(std::vector<std::shared_ptr<DCCaptureInfo>>& captureInfos)
62     {
63         return DCAMERA_OK;
64     }
StopCapture(std::vector<int> & streamIds,bool & isAllStop)65     int32_t StopCapture(std::vector<int>& streamIds, bool& isAllStop)
66     {
67         isAllStop = true;
68         return DCAMERA_OK;
69     }
StopAllCapture()70     int32_t StopAllCapture()
71     {
72         return DCAMERA_OK;
73     }
UpdateSettings(std::vector<std::shared_ptr<DCameraSettings>> & settings)74     int32_t UpdateSettings(std::vector<std::shared_ptr<DCameraSettings>>& settings)
75     {
76         return DCAMERA_OK;
77     }
CameraEventNotify(std::shared_ptr<DCameraEvent> & events)78     int32_t CameraEventNotify(std::shared_ptr<DCameraEvent>& events)
79     {
80         return DCAMERA_OK;
81     }
82 
83 private:
84     std::string devId_;
85     std::string dhId_;
86     std::shared_ptr<ICameraStateListener> stateLisener_;
87 };
88 } // namespace DistributedHardware
89 } // namespace OHOS
90 #endif // OHOS_DISTRIBUTED_CAMERA_MOCKSOURCE_DEV_H
91