1 /* 2 * Copyright (c) 2021-2022 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_CAMERA_HCAMERA_SERVICE_PROXY_H 17 #define OHOS_CAMERA_HCAMERA_SERVICE_PROXY_H 18 19 #include "icamera_service.h" 20 #include "icamera_service_callback.h" 21 #include "iremote_proxy.h" 22 23 namespace OHOS { 24 namespace CameraStandard { 25 class HCameraProxy : public IRemoteProxy<ICameraBroker> { 26 public: 27 explicit HCameraProxy(const sptr<IRemoteObject> &impl); 28 ~HCameraProxy() = default; 29 30 int32_t NotifyCloseCamera(std::string cameraId) override; 31 int32_t NotifyMuteCamera(bool muteMode) override; 32 private: 33 static inline BrokerDelegator<HCameraProxy> delegator_; 34 }; 35 36 class HCameraServiceProxy : public IRemoteProxy<ICameraService> { 37 public: 38 explicit HCameraServiceProxy(const sptr<IRemoteObject> &impl); 39 40 virtual ~HCameraServiceProxy() = default; 41 42 int32_t CreateCameraDevice(std::string cameraId, sptr<ICameraDeviceService>& device) override; 43 44 int32_t SetCameraCallback(sptr<ICameraServiceCallback>& callback) override; 45 int32_t UnSetCameraCallback() override; 46 47 int32_t SetMuteCallback(sptr<ICameraMuteServiceCallback>& callback) override; 48 int32_t UnSetMuteCallback() override; 49 50 int32_t SetTorchCallback(sptr<ITorchServiceCallback>& callback) override; 51 int32_t UnSetTorchCallback() override; 52 53 int32_t SetFoldStatusCallback(sptr<IFoldServiceCallback>& callback, bool isInnerCallback = false) override; 54 int32_t UnSetFoldStatusCallback() override; 55 56 int32_t GetCameras(std::vector<std::string> &cameraIds, 57 std::vector<std::shared_ptr<OHOS::Camera::CameraMetadata>> &cameraAbilityList) override; 58 59 int32_t GetCameraIds(std::vector<std::string>& cameraIds) override; 60 61 int32_t GetCameraAbility(std::string& cameraId, 62 std::shared_ptr<OHOS::Camera::CameraMetadata>& cameraAbility) override; 63 64 int32_t CreateCaptureSession(sptr<ICaptureSession>& session, int32_t operationMode = 0) override; 65 66 int32_t CreateDeferredPhotoProcessingSession(int32_t userId, 67 sptr<DeferredProcessing::IDeferredPhotoProcessingSessionCallback>& callback, 68 sptr<DeferredProcessing::IDeferredPhotoProcessingSession>& session) override; 69 70 int32_t CreateDeferredVideoProcessingSession(int32_t userId, 71 sptr<DeferredProcessing::IDeferredVideoProcessingSessionCallback>& callback, 72 sptr<DeferredProcessing::IDeferredVideoProcessingSession>& session) override; 73 74 int32_t CreatePhotoOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 75 int32_t width, int32_t height, sptr<IStreamCapture> &photoOutput) override; 76 77 int32_t CreatePreviewOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 78 int32_t width, int32_t height, sptr<IStreamRepeat> &previewOutput) override; 79 80 int32_t CreateDeferredPreviewOutput(int32_t format, int32_t width, int32_t height, 81 sptr<IStreamRepeat> &previewOutput) override; 82 83 int32_t CreateDepthDataOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 84 int32_t width, int32_t height, sptr<IStreamDepthData> &depthDataOutput) override; 85 86 int32_t CreateMetadataOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 87 std::vector<int32_t> metadataTypes, 88 sptr<IStreamMetadata>& metadataOutput) override; 89 90 int32_t CreateVideoOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 91 int32_t width, int32_t height, sptr<IStreamRepeat> &videoOutput) override; 92 93 int32_t SetListenerObject(const sptr<IRemoteObject> &object) override; 94 95 int32_t MuteCamera(bool muteMode) override; 96 97 int32_t MuteCameraPersist(PolicyType policyType, bool isMute) override; 98 99 int32_t PrelaunchCamera() override; 100 101 int32_t PreSwitchCamera(const std::string cameraId) override; 102 103 int32_t SetPrelaunchConfig(std::string cameraId, RestoreParamTypeOhos restoreParamType, int activeTime, 104 EffectParam effectParam) override; 105 106 int32_t IsTorchSupported(bool &isTorchSupported) override; 107 108 int32_t IsCameraMuteSupported(bool &isCameraMuteSupported) override; 109 110 int32_t IsCameraMuted(bool &muteMode) override; 111 112 int32_t GetTorchStatus(int32_t &status) override; 113 114 int32_t SetTorchLevel(float level) override; 115 116 int32_t AllowOpenByOHSide(std::string cameraId, int32_t state, bool &canOpenCamera) override; 117 118 int32_t NotifyCameraState(std::string cameraId, int32_t state) override; 119 120 int32_t SetPeerCallback(sptr<ICameraBroker>& callback) override; 121 122 int32_t UnsetPeerCallback() override; 123 124 int32_t DestroyStubObj() override; 125 126 int32_t ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override; 127 128 int32_t ResetAllFreezeStatus() override; 129 130 int32_t GetDmDeviceInfo(std::vector<std::string> &deviceInfos) override; 131 132 int32_t GetCameraOutputStatus(int32_t pid, int32_t &status) override; 133 134 int32_t RequireMemorySize(int32_t memSize) override; 135 136 int32_t GetIdforCameraConcurrentType(int32_t cameraPosition, std::string &cameraId) override; 137 138 int32_t GetConcurrentCameraAbility(std::string& cameraId, 139 std::shared_ptr<OHOS::Camera::CameraMetadata>& cameraAbility) override; 140 141 int32_t CheckWhiteList(bool &isInWhiteList) override; 142 private: 143 static inline BrokerDelegator<HCameraServiceProxy> delegator_; 144 }; 145 } // namespace CameraStandard 146 } // namespace OHOS 147 #endif // OHOS_CAMERA_HCAMERA_SERVICE_PROXY_H 148