Home | History | Annotate | Download | only in 1.0
      1 /*
      2  * Copyright (C) 2016 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 
     17 package android.hardware.tv.cec@1.0;
     18 
     19 enum MaxLength : int32_t {
     20     MESSAGE_BODY = 15,
     21 };
     22 
     23 enum CecDeviceType : int32_t {
     24     INACTIVE = -1,
     25     TV = 0,
     26     RECORDER = 1,
     27     TUNER = 3,
     28     PLAYBACK = 4,
     29     AUDIO_SYSTEM = 5,
     30     MAX = AUDIO_SYSTEM,
     31 };
     32 
     33 enum CecLogicalAddress : int32_t {
     34     TV = 0,
     35     RECORDER_1 = 1,
     36     RECORDER_2 = 2,
     37     TUNER_1 = 3,
     38     PLAYBACK_1 = 4,
     39     AUDIO_SYSTEM = 5,
     40     TUNER_2 = 6,
     41     TUNER_3 = 7,
     42     PLAYBACK_2 = 8,
     43     RECORDER_3 = 9,
     44     TUNER_4 = 10,
     45     PLAYBACK_3 = 11,
     46     FREE_USE = 14,
     47     UNREGISTERED = 15, // as Initiator address
     48     BROADCAST = 15, // as Destination address
     49 };
     50 
     51 /**
     52  * HDMI CEC message types. The assigned values represent opcode used in CEC
     53  * frame as specified in CEC Table 8-26 of the CEC Spec 1.4b.
     54  */
     55 enum CecMessageType : int32_t {
     56     FEATURE_ABORT = 0x00,
     57     IMAGE_VIEW_ON = 0x04,
     58     TUNER_STEP_INCREMENT = 0x05,
     59     TUNER_STEP_DECREMENT = 0x06,
     60     TUNER_DEVICE_STATUS = 0x07,
     61     GIVE_TUNER_DEVICE_STATUS = 0x08,
     62     RECORD_ON = 0x09,
     63     RECORD_STATUS = 0x0A,
     64     RECORD_OFF = 0x0B,
     65     TEXT_VIEW_ON = 0x0D,
     66     RECORD_TV_SCREEN = 0x0F,
     67     GIVE_DECK_STATUS = 0x1A,
     68     DECK_STATUS = 0x1B,
     69     SET_MENU_LANGUAGE = 0x32,
     70     CLEAR_ANALOG_TIMER = 0x33,
     71     SET_ANALOG_TIMER = 0x34,
     72     TIMER_STATUS = 0x35,
     73     STANDBY = 0x36,
     74     PLAY = 0x41,
     75     DECK_CONTROL = 0x42,
     76     TIMER_CLEARED_STATUS = 0x43,
     77     USER_CONTROL_PRESSED = 0x44,
     78     USER_CONTROL_RELEASED = 0x45,
     79     GIVE_OSD_NAME = 0x46,
     80     SET_OSD_NAME = 0x47,
     81     SET_OSD_STRING = 0x64,
     82     SET_TIMER_PROGRAM_TITLE = 0x67,
     83     SYSTEM_AUDIO_MODE_REQUEST = 0x70,
     84     GIVE_AUDIO_STATUS = 0x71,
     85     SET_SYSTEM_AUDIO_MODE = 0x72,
     86     REPORT_AUDIO_STATUS = 0x7A,
     87     GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D,
     88     SYSTEM_AUDIO_MODE_STATUS = 0x7E,
     89     ROUTING_CHANGE = 0x80,
     90     ROUTING_INFORMATION = 0x81,
     91     ACTIVE_SOURCE = 0x82,
     92     GIVE_PHYSICAL_ADDRESS = 0x83,
     93     REPORT_PHYSICAL_ADDRESS = 0x84,
     94     REQUEST_ACTIVE_SOURCE = 0x85,
     95     SET_STREAM_PATH = 0x86,
     96     DEVICE_VENDOR_ID = 0x87,
     97     VENDOR_COMMAND = 0x89,
     98     VENDOR_REMOTE_BUTTON_DOWN = 0x8A,
     99     VENDOR_REMOTE_BUTTON_UP = 0x8B,
    100     GIVE_DEVICE_VENDOR_ID = 0x8C,
    101     MENU_REQUEST = 0x8D,
    102     MENU_STATUS = 0x8E,
    103     GIVE_DEVICE_POWER_STATUS = 0x8F,
    104     REPORT_POWER_STATUS = 0x90,
    105     GET_MENU_LANGUAGE = 0x91,
    106     SELECT_ANALOG_SERVICE = 0x92,
    107     SELECT_DIGITAL_SERVICE = 0x93,
    108     SET_DIGITAL_TIMER = 0x97,
    109     CLEAR_DIGITAL_TIMER = 0x99,
    110     SET_AUDIO_RATE = 0x9A,
    111     INACTIVE_SOURCE = 0x9D,
    112     CEC_VERSION = 0x9E,
    113     GET_CEC_VERSION = 0x9F,
    114     VENDOR_COMMAND_WITH_ID = 0xA0,
    115     CLEAR_EXTERNAL_TIMER = 0xA1,
    116     SET_EXTERNAL_TIMER = 0xA2,
    117     INITIATE_ARC = 0xC0,
    118     REPORT_ARC_INITIATED = 0xC1,
    119     REPORT_ARC_TERMINATED = 0xC2,
    120     REQUEST_ARC_INITIATION = 0xC3,
    121     REQUEST_ARC_TERMINATION = 0xC4,
    122     TERMINATE_ARC = 0xC5,
    123     ABORT = 0xFF,
    124 };
    125 
    126 /**
    127  * Operand description [Abort Reason]
    128  */
    129 enum AbortReason : int32_t {
    130     UNRECOGNIZED_MODE = 0,
    131     NOT_IN_CORRECT_MODE = 1,
    132     CANNOT_PROVIDE_SOURCE = 2,
    133     INVALID_OPERAND = 3,
    134     REFUSED = 4,
    135     UNABLE_TO_DETERMINE = 5,
    136 };
    137 
    138 enum Result : int32_t {
    139     SUCCESS = 0,
    140     FAILURE_UNKNOWN = 1,
    141     FAILURE_INVALID_ARGS = 2,
    142     FAILURE_INVALID_STATE = 3,
    143     FAILURE_NOT_SUPPORTED = 4,
    144     FAILURE_BUSY = 5,
    145 };
    146 
    147 /**
    148  * error code used for send_message.
    149  */
    150 enum SendMessageResult : int32_t {
    151     SUCCESS = 0,
    152     NACK = 1, // not acknowledged
    153     BUSY = 2, // bus is busy
    154     FAIL = 3,
    155 };
    156 
    157 /**
    158  * HDMI port type.
    159  */
    160 enum HdmiPortType : int32_t {
    161     INPUT = 0,
    162     OUTPUT = 1,
    163 };
    164 
    165 /**
    166  * Options used for IHdmiCec.setOption()
    167  */
    168 enum OptionKey : int32_t {
    169     /**
    170      * When set to false, HAL does not wake up the system upon receiving <Image
    171      * View On> or <Text View On>. Used when user changes the TV settings to
    172      * disable the auto TV on functionality.
    173      * True by default.
    174      */
    175     WAKEUP = 1,
    176 
    177     /**
    178      * When set to false, all the CEC commands are discarded. Used when user
    179      * changes the TV settings to disable CEC functionality.
    180      * True by default.
    181      */
    182     ENABLE_CEC = 2,
    183 
    184     /**
    185      * Setting this flag to false means Android system must stop handling CEC
    186      * service and yield the control over to the microprocessor that is powered
    187      * on through the standby mode. When set to true, the system must gain the
    188      * control over, hence telling the microprocessor to stop handling the CEC
    189      * commands. For example, this may be called when system goes in and out of
    190      * standby mode to notify the microprocessor that it should start/stop
    191      * handling CEC commands on behalf of the system.
    192      * False by default.
    193      */
    194     SYSTEM_CEC_CONTROL = 3,
    195 
    196     /* Option 4 not used */
    197 };
    198 
    199 struct CecMessage {
    200     /** logical address of sender */
    201     CecLogicalAddress initiator;
    202 
    203     /** logical address of receiver */
    204     CecLogicalAddress destination;
    205 
    206     /**
    207      * The maximum size of body is 15 (MaxLength::MESSAGE_BODY) as specified in
    208      * the section 6 of the CEC Spec 1.4b. Overflowed data must be ignored. */
    209     vec<uint8_t> body;
    210 };
    211 
    212 struct HotplugEvent {
    213     bool connected;
    214     uint32_t portId;
    215 };
    216 
    217 /**
    218  * HDMI port descriptor
    219  */
    220 struct HdmiPortInfo {
    221     HdmiPortType type;
    222     uint32_t portId; // Should start from 1 which corresponds to HDMI "port 1".
    223     bool cecSupported;
    224     bool arcSupported;
    225     uint16_t physicalAddress;
    226 };
    227