fm/fmapp2/src/com/caf/fmradio/FMTransmitterService.java
public boolean searchWeakStationList(int numStations)
   {

       boolean bStatus=false;
       FmConfig config = FmSharedPreferences.getFMConfiguration();

       if(null != mTransmitter) {
           mTransmitter.disable();
           mTransmitter = null;
           mFMOn = false;
       }
       if(null != mReceiver) {
           mReceiver.disable();
           mReceiver = null;
       }
       try {
           Thread.sleep(100);//SoC needs a delay to switch mode
       } catch (Exception ex) {
           Log.d( LOGTAG,  "RunningThread InterruptedException");
       }


       if(null == mReceiver) {
           try {
               mReceiver = new FmReceiver(FMRADIO_DEVICE_FD_STRING, fmCallbacks);
           }
           catch (InstantiationException e){
            throw new RuntimeException("FmTx service not available!");
           }
           if (mReceiver.getFMState() == mReceiver.FMState_Turned_Off) {
               bStatus = mReceiver.enable(config);
           } else {
               try {
                   Thread.sleep(100);
               } catch (Exception ex) {
                   Log.d( LOGTAG,  "RunningThread InterruptedException");
               }
               bStatus = mReceiver.enable(config);
           }
           if (!bStatus) {
               Log.e( LOGTAG,  "Search for weak station failed");
               return false;
           }
       }

       bStatus = mReceiver.setStation(config.getLowerLimit());

       Log.d(LOGTAG, "mReceiver.setStation:  bStatus: " + bStatus);
       bStatus = mReceiver.searchStationList( FmReceiver.FM_RX_SRCHLIST_MODE_WEAKEST,
                                              FmReceiver.FM_RX_SEARCHDIR_UP,
                                              numStations,
                                              0);

        mFMSearchStations = 0;//numStations;
        if(bStatus == false)
        {
           try
           {
              if (mCallbacks != null)
              {
                 mCallbacks.onSearchListComplete(false);
              }
           } catch (RemoteException e)
           {
              e.printStackTrace();
           }
        }
      return bStatus;
   }
/* Search for the weakest 12 FM Stations in the current band.
    *
    * It searches in the forward direction relative to the current tuned station.
    * int numStations: maximum number of stations to search.
    *
    * @return true if Search command was invoked successfully, false if not muted.
    *  Note: 1. Callback FmRxEvSearchListComplete will be called when the Search
    *        is complete
    *        2. Callback FmRxEvRadioTuneStatus will also be called when tuned to
    *        the previously tuned station.
    */
Search for the weakest 12 FM Stations in the current band.
It searches in the forward direction relative to the current tuned station.
int numStations: maximum number of stations to search.

@return true if Search command was invoked successfully, false if not muted.
Note: 1. Callback FmRxEvSearchListComplete will be called when the Search
is complete
2. Callback FmRxEvRadioTuneStatus will also be called when tuned to
the previously tuned station.
Search for the weakest 12 FM Stations in the current band . It searches in the forward direction relative to the current tuned station . int numStations : maximum number of stations to search . @return true if Search command was invoked successfully false if not muted . Note : 1 . Callback FmRxEvSearchListComplete will be called when the Search is complete 2 . Callback FmRxEvRadioTuneStatus will also be called when tuned to the previously tuned station .
public boolean searchWeakStationList(int numStations)
   {
       boolean bStatus=false;
       FmConfig config = FmSharedPreferences.getFMConfiguration();
       if(null != mTransmitter) {
           mTransmitter.disable();
           mTransmitter = null;
           mFMOn = false;
       }
       if(null != mReceiver) {
           mReceiver.disable();
           mReceiver = null;
       }
       try {
           Thread.sleep(100);
       } catch (Exception ex) {
           Log.d( LOGTAG,  "RunningThread InterruptedException");
       }
       if(null == mReceiver) {
           try {
               mReceiver = new FmReceiver(FMRADIO_DEVICE_FD_STRING, fmCallbacks);
           }
           catch (InstantiationException e){
            throw new RuntimeException("FmTx service not available!");
           }
           if (mReceiver.getFMState() == mReceiver.FMState_Turned_Off) {
               bStatus = mReceiver.enable(config);
           } else {
               try {
                   Thread.sleep(100);
               } catch (Exception ex) {
                   Log.d( LOGTAG,  "RunningThread InterruptedException");
               }
               bStatus = mReceiver.enable(config);
           }
           if (!bStatus) {
               Log.e( LOGTAG,  "Search for weak station failed");
               return false;
           }
       }
       bStatus = mReceiver.setStation(config.getLowerLimit());
       Log.d(LOGTAG, "mReceiver.setStation:  bStatus: " + bStatus);
       bStatus = mReceiver.searchStationList( FmReceiver.FM_RX_SRCHLIST_MODE_WEAKEST,
                                              FmReceiver.FM_RX_SEARCHDIR_UP,
                                              numStations,
                                              0);
        mFMSearchStations = 0;
        if(bStatus == false)
        {
           try
           {
              if (mCallbacks != null)
              {
                 mCallbacks.onSearchListComplete(false);
              }
           } catch (RemoteException e)
           {
              e.printStackTrace();
           }
        }
      return bStatus;
   }
public boolean searchWeakStationList ( int numStations ) { boolean bStatus = false ; FmConfig config = FmSharedPreferences . getFMConfiguration ( ) ; if ( null != mTransmitter ) { mTransmitter . disable ( ) ; mTransmitter = null ; mFMOn = false ; } if ( null != mReceiver ) { mReceiver . disable ( ) ; mReceiver = null ; } try { Thread . sleep ( 100 ) ; } catch ( Exception ex ) { Log . d ( LOGTAG , "RunningThread InterruptedException" ) ; } if ( null == mReceiver ) { try { mReceiver = new FmReceiver ( FMRADIO_DEVICE_FD_STRING , fmCallbacks ) ; } catch ( InstantiationException e ) { throw new RuntimeException ( "FmTx service not available!" ) ; } if ( mReceiver . getFMState ( ) == mReceiver . FMState_Turned_Off ) { bStatus = mReceiver . enable ( config ) ; } else { try { Thread . sleep ( 100 ) ; } catch ( Exception ex ) { Log . d ( LOGTAG , "RunningThread InterruptedException" ) ; } bStatus = mReceiver . enable ( config ) ; } if ( ! bStatus ) { Log . e ( LOGTAG , "Search for weak station failed" ) ; return false ; } } bStatus = mReceiver . setStation ( config . getLowerLimit ( ) ) ; Log . d ( LOGTAG , "mReceiver.setStation:  bStatus: " + bStatus ) ; bStatus = mReceiver . searchStationList ( FmReceiver . FM_RX_SRCHLIST_MODE_WEAKEST , FmReceiver . FM_RX_SEARCHDIR_UP , numStations , 0 ) ; mFMSearchStations = 0 ; if ( bStatus == false ) { try { if ( mCallbacks != null ) { mCallbacks . onSearchListComplete ( false ) ; } } catch ( RemoteException e ) { e . printStackTrace ( ) ; } } return bStatus ; }
Search for the weakest 12 FM Stations in the current band.
Search for the weakest 12 FM Stations in the current band .
//SoC needs a delay to switch mode //numStations;