FM: Add RFstats app support for Silabs chip

Add RFstats app support for Silabs chip to be
able to configure performance parameters.

CRs-fixed: 713647
Change-Id: I7946eb54ed0627dbce95010b0b52c2de1c94d166
diff --git a/fmapp2/res/values/arrays.xml b/fmapp2/res/values/arrays.xml
index 3778be1..6686eb8 100644
--- a/fmapp2/res/values/arrays.xml
+++ b/fmapp2/res/values/arrays.xml
@@ -365,6 +365,18 @@
       <item> Set RXREPEAT Count</item>
   </string-array>
 
+
+  <string-array name="cfg_rf3">
+      <item> Set SINR Threshold</item>
+      <item> Get SINR Threshold</item>
+      <item> Set RSSI Threshold</item>
+      <item> Get RSSI Threshold</item>
+      <item> Set AFJumpRssi Threshold</item>
+      <item> Get AFJumpRssi Threshold</item>
+      <item> Set RDS FIFO count</item>
+      <item> Get RDS FIFO count</item>
+  </string-array>
+
   <string-array name="stats_options">
       <item> Select the option</item>
       <item> Configure Performance parameters</item>
diff --git a/fmapp2/res/values/strings.xml b/fmapp2/res/values/strings.xml
index a2bf1d4..cf07eb9 100644
--- a/fmapp2/res/values/strings.xml
+++ b/fmapp2/res/values/strings.xml
@@ -248,6 +248,12 @@
     <string name="rt_plus_tags">Tags</string>
     <string name="enter_RxRePeatCount">Enter RxRePeat count</string>
     <string name="set_RxRePeatCount">Config RxRePeat count</string>
+    <string name="enter_RssiTh">Enter RSSI Threshold</string>
+    <string name="set_RssiTh">Config RSSI Threshold</string>
+    <string name="enter_AfJumpRssiTh">Enter AF jump RSSI Threshold</string>
+    <string name="set_AfJumpRssiTh">Config AF jump RSSI Threshold</string>
+    <string name="enter_RdsFifoCnt">Enter RDS FIFO count</string>
+    <string name="set_RdsFifoCnt">Config RDS FIFO count</string>
 
     <string name="usr_def_band_min">Lower Freq Limit(In Mhz)</string>
     <string name="usr_def_band_max">Higher Freq Limit(In Mhz)</string>
diff --git a/fmapp2/src/com/caf/fmradio/FMStats.java b/fmapp2/src/com/caf/fmradio/FMStats.java
index 8defff5..38099ea 100644
--- a/fmapp2/src/com/caf/fmradio/FMStats.java
+++ b/fmapp2/src/com/caf/fmradio/FMStats.java
@@ -172,6 +172,7 @@
                                      new RfCfgItemSelectedListener();
     CfgRfItemSelectedListener1 mSpinCfgRfListener1 = null;
     CfgRfItemSelectedListener2 mSpinCfgRfListener2 = null;
+    CfgRfItemSelectedListener3 mSpinCfgRfListener3 = null;
     BandSweepMthdsSelectedListener mSweepMthdsListener =
                                      new BandSweepMthdsSelectedListener();
 
@@ -228,6 +229,12 @@
     private static final int MAX_GD_CH_RMSSI_TH = 127;
     private static final int MIN_AF_JMP_RMSSI_SAMPLES = 0;
     private static final int MAX_AF_JMP_RMSSI_SAMPLES = 255;
+    private static final int MIN_SINR_TH_SILABS = 0;
+    private static final int MAX_SINR_TH_SILABS = 127;
+    private static final int MIN_RSSI_TH_SILABS = 0;
+    private static final int MAX_RSSI_TH_SILABS = 127;
+    private static final int MIN_RDS_FIFO_CNT_SILABS = 0;
+    private static final int MAX_RDS_FIFO_CNT_SILABS = 25;
 
     private static final int DIALOG_BAND_SWEEP_SETTING = 1;
 
@@ -279,17 +286,23 @@
                             android.R.layout.simple_spinner_item);
 
         checkTransportLayer();
