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 #include "hcamera_broker_stub.h"
17 #include "iremote_stub.h"
18 #include "camera_log.h"
19
20 namespace OHOS {
21 namespace CameraStandard {
HCameraRgmProxy(const sptr<IRemoteObject> & impl)22 HCameraRgmProxy::HCameraRgmProxy(const sptr<IRemoteObject> &impl)
23 : IRemoteProxy<ICameraBroker>(impl) { }
24
NotifyCloseCamera(std::string cameraId)25 int32_t HCameraRgmProxy::NotifyCloseCamera(std::string cameraId)
26 {
27 MessageParcel data;
28 MessageParcel reply;
29 MessageOption option;
30
31 data.WriteInterfaceToken(GetDescriptor());
32 data.WriteString(cameraId);
33 option.SetFlags(option.TF_SYNC);
34 int error = Remote()->SendRequest(
35 static_cast<uint32_t>(CameraServiceDHInterfaceCode::CAMERA_SERVICE_NOTIFY_CLOSE_CAMERA), data, reply, option);
36 CHECK_PRINT_ELOG(error != ERR_NONE, "HCameraServiceProxy notifyCloseCamera failed, error: %{public}d", error);
37 MEDIA_DEBUG_LOG("HCameraServiceProxy notifyCloseCamera");
38
39 return error;
40 }
41
NotifyMuteCamera(bool muteMode)42 int32_t HCameraRgmProxy::NotifyMuteCamera(bool muteMode)
43 {
44 MessageParcel data;
45 MessageParcel reply;
46 MessageOption option;
47
48 data.WriteInterfaceToken(GetDescriptor());
49 data.WriteBool(muteMode);
50 option.SetFlags(option.TF_SYNC);
51 int error = Remote()->SendRequest(
52 static_cast<uint32_t>(CameraServiceDHInterfaceCode::CAMERA_SERVICE_NOTIFY_MUTE_CAMERA), data, reply, option);
53 CHECK_PRINT_ELOG(error != ERR_NONE, "HCameraServiceProxy NotifyMuteCamera failed, error: %{public}d", error);
54 MEDIA_DEBUG_LOG("HCameraServiceProxy NotifyMuteCamera");
55
56 return error;
57 }
58
59 } // namespace CameraStandard
60 } // namespace OHOS
61