@Override public void setAutomaticTASwitching(boolean automatic) { try { mService.setAutomaticTASwitching(automatic); } catch (RemoteException ex) { Log.e(TAG, "setAutomaticTASwitching: RemoteException", ex); } }
@Override public void resume() throws IOException { try { mService.resume(); } catch (RemoteException ex) { Log.e(TAG, "resume: RemoteException", ex); } }
@Override public void stopScan() { try { mService.stopScan(); } catch (RemoteException ex) { Log.e(TAG, "stopScan: RemoteException", ex); } }
@Override public void pause() throws IOException { try { mService.pause(); } catch (RemoteException ex) { Log.e(TAG, "pause: RemoteException", ex); } }
@Override public void setForceMono(boolean forceMono) { try { mService.setForceMono(forceMono); } catch (RemoteException ex) { Log.e(TAG, "setForceMono: RemoteException", ex); } }
@Override public boolean isPlayingInStereo() { try { return mService.isPlayingInStereo(); } catch (RemoteException ex) { Log.e(TAG, "isPlayingInStereo: RemoteException", ex); return false; } }
@Override public int getThreshold() throws IOException { try { return mService.getThreshold(); } catch (RemoteException ex) { Log.e(TAG, "getThreshold: RemoteException", ex); return 0; } }
@Override public boolean isTunedToValidChannel() { try { return mService.isTunedToValidChannel(); } catch (RemoteException ex) { Log.e(TAG, "isTunedToValidChannel: RemoteException", ex); return false; } }
@Override public boolean isRDSDataSupported() { try { return mService.isRDSDataSupported(); } catch (RemoteException ex) { Log.e(TAG, "isRDSDataSupported: RemoteException", ex); return false; } }
@Override public int getState() { try { return mService.getState(); } catch (RemoteException ex) { Log.e(TAG, "getState: RemoteException", ex); return STATE_IDLE; } }
@Override public void reset() throws IOException { try { mService.reset(); mBand = null; } catch (RemoteException ex) { Log.e(TAG, "reset: RemoteException", ex); } }
@Override public int getFrequency() throws IOException { try { return mService.getFrequency(); } catch (RemoteException ex) { Log.e(TAG, "getFrequency: RemoteException", ex); return FmBand.FM_FREQUENCY_UNKNOWN; } }
@Override public int getSignalStrength() throws IOException { try { return mService.getSignalStrength(); } catch (RemoteException ex) { Log.e(TAG, "getSignalStrength: RemoteException", ex); return SIGNAL_STRENGTH_UNKNOWN; } }
@Override public boolean sendExtraCommand(String command, String[] extras) { try { return mService.sendExtraCommand(command, extras); } catch (RemoteException ex) { Log.e(TAG, "sendExtraCommand: RemoteException", ex); return false; } }
@Override public void removeOnSignalStrengthChangedListener(OnSignalStrengthChangedListener listener) { try { OnSignalStrengthListenerTransport transport = mOnSignalStrength.remove(listener); if (transport != null) { mService.removeOnSignalStrengthChangedListener(transport); } } catch (RemoteException ex) { Log.e(TAG, "removeOnSignalStrengthChangedListener: DeadObjectException", ex); } }
@Override public void setThreshold(int threshold) throws IOException { if (threshold < 0 || threshold > 1000) { throw new IllegalArgumentException("threshold not within limits"); } try { mService.setThreshold(threshold); } catch (RemoteException ex) { Log.e(TAG, "setThreshold: RemoteException", ex); } }
@Override public void removeOnForcedPauseListener(OnForcedPauseListener listener) { try { OnForcedPauseListenerTransport transport = mOnForcedPause.remove(listener); if (transport != null) { mService.removeOnForcedPauseListener(transport); } } catch (RemoteException ex) { Log.e(TAG, "removeOnForcedPauseListener: DeadObjectException", ex); } }
@Override public void setFrequency(int frequency) throws IOException { if (mBand != null && !mBand.isFrequencyValid(frequency)) { throw new IllegalArgumentException("Frequency is not valid in this band."); } try { mService.setFrequency(frequency); } catch (RemoteException ex) { Log.e(TAG, "setFrequency: RemoteException", ex); } }
@Override public void start(FmBand band) throws IOException { if (band == null) { throw new IllegalArgumentException("Band cannot be null"); } try { mService.start(band); mBand = band; } catch (RemoteException ex) { Log.e(TAG, "start: RemoteException", ex); } }
@Override public void addOnForcedResetListener(OnForcedResetListener listener) { if (mOnForcedReset.get(listener) != null) { // listener is already registered return; } try { synchronized (mOnForcedReset) { OnForcedResetListenerTransport transport = new OnForcedResetListenerTransport(listener); mService.addOnForcedResetListener(transport); mOnForcedReset.put(listener, transport); } } catch (RemoteException ex) { Log.e(TAG, "addOnForcedResetListener: RemoteException", ex); } }