-        if (!isTransportLayerSMD()) {
-            mSpinCfgRfListener1 = new CfgRfItemSelectedListener1();
+        if (isRomeChip()) {
+            mSpinCfgRfListener3 = new CfgRfItemSelectedListener3();
             adaptCfgRf = ArrayAdapter.createFromResource(
-                           this, R.array.cfg_rf1,
+                           this, R.array.cfg_rf3,
                            android.R.layout.simple_spinner_item);
-        }else {
+        }else if (isTransportLayerSMD()) {
             mSpinCfgRfListener2 = new CfgRfItemSelectedListener2();
             adaptCfgRf = ArrayAdapter.createFromResource(
                            this, R.array.cfg_rf2,
                            android.R.layout.simple_spinner_item);
+        }else {
+            mSpinCfgRfListener1 = new CfgRfItemSelectedListener1();
+            adaptCfgRf = ArrayAdapter.createFromResource(
+                           this, R.array.cfg_rf1,
+                           android.R.layout.simple_spinner_item);
         }
+
         adaptRfCfg = ArrayAdapter.createFromResource(
             this, R.array.rf_cfg, android.R.layout.simple_spinner_item);
 
@@ -486,7 +499,10 @@
                adaptCfgRf.setDropDownViewResource
                            (android.R.layout.simple_spinner_dropdown_item);
                spinOptionFmRf.setAdapter(adaptCfgRf);
-               if(isTransportLayerSMD())
+               if (isRomeChip())
+                  spinOptionFmRf.setOnItemSelectedListener
+                                   (mSpinCfgRfListener3);
+               else if(isTransportLayerSMD())
                   spinOptionFmRf.setOnItemSelectedListener
                                    (mSpinCfgRfListener2);
                else
@@ -494,6 +510,10 @@
                                    (mSpinCfgRfListener1);
                break;
        case 2:
+               /* RF statics option is for non-Silabs targets */
+               if (isRomeChip())
+                   break;
+
                txtbox1 = (EditText)findViewById(R.id.txtbox1);
                tv1 = (TextView)findViewById(R.id.label);
                if(txtbox1 != null) {
@@ -839,6 +859,98 @@
        }
     };
 
+    private View.OnClickListener mOnSetSinrThListenerSilabs =
+    new View.OnClickListener() {
+       public void onClick(View v) {
+          String a;
+          a = txtbox1.getText().toString();
+          try {
+              int rdel = Integer.parseInt(a);
+              Log.d(LOGTAG, "Value of Sinr Th is : " + rdel);
+              if(mService != null) {
+                 try {
+                     if((rdel >= MIN_SINR_TH_SILABS) &&
+                             (rdel <= MAX_SINR_TH_SILABS))
+                             mService.setSinrTh(rdel);
+                     else
+                        Log.d(LOGTAG, "SINR out of valid range");
+                 }catch (RemoteException e) {
+                     e.printStackTrace();
+                 }
+              }
+          }catch (NumberFormatException e) {
+              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
+              txtbox1.setText("");
+          }
+      }
+    };
+
+    private View.OnClickListener mOnSetRssiThListenerSilabs =
+    new View.OnClickListener() {
+       public void onClick(View v) {
+          String a;
+          a = txtbox1.getText().toString();
+          try {
+              int rdel = Integer.parseInt(a);
+              Log.d(LOGTAG, "Value of Rssi Th is : " + rdel);
+              if(mReceiver != null) {
+                  if((rdel >= MIN_RSSI_TH_SILABS) &&
+                          (rdel <= MAX_RSSI_TH_SILABS))
+                          mReceiver.setRssiThreshold(rdel);
+                  else
+                     Log.d(LOGTAG, "RSSI out of valid range");
+              }
+          }catch (NumberFormatException e) {
+              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
+              txtbox1.setText("");
+          }
+      }
+    };
+
+    private View.OnClickListener mOnSetAfJumpRssiThListenerSilabs =
+    new View.OnClickListener() {
+       public void onClick(View v) {
+          String a;
+          a = txtbox1.getText().toString();
+          try {
+              int rdel = Integer.parseInt(a);
+              Log.d(LOGTAG, "Value of Af jump Rssi Th is : " + rdel);
+              if(mReceiver != null) {
+                  if((rdel >= MIN_RSSI_TH_SILABS) &&
+                          (rdel <= MAX_RSSI_TH_SILABS))
+                          mReceiver.setAfJumpRssiThreshold(rdel);
+                  else
+                     Log.d(LOGTAG, "Af jump rssi out of valid range");
+              }
+          }catch (NumberFormatException e) {
+              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
+              txtbox1.setText("");
+          }
+      }
+    };
+
+    private View.OnClickListener mOnSetRdsFifoCntListenerSilabs =
+    new View.OnClickListener() {
+       public void onClick(View v) {
+          String a;
+          a = txtbox1.getText().toString();
+          try {
+              int rdel = Integer.parseInt(a);
+              Log.d(LOGTAG, "Value of RDS fifo count is : " + rdel);
+              if(mReceiver != null) {
+                  if((rdel >= MIN_RDS_FIFO_CNT_SILABS) &&
+                          (rdel <= MAX_RDS_FIFO_CNT_SILABS))
+                          mReceiver.setRdsFifoCnt(rdel);
+                  else
+                     Log.d(LOGTAG, "RDS fifo count out of valid range");
+              }
+          }catch (NumberFormatException e) {
+              Log.e(LOGTAG, "Value entered is not in correct format: " + a);
+              txtbox1.setText("");
+          }
+      }
+    };
+
     public class CfgRfItemSelectedListener1 implements OnItemSelectedListener {
         public void onItemSelected(
                      AdapterView<?> parent, View view, int pos, long id) {
@@ -1461,6 +1573,235 @@
         }
     }
 
