HdmiClientpublic abstract class HdmiClient extends Object Parent for classes of various HDMI-CEC device type used to access
the HDMI control system service. Contains methods and data used in common. |
Fields Summary |
---|
private static final String | TAG | final IHdmiControlService | mService | private IHdmiVendorCommandListener | mIHdmiVendorCommandListener |
Constructors Summary |
---|
HdmiClient(IHdmiControlService service)
/* package */
/* package */
mService = service;
|
Methods Summary |
---|
public HdmiDeviceInfo | getActiveSource()Returns the active source information.
try {
return mService.getActiveSource();
} catch (RemoteException e) {
Log.e(TAG, "getActiveSource threw exception ", e);
}
return null;
| abstract int | getDeviceType()
| private static IHdmiVendorCommandListener | getListenerWrapper(android.hardware.hdmi.HdmiControlManager.VendorCommandListener listener)
return new IHdmiVendorCommandListener.Stub() {
@Override
public void onReceived(int srcAddress, int destAddress, byte[] params,
boolean hasVendorId) {
listener.onReceived(srcAddress, destAddress, params, hasVendorId);
}
@Override
public void onControlStateChanged(boolean enabled, int reason) {
listener.onControlStateChanged(enabled, reason);
}
};
| public void | sendKeyEvent(int keyCode, boolean isPressed)Sends a key event to other logical device.
try {
mService.sendKeyEvent(getDeviceType(), keyCode, isPressed);
} catch (RemoteException e) {
Log.e(TAG, "sendKeyEvent threw exception ", e);
}
| public void | sendVendorCommand(int targetAddress, byte[] params, boolean hasVendorId)Sends vendor-specific command.
try {
mService.sendVendorCommand(getDeviceType(), targetAddress, params, hasVendorId);
} catch (RemoteException e) {
Log.e(TAG, "failed to send vendor command: ", e);
}
| public void | setVendorCommandListener(android.hardware.hdmi.HdmiControlManager.VendorCommandListener listener)Sets a listener used to receive incoming vendor-specific command.
if (listener == null) {
throw new IllegalArgumentException("listener cannot be null");
}
if (mIHdmiVendorCommandListener != null) {
throw new IllegalStateException("listener was already set");
}
try {
IHdmiVendorCommandListener wrappedListener = getListenerWrapper(listener);
mService.addVendorCommandListener(wrappedListener, getDeviceType());
mIHdmiVendorCommandListener = wrappedListener;
} catch (RemoteException e) {
Log.e(TAG, "failed to set vendor command listener: ", e);
}
|
|