1 /* 2 * Copyright (C) 2020 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.media.tv.tuner.frontend; 18 19 import android.annotation.IntRange; 20 import android.annotation.NonNull; 21 import android.annotation.SystemApi; 22 23 /** 24 * Scan callback. 25 * 26 * @hide 27 */ 28 @SystemApi 29 public interface ScanCallback { 30 31 /** 32 * Scan locked the signal. 33 * 34 * It can also be notified after signal is locked if the signal attributes transmission 35 * parameter of the signal is changed (e.g., Modulation). 36 */ onLocked()37 void onLocked(); 38 39 /** Scan unlocked the signal. */ onUnlocked()40 default void onUnlocked() {} 41 42 /** Scan stopped. */ onScanStopped()43 void onScanStopped(); 44 45 /** scan progress percent (0..100) */ onProgress(@ntRangefrom = 0, to = 100) int percent)46 void onProgress(@IntRange(from = 0, to = 100) int percent); 47 48 /** 49 * @deprecated Use {@link #onFrequenciesLongReported(long[])} 50 */ onFrequenciesReported(@onNull int[] frequencies)51 @Deprecated void onFrequenciesReported(@NonNull int[] frequencies); 52 53 /** Signal frequencies in Hertz */ onFrequenciesLongReported(@onNull long[] frequencies)54 default void onFrequenciesLongReported(@NonNull long[] frequencies) { 55 final int[] intFrequencies = new int[frequencies.length]; 56 for (int i = 0; i < frequencies.length; i++) { 57 intFrequencies[i] = (int) frequencies[i]; 58 } 59 onFrequenciesReported(intFrequencies); 60 } 61 62 /** Symbols per second */ onSymbolRatesReported(@onNull int[] rate)63 void onSymbolRatesReported(@NonNull int[] rate); 64 65 /** Locked Plp Ids for DVBT2 frontend. */ onPlpIdsReported(@onNull int[] plpIds)66 void onPlpIdsReported(@NonNull int[] plpIds); 67 68 /** Locked group Ids for DVBT2 frontend. */ onGroupIdsReported(@onNull int[] groupIds)69 void onGroupIdsReported(@NonNull int[] groupIds); 70 71 /** Stream Ids. */ onInputStreamIdsReported(@onNull int[] inputStreamIds)72 void onInputStreamIdsReported(@NonNull int[] inputStreamIds); 73 74 /** Locked signal standard for DVBS. */ onDvbsStandardReported(@vbsFrontendSettings.Standard int dvbsStandard)75 void onDvbsStandardReported(@DvbsFrontendSettings.Standard int dvbsStandard); 76 77 /** Locked signal standard. for DVBT */ onDvbtStandardReported(@vbtFrontendSettings.Standard int dvbtStandard)78 void onDvbtStandardReported(@DvbtFrontendSettings.Standard int dvbtStandard); 79 80 /** Locked signal SIF standard for Analog. */ onAnalogSifStandardReported(@nalogFrontendSettings.SifStandard int sif)81 void onAnalogSifStandardReported(@AnalogFrontendSettings.SifStandard int sif); 82 83 /** PLP status in a tuned frequency band for ATSC3 frontend. */ onAtsc3PlpInfosReported(@onNull Atsc3PlpInfo[] atsc3PlpInfos)84 void onAtsc3PlpInfosReported(@NonNull Atsc3PlpInfo[] atsc3PlpInfos); 85 86 /** Frontend hierarchy. */ onHierarchyReported(@vbtFrontendSettings.Hierarchy int hierarchy)87 void onHierarchyReported(@DvbtFrontendSettings.Hierarchy int hierarchy); 88 89 /** Frontend signal type. */ onSignalTypeReported(@nalogFrontendSettings.SignalType int signalType)90 void onSignalTypeReported(@AnalogFrontendSettings.SignalType int signalType); 91 92 /** Frontend modulation reported. */ onModulationReported(@rontendStatus.FrontendModulation int modulation)93 default void onModulationReported(@FrontendStatus.FrontendModulation int modulation) {} 94 95 /** Frontend scan message priority reported. */ onPriorityReported(boolean isHighPriority)96 default void onPriorityReported(boolean isHighPriority) {} 97 98 /** DVBC Frontend Annex reported. */ onDvbcAnnexReported(@vbcFrontendSettings.Annex int dvbcAnnex)99 default void onDvbcAnnexReported(@DvbcFrontendSettings.Annex int dvbcAnnex) {} 100 101 /** DVBT Frontend Cell Ids reported. */ onDvbtCellIdsReported(@onNull int[] dvbtCellIds)102 default void onDvbtCellIdsReported(@NonNull int[] dvbtCellIds) {} 103 } 104