15fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim/*
25fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * Copyright (C) 2014 The Android Open Source Project
35fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim *
45fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * Licensed under the Apache License, Version 2.0 (the "License");
55fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * you may not use this file except in compliance with the License.
65fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * You may obtain a copy of the License at
75fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim *
85fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim *      http://www.apache.org/licenses/LICENSE-2.0
95fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim *
105fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * Unless required by applicable law or agreed to in writing, software
115fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * distributed under the License is distributed on an "AS IS" BASIS,
125fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * See the License for the specific language governing permissions and
145fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * limitations under the License.
155fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim */
165fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
175fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kimpackage com.android.server.hdmi;
185fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
195fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim/**
205fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim * Class that holds together the constants that may require per-product configuration.
215fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim */
225fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kimfinal class HdmiConfig {
235fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
245fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // Default timeout for the incoming command to arrive in response to a request.
255fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    static final int TIMEOUT_MS = 2000;
265fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
275fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // IRT(Initiator Repetition Time) in millisecond as recommended in the standard.
285fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // Outgoing UCP commands, when in 'Press and Hold' mode, should be this much apart
295fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // from the adjacent one so as not to place unnecessarily heavy load on the CEC line.
305fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    static final int IRT_MS = 300;
315fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
325fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // Number of retries for polling each device in device discovery phase after TV powers on
335fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // or HDMI control is enabled.
345fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    static final int DEVICE_POLLING_RETRY = 1;
355fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
365fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // Number of retries for polling each device in periodic check (hotplug detection).
378e93c84739902f5adaa499b474f39e3c4807bc1cJungshik Jang    static final int HOTPLUG_DETECTION_RETRY = 1;
385fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
395fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    // Number of retries for polling each device in address allocation mechanism.
405fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    static final int ADDRESS_ALLOCATION_RETRY = 3;
415fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim
4246350382ee1974fd635d43c7273dc44854edf7c7Yuncheol Heo    // Number of retries for sendCommand in actions related to new device discovery.
4346350382ee1974fd635d43c7273dc44854edf7c7Yuncheol Heo    // Number 5 comes from 10 seconds for Chromecast preparation time.
4446350382ee1974fd635d43c7273dc44854edf7c7Yuncheol Heo    static final int TIMEOUT_RETRY = 5;
4546350382ee1974fd635d43c7273dc44854edf7c7Yuncheol Heo
468ed86c467afa107f7aafacb85ca64c979cf56dc2Jungshik Jang    // CEC spec said that it should try retransmission at least once.
478ed86c467afa107f7aafacb85ca64c979cf56dc2Jungshik Jang    // The actual number of send request for a single command will be at most
488ed86c467afa107f7aafacb85ca64c979cf56dc2Jungshik Jang    // RETRANSMISSION_COUNT + 1. Note that it affects only to normal commands
498ed86c467afa107f7aafacb85ca64c979cf56dc2Jungshik Jang    // and polling message for logical address allocation and device discovery
508ed86c467afa107f7aafacb85ca64c979cf56dc2Jungshik Jang    // action. They will have their own retransmission count.
518ed86c467afa107f7aafacb85ca64c979cf56dc2Jungshik Jang    static final int RETRANSMISSION_COUNT = 1;
528ed86c467afa107f7aafacb85ca64c979cf56dc2Jungshik Jang
534fdd0f47bc10bdbc429c6316c2cc98a747570b12Jinsuk Kim    // Do not export the CEC devices connected to a legacy HDMI switch. The usage of legacy
544fdd0f47bc10bdbc429c6316c2cc98a747570b12Jinsuk Kim    // (non-CEC) switches is deprecated. They stop the correct operation of many mandatory
554fdd0f47bc10bdbc429c6316c2cc98a747570b12Jinsuk Kim    // CEC features. If set to true, do not pass the list of CEC devices behind the legacy
564fdd0f47bc10bdbc429c6316c2cc98a747570b12Jinsuk Kim    // switch since they won't be under control from TV.
574fdd0f47bc10bdbc429c6316c2cc98a747570b12Jinsuk Kim    static final boolean HIDE_DEVICES_BEHIND_LEGACY_SWITCH = true;
584fdd0f47bc10bdbc429c6316c2cc98a747570b12Jinsuk Kim
595fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim    private HdmiConfig() { /* cannot be instantiated */ }
605fba96df30b6b50b3cb9fe1d783320b1cc3bd6eaJinsuk Kim}
61