HdmiTimerRecordSourcespublic 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);
|
Fields Summary |
---|
private static final String | TAG | public static final int | RECORDING_SEQUENCE_REPEAT_ONCE_ONLYFields 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_PLUGExternal source specifier types. | private static final int | EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PHYSICAL_ADDRESS |
Constructors Summary |
---|
private HdmiTimerRecordSources()
|
Methods Summary |
---|
private static void | checkDurationValue(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 void | checkTimeValue(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 boolean | checkTimerRecordSource(int sourcetype, byte[] recordSource)Checks the byte array of timer record source.
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 void | checkTimerRecordSourceInputs(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$Duration | durationOf(int hour, int minute)Creates {@link Duration} for duration value.
checkDurationValue(hour, minute);
return new Duration(hour, minute);
| public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSource | ofAnalogueSource(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>.
checkTimerRecordSourceInputs(timerInfo, source);
return new TimerRecordSource(timerInfo, source);
| public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSource | ofDigitalSource(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>.
checkTimerRecordSourceInputs(timerInfo, source);
return new TimerRecordSource(timerInfo, source);
| public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSource | ofExternalPhysicalAddress(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>.
checkTimerRecordSourceInputs(timerInfo, source);
return new TimerRecordSource(timerInfo,
new ExternalSourceDecorator(source,
EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PHYSICAL_ADDRESS));
| public static android.hardware.hdmi.HdmiTimerRecordSources$TimerRecordSource | ofExternalPlug(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>.
checkTimerRecordSourceInputs(timerInfo, source);
return new TimerRecordSource(timerInfo,
new ExternalSourceDecorator(source, EXTERNAL_SOURCE_SPECIFIER_EXTERNAL_PLUG));
| public static android.hardware.hdmi.HdmiTimerRecordSources$Time | timeOf(int hour, int minute)Creates {@link Duration} for time value.
checkTimeValue(hour, minute);
return new Time(hour, minute);
| public static android.hardware.hdmi.HdmiTimerRecordSources$TimerInfo | timerInfoOf(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.
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);
|
|