+    public class CfgRfItemSelectedListener3 implements OnItemSelectedListener {
+        public void onItemSelected(
+                     AdapterView<?> parent, View view, int pos, long id) {
+            Log.d("Table","onItemSelected is hit with " + pos);
+            int ret = Integer.MAX_VALUE;
+            txtbox1 = (EditText)findViewById(R.id.txtbox1);
+            tv1 = (TextView)findViewById(R.id.label);
+            button1 = (Button)findViewById(R.id.SearchMpxDcc);
+            button2 = (Button)findViewById(R.id.SearchSinrInt);
+            Button SetButton = (Button)findViewById(R.id.Setbutton);
+            tLayout.setVisibility(View.INVISIBLE);
+            switch(pos)
+            {
+            case 0:
+                   if (txtbox1 != null) {
+                      txtbox1.setText(R.string.type_rd);
+                      txtbox1.setVisibility(View.VISIBLE);
+                   }
+                   if (tv1 != null) {
+                      tv1.setText(R.string.enter_SinrTh);
+                      tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                      SetButton.setText(R.string.set_SinrTh);
+                      SetButton.setVisibility(View.VISIBLE);
+                      SetButton.setOnClickListener(mOnSetSinrThListenerSilabs);
+                   }
+                   break;
+            case 1:
+                   if (txtbox1 != null) {
+                       txtbox1.setVisibility(View.INVISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setText("");
+                       tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setVisibility(View.INVISIBLE);
+                   }
+                   try {
+                       if(mService != null)
+                          ret = mService.getSinrTh();
+                          Log.d(LOGTAG, "Get Sinr Threshold: " + ret);
+                          if((ret >= MIN_SINR_TH_SILABS) &&
+                                  (ret <= MAX_SINR_TH_SILABS))
+                             tv1.setText(" " + String.valueOf(ret));
+                   }catch (RemoteException e) {
+
+                   }
+                   break;
+            case 2:
+                   if (txtbox1 != null) {
+                       txtbox1.setText(R.string.type_rd);
+                       txtbox1.setVisibility(View.VISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setText(R.string.enter_RssiTh);
+                       tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setText(R.string.set_RssiTh);
+                       SetButton.setVisibility(View.VISIBLE);
+                       SetButton.setOnClickListener(mOnSetRssiThListenerSilabs);
+                   }
+                   break;
+            case 3:
+                   if (txtbox1 != null) {
+                       txtbox1.setVisibility(View.INVISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setText("");
+                       tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setVisibility(View.INVISIBLE);
+                   }
+                   if (mReceiver != null) {
+                      ret = mReceiver.getRssiThreshold();
+                      Log.d(LOGTAG, "Get Rssi Th: " + ret);
+                      if((ret >= MIN_RSSI_TH_SILABS) &&
+                             (ret <= MAX_RSSI_TH_SILABS))
+                         tv1.setText(" " + String.valueOf(ret));
+                   }
+                   break;
+            case 4:
+                   if (txtbox1 != null) {
+                       txtbox1.setText(R.string.type_rd);
+                       txtbox1.setVisibility(View.VISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setText(R.string.enter_AfJumpRssiTh);
+                       tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setText(R.string.set_AfJumpRssiTh);
+                       SetButton.setVisibility(View.VISIBLE);
+                       SetButton.setOnClickListener(mOnSetAfJumpRssiThListenerSilabs);
+                   }
+                   break;
+            case 5:
+                   if (txtbox1 != null) {
+                       txtbox1.setVisibility(View.INVISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setText("");
+                       tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setVisibility(View.INVISIBLE);
+                   }
+                   if(mReceiver != null) {
+                      ret = mReceiver.getAfJumpRssiThreshold();
+                      Log.d(LOGTAG, "Get AF jump Rssi threshold: " + ret);
+                      if((ret >= MIN_RSSI_TH_SILABS) &&
+                             (ret <= MAX_RSSI_TH_SILABS))
+                         tv1.setText(" " + String.valueOf(ret));
+                   }
+                   break;
+            case 6:
+                   if (txtbox1 != null) {
+                       txtbox1.setText(R.string.type_rd);
+                       txtbox1.setVisibility(View.VISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setText(R.string.enter_AfJumpRssiTh);
+                       tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setText(R.string.set_RdsFifoCnt);
+                       SetButton.setVisibility(View.VISIBLE);
+                       SetButton.setOnClickListener(mOnSetRdsFifoCntListenerSilabs);
+                   }
+                   break;
+            case 7:
+                   if (txtbox1 != null) {
+                       txtbox1.setVisibility(View.INVISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setText("");
+                       tv1.setVisibility(View.VISIBLE);
+                   }
+                   if(button1 != null) {
+                      button1.setVisibility(View.INVISIBLE);
+                   }
+                   if(button2 != null) {
+                      button2.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setVisibility(View.INVISIBLE);
+                   }
+                   if(mReceiver != null) {
+                      ret = mReceiver.getRdsFifoCnt();
+                      Log.d(LOGTAG, "Get RDS fifo count: " + ret);
+                      if((ret >= MIN_RDS_FIFO_CNT_SILABS) &&
+                             (ret <= MAX_RDS_FIFO_CNT_SILABS))
+                         tv1.setText(" " + String.valueOf(ret));
+                   }
+                   break;
+/*
+            case 2:
+                   tLayout.removeAllViewsInLayout();
+                   mNewRowIds = NEW_ROW_ID;
+                   tLayout.setVisibility(View.VISIBLE);
+                   if (txtbox1 != null) {
+                       txtbox1.setVisibility(View.INVISIBLE);
+                   }
+                   if (tv1 != null) {
+                       tv1.setVisibility(View.INVISIBLE);
+                   }
+                   if (SetButton != null) {
+                       SetButton.setVisibility(View.INVISIBLE);
+                   }
+                   adaptRfCfg.setDropDownViewResource(
+                              android.R.layout.simple_spinner_dropdown_item);
+                   spinOptionFmRf.setAdapter(adaptRfCfg);
+                   spinOptionFmRf.setOnItemSelectedListener(
+                                                 mSpinRfCfgListener);
+                   break;
+*/
+            }
+        }
+
+        public void onNothingSelected(AdapterView<?> parent) {
+            // Do Nothing
+        }
+    }
+
     public class RfCfgItemSelectedListener implements OnItemSelectedListener {
         public void onItemSelected(AdapterView<?> parent,
                                     View view, int pos, long id) {
@@ -1502,7 +1843,9 @@
                     adaptCfgRf.setDropDownViewResource(
                                      android.R.layout.simple_spinner_dropdown_item);
                     spinOptionFmRf.setAdapter(adaptCfgRf);
-                    if(isTransportLayerSMD())
+                    if (isRomeChip())
+                       spinOptionFmRf.setOnItemSelectedListener(mSpinCfgRfListener3);
+                    else if(isTransportLayerSMD())
                        spinOptionFmRf.setOnItemSelectedListener(mSpinCfgRfListener2);
                     else
                        spinOptionFmRf.setOnItemSelectedListener(mSpinCfgRfListener1);
@@ -1536,6 +1879,15 @@
     private boolean isTransportLayerSMD() {
         return mIsTransportSMD;
     }
+    private boolean isRomeChip() {
+        String chip = "";
+
+        chip = SystemProperties.get("qcom.bluetooth.soc");
+        if(chip.equals("rome"))
+           return true;
+        return false;
+    }
+
     private void createResult(Result aRes) {
         // Get the TableLayout
         TableLayout tl = (TableLayout) findViewById(R.id.maintable);
diff --git a/qcom/fmradio/FmReceiver.java b/qcom/fmradio/FmReceiver.java
index 832cb29..3f5eb62 100644
--- a/qcom/fmradio/FmReceiver.java
+++ b/qcom/fmradio/FmReceiver.java
@@ -2493,6 +2493,114 @@
    }
 
 /*==============================================================
+   FUNCTION:  setRssiThreshold
+   ==============================================================*/
+   /**
+   *    Sets the RSSI threshold value
+   *
+   *    <p>
+   *    This method sets the RSSI threshold value.
+   *
+   *    <p>
+   */
+   public boolean setRssiThreshold(int data)
+   {
+      int re =  mControl.setRssiThreshold(sFd, data);
+      if (re < 0)
+          return false;
+      else
+          return true;
+   }
+
+/*==============================================================
+   FUNCTION:  getRssiThreshold
+   ==============================================================*/
+   /**
+   *    Gets the Rssi threshold value
+   *
+   *    <p>
+   *    This method gets the currently set Rssi threshold value.
+   *
+   *    <p>
+   */
+   public int getRssiThreshold()
+   {
+      return mControl.getRssiThreshold(sFd);
+   }
+
+/*==============================================================
+   FUNCTION:  setAfJumpRssiThreshold
+   ==============================================================*/
+   /**
+   *    Sets the Af jump RSSI threshold value
+   *
+   *    <p>
+   *    This method sets the AF jump RSSI threshold value.
+   *
+   *    <p>
+   */
+   public boolean setAfJumpRssiThreshold(int data)
+   {
+      int re =  mControl.setAfJumpRssiThreshold(sFd, data);
+      if (re < 0)
+          return false;
+      else
+          return true;
+   }
+
+/*==============================================================
+   FUNCTION:  getAfJumpRssiThreshold
+   ==============================================================*/
+   /**
+   *    Gets the Af jump RSSI threshold value
+   *
+   *    <p>
+   *    This method gets the currently set AF jump RSSI threshold value.
+   *
+   *    <p>
+   */
+   public int getAfJumpRssiThreshold()
+   {
+      return mControl.getAfJumpRssiThreshold(sFd);
+   }
+
+/*==============================================================
+   FUNCTION: setRdsFifoCnt
+   ==============================================================*/
+   /**
+   *    Sets the RDS FIFO count value
+   *
+   *    <p>
+   *    This method sets the RDS FIFO count value.
+   *
+   *    <p>
+   */
+   public boolean setRdsFifoCnt(int data)
+   {
+      int re =  mControl.setRdsFifoCnt(sFd, data);
+      if (re < 0)
+          return false;
+      else
+          return true;
+   }
+
+/*==============================================================
+   FUNCTION:  getRdsFifoCnt
+   ==============================================================*/
+   /**
+   *    Gets the RDS FIFO count value
+   *
+   *    <p>
+   *    This method gets the currently set RDS FIFO count value.
+   *
+   *    <p>
+   */
+   public int getRdsFifoCnt()
+   {
+      return mControl.getRdsFifoCnt(sFd);
+   }
+
+/*==============================================================
    FUNCTION:  setSINRsamples
    ==============================================================*/
    /**
diff --git a/qcom/fmradio/FmRxControls.java b/qcom/fmradio/FmRxControls.java
index ad69496..b959b70 100644
--- a/qcom/fmradio/FmRxControls.java
+++ b/qcom/fmradio/FmRxControls.java
@@ -72,6 +72,7 @@
    private static final int V4L2_CID_PRIVATE_TAVARUA_RDSON                 = V4L2_CID_PRIVATE_BASE + 15;
    private static final int V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_PROC         = V4L2_CID_PRIVATE_BASE + 16;
    private static final int V4L2_CID_PRIVATE_TAVARUA_LP_MODE               = V4L2_CID_PRIVATE_BASE + 17;
+   private static final int V4L2_CID_PRIVATE_TAVARUA_RDSD_BUF              = V4L2_CID_PRIVATE_BASE + 19;
    private static final int V4L2_CID_PRIVATE_TAVARUA_IOVERC                = V4L2_CID_PRIVATE_BASE + 24;
    private static final int V4L2_CID_PRIVATE_TAVARUA_INTDET                = V4L2_CID_PRIVATE_BASE + 25;
    private static final int V4L2_CID_PRIVATE_TAVARUA_MPX_DCC               = V4L2_CID_PRIVATE_BASE + 26;
@@ -95,6 +96,8 @@
    private static final int V4L2_CID_PRIVATE_SINRFIRSTSTAGE                = V4L2_CID_PRIVATE_BASE + 0x3B;
    private static final int V4L2_CID_PRIVATE_RMSSIFIRSTSTAGE               = V4L2_CID_PRIVATE_BASE + 0x3C;
    private static final int V4L2_CID_PRIVATE_RXREPEATCOUNT                 = V4L2_CID_PRIVATE_BASE + 0x3D;
+   private static final int V4L2_CID_PRIVATE_RSSI_TH                       = V4L2_CID_PRIVATE_BASE + 0x3E;
+   private static final int V4L2_CID_PRIVATE_AF_JUMP_RSSI_TH               = V4L2_CID_PRIVATE_BASE + 0x3F;
 
    private static final int V4L2_CTRL_CLASS_USER = 0x980000;
    private static final int V4L2_CID_BASE        = V4L2_CTRL_CLASS_USER | 0x900;
@@ -225,6 +228,63 @@
    }
 
    /*
+    * Set rssi threshold
+    */
+   public int setRssiThreshold(int fd, int sBuff)
+   {
+      int re = FmReceiverJNI.setControlNative(fd, V4L2_CID_PRIVATE_RSSI_TH, sBuff);
+      if ( re < 0)
+         Log.e(TAG, "Failed to set RSSI threshold data");
+      return re;
+   }
+
+   /*
+    * Get Rssi threshold
+    */
+   public int getRssiThreshold(int fd)
+   {
+      return  FmReceiverJNI.getControlNative(fd, V4L2_CID_PRIVATE_RSSI_TH);
+   }
+
+   /*
+    * Set AF jump rssi threshold
+    */
+   public int setAfJumpRssiThreshold(int fd, int sBuff)
+   {
+      int re = FmReceiverJNI.setControlNative(fd, V4L2_CID_PRIVATE_AF_JUMP_RSSI_TH, sBuff);
+      if ( re < 0)
+         Log.e(TAG, "Failed to set AF Jump Rssithreshold data");
+      return re;
+   }
+
+   /*
+    * Get AF jump Rssi threshold
+    */
+   public int getAfJumpRssiThreshold(int fd)
+   {
+      return  FmReceiverJNI.getControlNative(fd, V4L2_CID_PRIVATE_AF_JUMP_RSSI_TH);
+   }
+
+   /*
+    * Set RDS FIFO count
+    */
+   public int setRdsFifoCnt(int fd, int sBuff)
+   {
+      int re = FmReceiverJNI.setControlNative(fd, V4L2_CID_PRIVATE_TAVARUA_RDSD_BUF, sBuff);
+      if ( re < 0)
+         Log.e(TAG, "Failed to set RDS fifo count data");
+      return re;
+   }
+
+   /*
+    * Get RDS FIFO count
+    */
+   public int getRdsFifoCnt(int fd)
+   {
+      return  FmReceiverJNI.getControlNative(fd, V4L2_CID_PRIVATE_TAVARUA_RDSD_BUF);
+   }
+
+   /*
     * Set number of sinr samples to take in to account for SINR avg calculation
     */
    public int setSINRsamples(int fd, int sBuff)