1 /* 2 * Copyright (C) 2018 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 package com.android.tv.tuner.api; 17 18 import com.android.tv.tuner.data.nano.Channel; 19 20 /** Channel information gathered from a <em>scan</em> */ 21 public final class ScanChannel { 22 public final int type; 23 public final int frequency; 24 public final String modulation; 25 public final String filename; 26 /** 27 * Radio frequency (channel) number specified at 28 * https://en.wikipedia.org/wiki/North_American_television_frequencies This can be {@code null} 29 * for cases like cable signal. 30 */ 31 public final Integer radioFrequencyNumber; 32 forTuner( int frequency, String modulation, Integer radioFrequencyNumber)33 public static ScanChannel forTuner( 34 int frequency, String modulation, Integer radioFrequencyNumber) { 35 return new ScanChannel( 36 Channel.TunerType.TYPE_TUNER, frequency, modulation, null, radioFrequencyNumber); 37 } 38 forFile(int frequency, String filename)39 public static ScanChannel forFile(int frequency, String filename) { 40 return new ScanChannel(Channel.TunerType.TYPE_FILE, frequency, "file:", filename, null); 41 } 42 ScanChannel( int type, int frequency, String modulation, String filename, Integer radioFrequencyNumber)43 private ScanChannel( 44 int type, 45 int frequency, 46 String modulation, 47 String filename, 48 Integer radioFrequencyNumber) { 49 this.type = type; 50 this.frequency = frequency; 51 this.modulation = modulation; 52 this.filename = filename; 53 this.radioFrequencyNumber = radioFrequencyNumber; 54 } 55 } 56