FileDocCategorySizeDatePackage
HdmiTimerRecordSources.javaAPI DocAndroid 5.1 API18446Thu Mar 12 22:22:10 GMT 2015android.hardware.hdmi

HdmiTimerRecordSources

public class HdmiTimerRecordSources extends Object
Container for timer record source used for timer recording. Timer source consists of two parts, timer info and record source.

Timer info contains all timing information used for recording. It consists of the following values.

  • [Day of Month]
  • [Month of Year]
  • [Start Time]
  • [Duration]
  • [Recording Sequence]

Record source containers all program information used for recording. For more details, look at {@link HdmiRecordSources}.

Usage

TimeOrDuration startTime = HdmiTimerRecordSources.ofTime(18, 00); // 6PM.
TimeOrDuration duration = HdmiTimerRecordSource.ofDuration(1, 00); // 1 hour duration.
// For 1 hour from 6PM, August 10th every SaturDay and Sunday.
TimerInfo timerInfo = HdmiTimerRecordSource.timerInfoOf(10, 8, starTime, duration,
HdmiTimerRecordSource.RECORDING_SEQUENCE_REPEAT_SATURDAY |
HdmiTimerRecordSource.RECORDING_SEQUENCE_REPEAT_SUNDAY);
// create digital source.
DigitalServiceSource recordSource = HdmiRecordSource.ofDvb(...);
TimerRecordSource source = ofDigitalSource(timerInfo, recordSource);
hide

Fields Summary
private static final String
TAG
public static final int
RECORDING_SEQUENCE_REPEAT_ONCE_ONLY
Fields for recording sequence. The following can be merged by OR(|) operation.
public static final int
RECORDING_SEQUENCE_REPEAT_SUNDAY
public static final int
RECORDING_SEQUENCE_REPEAT_MONDAY
public static final int
RECORDING_SEQUENCE_REPEAT_TUESDAY
public static final int
RECORDING_SEQUENCE_REPEAT_WEDNESDAY
public static final int
RECORDING_SEQUENCE_REPEAT_THURSDAY
public static final int
RECORDING_SEQUENCE_REPEAT_FRIDAY
public static final int
RECORDING_SEQUENCE_REPEAT_SATUREDAY
private static final int
RECORDING_SEQUENCE_REPEAT_MASK
private static final int
EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PLUG
External source specifier types.
private static final int
EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PHYSICAL_ADDRESS
Constructors Summary
private HdmiTimerRecordSources()


      
Methods Summary
private static voidcheckDurationValue(int hour, int minute)

        if (hour < 0 || hour > 99) {
            throw new IllegalArgumentException("Hour should be in rage of [0, 99]:" + hour);
        }
        if (minute < 0 || minute > 59) {
            throw new IllegalArgumentException("minute should be in rage of [0, 59]:" + minute);
        }
    
private static voidcheckTimeValue(int hour, int minute)

        if (hour < 0 || hour > 23) {
            throw new IllegalArgumentException("Hour should be in rage of [0, 23]:" + hour);
        }
        if (minute < 0 || minute > 59) {
            throw new IllegalArgumentException("Minute should be in rage of [0, 59]:" + minute);
        }
    
public static booleancheckTimerRecordSource(int sourcetype, byte[] recordSource)
Checks the byte array of timer record source.

param
sourcetype
param
recordSource
hide

        int recordSourceSize = recordSource.length - TimerInfo.BASIC_INFO_SIZE;
        switch (sourcetype) {
            case TIMER_RECORDING_TYPE_DIGITAL:
                return DigitalServiceSource.EXTRA_DATA_SIZE == recordSourceSize;
            case TIMER_RECORDING_TYPE_ANALOGUE:
                return AnalogueServiceSource.EXTRA_DATA_SIZE == recordSourceSize;
            case TIMER_RECORDING_TYPE_EXTERNAL:
                int specifier = recordSource[TimerInfo.BASIC_INFO_SIZE];
                if (specifier == EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PLUG) {
                    // One byte for specifier.
                    return ExternalPlugData.EXTRA_DATA_SIZE + 1 == recordSourceSize;
                } else if (specifier == EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PHYSICAL_ADDRESS) {
                    // One byte for specifier.
                    return ExternalPhysicalAddress.EXTRA_DATA_SIZE + 1 == recordSourceSize;
                } else {
                    // Invalid specifier.
                    return false;
                }
            default:
                return false;
        }
    
private static voidcheckTimerRecordSourceInputs(android.hardware.hdmi.HdmiTimerRecordSources$TimerInfo timerInfo, android.hardware.hdmi.HdmiRecordSources.RecordSource source)

        if (timerInfo == null) {
            Log.w(TAG, "TimerInfo should not be null.");
            throw new IllegalArgumentException("TimerInfo should not be null.");
        }
        if (source == null) {
            Log.w(TAG, "source should not be null.");
            throw new IllegalArgumentException("source should not be null.");
        }
    
public static android.hardware.hdmi.HdmiTimerRecordSources$DurationdurationOf(int hour, int minute)
Creates {@link Duration} for duration value.

param
hour hour in range of [0, 99]
param
minute minute in range of [0, 59]
return
{@link Duration}
throws
IllegalArgumentException if hour or minute is out of range

        checkDurationValue(hour, minute);
        return new Duration(hour, minute);
    
