1/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.tv.cec@1.1;
18
19import @1.0::IHdmiCec;
20import @1.0::Result;
21import @1.0::SendMessageResult;
22
23import IHdmiCecCallback;
24
25/**
26 * HDMI-CEC HAL interface definition.
27 */
28interface IHdmiCec extends @1.0::IHdmiCec {
29    /**
30     * Passes the logical address that must be used in this system.
31     *
32     * HAL must use it to configure the hardware so that the CEC commands
33     * addressed the given logical address can be filtered in. This method must
34     * be able to be called as many times as necessary in order to support
35     * multiple logical devices.
36     *
37     * @param addr Logical address that must be used in this system. It must be
38     *        in the range of valid logical addresses for the call to succeed.
39     * @return result Result status of the operation. SUCCESS if successful,
40     *         FAILURE_INVALID_ARGS if the given logical address is invalid,
41     *         FAILURE_BUSY if device or resource is busy
42     */
43    addLogicalAddress_1_1(CecLogicalAddress addr) generates (Result result);
44
45    /**
46     * Transmits HDMI-CEC message to other HDMI device.
47     *
48     * The method must be designed to return in a certain amount of time and not
49     * hanging forever which may happen if CEC signal line is pulled low for
50     * some reason.
51     *
52     * It must try retransmission at least once as specified in the section '7.1
53     * Frame Re-transmissions' of the CEC Spec 1.4b.
54     *
55     * @param message CEC message to be sent to other HDMI device.
56     * @return result Result status of the operation. SUCCESS if successful,
57     *         NACK if the sent message is not acknowledged,
58     *         BUSY if the CEC bus is busy.
59     */
60    sendMessage_1_1(CecMessage message) generates (SendMessageResult result);
61
62    /**
63     * Sets a callback that HDMI-CEC HAL must later use for incoming CEC
64     * messages or internal HDMI events.
65     *
66     * @param callback Callback object to pass hdmi events to the system. The
67     *        previously registered callback must be replaced with this one.
68     */
69    setCallback_1_1(IHdmiCecCallback callback);
70};
71