• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_MANAGER_PRIVACY_PROXY_H
17 #define OHOS_CAMERA_MANAGER_PRIVACY_PROXY_H
18 
19 #include <iremote_proxy.h>
20 
21 namespace OHOS {
22 namespace Security {
23 namespace AccessToken {
24 enum CameraMuteServiceCallbackRequestCode {
25     CAMERA_CALLBACK_MUTE_MODE = 0
26 };
27 
28 enum CameraServiceRequestCode {
29     CAMERA_SERVICE_CREATE_DEVICE = 0,
30     CAMERA_SERVICE_SET_CALLBACK,
31     CAMERA_SERVICE_SET_MUTE_CALLBACK,
32     CAMERA_SERVICE_GET_CAMERAS,
33     CAMERA_SERVICE_CREATE_CAPTURE_SESSION,
34     CAMERA_SERVICE_CREATE_PHOTO_OUTPUT,
35     CAMERA_SERVICE_CREATE_PREVIEW_OUTPUT,
36     CAMERA_SERVICE_CREATE_DEFERRED_PREVIEW_OUTPUT,
37     CAMERA_SERVICE_CREATE_VIDEO_OUTPUT,
38     CAMERA_SERVICE_SET_LISTENER_OBJ,
39     CAMERA_SERVICE_CREATE_METADATA_OUTPUT,
40     CAMERA_SERVICE_MUTE_CAMERA,
41     CAMERA_SERVICE_IS_CAMERA_MUTED,
42 };
43 
44 class ICameraMuteServiceCallback : public IRemoteBroker {
45 public:
46     virtual int32_t OnCameraMute(bool muteMode) = 0;
47 
48     DECLARE_INTERFACE_DESCRIPTOR(u"ICameraMuteServiceCallback");
49 };
50 
51 class ICameraService : public IRemoteBroker {
52 public:
53     DECLARE_INTERFACE_DESCRIPTOR(u"ICameraService");
54 
55     virtual int32_t SetMuteCallback(const sptr<ICameraMuteServiceCallback>& callback) = 0;
56     virtual int32_t MuteCamera(bool muteMode) = 0;
57     virtual int32_t IsCameraMuted(bool &muteMode) = 0;
58 };
59 
60 class CameraManagerPrivacyProxy : public IRemoteProxy<ICameraService> {
61 public:
CameraManagerPrivacyProxy(const sptr<IRemoteObject> & impl)62     explicit CameraManagerPrivacyProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<ICameraService>(impl) {};
63 
64     virtual ~CameraManagerPrivacyProxy() = default;
65 
66     int32_t SetMuteCallback(const sptr<ICameraMuteServiceCallback>& callback) override;
67     int32_t MuteCamera(bool muteMode) override;
68     int32_t IsCameraMuted(bool &muteMode) override;
69 private:
70     static inline BrokerDelegator<CameraManagerPrivacyProxy> delegator_;
71 };
72 }
73 }
74 }
75 #endif // OHOS_CAMERA_MANAGER_PRIVACY_PROXY_H
76