Methods Summary |
---|
public int[] | getCarrierFrequencies()
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.TRANSMIT_IR)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Requires TRANSMIT_IR permission");
}
throwIfNoIrEmitter();
synchronized(mHalLock) {
return halGetCarrierFrequencies(mNativeHal);
}
|
private static native int[] | halGetCarrierFrequencies(long halObject)
|
private static native long | halOpen()
|
private static native int | halTransmit(long halObject, int carrierFrequency, int[] pattern)
|
public boolean | hasIrEmitter()
return mNativeHal != 0;
|
private void | throwIfNoIrEmitter()
if (mNativeHal == 0) {
throw new UnsupportedOperationException("IR emitter not available");
}
|
public void | transmit(java.lang.String packageName, int carrierFrequency, int[] pattern)
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.TRANSMIT_IR)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Requires TRANSMIT_IR permission");
}
long totalXmitTime = 0;
for (int slice : pattern) {
if (slice <= 0) {
throw new IllegalArgumentException("Non-positive IR slice");
}
totalXmitTime += slice;
}
if (totalXmitTime > MAX_XMIT_TIME ) {
throw new IllegalArgumentException("IR pattern too long");
}
throwIfNoIrEmitter();
// Right now there is no mechanism to ensure fair queing of IR requests
synchronized (mHalLock) {
int err = halTransmit(mNativeHal, carrierFrequency, pattern);
if (err < 0) {
Slog.e(TAG, "Error transmitting: " + err);
}
}
|