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 #include "display_device_callback_proxy.h"
17
OnHotplugIn(uint32_t outputId,bool connected)18 int32_t DisplayDeviceCallbackProxy::OnHotplugIn(uint32_t outputId, bool connected)
19 {
20 DISPLAY_START;
21 OHOS::MessageParcel data;
22 OHOS::MessageParcel reply;
23 OHOS::MessageOption option;
24 if (!data.WriteInterfaceToken(DisplayDeviceCallbackProxy::GetDescriptor()) || !data.WriteInt32(outputId) ||
25 !data.WriteBool(connected)) {
26 return HDF_FAILURE;
27 }
28
29 int32_t ret = Remote()->SendRequest(DSP_CMD_REGHOTPLUGCALLBACK, data, reply, option);
30 DISPLAY_END;
31 return ret;
32 }
33
OnVBlankCallback(unsigned int sequence,uint64_t ns)34 int32_t DisplayDeviceCallbackProxy::OnVBlankCallback(unsigned int sequence, uint64_t ns)
35 {
36 DISPLAY_START;
37 OHOS::MessageParcel data;
38 OHOS::MessageParcel reply;
39 OHOS::MessageOption option;
40 if (!data.WriteInterfaceToken(DisplayDeviceCallbackProxy::GetDescriptor()) || !data.WriteInt32(sequence) ||
41 !data.WriteUint64(ns)) {
42 return HDF_FAILURE;
43 }
44
45 int32_t ret = Remote()->SendRequest(DSP_CMD_REGDISPLAYVBLANKCALLBACK, data, reply, option);
46 DISPLAY_END;
47 return ret;
48 }
49
OnRefreshCallback(uint32_t devId)50 int32_t DisplayDeviceCallbackProxy::OnRefreshCallback(uint32_t devId)
51 {
52 DISPLAY_START;
53 OHOS::MessageParcel data;
54 OHOS::MessageParcel reply;
55 OHOS::MessageOption option;
56 if (!data.WriteInterfaceToken(DisplayDeviceCallbackProxy::GetDescriptor()) || !data.WriteInt32(devId)) {
57 return HDF_FAILURE;
58 }
59
60 int32_t ret = Remote()->SendRequest(DSP_CMD_REGDISPLAYREFRESHCALLBACK, data, reply, option);
61 DISPLAY_END;
62 return ret;
63 }
64