fm: add support for FMStats for cherokee
Add support for FMStats app for cherokee platform.
Change-Id: Ia63a69697554ebc28a22e86d450fade6b4427a67
diff --git a/fm_hci/fm_hci.c b/fm_hci/fm_hci.c
index e0294ee..f4b7e54 100644
--- a/fm_hci/fm_hci.c
+++ b/fm_hci/fm_hci.c
@@ -478,7 +478,7 @@
return -1;
}
-void enqueue_fm_tx_cmd(FM_HDR *pbuf)
+int enqueue_fm_tx_cmd(FM_HDR *pbuf)
{
pthread_mutex_lock(&fmHCIControlBlock.tx_q_lock);
@@ -486,36 +486,40 @@
if (!fmHCIControlBlock.first) {
fmHCIControlBlock.first = (TX_Q *) malloc(sizeof(TX_Q));
if (!fmHCIControlBlock.first) {
- printf("Failed to allocate memory for first!!\n");
+ ALOGI("Failed to allocate memory for first!!\n");
pthread_mutex_unlock(&fmHCIControlBlock.tx_q_lock);
- return;
+ return FM_HC_STATUS_NOMEM;
}
fmHCIControlBlock.first->hdr = pbuf;
fmHCIControlBlock.first->next = NULL;
fmHCIControlBlock.last = fmHCIControlBlock.first;
- ALOGI("%s: FM-CMD ENQUEUED SUCCESSFULLY", __func__);
+ ALOGI("%s: FM-CMD ENQUEUED SUCCESSFULLY", __func__);
} else {
TX_Q *element = (TX_Q *) malloc(sizeof(TX_Q));
if (!element) {
- printf("Failed to allocate memory for element!!\n");
+ ALOGI("Failed to allocate memory for element!!\n");
pthread_mutex_unlock(&fmHCIControlBlock.tx_q_lock);
- return;
+ return FM_HC_STATUS_NOMEM;
}
fmHCIControlBlock.last->next = element;
element->hdr = pbuf;
element->next = NULL;
fmHCIControlBlock.last = element;
- ALOGI("%s: fm-cmd enqueued successfully", __func__);
+ ALOGI("%s: fm-cmd enqueued successfully", __func__);
}
pthread_mutex_unlock(&fmHCIControlBlock.tx_q_lock);
+ return FM_HC_STATUS_SUCCESS;
}
/** Transmit frame */
-void transmit(FM_HDR *pbuf)
+int transmit(FM_HDR *pbuf)
{
- enqueue_fm_tx_cmd(pbuf);
- event_notification(HC_EVENT_TX);
+ int status = FM_HC_STATUS_FAIL;
+
+ if ((status = enqueue_fm_tx_cmd(pbuf)) == FM_HC_STATUS_SUCCESS)
+ event_notification(HC_EVENT_TX);
+ return status;
}
void userial_close_reader(void) {
diff --git a/fm_hci/fm_hci.h b/fm_hci/fm_hci.h
index 8ffbf04..2d5e4a1 100644
--- a/fm_hci/fm_hci.h
+++ b/fm_hci/fm_hci.h
@@ -45,8 +45,8 @@
} fm_hc_status_t;
typedef enum {
- FM_RADIO_DISABLE,
- FM_RADIO_ENABLE
+ FM_RADIO_DISABLE,
+ FM_RADIO_ENABLE
}fm_power_state;
/* Host/Controller lib internal event ID */
@@ -94,11 +94,11 @@
typedef struct hdr
{
- FM_HDR *hdr;
- struct hdr *next;
+ FM_HDR *hdr;
+ struct hdr *next;
} TX_Q;
-void transmit(FM_HDR *pbuf);
+int transmit(FM_HDR *pbuf);
int fm_hci_init(fm_hal_cb *);
void fm_power(fm_power_state state);
int open_serial_port(void);
diff --git a/fmapp2/res/values/arrays.xml b/fmapp2/res/values/arrays.xml
index 16b48e4..ad30a85 100644
--- a/fmapp2/res/values/arrays.xml
+++ b/fmapp2/res/values/arrays.xml
@@ -392,6 +392,36 @@
<item> RF Statistics</item>
</string-array>
+ <string-array name="cfg_rf4">
+ <item> Select Option</item>
+ <item> Set SINR Samples Count</item>
+ <item> Set SINR Threshold</item>
+ <item> Set IntfDetoutLow Threshold</item>
+ <item> Set IntfDetoutHigh Threshold</item>
+ <item> Set SinrFirstStage</item>
+ <item> Set RmssiFirstStage</item>
+ <item> Set CF0Th12</item>
+ <item> Set SearchAlgo Type</item>
+ <item> Get SINR Samples Count</item>
+ <item> Get SINR Threshold</item>
+ <item> Get SinrFirstStage</item>
+ <item> Get RmssiFirstStage</item>
+ <item> Get CF0Th12</item>
+ <item> Get Search Algo Type</item>
+ <item> Set AfJmpRmssi Threshold</item>
+ <item> Set GoodChRmssi Threshold</item>
+ <item> Set AfJmpRmssi Samples count</item>
+ <item> Get AfJmpRmssi Threshold</item>
+ <item> Get GoodChRmssi Threshold</item>
+ <item> Get AfJmpRmssi Samples count</item>
+ <item> Set RXREPEAT Count</item>
+ <item> Set Sig Blend SinrHi</item>
+ <item> Get Sig Blend SinrHi</item>
+ <item> Set Sig Blend RmssiHi</item>
+ <item> Get Sig Blend RmssiHi</item>
+ <item> RF Statistics</item>
+ </string-array>
+
<string-array name="stats_options">
<item> Select the option</item>
<item> Configure Performance parameters</item>
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index ee8ef3d..f83a0d0 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -2118,7 +2118,7 @@
display = station.getName();
if (display.length() > 6)
display = display.substring(0,6)+"...";
- mPresetButtons[buttonIndex].setEllipsize(TextUtils.TruncateAt.END);
+ mPresetButtons[buttonIndex].setEllipsize(TextUtils.TruncateAt.END);
mPresetButtons[buttonIndex].setText(display);
mPresetButtons[buttonIndex].setTag(station);
addedStations++;
@@ -2753,7 +2753,7 @@
mRadioTextTV.setText("");
mRadioTextScroller.mOriginalString = "";
}else {
- //Log.d(LOGTAG, "mUpdateRadioText: Leaving old string " + mRadioTextTV.getText());
+ Log.v(LOGTAG, "mUpdateRadioText: Leaving old string " + mRadioTextTV.getText());
}
/* Get PTY and PI and update the display */
@@ -3225,6 +3225,40 @@
mSpeakerButton.setClickable(false);
mMuteButton.setClickable(false);
}
+ /* Not used in FmRadio */
+ public void getSigThCb(int val, int status) {
+ Log.d(LOGTAG,"get Sig Thres callback");
+ }
+ public void getChDetThCb(int val, int status) {
+ Log.d(LOGTAG, "get Channel Det Threshold Callback");
+ }
+ public void setChDetThCb(int status)
+ {
+ Log.d(LOGTAG, "set channel Det Threshold Callback");
+ }
+ public void DefDataRdCb(int val, int status) {
+ Log.d(LOGTAG, "Def data Read callback");
+ }
+ public void DefDataWrtCb(int status)
+ {
+ Log.d(LOGTAG, "DefDataWrt");
+ }
+ public void getBlendCb(int val, int status)
+ {
+ Log.d(LOGTAG, "get blend callback");
+ }
+ public void setBlendCb(int status)
+ {
+ Log.d(LOGTAG, "set blend callback");
+ }
+ public void getStationParamCb(int val, int status)
+ {
+ Log.d(LOGTAG, "getStationParam");
+ }
+ public void getStationDbgParamCb(int val, int status)
+ {
+ Log.d(LOGTAG, "getStationDbgParam");
+ }
};
private void registerFMSettingListner() {
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index f4b24fb..b238e53 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1952,10 +1952,18 @@
{
return (mService.get().setIntfDetLowTh(intfLowTh));
}
+ public boolean getIntfDetLowTh()
+ {
+ return (mService.get().getIntfDetLowTh());
+ }
public boolean setIntfDetHighTh(int intfHighTh)
{
return (mService.get().setIntfDetHighTh(intfHighTh));
}
+ public boolean getIntfDetHighTh()
+ {
+ return (mService.get().getIntfDetHighTh());
+ }
public int getSearchAlgoType()
{
return (mService.get().getSearchAlgoType());
@@ -2024,6 +2032,10 @@
{
return (mService.get().setRxRepeatCount(count));
}
+ public boolean getRxRepeatCount()
+ {
+ return (mService.get().getRxRepeatCount());
+ }
public long getRecordingStartTime()
{
return (mService.get().getRecordingStartTime());
@@ -3151,10 +3163,113 @@
Log.d(LOGTAG, "FmRxEvServiceAvailable: Tuned frequency is below signal threshold level");
}
}
- public void FmRxEvGetSignalThreshold()
+ public void FmRxEvGetSignalThreshold(int val, int status)
{
Log.d(LOGTAG, "FmRxEvGetSignalThreshold");
+
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.getSigThCb(val, status);
+ } catch (RemoteException e) {
+ Log.e(LOGTAG, "FmRxEvGetSignalThreshold: Exception:" + e.toString());
+ }
+ }
}
+
+ public void FmRxEvGetChDetThreshold(int val, int status)
+ {
+ Log.e(LOGTAG, "FmRxEvGetChDetThreshold");
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.getChDetThCb(val, status);
+ } catch (RemoteException e) {
+ Log.e(LOGTAG, "FmRxEvGetChDetThreshold: Exception = " + e.toString());
+ }
+ }
+ }
+
+ public void FmRxEvSetChDetThreshold(int status)
+ {
+ Log.e(LOGTAG, "FmRxEvSetChDetThreshold");
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.setChDetThCb(status);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void FmRxEvDefDataRead(int val, int status) {
+ Log.e(LOGTAG, "FmRxEvDefDataRead");
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.DefDataRdCb(val, status);
+ } catch (RemoteException e) {
+ Log.e(LOGTAG, "FmRxEvDefDataRead: Exception = " + e.toString());
+ }
+ }
+ }
+
+ public void FmRxEvDefDataWrite(int status)
+ {
+ Log.e(LOGTAG, "FmRxEvDefDataWrite");
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.DefDataWrtCb(status);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void FmRxEvGetBlend(int val, int status)
+ {
+ Log.e(LOGTAG, "FmRxEvGetBlend");
+
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.getBlendCb(val, status);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void FmRxEvSetBlend(int status)
+ {
+ Log.e(LOGTAG, "FmRxEvSetBlend");
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.setBlendCb(status);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void FmRxGetStationParam(int val, int status)
+ {
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.getStationParamCb(val, status);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void FmRxGetStationDbgParam(int val, int status)
+ {
+ if (mCallbacks != null) {
+ try {
+ mCallbacks.getStationDbgParamCb(val, status);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
public void FmRxEvSearchInProgress()
{
Log.d(LOGTAG, "FmRxEvSearchInProgress");
@@ -3402,12 +3517,26 @@
else
return false;
}
+ public boolean getIntfDetLowTh()
+ {
+ if (mReceiver != null)
+ return mReceiver.getOnChannelThreshold();
+ else
+ return false;
+ }
public boolean setIntfDetHighTh(int intfHighTh) {
if(mReceiver != null)
return mReceiver.setOffChannelThreshold(intfHighTh);
else
return false;
}
+ public boolean getIntfDetHighTh()
+ {
+ if (mReceiver != null)
+ return mReceiver.getOffChannelThreshold();
+ else
+ return false;
+ }
public int getSearchAlgoType() {
if(mReceiver != null)
return mReceiver.getSearchAlgoType();
@@ -3556,7 +3685,12 @@
else
return false;
}
-
+ public boolean getRxRepeatCount() {
+ if(mReceiver != null)
+ return mReceiver.getPSRxRepeatCount();
+ else
+ return false;
+ }
public long getRecordingStartTime() {
return mSampleStart;
}
diff --git a/fmapp2/src/com/caf/fmradio/FMStats.java b/fmapp2/src/com/caf/fmradio/FMStats.java
index 75ba4c6..1c506c4 100644
--- a/fmapp2/src/com/caf/fmradio/FMStats.java
+++ b/fmapp2/src/com/caf/fmradio/FMStats.java
@@ -59,6 +59,8 @@
import android.app.Dialog;
import android.view.LayoutInflater;
import android.content.DialogInterface;
+import android.os.Handler;
+import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.app.AlarmManager;
@@ -173,6 +175,7 @@
CfgRfItemSelectedListener1 mSpinCfgRfListener1 = null;
CfgRfItemSelectedListener2 mSpinCfgRfListener2 = null;
CfgRfItemSelectedListener3 mSpinCfgRfListener3 = null;
+ CfgRfItemSelectedListener4 mSpinCfgRfListener4 = null;
BandSweepMthdsSelectedListener mSweepMthdsListener =
new BandSweepMthdsSelectedListener();
@@ -210,6 +213,27 @@
ArrayAdapter<CharSequence> bandSweepMthds;
private static boolean mIsTransportSMD = false;
+ private static boolean setCmdSent = false;
+ private static int lastCmdSent = 0;
+ private final int CMD_CHDET_SINR_TH = 1;
+ private final int CMD_CHDET_SINR_SAMPLE = 2;
+ private final int CMD_CHDET_INTF_TH_LOW = 3;
+ private final int CMD_CHDET_INTF_TH_HIGH = 4;
+ private final int CMD_DEFRD_AF_RMSSI_TH = 5;
+ private final int CMD_DEFRD_AF_RMSSI_SAMPLE = 6;
+ private final int CMD_DEFRD_GD_CH_RMSSI_TH = 7;
+ private final int CMD_DEFRD_SEARCH_ALGO = 8;
+ private final int CMD_DEFRD_SINR_FIRST_STAGE = 9;
+ private final int CMD_DEFRD_RMSSI_FIRST_STAGE = 10;
+ private final int CMD_DEFRD_CF0TH12 = 11;
+ private final int CMD_DEFRD_TUNE_POWER = 12;
+ private final int CMD_DEFRD_REPEATCOUNT = 13;
+ private final int CMD_BLENDTBL_SINR_HI = 14;
+ private final int CMD_BLENDTBL_RMSSI_HI = 15;
+ private final int CMD_STNPARAM_SINR = 16;
+ private final int CMD_STNPARAM_RSSI = 17;
+ private final int CMD_STNDBGPARAM_IOVERC = 18;
+ private final int CMD_STNDBGPARAM_INFDETOUT = 19;
private static final int MPX_DCC = 0;
private static final int SINR_INTF = 1;
@@ -247,8 +271,11 @@
private int prevSweepMthd = 0; //Manual (using band min, max)
private int curSweepMthd = 0;
+ private int textBoxVal = 0;
+ private int algo_type = -1;
private Thread mRecordUpdateHandlerThread = null;
+ private Thread mRunTestThread = null;
boolean mRecording = false;
@@ -268,6 +295,21 @@
private GetNextFreqInterface mNextFreqInterface;
private CommaSeparatedFreqFileReader mFreqFileReader;
+ private final int SIGNAL_THRESHOLD = 1;
+ private final int GET_CHANNEL_DET_THRESHOLD = 2;
+ private final int DEFAULT_DATA_READ = 3;
+ private final int GET_BLEND_TBL = 4;
+ private final int SET_CHANNEL_DET_THRESHOLD = 5;
+ private final int DEFAULT_DATA_WRITE = 6;
+ private final int SET_BLEND_TBL = 7;
+ private final int GET_STATION_PARAM = 8;
+ private final int GET_STATION_DBG_PARAM = 9;
+ private Object obj = new Object();
+ private int nRssi = 0;
+ private int nIoC = 0;
+ private int nIntDet = 0;
+ private int nMpxDcc = 0;
+ private int nSINR = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -289,8 +331,14 @@
(this, R.array.band_sweep_methods,
android.R.layout.simple_spinner_item);
+ Log.d(LOGTAG, "oncreate");
checkTransportLayer();
- if (isRomeChip()) {
+ if (isCherokeeChip()) {
+ mSpinCfgRfListener4 = new CfgRfItemSelectedListener4();
+ adaptCfgRf = ArrayAdapter.createFromResource(
+ this, R.array.cfg_rf4,
+ android.R.layout.simple_spinner_item);
+ } else if (isRomeChip()) {
mSpinCfgRfListener3 = new CfgRfItemSelectedListener3();
adaptCfgRf = ArrayAdapter.createFromResource(
this, R.array.cfg_rf3,
@@ -333,12 +381,6 @@
mCurrentFileName = null;
}
- if (false == bindToService(this, osc)) {
- Log.d(LOGTAG, "onCreate: Failed to Start Service");
- }else {
- Log.d(LOGTAG, "onCreate: Start Service completed successfully");
- }
-
/*Initialize the column header with
constant values*/
if (isRomeChip()) {
@@ -367,9 +409,104 @@
registerBandSweepDwellExprdListener();
}
+ private final Handler mCallbackHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ Log.e(LOGTAG, "mCallbackHandler: msg.what = " + msg.what);
+ int val, status;
+ tv1 = (TextView)findViewById(R.id.label);
+ switch (msg.what) {
+ case SIGNAL_THRESHOLD:
+ case GET_CHANNEL_DET_THRESHOLD:
+ case GET_BLEND_TBL:
+ status = msg.arg2;
+ if (status != 0) {
+ tv1.setText("Error:" + String.valueOf(status));
+ } else {
+ val = msg.arg1;
+ tv1.setText(String.valueOf(val));
+ }
+ break;
+ case DEFAULT_DATA_READ:
+ status = msg.arg2;
+ if (status != 0) {
+ tv1.setText("Error:" + String.valueOf(status));
+ } else {
+ val = msg.arg1;
+ if (lastCmdSent == CMD_DEFRD_SEARCH_ALGO && val == MPX_DCC) {
+ tv1.setText(R.string.search_algo_mpx);
+ } else if (lastCmdSent == CMD_DEFRD_SEARCH_ALGO && val == SINR_INTF) {
+ tv1.setText(R.string.search_algo_sinrint);
+ } else {
+ tv1.setText(String.valueOf(val));
+ }
+ lastCmdSent = 0;
+ }
+ break;
+ case SET_CHANNEL_DET_THRESHOLD:
+ case DEFAULT_DATA_WRITE:
+ case SET_BLEND_TBL:
+ tv1.setVisibility(View.VISIBLE);
+ status = msg.arg1;
+ if (status != 0)
+ tv1.setText("Error:" + String.valueOf(status));
+ else
+ tv1.setText("Success");
+ break;
+ case GET_STATION_PARAM:
+ status = msg.arg2;
+ if (status != 0) {
+ Log.e(LOGTAG, "GET_STATION_DBG_PARAM: status = " + status);
+ nRssi = Integer.MAX_VALUE;
+ nSINR = Integer.MAX_VALUE;
+ } else {
+ if (lastCmdSent == CMD_STNPARAM_RSSI)
+ nRssi = msg.arg1;
+ if (lastCmdSent == CMD_STNPARAM_SINR)
+ nSINR = msg.arg1;
+ }
+ if (mRunTestThread != null) {
+ synchronized (obj) {
+ obj.notify();
+ }
+ }
+ lastCmdSent = 0;
+ break;
+ case GET_STATION_DBG_PARAM:
+ status = msg.arg2;
+ if (status != 0) {
+ Log.e(LOGTAG, "GET_STATION_DBG_PARAM: status = " + status);
+ nIoC = Integer.MAX_VALUE;
+ nIntDet = Integer.MAX_VALUE;
+ } else {
+ if (lastCmdSent == CMD_STNDBGPARAM_IOVERC)
+ nIoC = msg.arg1;
+ if (lastCmdSent == CMD_STNDBGPARAM_INFDETOUT)
+ nIntDet = msg.arg1;
+ }
+ if (mRunTestThread != null) {
+ synchronized (obj) {
+ mRunTestThread.notify();
+ }
+ }
+ break;
+ default:
+ Log.e(LOGTAG, "mCallbackHandler:Default");
+ break;
+ }
+ Log.e(LOGTAG, "mCallbackHandler--");
+ }
+ };
+
@Override
public void onStart() {
super.onStart();
+
+ if (false == bindToService(this, osc)) {
+ Log.e(LOGTAG, "onCreate: Failed to Start Service");
+ }else {
+ Log.d(LOGTAG, "onCreate: Start Service completed successfully");
+ }
if(isRecording()) {
Log.d(LOGTAG, "onStart");
initiateRecordThread();
@@ -420,24 +557,45 @@
super.onDestroy();
}
+ private Runnable mRunTest = new Runnable(){
+ public void run() {
+ runCurrentTest();
+ }
+ };
+
private View.OnClickListener mOnRunListener = new View.OnClickListener() {
public void onClick(View v) {
+ Log.d(LOGTAG, "mTestRunning=" + mTestRunning);
if(false == mTestRunning) {
clearPreviousTestResults();
mTestRunning = true;
if(mTestSelected == SWEEP_TEST) {
disableBandSweepSetting();
}
- runCurrentTest();
- }else {
+ SetButtonState(false);
+ createResult(mColumnHeader);
+ if ((mRunTestThread == null) || (mRunTestThread.getState() == Thread.State.TERMINATED)) {
+ mRunTestThread = new Thread(mRunTest,
+ "mRunTestThread");
+ } else {
+ Log.e(LOGTAG, "Error: Thread is already running");
+ return;
+ }
+ if (mRunTestThread != null) {
+ mRunTestThread.start();
+ } else {
+ SetButtonState(true);
+ Log.e(LOGTAG, "RunTestThread: new Thread failed");
+ return;
+ }
+ } else {
mTestRunning = false;
SetButtonState(true);
/*Stop the thread by interrupting it*/
- if(mMultiUpdateThread != null) {
- mMultiUpdateThread.interrupt();
- mMultiUpdateThread = null;
+ if (mRunTestThread != null) {
+ mRunTestThread.interrupt();
+ mRunTestThread = null;
}
-
if(SEARCH_TEST == mTestSelected) {
try {
mService.cancelSearch();
@@ -495,6 +653,7 @@
szbTestHeader.append("running test:").append
(szTestInformation[mTestSelected]);
String szTestHeader = new String(szbTestHeader);
+ Log.d(LOGTAG, "chooseFMRfoption");
switch(mTestSelected)
{
case 1:
@@ -509,7 +668,10 @@
adaptCfgRf.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
spinOptionFmRf.setAdapter(adaptCfgRf);
- if (isRomeChip())
+ if (isCherokeeChip()) {
+ spinOptionFmRf.setOnItemSelectedListener
+ (mSpinCfgRfListener4);
+ } else if (isRomeChip())
spinOptionFmRf.setOnItemSelectedListener
(mSpinCfgRfListener3);
else if(isTransportLayerSMD())
@@ -563,14 +725,16 @@
String a;
a = txtbox1.getText().toString();
try {
- int count = Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for mOnSetRxRePeatCount: " + count);
- if((count < 0) ||
- (count > 255))
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for mOnSetRxRePeatCount: " + textBoxVal);
+ if((textBoxVal < 0) ||
+ (textBoxVal > 255))
return;
if(mService != null) {
try {
- mService.setRxRepeatCount(count);
+ mService.getRxRepeatCount();
+ setCmdSent = true;
+ lastCmdSent = CMD_DEFRD_REPEATCOUNT;
} catch (RemoteException e) {
e.printStackTrace();
}
@@ -587,13 +751,15 @@
String a;
a = txtbox1.getText().toString();
try {
- byte count = (byte) Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for mOnSetBlendSinrHiListener: " + count);
- if((count < MIN_BLEND_SINRHI ) ||
- (count > MAX_BLEND_SINRHI))
+ textBoxVal = (byte) Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for mOnSetBlendSinrHiListener: " + textBoxVal);
+ if((textBoxVal < MIN_BLEND_SINRHI ) ||
+ (textBoxVal > MAX_BLEND_SINRHI))
return;
if(mReceiver != null) {
- mReceiver.setBlendSinr(count);
+ mReceiver.getBlendSinr();
+ setCmdSent = true;
+ lastCmdSent = CMD_BLENDTBL_SINR_HI;
}
} catch (NumberFormatException e) {
Log.e(LOGTAG, "Value entered is not in correct format : " + a);
@@ -607,13 +773,15 @@
String a;
a = txtbox1.getText().toString();
try {
- byte count = (byte)Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for mOnSetBlendRmssiHiListener: " + count);
- if((count < MIN_BLEND_RMSSIHI) ||
- (count > MAX_BLEND_RMSSIHI))
+ textBoxVal = (byte)Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for mOnSetBlendRmssiHiListener: " + textBoxVal);
+ if((textBoxVal < MIN_BLEND_RMSSIHI) ||
+ (textBoxVal > MAX_BLEND_RMSSIHI))
return;
if(mReceiver != null) {
- mReceiver.setBlendRmssi(count);
+ mReceiver.getBlendRmssi();
+ setCmdSent = true;
+ lastCmdSent = CMD_BLENDTBL_RMSSI_HI;
}
} catch (NumberFormatException e) {
Log.e(LOGTAG, "Value entered is not in correct format : " + a);
@@ -646,17 +814,18 @@
String a;
a = txtbox1.getText().toString();
try {
- int rdel = Integer.parseInt(a);
- Log.d(LOGTAG, "Value of Sinr Samples count is : " + rdel);
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value of Sinr Samples count is : " + textBoxVal);
if(mService != null) {
try {
- mService.setSinrSamplesCnt(rdel);
+ mService.getSinrSamplesCnt();
+ setCmdSent = true;
+ lastCmdSent = CMD_CHDET_SINR_SAMPLE;
}catch (RemoteException e) {
e.printStackTrace();
}
}
}catch (NumberFormatException e) {
- Log.e(LOGTAG, "Value entered is not in correct format: " + a);
txtbox1.setText("");
}
}
@@ -668,11 +837,13 @@
String a;
a = txtbox1.getText().toString();
try {
- int rdel = Integer.parseInt(a);
- Log.d(LOGTAG, "Value of Sinr Th is : " + rdel);
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value of Sinr Th is : " + textBoxVal);
if(mService != null) {
try {
- mService.setSinrTh(rdel);
+ mService.getSinrTh();
+ setCmdSent = true;
+ lastCmdSent = CMD_CHDET_SINR_TH;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -690,11 +861,13 @@
String a;
a = txtbox1.getText().toString();
try {
- int rdel = Integer.parseInt(a);
- Log.d(LOGTAG, "Value of Intf Det Low Th is : " + rdel);
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value of Intf Det Low Th is : " + textBoxVal);
if(mService != null) {
try {
- mService.setIntfDetLowTh(rdel);
+ mService.getIntfDetLowTh();
+ setCmdSent = true;
+ lastCmdSent = CMD_CHDET_INTF_TH_LOW;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -711,11 +884,13 @@
String a;
a = txtbox1.getText().toString();
try {
- int rdel = Integer.parseInt(a);
- Log.d(LOGTAG, "Value of Intf Det Low Th is : " + rdel);
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value of Intf Det Low Th is : " + textBoxVal);
if(mService != null) {
try {
- mService.setIntfDetHighTh(rdel);
+ mService.getIntfDetHighTh();
+ setCmdSent = true;
+ lastCmdSent = CMD_CHDET_INTF_TH_HIGH;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -733,14 +908,16 @@
String a;
a = txtbox1.getText().toString();
try {
- int sinr = Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for SINR FIRST STAGE is : " + sinr);
- if((sinr < MIN_SINR_FIRST_STAGE) ||
- (sinr > MAX_SINR_FIRST_STAGE))
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for SINR FIRST STAGE is : " + textBoxVal);
+ if((textBoxVal < MIN_SINR_FIRST_STAGE) ||
+ (textBoxVal > MAX_SINR_FIRST_STAGE))
return;
if(mService != null) {
try {
- mService.setSinrFirstStage(sinr);
+ mService.getSinrFirstStage();
+ setCmdSent = true;
+ lastCmdSent = CMD_DEFRD_SINR_FIRST_STAGE;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -758,14 +935,16 @@
String a;
a = txtbox1.getText().toString();
try {
- int rmssi = Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for RMSSI FIRST STAGE is: " + rmssi);
- if((rmssi < MIN_RMSSI_FIRST_STAGE) ||
- (rmssi > MAX_RMSSI_FIRST_STAGE))
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for RMSSI FIRST STAGE is: " + textBoxVal);
+ if((textBoxVal < MIN_RMSSI_FIRST_STAGE) ||
+ (textBoxVal > MAX_RMSSI_FIRST_STAGE))
return;
if(mService != null) {
try {
- mService.setRmssiFirstStage(rmssi);
+ mService.getRmssiFirstStage();
+ setCmdSent = true;
+ lastCmdSent = CMD_DEFRD_RMSSI_FIRST_STAGE;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -783,14 +962,16 @@
String a;
a = txtbox1.getText().toString();
try {
- int cf0 = Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for CF0TH12 is: " + cf0);
- if((cf0 < MIN_CF0TH12) ||
- (cf0 > MAX_CF0TH12))
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for CF0TH12 is: " + textBoxVal);
+ if((textBoxVal < MIN_CF0TH12) ||
+ (textBoxVal > MAX_CF0TH12))
return;
if(mService != null) {
try {
- mService.setCFOMeanTh(cf0);
+ mService.getCFOMeanTh();
+ setCmdSent = true;
+ lastCmdSent = CMD_DEFRD_CF0TH12;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -808,9 +989,12 @@
Log.d(LOGTAG, "Value entered for search is: MPX DCC");
if(mService != null) {
try {
- mService.setSearchAlgoType(MPX_DCC);
+ mService.getSearchAlgoType();
+ setCmdSent = true;
+ algo_type = MPX_DCC;
+ lastCmdSent = CMD_DEFRD_SEARCH_ALGO;
}catch (RemoteException e) {
- e.printStackTrace();
+ e.printStackTrace();
}
}
}
@@ -822,7 +1006,10 @@
Log.d(LOGTAG, "Value entered for search is: SINR INTF");
if(mService != null) {
try {
- mService.setSearchAlgoType(SINR_INTF);
+ mService.getSearchAlgoType();
+ setCmdSent = true;
+ algo_type = SINR_INTF;
+ lastCmdSent = CMD_DEFRD_SEARCH_ALGO;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -836,14 +1023,16 @@
String a;
a = txtbox1.getText().toString();
try {
- int th = Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for AfJmpRmssiTh is: " + th);
- if((th < MIN_AF_JMP_RMSSI_TH) ||
- (th > MAX_AF_JMP_RMSSI_TH))
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for AfJmpRmssiTh is: " + textBoxVal);
+ if((textBoxVal < MIN_AF_JMP_RMSSI_TH) ||
+ (textBoxVal > MAX_AF_JMP_RMSSI_TH))
return;
if(mService != null) {
try {
- mService.setAfJmpRmssiTh(th);
+ mService.getAfJmpRmssiTh();
+ setCmdSent = true;
+ lastCmdSent = CMD_DEFRD_AF_RMSSI_TH;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -861,14 +1050,16 @@
String a;
a = txtbox1.getText().toString();
try {
- int th = Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for Good channel Rmssi Th is: " + th);
- if((th < MIN_GD_CH_RMSSI_TH) ||
- (th > MAX_GD_CH_RMSSI_TH))
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for Good channel Rmssi Th is: " + textBoxVal);
+ if((textBoxVal < MIN_GD_CH_RMSSI_TH) ||
+ (textBoxVal > MAX_GD_CH_RMSSI_TH))
return;
if(mService != null) {
try {
- mService.setGoodChRmssiTh(th);
+ mService.getGoodChRmssiTh();
+ setCmdSent = true;
+ lastCmdSent = CMD_DEFRD_GD_CH_RMSSI_TH;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -886,14 +1077,16 @@
String a;
a = txtbox1.getText().toString();
try {
- int cnt = Integer.parseInt(a);
- Log.d(LOGTAG, "Value entered for AfJmpRmssiSamples is: " + cnt);
- if((cnt < MIN_AF_JMP_RMSSI_SAMPLES) ||
- (cnt > MAX_AF_JMP_RMSSI_SAMPLES))
+ textBoxVal = Integer.parseInt(a);
+ Log.d(LOGTAG, "Value entered for AfJmpRmssiSamples is: " + textBoxVal);
+ if((textBoxVal < MIN_AF_JMP_RMSSI_SAMPLES) ||
+ (textBoxVal > MAX_AF_JMP_RMSSI_SAMPLES))
return;
if(mService != null) {
try {
- mService.setAfJmpRmssiSamplesCnt(cnt);
+ mService.getAfJmpRmssiSamplesCnt();
+ setCmdSent = true;
+ lastCmdSent = CMD_DEFRD_AF_RMSSI_SAMPLE;
}catch (RemoteException e) {
e.printStackTrace();
}
@@ -1989,6 +2182,621 @@
}
}
+ public class CfgRfItemSelectedListener4 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;
+ byte retval = Byte.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 1:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_SinrSmplsCnt);
+ 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_SinrSmplsCnt);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetSinrSmplCntListener);
+ }
+ break;
+ case 2:
+ 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(mOnSetSinrThListener);
+ }
+ break;
+ case 3:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_IntfLowTh);
+ 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_IntfLowTh);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetIntfLowThListener);
+ }
+ break;
+ case 4:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_IntfHighTh);
+ 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_IntfHighTh);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetIntfHighThListener);
+ }
+ break;
+ case 5:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_SinrFirstStage);
+ 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_SinrFirstStage);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetSinrFirstStageListener);
+ }
+ break;
+ case 6:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_RmssiFirstStage);
+ 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_RmssiFirstStage);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetRmssiFirstStageListener);
+ }
+ break;
+ case 7:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_CF0Th12);
+ 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_CF0Th12);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetCFOMeanThListener);
+ }
+ break;
+ case 8:
+ if (txtbox1 != null) {
+ txtbox1.setVisibility(View.INVISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setVisibility(View.INVISIBLE);
+ }
+ if (SetButton != null) {
+ SetButton.setVisibility(View.INVISIBLE);
+ }
+ if(button1 != null) {
+ button1.setText(R.string.search_algo_mpx);
+ button1.setVisibility(View.VISIBLE);
+ button1.setOnClickListener(mOnSetSearchMPXDCCListener);
+ }
+ if(button2 != null) {
+ button2.setText(R.string.search_algo_sinrint);
+ button2.setVisibility(View.VISIBLE);
+ button2.setOnClickListener(mOnSetSearchSinrIntfListener);
+ }
+ break;
+ case 9:
+ 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.getSinrSamplesCnt();
+ Log.d(LOGTAG, "Get Sinr Samples Count: " + ret);
+ }catch (RemoteException e) {
+ }
+ break;
+ case 10:
+ 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);
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 11:
+ 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.getSinrFirstStage();
+ Log.d(LOGTAG, "Get Sinr First Stage: " + ret);
+ }
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 12:
+ 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.getRmssiFirstStage();
+ Log.d(LOGTAG, "Get Rmssi First Stage: " + ret);
+ }
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 13:
+ 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.getCFOMeanTh();
+ Log.d(LOGTAG, "Get CF0 Threshold: " + ret);
+ }
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 14:
+ 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.getSearchAlgoType();
+ lastCmdSent = CMD_DEFRD_SEARCH_ALGO;
+ Log.d(LOGTAG, "Search Type: " + ret);
+ }
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 15:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_AfJmpRmssiTh);
+ 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_AfJmpRmssiTh);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetAfJmpRmssiThListener);
+ }
+ break;
+ case 16:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_GdChRmssiTh);
+ 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_GdChRmssiTh);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetGdChRmssiThListener);
+ }
+ break;
+ case 17:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_AfJmpRmssiSmplsCnt);
+ 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_AfJmpRmssiSmplsCnt);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetAfJmpRmssiSmplsCntListener);
+ }
+ break;
+ case 18:
+ 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.getAfJmpRmssiTh();
+ Log.d(LOGTAG, "Get Af Jmp Rmssi Th: " + ret);
+ }
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 19:
+ 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.getGoodChRmssiTh();
+ Log.d(LOGTAG, "Get GoodChRmssi Threshold: " + ret);
+ }
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 20:
+ 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.getAfJmpRmssiSamplesCnt();
+ Log.d(LOGTAG, "Get AfJmpRmssiSamples count: " + ret);
+ }
+ }catch (RemoteException e) {
+
+ }
+ break;
+ case 21:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_RxRePeatCount);
+ tv1.setVisibility(View.VISIBLE);
+ }
+ if (SetButton != null) {
+ SetButton.setText(R.string.set_RxRePeatCount);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetRxRePeatCount);
+ }
+ if(button1 != null) {
+ button1.setVisibility(View.INVISIBLE);
+ }
+ if(button2 != null) {
+ button2.setVisibility(View.INVISIBLE);
+ }
+ break;
+ case 22:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_BlendSinrHi);
+ 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_BlendSinrHi);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetBlendSinrHiListener);
+ }
+ break;
+ case 23:
+ 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) {
+ retval = mReceiver.getBlendSinr();
+ Log.d(LOGTAG, "Get BlendSinrHi: " + retval);
+ }
+ break;
+ case 24:
+ if (txtbox1 != null) {
+ txtbox1.setText(R.string.type_rd);
+ txtbox1.setVisibility(View.VISIBLE);
+ }
+ if (tv1 != null) {
+ tv1.setText(R.string.enter_BlendRmssiHi);
+ 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_BlendRmssiHi);
+ SetButton.setVisibility(View.VISIBLE);
+ SetButton.setOnClickListener(mOnSetBlendRmssiHiListener);
+ }
+ break;
+ case 25:
+ 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) {
+ retval = mReceiver.getBlendRmssi();
+ Log.d(LOGTAG, "Get BlendRmssiHi: " + retval);
+ }
+ break;
+ case 26:
+ 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);
+ }
+ if(button1 != null) {
+ button1.setVisibility(View.INVISIBLE);
+ }
+ if(button2 != null) {
+ button2.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) {
@@ -2030,6 +2838,8 @@
adaptCfgRf.setDropDownViewResource(
android.R.layout.simple_spinner_dropdown_item);
spinOptionFmRf.setAdapter(adaptCfgRf);
+ if (isCherokeeChip())
+ spinOptionFmRf.setOnItemSelectedListener(mSpinCfgRfListener4);
if (isRomeChip())
spinOptionFmRf.setOnItemSelectedListener(mSpinCfgRfListener3);
else if(isTransportLayerSMD())
@@ -2066,6 +2876,17 @@
private boolean isTransportLayerSMD() {
return mIsTransportSMD;
}
+
+ private boolean isCherokeeChip() {
+ Log.d(LOGTAG, "isCherokeeChip");
+
+ String chip = SystemProperties.get("qcom.bluetooth.soc");
+ if (chip.equals("cherokee"))
+ return true;
+ else
+ return false;
+ }
+
private boolean isRomeChip() {
String chip = "";
@@ -2079,6 +2900,7 @@
// Get the TableLayout
TableLayout tl = (TableLayout) findViewById(R.id.maintable);
if (tl == null) {
+ Log.e(LOGTAG, "Tl is null");
return;
}
@@ -2112,7 +2934,7 @@
tr2.addView(colIoC);
}
- if(isTransportLayerSMD() || isRomeChip())
+ if(isTransportLayerSMD() || isRomeChip() || isCherokeeChip())
{
TextView colSINR = new TextView(getApplicationContext());
colSINR.setText(aRes.getSINR());
@@ -2170,6 +2992,8 @@
szbTestHeader.append("running test:").append(szTestInformation[mTestSelected]);
szbTestHeader.append("\r\n");
String szTestHeader = new String(szbTestHeader);
+ Message updateStop;
+ int freq;
if(null != mFileCursor ) {
try {
mFileCursor.write(szTestHeader.getBytes());
@@ -2181,53 +3005,61 @@
{
case CUR_FREQ_TEST:
Log.d(LOGTAG,"Current Freq test is going to run");
- int freq = FmSharedPreferences.getTunedFrequency();
+ freq = FmSharedPreferences.getTunedFrequency();
Result res = GetFMStatsForFreq(freq);
- createResult(mColumnHeader);
- if(res != null)
- createResult(res);
- mTestRunning = false;
+ if(res != null) {
+ Log.e(LOGTAG, "CUR_FREQ_TEST: Updating UI");
+ Message updateUI = new Message();
+ updateUI.what = STATUS_UPDATE;
+ updateUI.obj = (Object)res;
+ mUIUpdateHandlerHandler.sendMessage(updateUI);
+ }
+ updateStop = new Message();
+ updateStop.what = STATUS_DONE;
+ mUIUpdateHandlerHandler.sendMessage(updateStop);
+ mTestRunning = false;
break;
case CUR_MULTI_TEST:
- /*Set it to ready to Stop*/
- SetButtonState(false);
- createResult(mColumnHeader);
- if(mMultiUpdateThread == null) {
- mMultiUpdateThread = new Thread(null, getMultipleResults,
- "MultiResultsThread");
- }
- /* Launch dummy thread to simulate the transfer progress */
- Log.d(LOGTAG, "Thread State: " + mMultiUpdateThread.getState());
- if(mMultiUpdateThread.getState() == Thread.State.TERMINATED) {
- mMultiUpdateThread = new Thread(null, getMultipleResults,
- "MultiResultsThread");
- }
- /* If the thread state is "new" then the thread has not yet started */
- if(mMultiUpdateThread.getState() == Thread.State.NEW) {
- mMultiUpdateThread.start();
- }
- // returns and UI in different thread.
- break;
+ freq = FmSharedPreferences.getTunedFrequency();
+
+ for(int i = 0; i < 20 && !Thread.currentThread().isInterrupted(); i++) {
+ try {
+ Thread.sleep(500);
+ Message updateUI = new Message();
+ updateUI.what = STATUS_UPDATE;
+ updateUI.obj = (Object)GetFMStatsForFreq(freq);
+ if(updateUI.obj == null)
+ break;
+ mUIUpdateHandlerHandler.sendMessage(updateUI);
+ }catch (InterruptedException e) {
+ /*break the loop*/
+ break;
+ }
+ }
+ mTestRunning = false;
+ updateStop = new Message();
+ updateStop.what = STATUS_DONE;
+ mUIUpdateHandlerHandler.sendMessage(updateStop);
+ // returns and UI in different thread.
+
+ break;
case SEARCH_TEST:
- try {
- Log.d(LOGTAG, "start scanning\n");
- if(isTransportLayerSMD()) {
- Log.d(LOGTAG,"Scanning with 0 scan time");
- if (mReceiver != null)
- mIsSearching = mReceiver.searchStations(FmReceiver.FM_RX_SRCH_MODE_SCAN,
- SCAN_DWELL_PERIOD, FmReceiver.FM_RX_SEARCHDIR_UP);
- }else {
- mIsSearching = mService.scan(0);
- }
- }catch (RemoteException e) {
- e.printStackTrace();
- }
+ try {
+ Log.e(LOGTAG, "start scanning\n");
+ if(isTransportLayerSMD() || isCherokeeChip()) {
+ Log.d(LOGTAG,"Scanning with 0 scan time");
+ if (mReceiver != null)
+ mIsSearching = mReceiver.searchStations(FmReceiver.FM_RX_SRCH_MODE_SCAN,
+ SCAN_DWELL_PERIOD, FmReceiver.FM_RX_SEARCHDIR_UP);
+ } else {
+ mIsSearching = mService.scan(0);
+ }
+ }catch (RemoteException e) {
+ e.printStackTrace();
+ }
if(mIsSearching) {
- /*Set it to Ready to Stop*/
- SetButtonState(false);
- createResult(mColumnHeader);
Log.d(LOGTAG, "Created the results and cancel UI\n");
}else {
mTestRunning = false;
@@ -2243,9 +3075,7 @@
}catch (RemoteException e) {
e.printStackTrace();
}
- /* Set it to Ready to stop*/
- SetButtonState(false);
- createResult(mColumnHeader);
+
getFMStatsInBand(lowerFreq, higherFreq, Spacing);
break;
}
@@ -2416,98 +3246,144 @@
private Result GetFMStatsForFreq(int freq)
{
Result result = new Result();
+ int ret;
Log.d(LOGTAG,"freq is "+freq);
result.setFreq(Integer.toString(freq));
- byte nRssi = 0;
- int nIoC = 0;
- int dummy = 0;
- int nIntDet = 0;
- int nMpxDcc = 0;
- byte nSINR = 0;
if((null != mService)) {
- try {
- dummy = mService.getRssi();
- if (dummy != Integer.MAX_VALUE) {
- nRssi = (byte)dummy;
- result.setRSSI(Byte.toString(nRssi));
- } else {
- return null;
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- } catch(Exception e) {
- e.printStackTrace();
- }
+ try {
+ ret = mService.getRssi();
+ if (ret != 0) {
+ Log.e(LOGTAG, "getrssi cmd failed: ret = " + ret);
+ return null;
+ }
+ lastCmdSent = CMD_STNPARAM_RSSI;
+ Log.e(LOGTAG, "wait for response of mService.getRssi");
+ synchronized (obj) {
+ try {
+ obj.wait();
+ } catch (InterruptedException e) {
+ Log.e(LOGTAG, "getRSSI:THREAD interrupted");
+ e.printStackTrace();
+ return null;
+ }
+ }
+ Log.e(LOGTAG, "Got response of mService.getRssi");
+ if (nRssi != Integer.MAX_VALUE) {
+ result.setRSSI(Integer.toString(nRssi));
+ } else {
+ return null;
+ }
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
- if(!isRomeChip()) {
- try {
- nIoC = mService.getIoC();
- if (nIoC != Integer.MAX_VALUE)
- result.setIoC(Integer.toString(nIoC));
- else
- return null;
- } catch (RemoteException e) {
- e.printStackTrace();
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
+ if(!isRomeChip()) {
+ try {
+ mService.getIoC();
+ lastCmdSent = CMD_STNDBGPARAM_IOVERC;
+ Log.e(LOGTAG, "wait for response of mService.getIoC");
+ synchronized (obj) {
+ try {
+ obj.wait();
+ } catch (InterruptedException e) {
+ Log.e(LOGTAG, "getIOC:THREAD interrupted");
+ e.printStackTrace();
+ return null;
+ }
+ }
+ Log.e(LOGTAG, "GOT response of mService.getIoC");
+ if (nIoC != Integer.MAX_VALUE)
+ result.setIoC(Integer.toString(nIoC));
+ else
+ return null;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
- if(isTransportLayerSMD() || isRomeChip()) {
- try {
- dummy = mService.getSINR();
- if (dummy != Integer.MAX_VALUE) {
- nSINR = (byte)dummy;
- result.setSINR(Integer.toString(nSINR));
- } else {
- return null;
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- } catch(Exception e) {
- e.printStackTrace();
- }
- } else {
- try {
- nMpxDcc = mService.getMpxDcc();
- if (nMpxDcc != Integer.MAX_VALUE)
- result.setMpxDcc(Integer.toString(nMpxDcc));
- else
- return null;
- } catch (RemoteException e) {
- e.printStackTrace();
- }catch(Exception e) {
- e.printStackTrace();
- }
- }
+ if(isTransportLayerSMD() || isRomeChip() || isCherokeeChip()) {
+ try {
+ mService.getSINR();
+ lastCmdSent = CMD_STNPARAM_SINR;
+ Log.e(LOGTAG, "wait for response of mService.getSINR");
+ synchronized (obj) {
+ try {
+ obj.wait();
+ } catch (InterruptedException e) {
+ Log.e(LOGTAG, "getSINR:THREAD interrupted");
+ e.printStackTrace();
+ return null;
+ }
+ }
+ Log.e(LOGTAG, "Got response of mService.getSINR");
+ if (nSINR != Integer.MAX_VALUE) {
+ result.setSINR(Integer.toString(nSINR));
+ } else {
+ return null;
+ }
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ try {
+ nMpxDcc = mService.getMpxDcc();
+ if (nMpxDcc != Integer.MAX_VALUE)
+ result.setMpxDcc(Integer.toString(nMpxDcc));
+ else
+ return null;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
- if(!isRomeChip()) {
- try {
- nIntDet = mService.getIntDet();
- if (nIntDet != Integer.MAX_VALUE)
- result.setIntDet(Integer.toString(nIntDet));
- else
- return null;
- } catch (RemoteException e) {
- e.printStackTrace();
- }catch (Exception e) {
- e.printStackTrace();
- }
- }
+ if(!isRomeChip()) {
+ try {
+ mService.getIntDet();
+ lastCmdSent = CMD_STNDBGPARAM_INFDETOUT;
+ Log.e(LOGTAG, "wait for response of mService.getIntDet");
+ synchronized (obj) {
+ try {
+ obj.wait();
+ } catch (InterruptedException e) {
+ Log.e(LOGTAG, "getIntDet:THREAD interrupted");
+ e.printStackTrace();
+ return null;
+ }
+ }
+ Log.e(LOGTAG, "Got response of mService.getIntDet");
+ if (nIntDet != Integer.MAX_VALUE)
+ result.setIntDet(Integer.toString(nIntDet));
+ else
+ return null;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
} else {
- return null;
+ return null;
}
return result;
- }
+ }
private Handler mUIUpdateHandlerHandler = new Handler() {
public void handleMessage(Message msg) {
+ Log.d(LOGTAG, "mUIUpdateHandlerHandler: msg.what = " + msg.what);
switch (msg.what)
{
case STATUS_UPDATE:
Result myRes = (Result) msg.obj;
- Log.d(LOGTAG,"Status update is" +myRes.mFreq);
+ Log.d(LOGTAG,"Status update is" +myRes.mFreq + "mRSSI=" + myRes.mRSSI + "mSINR=" + myRes.mSINR);
createResult(myRes);
break;
case STATUS_DONE:
@@ -2558,7 +3434,7 @@
{
// presumably there is nobody interested in the service at this point,
// so don't hang on to the ServiceConnection
- sService = null;
+ mService = null;
}
}
@@ -2570,7 +3446,6 @@
}
public void onServiceConnected(ComponentName className, android.os.IBinder service) {
- sService = IFMRadioService.Stub.asInterface(service);
if (mCallback != null)
{
Log.e(LOGTAG, "onServiceConnected: mCallback");
@@ -2583,7 +3458,7 @@
{
mCallback.onServiceDisconnected(className);
}
- sService = null;
+ mService = null;
}
}
@@ -2639,7 +3514,7 @@
public void onTuneStatusChanged()
{
- Log.d(LOGTAG, "mServiceCallbacks.onTuneStatusChanged :");
+ Log.d(LOGTAG, "mServiceCallbacks.onTuneStatusChanged :" + mTestRunning);
if (mTestRunning)
mHandler.post(mTuneComplete);
}
@@ -2729,6 +3604,138 @@
public void onFmAudioPathStopped() {
Log.d(LOGTAG, "mServiceCallbacks.onFmAudioPathStopped:");
}
+ public void getSigThCb(int val, int status) {
+ Log.d(LOGTAG, "getSigThCb ");
+
+ if (setCmdSent) {
+ setCmdSent = false;
+ if (mService != null) {
+ try {
+ mService.setSinrSamplesCnt(textBoxVal);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ } else {
+ Log.e(LOGTAG, "getSigTh: Service is null");
+ }
+ } else {
+ Log.e(LOGTAG, "Send message: SIGNAL_THRESHOLD");
+ mCallbackHandler.obtainMessage(SIGNAL_THRESHOLD, val, status).sendToTarget();
+ }
+ }
+
+ public void getChDetThCb(int val, int status) {
+ Log.d(LOGTAG, "getChDetThCb");
+
+ if (setCmdSent) {
+ setCmdSent = false;
+ if (mService != null) {
+ try {
+ if (lastCmdSent == CMD_CHDET_SINR_TH)
+ mService.setSinrTh(textBoxVal);
+ else if (lastCmdSent == CMD_CHDET_SINR_SAMPLE)
+ mService.setSinrSamplesCnt(textBoxVal);
+ else if (lastCmdSent == CMD_CHDET_INTF_TH_LOW)
+ mService.setIntfDetLowTh(textBoxVal);
+ else if (lastCmdSent == CMD_CHDET_INTF_TH_HIGH)
+ mService.setIntfDetHighTh(textBoxVal);
+ } catch (RemoteException e) {
+ Log.e(LOGTAG, "getChDetTh: exception");
+ e.printStackTrace();
+ }
+ }
+ lastCmdSent = 0;
+ } else {
+ Log.e(LOGTAG, "Send message: GET_CHANNEL_DET_THRESHOLD");
+ mCallbackHandler.obtainMessage(GET_CHANNEL_DET_THRESHOLD, val, status).sendToTarget();
+ }
+ }
+
+ public void setChDetThCb(int status)
+ {
+ Log.d(LOGTAG, "setChDetTh++");
+ mCallbackHandler.obtainMessage(SET_CHANNEL_DET_THRESHOLD, status).sendToTarget();
+ }
+
+ public void DefDataRdCb(int val, int status) {
+ Log.d(LOGTAG, "DefDataRdCb");
+
+ if (setCmdSent) {
+ setCmdSent = false;
+ if (mService != null) {
+ try {
+ if (lastCmdSent == CMD_DEFRD_AF_RMSSI_TH)
+ mService.setAfJmpRmssiTh(textBoxVal);
+ else if (lastCmdSent == CMD_DEFRD_AF_RMSSI_SAMPLE)
+ mService.setAfJmpRmssiSamplesCnt(textBoxVal);
+ else if (lastCmdSent == CMD_DEFRD_GD_CH_RMSSI_TH)
+ mService.setGoodChRmssiTh(textBoxVal);
+ else if (lastCmdSent == CMD_DEFRD_SEARCH_ALGO)
+ mService.setSearchAlgoType(algo_type);
+ else if (lastCmdSent == CMD_DEFRD_SINR_FIRST_STAGE)
+ mService.setSinrFirstStage(textBoxVal);
+ else if (lastCmdSent == CMD_DEFRD_RMSSI_FIRST_STAGE)
+ mService.setRmssiFirstStage(textBoxVal);
+ else if (lastCmdSent == CMD_DEFRD_CF0TH12)
+ mService.setCFOMeanTh(textBoxVal);
+ else if (lastCmdSent == CMD_DEFRD_REPEATCOUNT)
+ mService.setRxRepeatCount(textBoxVal);
+ } catch (RemoteException e) {
+ Log.e(LOGTAG,"DefDataRd: exception");
+ lastCmdSent = 0;
+ e.printStackTrace();
+ }
+ } else {
+ Log.e(LOGTAG, "DefDataRd:Service is null");
+ }
+ lastCmdSent = 0;
+ } else {
+ Log.e(LOGTAG, "Send message: DEFAULT_DATA_READ");
+ mCallbackHandler.obtainMessage(DEFAULT_DATA_READ, val, status).sendToTarget();
+ }
+ }
+
+ public void DefDataWrtCb(int status)
+ {
+ Log.d(LOGTAG, "DefDataWrtCb");
+ mCallbackHandler.obtainMessage(DEFAULT_DATA_WRITE, status).sendToTarget();
+ }
+
+ public void getBlendCb(int val, int status) {
+ Log.d(LOGTAG, "getBlend");
+
+ if (setCmdSent) {
+ setCmdSent = false;
+ if (mReceiver != null) {
+ if (lastCmdSent == CMD_BLENDTBL_SINR_HI)
+ mReceiver.setBlendSinr(textBoxVal);
+ else if (lastCmdSent == CMD_BLENDTBL_RMSSI_HI)
+ mReceiver.setBlendRmssi(textBoxVal);
+ } else {
+ Log.e(LOGTAG, "getBlend: Service is null");
+ }
+ lastCmdSent = 0;
+ } else {
+ Log.e(LOGTAG, "Send message: GET_BLEND_TBL");
+ mCallbackHandler.obtainMessage(GET_BLEND_TBL, val, status).sendToTarget();
+ }
+ }
+
+ public void setBlendCb(int status)
+ {
+ Log.d(LOGTAG, "setBlendCb");
+ mCallbackHandler.obtainMessage(SET_BLEND_TBL, status).sendToTarget();
+ }
+ public void getStationParamCb(int val, int status)
+ {
+ Log.d(LOGTAG, "getStationParamCb");
+ mCallbackHandler.obtainMessage(GET_STATION_PARAM, val, status).sendToTarget();
+ }
+ public void getStationDbgParamCb(int val, int status)
+ {
+ Log.d(LOGTAG, "getStationDbgParamCb");
+ mCallbackHandler.obtainMessage(GET_STATION_DBG_PARAM, val, status).sendToTarget();
+ }
};
/* Radio Vars */
private Handler mHandler = new Handler();
@@ -2756,6 +3763,9 @@
};
private void stopCurTest() {
+ if (mRunTestThread != null) {
+ mRunTestThread.interrupt();
+ }
if (mTestRunning) {
switch(mTestSelected) {
case CUR_FREQ_TEST:
diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
index 766961a..50706af 100644
--- a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
+++ b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl
@@ -76,5 +76,8 @@
boolean isSSRInProgress();
boolean isRtPlusSupported();
boolean isA2DPConnected();
+ boolean getIntfDetLowTh();
+ boolean getIntfDetHighTh();
+ boolean getRxRepeatCount();
}
diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl
index 826b5f3..f16c2d6 100644
--- a/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl
+++ b/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl
@@ -51,4 +51,13 @@
void onFmAudioPathStarted();
void onFmAudioPathStopped();
void onExtenCountryCodeChanged();
+ void getSigThCb(int val, int status);
+ void getChDetThCb(int val, int status);
+ void DefDataRdCb(int val, int status);
+ void getBlendCb(int val, int status);
+ void setChDetThCb(int status);
+ void DefDataWrtCb(int status);
+ void setBlendCb(int status);
+ void getStationParamCb(int val, int status);
+ void getStationDbgParamCb(int val, int status);
}
diff --git a/helium/radio-helium-commands.h b/helium/radio-helium-commands.h
index f76b7d2..3c9bbdc 100644
--- a/helium/radio-helium-commands.h
+++ b/helium/radio-helium-commands.h
@@ -109,6 +109,7 @@
HCI_FM_HELIUM_UPPER_BAND,
HCI_FM_HELIUM_LOWER_BAND,
HCI_FM_HELIUM_AUDIO_MODE,
+ HCI_FM_HELIUM_RMSSI,
HCI_FM_HELIUM_AUDIO_MUTE,
};
#endif /* __RADIO_CHEROKEE_COMMANDS_H */
diff --git a/helium/radio-helium.h b/helium/radio-helium.h
index 98452d8..05fc309 100644
--- a/helium/radio-helium.h
+++ b/helium/radio-helium.h
@@ -104,38 +104,41 @@
#define FM_TX_PHY_CFG_LEN 0x10
#define FM_TX_PWR_GAIN_OFFSET 14
/**RDS CONFIG MODE**/
-#define FM_RDS_CNFG_MODE 0x0f
-#define FM_RDS_CNFG_LEN 0x10
-#define AF_RMSSI_TH_LSB_OFFSET 10
-#define AF_RMSSI_TH_MSB_OFFSET 11
-#define AF_RMSSI_SAMPLES_OFFSET 15
+#define FM_RDS_CNFG_MODE 0x0f
+#define FM_RDS_CNFG_LEN 0x10
+#define AF_RMSSI_TH_OFFSET 1
+#define AF_RMSSI_SAMPLES_OFFSET 2
/**RX CONFIG MODE**/
-#define FM_RX_CONFG_MODE 0x15
-#define FM_RX_CNFG_LEN 0x20
-#define GD_CH_RMSSI_TH_OFFSET 12
-#define MAX_GD_CH_RMSSI_TH 127
-#define SRCH_ALGO_TYPE_OFFSET 25
-#define SINRFIRSTSTAGE_OFFSET 26
-#define RMSSIFIRSTSTAGE_OFFSET 27
-#define CF0TH12_BYTE1_OFFSET 8
-#define CF0TH12_BYTE2_OFFSET 9
-#define CF0TH12_BYTE3_OFFSET 10
-#define CF0TH12_BYTE4_OFFSET 11
-#define MAX_SINR_FIRSTSTAGE 127
-#define MAX_RMSSI_FIRSTSTAGE 127
+#define FM_RX_CONFG_MODE 0x15
+#define FM_RX_CNFG_LEN 0x15
+#define GD_CH_RMSSI_TH_OFFSET 0x03
+#define MAX_GD_CH_RMSSI_TH 0x7F
+#define SRCH_ALGO_TYPE_OFFSET 0x00
+#define SINRFIRSTSTAGE_OFFSET 0x01
+#define RMSSIFIRSTSTAGE_OFFSET 0x02
+#define CF0TH12_BYTE1_OFFSET 0x03
+#define CF0TH12_BYTE2_OFFSET 0x04
+#define MAX_SINR_FIRSTSTAGE 0x7F
+#define MAX_RMSSI_FIRSTSTAGE 0x7F
#define RDS_PS0_XFR_MODE 0x01
-#define RDS_PS0_LEN 6
-#define RX_REPEATE_BYTE_OFFSET 5
-#define FM_SPUR_TBL_SIZE 240
-#define SPUR_DATA_LEN 16
-#define ENTRIES_EACH_CMD 15
-#define SPUR_DATA_INDEX 2
-#define FM_AF_LIST_MAX_SIZE 200
+#define RDS_PS0_LEN 0x06
+#define RX_REPEATE_BYTE_OFFSET 0x05
+#define FM_SPUR_TBL_SIZE 0xF0
+#define SPUR_DATA_LEN 0x10
+#define ENTRIES_EACH_CMD 0x0F
+#define SPUR_DATA_INDEX 0x02
+#define FM_AF_LIST_MAX_SIZE 0xC8
#define AF_LIST_MAX (FM_AF_LIST_MAX_SIZE / 4) /* Each AF frequency consist
- of sizeof(int) bytes */
-#define MAX_BLEND_INDEX 49
+ of sizeof(int) bytes */
+#define MAX_BLEND_INDEX 0x31
+
+#define FM_SRCH_CONFG_MODE 0x41
+#define FM_AFJUMP_CONFG_MODE 0x42
+#define FM_SRCH_CNFG_LEN 0x08
+#define FM_AFJUMP_CNFG_LEN 0x06
+
/* HCI timeouts */
-#define RADIO_HCI_TIMEOUT (10000) /* 10 seconds */
+#define RADIO_HCI_TIMEOUT (10000) /* 10 seconds */
typedef enum {
ASSOCIATE_JVM,
@@ -164,6 +167,15 @@
typedef void (*fm_ssbi_peek_cb)(char *ssbi_peek_rsp);
typedef void (*fm_ch_det_th_cb)(char *ch_det_rsp);
typedef void (*fm_ecc_evt_cb)(char *ecc_rsp);
+typedef void (*fm_sig_thr_cb) (int val, int status);
+typedef void (*fm_get_ch_det_thrs_cb) (int val, int status);
+typedef void (*fm_def_data_rd_cb) (int val, int status);
+typedef void (*fm_get_blnd_cb) (int val, int status);
+typedef void (*fm_set_ch_det_thrs_cb) (int status);
+typedef void (*fm_def_data_wrt_cb) (int status);
+typedef void (*fm_set_blnd_cb) (int status);
+typedef void (*fm_get_stn_prm_cb) (int val, int status);
+typedef void (*fm_get_stn_dbg_prm_cb) (int val, int status);
typedef struct {
size_t size;
@@ -188,6 +200,15 @@
fm_ch_det_th_cb fm_ch_det_th_rsp_cb;
fm_ecc_evt_cb ext_country_code_cb;
callback_thread_event thread_evt_cb;
+ fm_sig_thr_cb fm_get_sig_thres_cb;
+ fm_get_ch_det_thrs_cb fm_get_ch_det_thr_cb;
+ fm_def_data_rd_cb fm_def_data_read_cb;
+ fm_get_blnd_cb fm_get_blend_cb;
+ fm_set_ch_det_thrs_cb fm_set_ch_det_thr_cb;
+ fm_def_data_wrt_cb fm_def_data_write_cb;
+ fm_set_blnd_cb fm_set_blend_cb;
+ fm_get_stn_prm_cb fm_get_station_param_cb;
+ fm_get_stn_dbg_prm_cb fm_get_station_debug_param_cb;
} fm_vendor_callbacks_t;
pthread_mutex_t radio_fm_cmd;
@@ -304,11 +325,11 @@
(short) hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ, ocf)
#define hci_trans_ctrl_cmd_op_pack(ocf) \
(short) hci_opcode_pack(HCI_OGF_FM_TRANS_CTRL_CMD_REQ, ocf)
-#define hci_common_cmd_op_pack(ocf) \
+#define hci_common_cmd_op_pack(ocf) \
(short) hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ, ocf)
-#define hci_status_param_op_pack(ocf) \
+#define hci_status_param_op_pack(ocf) \
(short) hci_opcode_pack(HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ, ocf)
-#define hci_diagnostic_cmd_op_pack(ocf) \
+#define hci_diagnostic_cmd_op_pack(ocf) \
(short) hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ, ocf)
@@ -342,15 +363,15 @@
char ch_spacing;
char rds_std;
char hlsi;
- int band_low_limit;
- int band_high_limit;
+ int band_low_limit;
+ int band_high_limit;
} ;
/* ----- HCI Command request ----- */
struct hci_fm_trans_conf_req_struct {
char emphasis;
char rds_std;
- int band_low_limit;
+ int band_low_limit;
int band_high_limit;
} ;
@@ -467,21 +488,27 @@
char sinr_samples;
char low_th;
char high_th;
-
} ;
struct hci_fm_blend_table {
- char ucBlendType;
- char ucBlendRampRateUp;
- char ucBlendDebounceNumSampleUp;
- char ucBlendDebounceIdxUp;
- char ucBlendSinrIdxSkipStep;
- char scBlendSinrHi;
- char scBlendRmssiHi;
- char ucBlendIndexHi;
- char ucBlendIndex[MAX_BLEND_INDEX];
+ char BlendType;
+ char BlendRampRateUp;
+ char BlendDebounceNumSampleUp;
+ char BlendDebounceIdxUp;
+ char BlendSinrIdxSkipStep;
+ char BlendSinrHi;
+ char BlendRmssiHi;
+ char BlendIndexHi;
+ char BlendIndex[MAX_BLEND_INDEX];
} ;
+struct hci_fm_def_data_rd {
+ char mode;
+ char length;
+ char param_len;
+ char param;
+};
+
/*HCI events*/
#define HCI_EV_TUNE_STATUS 0x01
#define HCI_EV_RDS_LOCK_STATUS 0x02
@@ -521,22 +548,22 @@
/*RT PLUS*/
#define DUMMY_CLASS 0
#define RT_PLUS_LEN_1_TAG 3
-#define RT_ERT_FLAG_BIT 5
+#define RT_ERT_FLAG_BIT 5
/*TAG1*/
-#define TAG1_MSB_OFFSET 3
-#define TAG1_MSB_MASK 7
-#define TAG1_LSB_OFFSET 5
+#define TAG1_MSB_OFFSET 3
+#define TAG1_MSB_MASK 7
+#define TAG1_LSB_OFFSET 5
#define TAG1_POS_MSB_MASK 31
#define TAG1_POS_MSB_OFFSET 1
#define TAG1_POS_LSB_OFFSET 7
-#define TAG1_LEN_OFFSET 1
+#define TAG1_LEN_OFFSET 1
#define TAG1_LEN_MASK 63
/*TAG2*/
-#define TAG2_MSB_OFFSET 5
+#define TAG2_MSB_OFFSET 5
#define TAG2_MSB_MASK 1
-#define TAG2_LSB_OFFSET 3
+#define TAG2_LSB_OFFSET 3
#define TAG2_POS_MSB_MASK 7
#define TAG2_POS_MSB_OFFSET 3
#define TAG2_POS_LSB_OFFSET 5
@@ -544,7 +571,7 @@
#define AGT_MASK 31
/*Extract 5 left most bits of lsb of 2nd block*/
-#define AGT(x) (x & AGT_MASK)
+#define AGT(x) (x & AGT_MASK)
/*16 bits of 4th block*/
#define AID(lsb, msb) ((msb << 8) | (lsb))
/*Extract 5 right most bits of msb of 2nd block*/
@@ -554,9 +581,9 @@
#define RT_PLUS_AID 0x4bd7
/*ERT*/
-#define ERT_AID 0x6552
-#define CARRIAGE_RETURN 0x000D
-#define MAX_ERT_SEGMENT 31
+#define ERT_AID 0x6552
+#define CARRIAGE_RETURN 0x000D
+#define MAX_ERT_SEGMENT 31
#define ERT_FORMAT_DIR_BIT 1
#define EXTRACT_BIT(data, bit_pos) ((data & (1 << bit_pos)) >> bit_pos)
@@ -683,8 +710,7 @@
} ;
struct hci_fm_data_rd_rsp {
- char status;
- char ret_data_len;
+ char data_len;
char data[DEFAULT_DATA_SIZE];
} ;
@@ -694,7 +720,6 @@
} ;
struct hci_fm_dbg_param_rsp {
- char status;
char blend;
char soft_mute;
char inf_blend;
@@ -704,35 +729,35 @@
char in_det_out;
} ;
-#define CLKSPURID_INDEX0 0
-#define CLKSPURID_INDEX1 5
-#define CLKSPURID_INDEX2 10
-#define CLKSPURID_INDEX3 15
-#define CLKSPURID_INDEX4 20
-#define CLKSPURID_INDEX5 25
+#define CLKSPURID_INDEX0 0
+#define CLKSPURID_INDEX1 5
+#define CLKSPURID_INDEX2 10
+#define CLKSPURID_INDEX3 15
+#define CLKSPURID_INDEX4 20
+#define CLKSPURID_INDEX5 25
-#define MAX_SPUR_FREQ_LIMIT 30
-#define CKK_SPUR 0x3B
-#define SPUR_DATA_SIZE 0x4
-#define SPUR_ENTRIES_PER_ID 0x5
+#define MAX_SPUR_FREQ_LIMIT 30
+#define CKK_SPUR 0x3B
+#define SPUR_DATA_SIZE 0x4
+#define SPUR_ENTRIES_PER_ID 0x5
#define COMPUTE_SPUR(val) ((((val) - (76000)) / (50)))
#define GET_FREQ(val, bit) ((bit == 1) ? ((val) >> 8) : ((val) & 0xFF))
#define GET_SPUR_ENTRY_LEVEL(val) ((val) / (5))
struct hci_fm_spur_data {
- int freq[MAX_SPUR_FREQ_LIMIT];
+ int freq[MAX_SPUR_FREQ_LIMIT];
char rmssi[MAX_SPUR_FREQ_LIMIT];
char enable[MAX_SPUR_FREQ_LIMIT];
} ;
/* HCI dev events */
-#define RADIO_HCI_DEV_REG 1
-#define RADIO_HCI_DEV_WRITE 2
+#define RADIO_HCI_DEV_REG 1
+#define RADIO_HCI_DEV_WRITE 2
-#define hci_req_lock(d) mutex_lock(&d->req_lock)
-#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
+#define hci_req_lock(d) mutex_lock(&d->req_lock)
+#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
/* FM RDS */
#define RDS_PTYPE 2
@@ -824,7 +849,7 @@
#define SRCH_MODE 0x07
#define SRCH_DIR 0x08 /* 0-up 1-down */
#define SCAN_DWELL 0x70
-#define SRCH_ON 0x80
+#define SRCH_ON 0x80
/* I/O Control */
#define IOC_HRD_MUTE 0x03
@@ -835,12 +860,12 @@
#define IOC_ANTENNA 0x01
/* RDS Control */
-#define RDS_ON 0x01
+#define RDS_ON 0x01
#define RDS_BUF_SZ 100
/* constants */
-#define RDS_BLOCKS_NUM (4)
-#define BYTES_PER_BLOCK (3)
+#define RDS_BLOCKS_NUM (4)
+#define BYTES_PER_BLOCK (3)
#define MAX_PS_LENGTH (108)
#define MAX_RT_LENGTH (64)
#define RDS_GRP_CNTR_LEN (36)
@@ -861,7 +886,7 @@
#define GET_LSB(x)((x) & 0xFF)
/* control options */
-#define CTRL_ON (1)
+#define CTRL_ON (1)
#define CTRL_OFF (0)
/*Diagnostic commands*/
@@ -885,7 +910,7 @@
#define MAX_CALIB_SIZE 75
/* Channel validity */
-#define INVALID_CHANNEL (0)
+#define INVALID_CHANNEL (0)
#define VALID_CHANNEL (1)
struct hci_fm_set_cal_req_proc {
@@ -1170,7 +1195,44 @@
struct hci_fm_ssbi_req ssbi_data_accs;
struct hci_fm_ssbi_peek ssbi_peek_reg;
struct hci_fm_ch_det_threshold ch_det_threshold;
+ struct hci_fm_data_rd_rsp def_data;
+ struct hci_fm_blend_table blend_tbl;
};
+
+#define set_bit(flag, bit_pos) ((flag) |= (1 << (bit_pos)))
+#define clear_bit(flag, bit_pos) ((flag) &= (~(1 << (bit_pos))))
+#define test_bit(flag, bit_pos) ((flag) & (1 << (bit_pos)))
+#define clear_all_bit(flag) ((flag) &= (~0xFFFFFFFF))
+#define CMD_CHDET_SINR_TH (1)
+#define CMD_CHDET_SINR_SAMPLE (2)
+#define CMD_CHDET_INTF_TH_LOW (3)
+#define CMD_CHDET_INTF_TH_HIGH (4)
+
+#define CMD_DEFRD_AF_RMSSI_TH (1)
+#define CMD_DEFRD_AF_RMSSI_SAMPLE (2)
+#define CMD_DEFRD_GD_CH_RMSSI_TH (3)
+#define CMD_DEFRD_SEARCH_ALGO (4)
+#define CMD_DEFRD_SINR_FIRST_STAGE (5)
+#define CMD_DEFRD_RMSSI_FIRST_STAGE (6)
+#define CMD_DEFRD_CF0TH12 (7)
+#define CMD_DEFRD_TUNE_POWER (8)
+#define CMD_DEFRD_REPEATCOUNT (9)
+
+#define CMD_STNPARAM_RSSI (1)
+#define CMD_STNPARAM_SINR (2)
+#define CMD_STNPARAM_INTF_DET_TH (3)
+
+#define CMD_STNDBGPARAM_BLEND (1)
+#define CMD_STNDBGPARAM_SOFTMUTE (2)
+#define CMD_STNDBGPARAM_INFBLEND (3)
+#define CMD_STNDBGPARAM_INFSOFTMUTE (4)
+#define CMD_STNDBGPARAM_PILOTPLL (5)
+#define CMD_STNDBGPARAM_IOVERC (6)
+#define CMD_STNDBGPARAM_INFDETOUT (7)
+
+#define CMD_BLENDTBL_SINR_HI (1)
+#define CMD_BLENDTBL_RMSSI_HI (2)
+
int hci_fm_disable_recv_req();
int helium_search_list(struct hci_fm_search_station_list_req *s_list);
int helium_search_rds_stations(struct hci_fm_search_rds_station_req *rds_srch);
@@ -1194,6 +1256,11 @@
int hci_ssbi_peek_reg(struct hci_fm_ssbi_peek *data);
int hci_fm_get_ch_det_th();
int set_ch_det_thresholds_req(struct hci_fm_ch_det_threshold *ch_det_th);
-
+int hci_fm_default_data_read_req(struct hci_fm_def_data_rd_req *def_data_rd);
+int hci_fm_get_blend_req();
+int hci_fm_set_blend_tbl_req(struct hci_fm_blend_table *blnd_tbl);
+int hci_fm_default_data_write_req(struct hci_fm_def_data_wr_req * data_wrt);
+int hci_fm_get_station_dbg_param_req();
+int hci_fm_get_station_cmd_param_req();
#endif /* __UAPI_RADIO_HCI_CORE_H */
diff --git a/helium/radio_helium_hal.c b/helium/radio_helium_hal.c
index 561c92a..2a29f64 100644
--- a/helium/radio_helium_hal.c
+++ b/helium/radio_helium_hal.c
@@ -36,6 +36,7 @@
#include "radio-helium.h"
#include "fm_hci.h"
#include <dlfcn.h>
+#include <errno.h>
fm_vendor_callbacks_t *jni_cb;
int hci_fm_get_signal_threshold();
@@ -52,6 +53,12 @@
static char utf_8_flag;
static char rt_ert_flag;
static char formatting_dir;
+static uint32_t ch_det_th_mask_flag;
+static uint32_t def_data_rd_mask_flag;
+static uint32_t blend_tbl_mask_flag;
+static uint32_t station_param_mask_flag;
+static uint32_t station_dbg_param_mask_flag;
+uint64_t flag;
#define LOG_TAG "radio_helium"
static void radio_hci_req_complete(char result)
@@ -76,6 +83,8 @@
jni_cb->thread_evt_cb(0);
radio_hci_req_complete(rsp->status);
jni_cb->enabled_cb();
+ if (rsp->status == FM_HC_STATUS_SUCCESS)
+ radio->mode = FM_RECV;
}
static void hci_cc_conf_rsp(char *ev_rsp)
@@ -181,20 +190,179 @@
static void hci_cc_get_ch_det_threshold_rsp(char *ev_buff)
{
- char status;
-
+ int status;
+ int val = 0;
if (ev_buff == NULL) {
ALOGE("%s:%s, buffer is null\n", LOG_TAG, __func__);
return;
}
status = ev_buff[0];
- ALOGE("%s:%s, status =%d\n", LOG_TAG, __func__,status);
- if (status < 0) {
+ ALOGV("%s:%s, status =%d\n", LOG_TAG, __func__,status);
+ if (status != 0) {
ALOGE("%s:%s,ssbi peek failed=%d\n", LOG_TAG, __func__, status);
- }
- memcpy(&radio->ch_det_threshold, &ev_buff[1],
+ } else {
+ memcpy(&radio->ch_det_threshold, &ev_buff[1],
sizeof(struct hci_fm_ch_det_threshold));
- radio_hci_req_complete(status);
+ radio_hci_req_complete(status);
+
+ if (test_bit(ch_det_th_mask_flag, CMD_CHDET_SINR_TH))
+ val = radio->ch_det_threshold.sinr;
+ else if (test_bit(ch_det_th_mask_flag, CMD_CHDET_SINR_SAMPLE))
+ val = radio->ch_det_threshold.sinr_samples;
+ else if (test_bit(ch_det_th_mask_flag, CMD_CHDET_INTF_TH_LOW))
+ val = radio->ch_det_threshold.low_th;
+ else if (test_bit(ch_det_th_mask_flag, CMD_CHDET_INTF_TH_HIGH))
+ val = radio->ch_det_threshold.high_th;
+ }
+ clear_all_bit(ch_det_th_mask_flag);
+ jni_cb->fm_get_ch_det_thr_cb(val, status);
+}
+
+static void hci_cc_set_ch_det_threshold_rsp(char *ev_buff)
+{
+ int status = ev_buff[0];
+
+ jni_cb->fm_set_ch_det_thr_cb(status);
+}
+
+static void hci_cc_sig_threshold_rsp(char *ev_buff)
+{
+ int status, val = -1;
+ ALOGD("hci_cc_sig_threshold_rsp");
+
+ status = ev_buff[0];
+
+ if (status != 0) {
+ ALOGE("%s: status= 0x%x", __func__, status);
+ } else {
+ val = ev_buff[1];
+ }
+ jni_cb->fm_get_sig_thres_cb(val, status);
+}
+
+static void hci_cc_default_data_read_rsp(char *ev_buff)
+{
+ int status, val= 0, data_len = 0;
+
+ if (ev_buff == NULL) {
+ ALOGE("Response buffer is null");
+ return;
+ }
+ status = ev_buff[0];
+ if (status == 0) {
+ data_len = ev_buff[1];
+ ALOGV("hci_cc_default_data_read_rsp:data_len = %d", data_len);
+ memcpy(&radio->def_data, &ev_buff[1], data_len + sizeof(char));
+
+ if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_AF_RMSSI_TH)) {
+ val = radio->def_data.data[AF_RMSSI_TH_OFFSET];
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_AF_RMSSI_SAMPLE)) {
+ val = radio->def_data.data[AF_RMSSI_SAMPLES_OFFSET];
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_GD_CH_RMSSI_TH)) {
+ val = radio->def_data.data[GD_CH_RMSSI_TH_OFFSET];
+ if (val > MAX_GD_CH_RMSSI_TH)
+ val -= 256;
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_SEARCH_ALGO)) {
+ val = radio->def_data.data[SRCH_ALGO_TYPE_OFFSET];
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_SINR_FIRST_STAGE)) {
+ val = radio->def_data.data[SINRFIRSTSTAGE_OFFSET];
+ if (val > MAX_SINR_FIRSTSTAGE)
+ val -= 256;
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_RMSSI_FIRST_STAGE)) {
+ val = radio->def_data.data[RMSSIFIRSTSTAGE_OFFSET];
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_CF0TH12)) {
+ val = (radio->def_data.data[CF0TH12_BYTE1_OFFSET] |
+ (radio->def_data.data[CF0TH12_BYTE2_OFFSET] << 8));
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_TUNE_POWER)) {
+ } else if (test_bit(def_data_rd_mask_flag, CMD_DEFRD_REPEATCOUNT)) {
+ val = radio->def_data.data[RX_REPEATE_BYTE_OFFSET];
+ }
+ } else {
+ ALOGE("%s: Error: Status= 0x%x", __func__, status);
+ }
+ clear_all_bit(def_data_rd_mask_flag);
+ jni_cb->fm_def_data_read_cb(val, status);
+}
+
+static void hci_cc_default_data_write_rsp(char *ev_buff)
+{
+ int status = ev_buff[0];
+
+ jni_cb->fm_def_data_write_cb(status);
+}
+
+static void hci_cc_get_blend_tbl_rsp(char *ev_buff)
+{
+ int status, val;
+
+ if (ev_buff == NULL) {
+ ALOGE("%s:response buffer in null", LOG_TAG);
+ return;
+ }
+
+ status = ev_buff[0];
+ if (status != 0) {
+ ALOGE("%s: status = 0x%x", LOG_TAG, status);
+ } else {
+ memcpy(&radio->blend_tbl, &ev_buff[1],
+ sizeof(struct hci_fm_blend_table));
+
+ ALOGE("hci_cc_get_blend_tbl_rsp: data");
+ int i;
+ for (i = 0; i < 8; i++)
+ ALOGE("data[%d] = 0x%x", i, ev_buff[1 + i]);
+ if (test_bit(blend_tbl_mask_flag, CMD_BLENDTBL_SINR_HI)) {
+ val = radio->blend_tbl.BlendSinrHi;
+ } else if (test_bit(blend_tbl_mask_flag, CMD_BLENDTBL_RMSSI_HI)) {
+ val = radio->blend_tbl.BlendRmssiHi;
+ }
+ }
+ clear_all_bit(blend_tbl_mask_flag);
+ jni_cb->fm_get_blend_cb(val, status);
+}
+
+static void hci_cc_set_blend_tbl_rsp(char *ev_buff)
+{
+ int status = ev_buff[0];
+
+ jni_cb->fm_set_blend_cb(status);
+}
+
+static void hci_cc_station_rsp(char *ev_buff)
+{
+ int val, status = ev_buff[0];
+
+ if (status == FM_HC_STATUS_SUCCESS) {
+ memcpy(&radio->fm_st_rsp.station_rsp.station_freq, &ev_buff[1],
+ sizeof(struct hci_fm_station_rsp) - sizeof(char));
+ if (test_bit(station_param_mask_flag, CMD_STNPARAM_RSSI)) {
+ val = radio->fm_st_rsp.station_rsp.rssi;
+ } else if (test_bit(station_param_mask_flag, CMD_STNPARAM_SINR)) {
+ val = radio->fm_st_rsp.station_rsp.sinr;
+ }
+ }
+ ALOGE("hci_cc_station_rsp: val =%x, status = %x", val, status);
+
+ jni_cb->fm_get_station_param_cb(val, status);
+ clear_all_bit(station_param_mask_flag);
+}
+
+static void hci_cc_dbg_param_rsp(char *ev_buff)
+{
+ int val, status = ev_buff[0];
+
+ if (status == FM_HC_STATUS_SUCCESS) {
+ memcpy(&radio->st_dbg_param, &ev_buff[1],
+ sizeof(struct hci_fm_dbg_param_rsp));
+ if (test_bit(station_dbg_param_mask_flag, CMD_STNDBGPARAM_INFDETOUT)) {
+ val = radio->st_dbg_param.in_det_out;
+ } else if (test_bit(station_dbg_param_mask_flag, CMD_STNDBGPARAM_IOVERC)) {
+ val = radio->st_dbg_param.io_verc;
+ }
+ }
+ ALOGE("hci_cc_dbg_param_rsp: val =%x, status = %x", val, status);
+ jni_cb->fm_get_station_debug_param_cb(val, status);
+ clear_all_bit(station_dbg_param_mask_flag);
}
static inline void hci_cmd_complete_event(char *buff)
@@ -233,11 +401,11 @@
case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_RDS_GRP_PROCESS):
case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_EN_WAN_AVD_CTRL):
case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_EN_NOTCH_CTRL):
- case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_SET_CH_DET_THRESHOLD):
- case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_SET_BLND_TBL):
- case hci_common_cmd_op_pack(HCI_OCF_FM_DEFAULT_DATA_WRITE):
hci_cc_rsp(pbuf);
break;
+ case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_SET_CH_DET_THRESHOLD):
+ hci_cc_set_ch_det_threshold_rsp(pbuf);
+ break;
case hci_common_cmd_op_pack(HCI_OCF_FM_RESET):
case hci_diagnostic_cmd_op_pack(HCI_OCF_FM_SSBI_POKE_REG):
case hci_diagnostic_cmd_op_pack(HCI_OCF_FM_POKE_DATA):
@@ -257,17 +425,34 @@
hci_cc_ssbi_peek_rsp(buff);
break;
case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_GET_CH_DET_THRESHOLD):
- hci_cc_get_ch_det_threshold_rsp(buff);
- break;
-/* case hci_common_cmd_op_pack(HCI_OCF_FM_GET_SPUR_TABLE):
- hci_cc_get_spur_tbl(buff);
+ hci_cc_get_ch_det_threshold_rsp(pbuf);
break;
case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_GET_SIGNAL_THRESHOLD):
- hci_cc_sig_threshold_rsp(buff);
+ hci_cc_sig_threshold_rsp(pbuf);
+ break;
+ case hci_common_cmd_op_pack(HCI_OCF_FM_DEFAULT_DATA_READ):
+ hci_cc_default_data_read_rsp(pbuf);
+ break;
+ case hci_common_cmd_op_pack(HCI_OCF_FM_DEFAULT_DATA_WRITE):
+ hci_cc_default_data_write_rsp(pbuf);
+ break;
+ case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_GET_BLND_TBL):
+ hci_cc_get_blend_tbl_rsp(pbuf);
+ break;
+ case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_SET_BLND_TBL):
+ hci_cc_set_blend_tbl_rsp(pbuf);
break;
case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_GET_STATION_PARAM_REQ):
- hci_cc_station_rsp(buff);
+ hci_cc_station_rsp(pbuf);
+ break;
+
+ case hci_diagnostic_cmd_op_pack(HCI_OCF_FM_STATION_DBG_PARAM):
+ hci_cc_dbg_param_rsp(pbuf);
+ break;
+
+/* case hci_common_cmd_op_pack(HCI_OCF_FM_GET_SPUR_TABLE):
+ hci_cc_get_spur_tbl(buff);
break;
case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_GET_PROGRAM_SERVICE_REQ):
@@ -282,17 +467,10 @@
hci_cc_af_list_rsp(buff);
break;
- case hci_common_cmd_op_pack(HCI_OCF_FM_DEFAULT_DATA_READ):
- hci_cc_riva_read_default_rsp(buff);
- break;
-
case hci_common_cmd_op_pack(HCI_OCF_FM_GET_FEATURE_LIST):
hci_cc_feature_list_rsp(buff);
break;
- case hci_diagnostic_cmd_op_pack(HCI_OCF_FM_STATION_DBG_PARAM):
- hci_cc_dbg_param_rsp(buff);
- break;
case hci_status_param_op_pack(HCI_OCF_FM_READ_GRP_COUNTERS):
hci_cc_rds_grp_cntrs_rsp(buff);
break;
@@ -300,9 +478,6 @@
hci_cc_do_calibration_rsp(buff);
break;
- case hci_recv_ctrl_cmd_op_pack(HCI_OCF_FM_GET_BLND_TBL):
- hci_cc_get_blend_tbl_rsp(buff);
- break;
default:
ALOGE("opcode 0x%x", opcode);
break; */
@@ -733,7 +908,7 @@
}
}
-void radio_hci_event_packet(char *evt_buf)
+static void radio_hci_event_packet(char *evt_buf)
{
char evt;
@@ -947,8 +1122,11 @@
char temp_val = 0;
unsigned int rds_grps_proc = 0;
char *data;
+ struct hci_fm_def_data_wr_req def_data_wrt;
+
ALOGE("%s:cmd: %x, val: %d",LOG_TAG, cmd, val);
+
switch (cmd) {
case HCI_FM_HELIUM_AUDIO_MUTE:
saved_val = radio->mute_mode.hard_mute;
@@ -960,10 +1138,16 @@
}
break;
case HCI_FM_HELIUM_SRCHMODE:
+ if (is_valid_srch_mode(val))
radio->g_search_mode = val;
+ else
+ ret = -EINVAL;
break;
case HCI_FM_HELIUM_SCANDWELL:
+ if (is_valid_scan_dwell_prd(val))
radio->g_scan_time = val;
+ else
+ ret = -EINVAL;
break;
case HCI_FM_HELIUM_SRCHON:
helium_search_req(val, SRCH_DIR_UP);
@@ -989,18 +1173,28 @@
ret = helium_set_sig_threshold_req(temp_val);
if (ret < 0) {
ALOGE("%s:Error while setting signal threshold\n", LOG_TAG);
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_SRCH_PTY:
- radio->srch_rds.srch_pty = val;
- radio->srch_st_list.srch_pty = val;
+ if (is_valid_pty(val)) {
+ radio->srch_rds.srch_pty = val;
+ radio->srch_st_list.srch_pty = val;
+ } else {
+ ret = -EINVAL;
+ }
break;
case HCI_FM_HELIUM_SRCH_PI:
- radio->srch_rds.srch_pi = val;
+ if (is_valid_pi(val))
+ radio->srch_rds.srch_pi = val;
+ else
+ ret = -EINVAL;
break;
case HCI_FM_HELIUM_SRCH_CNT:
- radio->srch_st_list.srch_list_max = val;
+ if (is_valid_srch_station_cnt(val))
+ radio->srch_st_list.srch_list_max = val;
+ else
+ ret = -EINVAL;
break;
case HCI_FM_HELIUM_SPACING:
saved_val = radio->recv_conf.ch_spacing;
@@ -1009,7 +1203,7 @@
if (ret < 0) {
ALOGE("%s:Error in setting channel spacing", LOG_TAG);
radio->recv_conf.ch_spacing = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_EMPHASIS:
@@ -1019,7 +1213,7 @@
if (ret < 0) {
ALOGE("%s:Error in setting emphasis", LOG_TAG);
radio->recv_conf.emphasis = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_RDS_STD:
@@ -1029,7 +1223,7 @@
if (ret < 0) {
ALOGE("%s:Error in rds_std", LOG_TAG);
radio->recv_conf.rds_std = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_RDSON:
@@ -1039,7 +1233,7 @@
if (ret < 0) {
ALOGE("%s:Error in rds_std", LOG_TAG);
radio->recv_conf.rds_std = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_RDSGROUP_MASK:
@@ -1052,7 +1246,7 @@
if (ret < 0) {
ALOGE("%s:error in setting group mask\n", LOG_TAG);
radio->rds_grp.rds_grp_enable_mask = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_RDSGROUP_PROC:
@@ -1062,7 +1256,7 @@
ret = helium_rds_grp_process_req(radio->g_rds_grp_proc_ps);
if (ret < 0) {
radio->g_rds_grp_proc_ps = saved_val;
- goto END;
+ goto end;
}
break;
@@ -1071,7 +1265,7 @@
ret = hci_fm_get_rds_grpcounters_req(val);
if (ret < 0) {
radio->g_rds_grp_proc_ps = saved_val;
- goto END;
+ goto end;
}
break;
@@ -1079,7 +1273,7 @@
ALOGD("%s: set notch filter notch=%d ", LOG_TAG,val);
ret = hci_fm_set_notch_filter_req(val);
if (ret < 0) {
- goto END;
+ goto end;
}
break;
@@ -1093,7 +1287,7 @@
ret = helium_rds_grp_process_req(radio->g_rds_grp_proc_ps);
if (ret < 0) {
radio->g_rds_grp_proc_ps = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_AF_JUMP:
@@ -1106,7 +1300,7 @@
ret = helium_rds_grp_process_req(radio->g_rds_grp_proc_ps);
if (ret < 0) {
radio->g_rds_grp_proc_ps = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_LP_MODE:
@@ -1117,7 +1311,7 @@
ret = helium_set_antenna_req(temp_val);
if (ret < 0) {
ALOGE("%s:Set Antenna failed retval = %x", LOG_TAG, ret);
- goto END;
+ goto end;
}
radio->g_antenna = val;
break;
@@ -1128,7 +1322,7 @@
if (ret < 0) {
ALOGE("%s:Error while setting FM soft mute %d", LOG_TAG, ret);
radio->mute_mode.soft_mute = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_FREQ:
@@ -1156,7 +1350,7 @@
} else {
ret = -1;
ALOGE("%s: riva access len is not valid\n", LOG_TAG);
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_RIVA_PEEK:
@@ -1172,7 +1366,7 @@
} else {
ALOGE("%s: riva access len is not valid for poke\n", LOG_TAG);
ret = -1;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_SSBI_ACCS_ADDR:
@@ -1190,97 +1384,142 @@
if (!is_valid_sinr_samples(val)) {
ALOGE("%s: sinr samples count is not valid\n", __func__);
ret = -1;
- goto END;
+ goto end;
}
- ret = hci_fm_get_ch_det_th();
- if (ret < 0) {
- ALOGE("Failed to get chnl det thresholds %d", ret);
- goto END;
- }
- saved_val = radio->ch_det_threshold.sinr_samples;
radio->ch_det_threshold.sinr_samples = val;
ret = set_ch_det_thresholds_req(&radio->ch_det_threshold);
if (ret < 0) {
ALOGE("Failed to set SINR samples %d", ret);
- radio->ch_det_threshold.sinr_samples = saved_val;
- goto END;
+ goto end;
}
break;
case HCI_FM_HELIUM_SINR_THRESHOLD:
if (!is_valid_sinr_th(val)) {
- ALOGE("%s: sinr threshold is not valid\n");
+ ALOGE("%s: sinr threshold is not valid\n", __func__);
ret = -1;
- goto END;
+ goto end;
}
- ret = hci_fm_get_ch_det_th();
- if (ret < 0) {
- ALOGE("Failed to get chnl det thresholds %d", ret);
- goto END;
- }
- saved_val = radio->ch_det_threshold.sinr;
radio->ch_det_threshold.sinr = val;
ret = set_ch_det_thresholds_req(&radio->ch_det_threshold);
- if (ret < 0) {
- ALOGE("Failed to set SINR threshold %d", ret);
- radio->ch_det_threshold.sinr = saved_val;
- goto END;
- }
break;
case HCI_FM_HELIUM_INTF_LOW_THRESHOLD:
if (!is_valid_intf_det_low_th(val)) {
ALOGE("%s: intf det low threshold is not valid\n", __func__);
ret = -1;
- goto END;
+ goto end;
}
- ret = hci_fm_get_ch_det_th();
- if (ret < 0) {
- ALOGE("Failed to get chnl det thresholds %d", ret);
- goto END;
- }
- saved_val = radio->ch_det_threshold.low_th;
radio->ch_det_threshold.low_th = val;
ret = set_ch_det_thresholds_req(&radio->ch_det_threshold);
- if (ret < 0) {
- ALOGE("Failed to Set Low det threshold %d", ret);
- radio->ch_det_threshold.low_th = saved_val;
- goto END;
- }
break;
case HCI_FM_HELIUM_INTF_HIGH_THRESHOLD:
if (!is_valid_intf_det_hgh_th(val)) {
ALOGE("%s: intf high threshold is not valid\n", __func__);
ret = -1;
- goto END;
+ goto end;
}
- ret = hci_fm_get_ch_det_th();
- if (ret < 0) {
- ALOGE("Failed to get chnl det thresholds %d", ret);
- goto END;
- }
- saved_val = radio->ch_det_threshold.high_th;
radio->ch_det_threshold.high_th = val;
ret = set_ch_det_thresholds_req(&radio->ch_det_threshold);
- if (ret < 0) {
- ALOGE("Failed to set High det threshold %d ", ret);
- radio->ch_det_threshold.high_th = saved_val;
- goto END;
+ break;
+ case HCI_FM_HELIUM_SINRFIRSTSTAGE:
+ def_data_wrt.mode = FM_SRCH_CONFG_MODE;
+ def_data_wrt.length = FM_SRCH_CNFG_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[SINRFIRSTSTAGE_OFFSET] = val;
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_RMSSIFIRSTSTAGE:
+ def_data_wrt.mode = FM_SRCH_CONFG_MODE;
+ def_data_wrt.length = FM_SRCH_CNFG_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[RMSSIFIRSTSTAGE_OFFSET] = val;
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_CF0TH12:
+ def_data_wrt.mode = FM_SRCH_CONFG_MODE;
+ def_data_wrt.length = FM_SRCH_CNFG_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[CF0TH12_BYTE1_OFFSET] = (val & 0xFF);
+ def_data_wrt.data[CF0TH12_BYTE2_OFFSET] = ((val >> 8) & 0xFF);
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_SRCHALGOTYPE:
+ def_data_wrt.mode = FM_SRCH_CONFG_MODE;
+ def_data_wrt.length = FM_SRCH_CNFG_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[SRCH_ALGO_TYPE_OFFSET] = val;
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_AF_RMSSI_TH:
+ def_data_wrt.mode = FM_AFJUMP_CONFG_MODE;
+ def_data_wrt.length = FM_AFJUMP_CNFG_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[AF_RMSSI_TH_OFFSET] = (val & 0xFF);
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_GOOD_CH_RMSSI_TH:
+ def_data_wrt.mode = FM_AFJUMP_CONFG_MODE;
+ def_data_wrt.length = FM_AFJUMP_CNFG_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[GD_CH_RMSSI_TH_OFFSET] = val;
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_AF_RMSSI_SAMPLES:
+ def_data_wrt.mode = FM_AFJUMP_CONFG_MODE;
+ def_data_wrt.length = FM_AFJUMP_CNFG_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[AF_RMSSI_SAMPLES_OFFSET] = val;
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_RXREPEATCOUNT:
+ def_data_wrt.mode = RDS_PS0_XFR_MODE;
+ def_data_wrt.length = RDS_PS0_LEN;
+ memcpy(&def_data_wrt.data, &radio->def_data.data,
+ radio->def_data.data_len);
+ def_data_wrt.data[AF_RMSSI_SAMPLES_OFFSET] = val;
+ ret = hci_fm_default_data_write_req(&def_data_wrt);
+ break;
+ case HCI_FM_HELIUM_BLEND_SINRHI:
+ if (!is_valid_blend_value(val)) {
+ ALOGE("%s: sinr samples count is not valid\n", __func__);
+ ret = -1;
+ goto end;
}
+ radio->blend_tbl.BlendSinrHi = val;
+ ret = hci_fm_set_blend_tbl_req(&radio->blend_tbl);
+ break;
+ case HCI_FM_HELIUM_BLEND_RMSSIHI:
+ if (!is_valid_blend_value(val)) {
+ ALOGE("%s: sinr samples count is not valid\n", __func__);
+ ret = -1;
+ goto end;
+ }
+ radio->blend_tbl.BlendRmssiHi = val;
+ ret = hci_fm_set_blend_tbl_req(&radio->blend_tbl);
break;
default:
ALOGE("%s:%s: Not a valid FM CMD!!", LOG_TAG, __func__);
ret = 0;
break;
}
-END:
+end:
if (ret < 0)
ALOGE("%s:%s: %d cmd failed", LOG_TAG, __func__, cmd);
return ret;
}
-static void get_fm_ctrl(int cmd, int val)
+static int get_fm_ctrl(int cmd, int val)
{
int ret = 0;
+ struct hci_fm_def_data_rd_req def_data_rd;
+ ALOGE("%s: cmd = 0x%x", __func__, cmd);
switch(cmd) {
case HCI_FM_HELIUM_FREQ:
val = radio->fm_st_rsp.station_rsp.station_freq;
@@ -1292,24 +1531,127 @@
val = radio->recv_conf.band_low_limit;
break;
case HCI_FM_HELIUM_SINR_SAMPLES:
+ set_bit(ch_det_th_mask_flag, CMD_CHDET_SINR_SAMPLE);
ret = hci_fm_get_ch_det_th();
- if (ret == 0)
- val = radio->ch_det_threshold.sinr_samples;
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(ch_det_th_mask_flag, CMD_CHDET_SINR_SAMPLE);
break;
case HCI_FM_HELIUM_SINR_THRESHOLD:
+ set_bit(ch_det_th_mask_flag, CMD_CHDET_SINR_TH);
ret = hci_fm_get_ch_det_th();
- if (ret == 0)
- val = radio->ch_det_threshold.sinr;
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(ch_det_th_mask_flag, CMD_CHDET_SINR_TH);
break;
case HCI_FM_HELIUM_INTF_LOW_THRESHOLD:
+ set_bit(ch_det_th_mask_flag, CMD_CHDET_INTF_TH_LOW);
ret = hci_fm_get_ch_det_th();
- if (ret == 0)
- val = radio->ch_det_threshold.low_th;
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(ch_det_th_mask_flag, CMD_CHDET_INTF_TH_LOW);
break;
case HCI_FM_HELIUM_INTF_HIGH_THRESHOLD:
+ set_bit(ch_det_th_mask_flag, CMD_CHDET_INTF_TH_HIGH);
ret = hci_fm_get_ch_det_th();
- if (ret == 0)
- val = radio->ch_det_threshold.high_th;
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(ch_det_th_mask_flag, CMD_CHDET_INTF_TH_HIGH);
+ break;
+ case HCI_FM_HELIUM_SINRFIRSTSTAGE:
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_SINR_FIRST_STAGE);
+ def_data_rd.mode = FM_SRCH_CONFG_MODE;
+ def_data_rd.length = FM_SRCH_CNFG_LEN;
+ goto cmd;
+ case HCI_FM_HELIUM_RMSSIFIRSTSTAGE:
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_RMSSI_FIRST_STAGE);
+ def_data_rd.mode = FM_SRCH_CONFG_MODE;
+ def_data_rd.length = FM_SRCH_CNFG_LEN;
+ goto cmd;
+ case HCI_FM_HELIUM_CF0TH12:
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_CF0TH12);
+ def_data_rd.mode = FM_SRCH_CONFG_MODE;
+ def_data_rd.length = FM_SRCH_CNFG_LEN;
+ goto cmd;
+ case HCI_FM_HELIUM_SRCHALGOTYPE:
+ def_data_rd.mode = FM_SRCH_CONFG_MODE;
+ def_data_rd.length = FM_SRCH_CNFG_LEN;
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_SEARCH_ALGO);
+ goto cmd;
+ case HCI_FM_HELIUM_AF_RMSSI_TH:
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_AF_RMSSI_TH);
+ def_data_rd.mode = FM_AFJUMP_CONFG_MODE;
+ def_data_rd.length = FM_AFJUMP_CNFG_LEN;
+ goto cmd;
+ case HCI_FM_HELIUM_GOOD_CH_RMSSI_TH:
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_GD_CH_RMSSI_TH);
+ def_data_rd.mode = FM_AFJUMP_CONFG_MODE;
+ def_data_rd.length = FM_AFJUMP_CNFG_LEN;
+ goto cmd;
+ case HCI_FM_HELIUM_AF_RMSSI_SAMPLES:
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_AF_RMSSI_SAMPLE);
+ def_data_rd.mode = FM_AFJUMP_CONFG_MODE;
+ def_data_rd.length = FM_AFJUMP_CNFG_LEN;
+
+cmd:
+ def_data_rd.param_len = 0;
+ def_data_rd.param = 0;
+
+ ret = hci_fm_default_data_read_req(&def_data_rd);
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_all_bit(def_data_rd_mask_flag);
+ break;
+ case HCI_FM_HELIUM_RXREPEATCOUNT:
+ def_data_rd.mode = RDS_PS0_XFR_MODE;
+ def_data_rd.length = RDS_PS0_LEN;
+ def_data_rd.param_len = 0;
+ def_data_rd.param = 0;
+ set_bit(def_data_rd_mask_flag, CMD_DEFRD_REPEATCOUNT);
+
+ ret = hci_fm_default_data_read_req(&def_data_rd);
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(def_data_rd_mask_flag, CMD_DEFRD_REPEATCOUNT);
+ break;
+ case HCI_FM_HELIUM_BLEND_SINRHI:
+ set_bit(blend_tbl_mask_flag, CMD_BLENDTBL_SINR_HI);
+ ret = hci_fm_get_blend_req();
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(blend_tbl_mask_flag, CMD_BLENDTBL_SINR_HI);
+ case HCI_FM_HELIUM_BLEND_RMSSIHI:
+ set_bit(blend_tbl_mask_flag, CMD_BLENDTBL_RMSSI_HI);
+ ret = hci_fm_get_blend_req();
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(blend_tbl_mask_flag, CMD_BLENDTBL_RMSSI_HI);
+ break;
+ case HCI_FM_HELIUM_IOVERC:
+ set_bit(station_dbg_param_mask_flag, CMD_STNDBGPARAM_IOVERC);
+ ret = hci_fm_get_station_dbg_param_req();
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(station_dbg_param_mask_flag, CMD_STNDBGPARAM_IOVERC);
+ break;
+ case HCI_FM_HELIUM_INTDET:
+ set_bit(station_dbg_param_mask_flag, CMD_STNDBGPARAM_INFDETOUT);
+ ret = hci_fm_get_station_dbg_param_req();
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(station_dbg_param_mask_flag, CMD_STNDBGPARAM_INFDETOUT);
+ break;
+ case HCI_FM_HELIUM_GET_SINR:
+ if (radio->mode == FM_RECV) {
+ set_bit(station_param_mask_flag, CMD_STNPARAM_SINR);
+ ret = hci_fm_get_station_cmd_param_req();
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(station_param_mask_flag, CMD_STNPARAM_SINR);
+ } else {
+ ALOGE("HCI_FM_HELIUM_GET_SINR: radio is not in recv mode");
+ ret = -EINVAL;
+ }
+ break;
+ case HCI_FM_HELIUM_RMSSI:
+ if (radio->mode == FM_RECV) {
+ set_bit(station_param_mask_flag, CMD_STNPARAM_RSSI);
+ ret = hci_fm_get_station_cmd_param_req();
+ if (ret != FM_HC_STATUS_SUCCESS)
+ clear_bit(station_param_mask_flag, CMD_STNPARAM_RSSI);
+ } else if (radio->mode == FM_TRANS) {
+ ALOGE("HCI_FM_HELIUM_RMSSI: radio is not in recv mode");
+ ret = -EINVAL;
+ }
break;
default:
break;
diff --git a/helium/radio_helium_hal_cmds.c b/helium/radio_helium_hal_cmds.c
index df79d75..ea0b3c2 100644
--- a/helium/radio_helium_hal_cmds.c
+++ b/helium/radio_helium_hal_cmds.c
@@ -47,32 +47,28 @@
FM_HDR *hdr = (FM_HDR *) malloc(p_len);
if (!hdr) {
ALOGE("%s:hdr allocation failed", LOG_TAG);
- return -1;
+ return -FM_HC_STATUS_NOMEM;
}
- ALOGE("%s:%s: Sizeof FM_HDR: %d", LOG_TAG, __func__, sizeof(FM_HDR));
- ALOGE("%s:opcode: %x", LOG_TAG, opcode);
+ ALOGV("%s:opcode: %x", LOG_TAG, opcode);
- hdr->protocol_byte = 0x11;
+ hdr->protocol_byte = RADIO_HCI_COMMAND_PKT;
hdr->opcode = opcode;
hdr->plen = len;
if (len)
memcpy(hdr->cmd_params, (uint8_t *)param, len);
- ALOGE("%s:calling transmit", __func__);
- transmit(hdr);
- ALOGE("%s:transmit success",__func__);
- return 0;
+ ret = transmit(hdr);
+ ALOGV("%s:transmit done. status = %d", __func__, ret);
+ return ret;
}
int hci_fm_get_signal_threshold()
{
+ uint16_t opcode = 0;
- FM_HDR *hdr = (FM_HDR *) malloc(sizeof(FM_HDR));
- hdr->protocol_byte = FM_CMD;
- hdr->opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ, HCI_OCF_FM_GET_SIGNAL_THRESHOLD);
- hdr->plen = 0;
- transmit(hdr);
- return 0;
+ opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
+ HCI_OCF_FM_GET_SIGNAL_THRESHOLD);
+ return send_fm_cmd_pkt(opcode, 0, NULL);
}
int hci_fm_enable_recv_req()
@@ -109,7 +105,7 @@
if (s_list == NULL) {
ALOGE("%s:%s, search list param is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SEARCH_STATIONS_LIST);
@@ -122,7 +118,7 @@
if (rds_srch == NULL) {
ALOGE("%s:%s, rds stations param is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SEARCH_RDS_STATIONS);
@@ -135,7 +131,7 @@
if (srch == NULL) {
ALOGE("%s:%s, search station param is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SEARCH_STATIONS);
@@ -157,7 +153,7 @@
if (conf == NULL) {
ALOGE("%s:%s, recv conf is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SET_RECV_CONF_REQ);
@@ -198,11 +194,11 @@
if (th == NULL) {
ALOGE("%s:Threshold value NULL", LOG_TAG);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SET_SIGNAL_THRESHOLD);
- return send_fm_cmd_pkt(opcode, sizeof(th), th);
+ return send_fm_cmd_pkt(opcode, sizeof(th), &th);
}
int helium_rds_grp_mask_req(struct hci_fm_rds_grp_req *rds_grp_msk)
@@ -251,7 +247,7 @@
if (mute == NULL) {
ALOGE("%s:%s, mute mode is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SET_MUTE_MODE_REQ);
@@ -263,7 +259,7 @@
uint16_t opcode = 0;
int tune_freq = param;
- ALOGE("%s:tune_freq: %d", LOG_TAG, tune_freq);
+ ALOGV("%s:tune_freq: %d", LOG_TAG, tune_freq);
opcode = hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ,
HCI_OCF_FM_TUNE_STATION_REQ);
return send_fm_cmd_pkt(opcode, sizeof(tune_freq), &tune_freq);
@@ -277,7 +273,7 @@
if (stereo_mode_req == NULL) {
ALOGE("%s:%s, stere mode req is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SET_STEREO_MODE_REQ);
@@ -291,7 +287,7 @@
if (data == NULL) {
ALOGE("%s:%s, peek data req is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ,
HCI_OCF_FM_PEEK_DATA);
@@ -304,7 +300,7 @@
if (data == NULL) {
ALOGE("%s:%s, poke data req is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ,
HCI_OCF_FM_POKE_DATA);
@@ -317,7 +313,7 @@
if (data == NULL) {
ALOGE("%s:%s,SSBI poke data req is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ,
HCI_OCF_FM_SSBI_POKE_REG);
@@ -330,7 +326,7 @@
if (data == NULL) {
ALOGE("%s:%s,SSBI peek data req is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ,
HCI_OCF_FM_SSBI_PEEK_REG);
@@ -339,8 +335,9 @@
int hci_fm_get_ch_det_th()
{
+ ALOGV("%s", __func__);
uint16_t opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
- HCI_OCF_FM_GET_CH_DET_THRESHOLD);
+ HCI_OCF_FM_GET_CH_DET_THRESHOLD);
return send_fm_cmd_pkt(opcode, 0, NULL);
}
@@ -350,9 +347,81 @@
if (ch_det_th == NULL) {
ALOGE("%s,%s channel det thrshld is null\n", LOG_TAG, __func__);
- return -1;
+ return -EINVAL;
}
opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
HCI_OCF_FM_SET_CH_DET_THRESHOLD);
return send_fm_cmd_pkt(opcode, sizeof((*ch_det_th)), ch_det_th);
}
+
+int hci_fm_default_data_read_req(struct hci_fm_def_data_rd_req *def_data_rd)
+{
+ uint16_t opcode = 0;
+
+ if (def_data_rd == NULL) {
+ ALOGE("Def data read param is null");
+ return -EINVAL;
+ }
+
+ opcode = hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ,
+ HCI_OCF_FM_DEFAULT_DATA_READ);
+ return send_fm_cmd_pkt(opcode, sizeof(struct hci_fm_def_data_rd_req),
+ def_data_rd);
+}
+
+int hci_fm_get_blend_req()
+{
+ uint16_t opcode = 0;
+
+ opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
+ HCI_OCF_FM_GET_BLND_TBL);
+ return send_fm_cmd_pkt(opcode, 0, NULL);
+}
+
+int hci_fm_set_blend_tbl_req(struct hci_fm_blend_table *blnd_tbl)
+{
+ int opcode = 0;
+
+ if (blnd_tbl == NULL) {
+ ALOGE("Req param is null");
+ return -EINVAL;
+ }
+
+ opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
+ HCI_OCF_FM_SET_BLND_TBL);
+ return send_fm_cmd_pkt(opcode, sizeof(struct hci_fm_blend_table),
+ blnd_tbl);
+}
+
+int hci_fm_default_data_write_req(struct hci_fm_def_data_wr_req * data_wrt)
+{
+ int opcode = 0;
+
+ if (data_wrt == NULL) {
+ ALOGE("req param is null");
+ return -EINVAL;
+ }
+
+ opcode = hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ,
+ HCI_OCF_FM_DEFAULT_DATA_WRITE);
+ return send_fm_cmd_pkt(opcode, data_wrt->length + sizeof(char) * 2,
+ data_wrt);
+}
+
+int hci_fm_get_station_cmd_param_req()
+{
+ int opcode = 0;
+
+ opcode = hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ,
+ HCI_OCF_FM_GET_STATION_PARAM_REQ);
+ return send_fm_cmd_pkt(opcode, 0, NULL);
+}
+
+int hci_fm_get_station_dbg_param_req()
+{
+ int opcode = 0;
+
+ opcode = hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ,
+ HCI_OCF_FM_STATION_DBG_PARAM);
+ return send_fm_cmd_pkt(opcode, 0, NULL);
+}
diff --git a/jni/FmConst.h b/jni/FmConst.h
index 8c8d6f4..26eb616 100644
--- a/jni/FmConst.h
+++ b/jni/FmConst.h
@@ -152,6 +152,7 @@
V4L2_CID_PRV_IRIS_UPPER_BAND,
V4L2_CID_PRV_IRIS_LOWER_BAND,
V4L2_CID_PRV_IRIS_AUDIO_MODE,
+ V4L2_CID_PRV_IRIS_RMSSI,
};
#endif
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 21528bb..d1857e4 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -108,6 +108,15 @@
typedef void (*fm_ssbi_peek_cb)(char *ssbi_peek_rsp);
typedef void (*fm_ch_det_th_cb)(char *ch_det_rsp);
typedef void (*fm_ecc_evt_cb)(char *ecc);
+typedef void (*fm_sig_thr_cb)(int val, int status);
+typedef void (*fm_get_ch_det_thrs_cb) (int val, int status);
+typedef void (*fm_def_data_rd_cb) (int val, int status);
+typedef void (*fm_get_blnd_cb) (int val, int status);
+typedef void (*fm_set_ch_det_thrs_cb) (int status);
+typedef void (*fm_def_data_wrt_cb) (int status);
+typedef void (*fm_set_blnd_cb) (int status);
+typedef void (*fm_get_stn_prm_cb) (int val, int status);
+typedef void (*fm_get_stn_dbg_prm_cb) (int val, int status);
static JNIEnv *mCallbackEnv = NULL;
static jobject mCallbacksObj = NULL;
@@ -129,6 +138,15 @@
jmethodID method_stereostsCallback;
jmethodID method_rdsAvlStsCallback;
jmethodID method_disableCallback;
+jmethodID method_getSigThCallback;
+jmethodID method_getChDetThrCallback;
+jmethodID method_defDataRdCallback;
+jmethodID method_getBlendCallback;
+jmethodID method_setChDetThrCallback;
+jmethodID method_defDataWrtCallback;
+jmethodID method_setBlendCallback;
+jmethodID method_getStnParamCallback;
+jmethodID method_getStnDbgParamCallback;
static bool checkCallbackThread() {
JNIEnv* env = AndroidRuntime::getJNIEnv();
@@ -142,55 +160,55 @@
}
void fm_enabled_cb() {
- ALOGE("Entered %s", __func__);
+ ALOGD("Entered %s", __func__);
if (mCallbackEnv != NULL) {
ALOGE("javaObjectRef creating");
jobject javaObjectRef = mCallbackEnv->NewObject(javaClassRef, method_enableCallback);
mCallbacksObj = javaObjectRef;
ALOGE("javaObjectRef = %p mCallbackobject =%p \n",javaObjectRef,mCallbacksObj);
}
- ALOGE("exit %s", __func__);
+ ALOGD("exit %s", __func__);
}
void fm_tune_cb(int Freq)
{
- ALOGE("TUNE:Freq:%d", Freq);
+ ALOGD("TUNE:Freq:%d", Freq);
mCallbackEnv->CallVoidMethod(mCallbacksObj, method_tuneCallback, (jint) Freq);
}
void fm_seek_cmpl_cb(int Freq)
{
- ALOGE("SEEK_CMPL: Freq: %d", Freq);
+ ALOGI("SEEK_CMPL: Freq: %d", Freq);
mCallbackEnv->CallVoidMethod(mCallbacksObj, method_seekCmplCallback, (jint) Freq);
}
void fm_scan_next_cb()
{
- ALOGE("SCAN_NEXT");
+ ALOGI("SCAN_NEXT");
mCallbackEnv->CallVoidMethod(mCallbacksObj, method_scanNxtCallback);
}
void fm_srch_list_cb(uint16_t *scan_tbl)
{
- ALOGE("SRCH_LIST");
+ ALOGI("SRCH_LIST");
//mCallbackEnv->CallVoidMethod(javaObjectRef, method_srchListCallback);
}
void fm_stereo_status_cb(bool stereo)
{
- ALOGE("STEREO: %d", stereo);
+ ALOGI("STEREO: %d", stereo);
mCallbackEnv->CallVoidMethod(mCallbacksObj, method_stereostsCallback, (jboolean) stereo);
}
void fm_rds_avail_status_cb(bool rds_avl)
{
- ALOGE("fm_rds_avail_status_cb: %d", rds_avl);
+ ALOGD("fm_rds_avail_status_cb: %d", rds_avl);
mCallbackEnv->CallVoidMethod(mCallbacksObj, method_rdsAvlStsCallback, (jboolean) rds_avl);
}
void fm_af_list_update_cb(uint16_t *af_list)
{
- ALOGE("AF_LIST");
+ ALOGD("AF_LIST");
jbyteArray af_buffer = NULL;
if (!checkCallbackThread()) {
@@ -211,7 +229,7 @@
void fm_rt_update_cb(char *rt)
{
- ALOGE("RT_EVT: " );
+ ALOGD("RT_EVT: " );
jbyteArray rt_buff = NULL;
int i,len;
@@ -221,10 +239,10 @@
}
len = (int)(rt[0] & 0xFF);
- ALOGV(" rt data len=%d :",len);
+ ALOGD(" rt data len=%d :",len);
len = len+5;
- ALOGE(" rt data len=%d :",len);
+ ALOGD(" rt data len=%d :",len);
rt_buff = mCallbackEnv->NewByteArray(len);
if (rt_buff == NULL) {
ALOGE(" ps data allocate failed :");
@@ -251,7 +269,7 @@
numPs = (int)(ps[0] & 0xFF);
len = (numPs *8)+5;
- ALOGE(" ps data len=%d :",len);
+ ALOGD(" ps data len=%d :",len);
ps_data = mCallbackEnv->NewByteArray(len);
if(ps_data == NULL) {
ALOGE(" ps data allocate failed :");
@@ -266,17 +284,17 @@
void fm_oda_update_cb()
{
- ALOGE("ODA_EVT");
+ ALOGD("ODA_EVT");
}
void fm_rt_plus_update_cb(char *rt_plus)
{
jbyteArray RtPlus = NULL;
- ALOGE("RT_PLUS");
+ ALOGD("RT_PLUS");
int len;
len = (int)(rt_plus[0] & 0xFF);
- ALOGE(" rt plus len=%d :",len);
+ ALOGD(" rt plus len=%d :",len);
RtPlus = mCallbackEnv->NewByteArray(len);
if (RtPlus == NULL) {
ALOGE(" rt plus data allocate failed :");
@@ -289,7 +307,7 @@
void fm_ert_update_cb(char *ert)
{
- ALOGI("ERT_EVT");
+ ALOGD("ERT_EVT");
jbyteArray ert_buff = NULL;
int i,len;
@@ -341,7 +359,7 @@
void rds_grp_cntrs_rsp_cb(char * evt_buffer)
{
- ALOGE("rds_grp_cntrs_rsp_cb");
+ ALOGD("rds_grp_cntrs_rsp_cb");
}
void fm_disabled_cb()
@@ -351,15 +369,15 @@
}
void fm_peek_rsp_cb(char *peek_rsp) {
- ALOGE("fm_peek_rsp_cb");
+ ALOGD("fm_peek_rsp_cb");
}
void fm_ssbi_peek_rsp_cb(char *ssbi_peek_rsp){
- ALOGE("fm_ssbi_peek_rsp_cb");
+ ALOGD("fm_ssbi_peek_rsp_cb");
}
void fm_ch_det_th_rsp_cb(char *ch_det_rsp){
- ALOGE("fm_ch_det_th_rsp_cb");
+ ALOGD("fm_ch_det_th_rsp_cb");
}
static void fm_thread_evt_cb(unsigned int event) {
@@ -371,7 +389,7 @@
args.name = name;
args.group = NULL;
vm->AttachCurrentThread(&mCallbackEnv, &args);
- ALOGE("satish: Callback thread attached: %p", mCallbackEnv);
+ ALOGD("Callback thread attached: %p", mCallbackEnv);
} else if (event == 1) {
if (!checkCallbackThread()) {
ALOGE("Callback: '%s' is not called on the correct thread", __FUNCTION__);
@@ -380,6 +398,70 @@
vm->DetachCurrentThread();
}
}
+
+static void fm_get_sig_thres_cb(int val, int status)
+{
+ ALOGD("Get signal Thres callback");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_getSigThCallback, val, status);
+}
+
+static void fm_get_ch_det_thr_cb(int val, int status)
+{
+ ALOGD("fm_get_ch_det_thr_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_getChDetThrCallback, val, status);
+}
+
+static void fm_set_ch_det_thr_cb(int status)
+{
+ ALOGD("fm_set_ch_det_thr_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_setChDetThrCallback, status);
+}
+
+static void fm_def_data_read_cb(int val, int status)
+{
+ ALOGD("fm_def_data_read_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_defDataRdCallback, val, status);
+}
+
+static void fm_def_data_write_cb(int status)
+{
+ ALOGD("fm_def_data_write_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_defDataWrtCallback, status);
+}
+
+static void fm_get_blend_cb(int val, int status)
+{
+ ALOGD("fm_get_blend_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_getBlendCallback, val, status);
+}
+
+static void fm_set_blend_cb(int status)
+{
+ ALOGD("fm_set_blend_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_setBlendCallback, status);
+}
+
+static void fm_get_station_param_cb(int val, int status)
+{
+ ALOGD("fm_get_station_param_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_getStnParamCallback, val, status);
+}
+
+static void fm_get_station_debug_param_cb(int val, int status)
+{
+ ALOGD("fm_get_station_debug_param_cb");
+
+ mCallbackEnv->CallVoidMethod(mCallbacksObj, method_getStnDbgParamCallback, val, status);
+}
+
typedef struct {
size_t size;
@@ -403,6 +485,15 @@
fm_ch_det_th_cb fm_ch_det_th_rsp_cb;
fm_ecc_evt_cb ext_country_code_cb;
callback_thread_event thread_evt_cb;
+ fm_sig_thr_cb fm_get_sig_thres_cb;
+ fm_get_ch_det_thrs_cb fm_get_ch_det_thr_cb;
+ fm_def_data_rd_cb fm_def_data_read_cb;
+ fm_get_blnd_cb fm_get_blend_cb;
+ fm_set_ch_det_thrs_cb fm_set_ch_det_thr_cb;
+ fm_def_data_wrt_cb fm_def_data_write_cb;
+ fm_set_blnd_cb fm_set_blend_cb;
+ fm_get_stn_prm_cb fm_get_station_param_cb;
+ fm_get_stn_dbg_prm_cb fm_get_station_debug_param_cb;
} fm_vendor_callbacks_t;
typedef struct {
@@ -434,7 +525,16 @@
fm_ssbi_peek_rsp_cb,
fm_ch_det_th_rsp_cb,
fm_ext_country_code_cb,
- fm_thread_evt_cb
+ fm_thread_evt_cb,
+ fm_get_sig_thres_cb,
+ fm_get_ch_det_thr_cb,
+ fm_def_data_read_cb,
+ fm_get_blend_cb,
+ fm_set_ch_det_thr_cb,
+ fm_def_data_write_cb,
+ fm_set_blend_cb,
+ fm_get_station_param_cb,
+ fm_get_station_debug_param_cb
};
#endif
/* native interface */
@@ -734,6 +834,15 @@
int err;
long rmssi;
+#ifdef FM_SOC_TYPE_CHEROKEE
+ err = vendor_interface->get_fm_ctrl(V4L2_CID_PRV_IRIS_RMSSI, rmssi);
+ if (err < 0) {
+ ALOGE("%s: Get Rssi failed", LOG_TAG);
+ err = FM_JNI_FAILURE;
+ } else {
+ err = FM_JNI_SUCCESS;
+ }
+#else
if (fd >= 0) {
err = FmIoctlsInterface :: get_rmssi(fd, rmssi);
if (err < 0) {
@@ -747,7 +856,7 @@
LOG_TAG, fd);
err = FM_JNI_FAILURE;
}
-
+#endif
return err;
}
@@ -1393,6 +1502,15 @@
method_stereostsCallback = env->GetMethodID(javaClassRef, "stereostsCallback", "(Z)V");
method_rdsAvlStsCallback = env->GetMethodID(javaClassRef, "rdsAvlStsCallback", "(Z)V");
method_disableCallback = env->GetMethodID(javaClassRef, "disableCallback", "()V");
+ method_getSigThCallback = env->GetMethodID(javaClassRef, "getSigThCallback", "(II)V");
+ method_getChDetThrCallback = env->GetMethodID(javaClassRef, "getChDetThCallback", "(II)V");
+ method_defDataRdCallback = env->GetMethodID(javaClassRef, "DefDataRdCallback", "(II)V");
+ method_getBlendCallback = env->GetMethodID(javaClassRef, "getBlendCallback", "(II)V");
+ method_setChDetThrCallback = env->GetMethodID(javaClassRef, "setChDetThCallback","(I)V");
+ method_defDataWrtCallback = env->GetMethodID(javaClassRef, "DefDataWrtCallback", "(I)V");
+ method_setBlendCallback = env->GetMethodID(javaClassRef, "setBlendCallback", "(I)V");
+ method_getStnParamCallback = env->GetMethodID(javaClassRef, "getStnParamCallback", "(II)V");
+ method_getStnDbgParamCallback = env->GetMethodID(javaClassRef, "getStnDbgParamCallback", "(II)V");
return;
error:
diff --git a/qcom/fmradio/FmReceiver.java b/qcom/fmradio/FmReceiver.java
index 8e681e7..c61b78e 100644
--- a/qcom/fmradio/FmReceiver.java
+++ b/qcom/fmradio/FmReceiver.java
@@ -1455,7 +1455,7 @@
try
{
- String rdsStr = new String(buff, 5, numOfPs*8 );
+ String rdsStr = new String(buff, 5, numOfPs*8 );
mRdsData.setPrgmServices (rdsStr);
} catch (StringIndexOutOfBoundsException x)
@@ -2018,6 +2018,16 @@
return mControl.setPSRxRepeatCount(sFd, count);
}
+ public boolean getPSRxRepeatCount() {
+ int state = getFMState();
+ /* Check current state of FM device */
+ if (state == FMState_Turned_Off){
+ Log.d(TAG, "setRxRepeatcount failed");
+ return false;
+ }
+ return mControl.getPSRxRepeatCount(sFd);
+ }
+
public byte getBlendSinr() {
int state = getFMState();
if ((state == FMState_Turned_Off) || (state == FMState_Srch_InProg)) {
@@ -2027,7 +2037,7 @@
return mControl.getBlendSinr(sFd);
}
- public boolean setBlendSinr(byte sinrHi) {
+ public boolean setBlendSinr(int sinrHi) {
int state = getFMState();
if ((state == FMState_Turned_Off) || (state == FMState_Srch_InProg)) {
Log.d(TAG, "setBlendSinr: Device currently busy in executing another command.");
@@ -2045,7 +2055,7 @@
return mControl.getBlendRmssi(sFd);
}
- public boolean setBlendRmssi(byte rmssiHi) {
+ public boolean setBlendRmssi(int rmssiHi) {
int state = getFMState();
if ((state == FMState_Turned_Off) || (state == FMState_Srch_InProg)) {
Log.d(TAG, "setBlendRmssi: Device currently busy in executing another command.");
@@ -2318,7 +2328,7 @@
*
* <p>
* @return IOVERC of currently tuned station on Success.
- * -1 on failure to retrieve the current IoverC.
+ * -1 on failure to retrieve the current IoverC.
*/
public int getIoverc()
{
@@ -2339,7 +2349,7 @@
*
* <p>
* @return IntDet of currently tuned station.
- * -1 on failure to retrieve the current IntDet
+ * -1 on failure to retrieve the current IntDet
*/
public int getIntDet()
{
@@ -2510,9 +2520,14 @@
*
* <p>
*/
- public int getOnChannelThreshold()
+ public boolean getOnChannelThreshold()
{
- return mControl.getOnChannelThreshold(sFd);
+ int re = mControl.getOnChannelThreshold(sFd);
+
+ if (re != 0)
+ return false;
+ else
+ return true;
}
/*==============================================================
@@ -2545,9 +2560,14 @@
*
* <p>
*/
- public int getOffChannelThreshold()
+ public boolean getOffChannelThreshold()
{
- return mControl.getOffChannelThreshold(sFd);
+ int re = mControl.getOffChannelThreshold(sFd);
+
+ if (re != 0)
+ return false;
+ else
+ return true;
}
/*===============================================================
FUNCTION: getSINR
diff --git a/qcom/fmradio/FmReceiverJNI.java b/qcom/fmradio/FmReceiverJNI.java
index d085476..e587b44 100644
--- a/qcom/fmradio/FmReceiverJNI.java
+++ b/qcom/fmradio/FmReceiverJNI.java
@@ -80,6 +80,53 @@
Log.e(TAG, "AflistCallback exit " );
}
+ public void getSigThCallback(int val, int status)
+ {
+ Log.d(TAG, "get Signal Threshold callback");
+
+ FmReceiver.mCallback.FmRxEvGetSignalThreshold(val, status);
+ }
+
+ public void getChDetThCallback(int val, int status)
+ {
+ FmReceiver.mCallback.FmRxEvGetChDetThreshold(val, status);
+ }
+
+ public void setChDetThCallback(int status)
+ {
+ FmReceiver.mCallback.FmRxEvSetChDetThreshold(status);
+ }
+
+ public void DefDataRdCallback(int val, int status)
+ {
+ FmReceiver.mCallback.FmRxEvDefDataRead(val, status);
+ }
+
+ public void DefDataWrtCallback(int status)
+ {
+ FmReceiver.mCallback.FmRxEvDefDataWrite(status);
+ }
+
+ public void getBlendCallback(int val, int status)
+ {
+ FmReceiver.mCallback.FmRxEvGetBlend(val, status);
+ }
+
+ public void setBlendCallback(int status)
+ {
+ FmReceiver.mCallback.FmRxEvSetBlend(status);
+ }
+
+ public void getStnParamCallback(int val, int status)
+ {
+ FmReceiver.mCallback.FmRxGetStationParam(val, status);
+ }
+
+ public void getStnDbgParamCallback(int val, int status)
+ {
+ FmReceiver.mCallback.FmRxGetStationDbgParam(val, status);
+ }
+
public void RtPlusCallback(byte[] rtplus) {
Log.d(TAG, "RtPlusCallback enter " );
if (rtplus == null) {
diff --git a/qcom/fmradio/FmRxControls.java b/qcom/fmradio/FmRxControls.java
index 767d56f..701448f 100644
--- a/qcom/fmradio/FmRxControls.java
+++ b/qcom/fmradio/FmRxControls.java
@@ -738,11 +738,21 @@
}
}
+ public boolean getPSRxRepeatCount(int fd) {
+ int ret;
+ ret = FmReceiverJNI.getControlNative(fd, V4L2_CID_PRIVATE_RXREPEATCOUNT);
+ if (ret < 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
public byte getBlendSinr(int fd) {
return (byte)FmReceiverJNI.getControlNative(fd, V4L2_CID_PRIVATE_BLEND_SINRHI);
}
- public boolean setBlendSinr(int fd, byte sinrHi) {
+ public boolean setBlendSinr(int fd, int sinrHi) {
int ret;
ret = FmReceiverJNI.setControlNative(fd, V4L2_CID_PRIVATE_BLEND_SINRHI, sinrHi);
if(ret < 0) {
@@ -757,7 +767,7 @@
return (byte)FmReceiverJNI.getControlNative(fd, V4L2_CID_PRIVATE_BLEND_RMSSIHI);
}
- public boolean setBlendRmssi(int fd, byte rmssiHi) {
+ public boolean setBlendRmssi(int fd, int rmssiHi) {
int ret;
ret = FmReceiverJNI.setControlNative(fd, V4L2_CID_PRIVATE_BLEND_RMSSIHI, rmssiHi);
if(ret < 0) {
diff --git a/qcom/fmradio/FmRxEvCallbacksAdaptor.java b/qcom/fmradio/FmRxEvCallbacksAdaptor.java
index 753d506..59953e8 100644
--- a/qcom/fmradio/FmRxEvCallbacksAdaptor.java
+++ b/qcom/fmradio/FmRxEvCallbacksAdaptor.java
@@ -52,5 +52,13 @@
public void FmRxEvRTPlus() {};
public void FmRxEvERTInfo() {};
public void FmRxEvECCInfo() {};
+ public void FmRxEvGetSignalThreshold(int val, int status) {};
+ public void FmRxEvGetChDetThreshold(int val, int status) {};
+ public void FmRxEvDefDataRead(int val, int status) {};
+ public void FmRxEvGetBlend(int val, int status) {};
+ public void FmRxEvSetChDetThreshold(int status) {};
+ public void FmRxEvDefDataWrite(int status) {};
+ public void FmRxEvSetBlend(int status) {};
+ public void FmRxGetStationParam(int val, int status) {};
+ public void FmRxGetStationDbgParam(int val, int status) {};
}
-