Methods Summary |
---|
private void | checkTimerRecordingSourceType(int sourceType)
switch (sourceType) {
case HdmiControlManager.TIMER_RECORDING_TYPE_DIGITAL:
case HdmiControlManager.TIMER_RECORDING_TYPE_ANALOGUE:
case HdmiControlManager.TIMER_RECORDING_TYPE_EXTERNAL:
break;
default:
throw new IllegalArgumentException("Invalid source type:" + sourceType);
}
|
public void | clearTimerRecording(int recorderAddress, int sourceType, android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource source)Clears timer recording with the given recorder address and recording source.
For more details, please refer {@link #startTimerRecording(int, int, TimerRecordSource)}.
if (source == null) {
throw new IllegalArgumentException("source must not be null.");
}
checkTimerRecordingSourceType(sourceType);
try {
byte[] data = new byte[source.getDataSize()];
source.toByteArray(data, 0);
mService.clearTimerRecording(recorderAddress, sourceType, data);
} catch (RemoteException e) {
Log.e(TAG, "failed to start record: ", e);
}
|
static android.hardware.hdmi.HdmiTvClient | create(IHdmiControlService service)
return new HdmiTvClient(service);
|
public void | deviceSelect(int logicalAddress, android.hardware.hdmi.HdmiTvClient$SelectCallback callback)Selects a CEC logical device to be a new active source.
if (callback == null) {
throw new IllegalArgumentException("callback must not be null.");
}
try {
mService.deviceSelect(logicalAddress, getCallbackWrapper(callback));
} catch (RemoteException e) {
Log.e(TAG, "failed to select device: ", e);
}
|
private static IHdmiControlCallback | getCallbackWrapper(android.hardware.hdmi.HdmiTvClient$SelectCallback callback)
return new IHdmiControlCallback.Stub() {
@Override
public void onComplete(int result) {
callback.onComplete(result);
}
};
|
public java.util.List | getDeviceList()Returns all the CEC devices connected to TV.
try {
return mService.getDeviceList();
} catch (RemoteException e) {
Log.e("TAG", "Failed to call getDeviceList():", e);
return Collections.<HdmiDeviceInfo>emptyList();
}
|
public int | getDeviceType()
return HdmiDeviceInfo.DEVICE_TV;
|
private static IHdmiRecordListener | getListenerWrapper(HdmiRecordListener callback)
return new IHdmiRecordListener.Stub() {
@Override
public byte[] getOneTouchRecordSource(int recorderAddress) {
HdmiRecordSources.RecordSource source =
callback.onOneTouchRecordSourceRequested(recorderAddress);
if (source == null) {
return EmptyArray.BYTE;
}
byte[] data = new byte[source.getDataSize(true)];
source.toByteArray(true, data, 0);
return data;
}
@Override
public void onOneTouchRecordResult(int recorderAddress, int result) {
callback.onOneTouchRecordResult(recorderAddress, result);
}
@Override
public void onTimerRecordingResult(int recorderAddress, int result) {
callback.onTimerRecordingResult(recorderAddress,
HdmiRecordListener.TimerStatusData.parseFrom(result));
}
@Override
public void onClearTimerRecordingResult(int recorderAddress, int result) {
callback.onClearTimerRecordingResult(recorderAddress, result);
}
};
|
private IHdmiMhlVendorCommandListener | getListenerWrapper(android.hardware.hdmi.HdmiTvClient$HdmiMhlVendorCommandListener listener)
return new IHdmiMhlVendorCommandListener.Stub() {
@Override
public void onReceived(int portId, int offset, int length, byte[] data) {
listener.onReceived(portId, offset, length, data);
}
};
|
private static IHdmiInputChangeListener | getListenerWrapper(android.hardware.hdmi.HdmiTvClient$InputChangeListener listener)
return new IHdmiInputChangeListener.Stub() {
@Override
public void onChanged(HdmiDeviceInfo info) {
listener.onChanged(info);
}
};
|
public void | portSelect(int portId, android.hardware.hdmi.HdmiTvClient$SelectCallback callback)Selects a HDMI port to be a new route path.
if (callback == null) {
throw new IllegalArgumentException("Callback must not be null");
}
try {
mService.portSelect(portId, getCallbackWrapper(callback));
} catch (RemoteException e) {
Log.e(TAG, "failed to select port: ", e);
}
|
public void | sendMhlVendorCommand(int portId, int offset, int length, byte[] data)Sends MHL vendor command to the device connected to a port of the given portId.
if (data == null || data.length != VENDOR_DATA_SIZE) {
throw new IllegalArgumentException("Invalid vendor command data.");
}
if (offset < 0 || offset >= VENDOR_DATA_SIZE) {
throw new IllegalArgumentException("Invalid offset:" + offset);
}
if (length < 0 || offset + length > VENDOR_DATA_SIZE) {
throw new IllegalArgumentException("Invalid length:" + length);
}
try {
mService.sendMhlVendorCommand(portId, offset, length, data);
} catch (RemoteException e) {
Log.e(TAG, "failed to send vendor command: ", e);
}
|
public void | setHdmiMhlVendorCommandListener(android.hardware.hdmi.HdmiTvClient$HdmiMhlVendorCommandListener listener)Sets {@link HdmiMhlVendorCommandListener} to get incoming MHL vendor command.
if (listener == null) {
throw new IllegalArgumentException("listener must not be null.");
}
try {
mService.addHdmiMhlVendorCommandListener(getListenerWrapper(listener));
} catch (RemoteException e) {
Log.e(TAG, "failed to set hdmi mhl vendor command listener: ", e);
}
|
public void | setInputChangeListener(android.hardware.hdmi.HdmiTvClient$InputChangeListener listener)Sets the listener used to get informed of the input change event.
if (listener == null) {
throw new IllegalArgumentException("listener must not be null.");
}
try {
mService.setInputChangeListener(getListenerWrapper(listener));
} catch (RemoteException e) {
Log.e("TAG", "Failed to set InputChangeListener:", e);
}
|
public void | setRecordListener(HdmiRecordListener listener)Sets record listener
if (listener == null) {
throw new IllegalArgumentException("listener must not be null.");
}
try {
mService.setHdmiRecordListener(getListenerWrapper(listener));
} catch (RemoteException e) {
Log.e(TAG, "failed to set record listener.", e);
}
|
public void | setSystemAudioMute(boolean mute)Sets system audio mute status
try {
mService.setSystemAudioMute(mute);
} catch (RemoteException e) {
Log.e(TAG, "failed to set mute: ", e);
}
|
public void | setSystemAudioVolume(int oldIndex, int newIndex, int maxIndex)Sets system audio volume
try {
mService.setSystemAudioVolume(oldIndex, newIndex, maxIndex);
} catch (RemoteException e) {
Log.e(TAG, "failed to set volume: ", e);
}
|
public void | startOneTouchRecord(int recorderAddress, android.hardware.hdmi.HdmiRecordSources.RecordSource source)Starts one touch recording with the given recorder address and recorder source.
Usage
HdmiTvClient tvClient = ....;
// for own source.
OwnSource ownSource = HdmiRecordSources.ofOwnSource();
tvClient.startOneTouchRecord(recorderAddress, ownSource);
if (source == null) {
throw new IllegalArgumentException("source must not be null.");
}
try {
byte[] data = new byte[source.getDataSize(true)];
source.toByteArray(true, data, 0);
mService.startOneTouchRecord(recorderAddress, data);
} catch (RemoteException e) {
Log.e(TAG, "failed to start record: ", e);
}
|
public void | startTimerRecording(int recorderAddress, int sourceType, android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource source)Starts timer recording with the given recoder address and recorder source.
Usage
HdmiTvClient tvClient = ....;
// create timer info
TimerInfo timerInfo = HdmiTimerRecourdSources.timerInfoOf(...);
// for digital source.
DigitalServiceSource recordSource = HdmiRecordSources.ofDigitalService(...);
// create timer recording source.
TimerRecordSource source = HdmiTimerRecourdSources.ofDigitalSource(timerInfo, recordSource);
tvClient.startTimerRecording(recorderAddress, source);
if (source == null) {
throw new IllegalArgumentException("source must not be null.");
}
checkTimerRecordingSourceType(sourceType);
try {
byte[] data = new byte[source.getDataSize()];
source.toByteArray(data, 0);
mService.startTimerRecording(recorderAddress, sourceType, data);
} catch (RemoteException e) {
Log.e(TAG, "failed to start record: ", e);
}
|
public void | stopOneTouchRecord(int recorderAddress)Stops one touch record.
try {
mService.stopOneTouchRecord(recorderAddress);
} catch (RemoteException e) {
Log.e(TAG, "failed to stop record: ", e);
}
|