1/*
2 * Copyright (C) 2019 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.tuner@1.0;
18
19import ILnbCallback;
20
21/**
22 * A Tuner LNB (low-noise block downconverter) is used by satellite frontend
23 * to receive the microwave signal from the satellite, amplify it, and
24 * downconvert the frequency to a lower frequency.
25 */
26interface ILnb {
27    /**
28     * Set the lnb callback.
29     *
30     * ILnbCallback is used by the client to receive events from the Lnb.
31     * Only one callback per ILnb instance is supported. The callback
32     * will be replaced if it's set again.
33     *
34     * @param callback Callback object to pass Lnb events to the system.
35     *        The previously registered callback must be replaced with this one.
36     *        It can be null.
37     * @return result Result status of the operation.
38     *         SUCCESS if successful,
39     *         INVALID_STATE if callback can't be set at current stage,
40     *         UNKNOWN_ERROR if callback setting failed for other reasons.
41     */
42    setCallback(ILnbCallback callback) generates (Result result);
43
44    /**
45     * Set the lnb's power voltage.
46     *
47     * @param voltage the power's voltage the Lnb to use.
48     * @return result Result status of the operation.
49     *         SUCCESS if successful,
50     *         INVALID_ARGUMENT if the selected voltage isn't allowed,
51     *         UNKNOWN_ERROR if failed for other reasons.
52     */
53    setVoltage(LnbVoltage voltage) generates (Result result);
54
55    /**
56     * Set the lnb's tone mode.
57     *
58     * @param tone the tone mode the Lnb to use.
59     * @return result Result status of the operation.
60     *         SUCCESS if successful,
61     *         INVALID_ARGUMENT if the selected tone mode isn't allowed,
62     *         UNKNOWN_ERROR if failed for other reasons.
63     */
64    setTone(LnbTone tone) generates (Result result);
65
66    /**
67     * Select the lnb's position.
68     *
69     * @param position the position the Lnb to use.
70     * @return result Result status of the operation.
71     *         SUCCESS if successful,
72     *         INVALID_ARGUMENT if the selected position isn't allowed,
73     *         UNKNOWN_ERROR if failed for other reasons.
74     */
75    setSatellitePosition(LnbPosition position) generates (Result result);
76
77    /**
78     *  Sends DiSEqC (Digital Satellite Equipment Control) message.
79     *
80     * Client sends DiSeqc message to DiSEqc to LNB. The response message from
81     * the device comes back to the client through frontend's callback
82     * onDiseqcMessage.
83     *
84     * @param diseqcMessage a byte array of data for DiSEqC message which is
85     *        specified by EUTELSAT Bus Functional Specification Version 4.2.
86     *
87     * @return result Result status of the operation.
88     *         SUCCESS if successful,
89     *         INVALID_STATE if the frontend can't send DiSEqc Message, such as
90     *         cable frontend.
91     *         UNKNOWN_ERROR if failed for other reasons.
92     */
93    sendDiseqcMessage(vec<uint8_t> diseqcMessage) generates (Result result);
94
95    /**
96     * Releases the LNB instance
97     *
98     * Associated resources are released.  close may be called more than once.
99     * Calls to any other method after this will return an error
100     *
101     * @return result Result status of the operation.
102     *         SUCCESS if successful,
103     *         UNKNOWN_ERROR if failed for other reasons.
104     */
105    close() generates (Result result);
106};
107