public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSourceofAnalogueSource(android.hardware.hdmi.HdmiTimerRecordSources$TimerInfo timerInfo, android.hardware.hdmi.HdmiRecordSources.AnalogueServiceSource source)
Creates {@link TimerRecordSource} for analogue source which is used for <Set Analogue Timer>.

param
timerInfo timer info used for timer recording
param
source digital source used for timer recording
return
{@link TimerRecordSource}
throws
IllegalArgumentException if {@code timerInfo} or {@code source} is null

        checkTimerRecordSourceInputs(timerInfo, source);
        return new TimerRecordSource(timerInfo, source);
    
public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSourceofDigitalSource(android.hardware.hdmi.HdmiTimerRecordSources$TimerInfo timerInfo, android.hardware.hdmi.HdmiRecordSources.DigitalServiceSource source)
Creates {@link TimerRecordSource} for digital source which is used for <Set Digital Timer>.

param
timerInfo timer info used for timer recording
param
source digital source used for timer recording
return
{@link TimerRecordSource}
throws
IllegalArgumentException if {@code timerInfo} or {@code source} is null

        checkTimerRecordSourceInputs(timerInfo, source);
        return new TimerRecordSource(timerInfo, source);
    
public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSourceofExternalPhysicalAddress(android.hardware.hdmi.HdmiTimerRecordSources$TimerInfo timerInfo, android.hardware.hdmi.HdmiRecordSources.ExternalPhysicalAddress source)
Creates {@link TimerRecordSource} for external physical address which is used for <Set External Timer>.

param
timerInfo timer info used for timer recording
param
source digital source used for timer recording
return
{@link TimerRecordSource}
throws
IllegalArgumentException if {@code timerInfo} or {@code source} is null

        checkTimerRecordSourceInputs(timerInfo, source);
        return new TimerRecordSource(timerInfo,
                new ExternalSourceDecorator(source,
                        EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PHYSICAL_ADDRESS));
    
public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSourceofExternalPlug(android.hardware.hdmi.HdmiTimerRecordSources$TimerInfo timerInfo, android.hardware.hdmi.HdmiRecordSources.ExternalPlugData source)
Creates {@link TimerRecordSource} for external plug which is used for <Set External Timer>.

param
timerInfo timer info used for timer recording
param
source digital source used for timer recording
return
{@link TimerRecordSource}
throws
IllegalArgumentException if {@code timerInfo} or {@code source} is null

        checkTimerRecordSourceInputs(timerInfo, source);
        return new TimerRecordSource(timerInfo,
                new ExternalSourceDecorator(source, EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PLUG));
    
public static android.hardware.hdmi.HdmiTimerRecordSources$TimetimeOf(int hour, int minute)
Creates {@link Duration} for time value.

param
hour hour in range of [0, 23]
param
minute minute in range of [0, 60]
return
{@link Duration}
throws
IllegalArgumentException if hour or minute is out of range

        checkTimeValue(hour, minute);
        return new Time(hour, minute);
    
public static android.hardware.hdmi.HdmiTimerRecordSources$TimerInfotimerInfoOf(int dayOfMonth, int monthOfYear, android.hardware.hdmi.HdmiTimerRecordSources$Time startTime, android.hardware.hdmi.HdmiTimerRecordSources$Duration duration, int recordingSequence)
Creates {@link TimerInfo} with the given information.

param
dayOfMonth day of month
param
monthOfYear month of year
param
startTime start time in {@link Time}
param
duration duration in {@link Duration}
param
recordingSequence recording sequence. Use RECORDING_SEQUENCE_REPEAT_ONCE_ONLY for no repeat. Otherwise use combination of {@link #RECORDING_SEQUENCE_REPEAT_SUNDAY}, {@link #RECORDING_SEQUENCE_REPEAT_MONDAY}, {@link #RECORDING_SEQUENCE_REPEAT_TUESDAY}, {@link #RECORDING_SEQUENCE_REPEAT_WEDNESDAY}, {@link #RECORDING_SEQUENCE_REPEAT_THURSDAY}, {@link #RECORDING_SEQUENCE_REPEAT_FRIDAY}, {@link #RECORDING_SEQUENCE_REPEAT_SATUREDAY}.
return
{@link TimerInfo}.
throws
IllegalArgumentException if input value is invalid


                                                                                                                                                         
            
                
        if (dayOfMonth < 0 || dayOfMonth > 31) {
            throw new IllegalArgumentException(
                    "Day of month should be in range of [0, 31]:" + dayOfMonth);
        }
        if (monthOfYear < 1 || monthOfYear > 12) {
            throw new IllegalArgumentException(
                    "Month of year should be in range of [1, 12]:" + monthOfYear);
        }
        checkTimeValue(startTime.mHour, startTime.mMinute);
        checkDurationValue(duration.mHour, duration.mMinute);
        // Recording sequence should use least 7 bits or no bits.
        if ((recordingSequence != 0)
                && ((recordingSequence & ~RECORDING_SEQUENCE_REPEAT_MASK) != 0)) {
            throw new IllegalArgumentException(
                    "Invalid reecording sequence value:" + recordingSequence);
        }

        return new TimerInfo(dayOfMonth, monthOfYear, startTime, duration, recordingSequence);