Merge "FMStats: Don't run runnable in context of handler"
diff --git a/helium/radio-helium-commands.h b/helium/radio-helium-commands.h
index 352017e..da02f52 100644
--- a/helium/radio-helium-commands.h
+++ b/helium/radio-helium-commands.h
@@ -97,6 +97,7 @@
HCI_FM_HELIUM_AF_JUMP_RSSI_TH,
HCI_FM_HELIUM_BLEND_SINRHI,
HCI_FM_HELIUM_BLEND_RMSSIHI,
+ HCI_FM_HELIUM_RDS_GRP_COUNTERS_EXT,
HCI_FM_HELIUM_AGC_UCCTRL = 0x8000043, /* 0x8000043 */
HCI_FM_HELIUM_AGC_GAIN_STATE,
diff --git a/helium/radio-helium.h b/helium/radio-helium.h
index cb72cd5..4437748 100644
--- a/helium/radio-helium.h
+++ b/helium/radio-helium.h
@@ -164,6 +164,7 @@
typedef void (*disable_cb)();
typedef void (*callback_thread_event)(unsigned int evt);
typedef void (*rds_grp_cntrs_cb)(char *rds_params);
+typedef void (*rds_grp_cntrs_ext_cb)(char *rds_params);
typedef void (*fm_peek_cb)(char *peek_rsp);
typedef void (*fm_ssbi_peek_cb)(char *ssbi_peek_rsp);
typedef void (*fm_agc_gain_cb)(char *agc_gain_rsp);
@@ -197,6 +198,7 @@
ert_cb ert_update_cb;
disable_cb disabled_cb;
rds_grp_cntrs_cb rds_grp_cntrs_rsp_cb;
+ rds_grp_cntrs_ext_cb rds_grp_cntrs_ext_rsp_cb;
fm_peek_cb fm_peek_rsp_cb;
fm_ssbi_peek_cb fm_ssbi_peek_rsp_cb;
fm_agc_gain_cb fm_agc_gain_rsp_cb;
@@ -304,6 +306,9 @@
/*HCI Status parameters commands*/
#define HCI_OCF_FM_READ_GRP_COUNTERS 0x0001
+#define HCI_OCF_FM_READ_GRP_COUNTERS_EXT 0x0002
+
+
/*HCI Diagnostic commands*/
#define HCI_OCF_FM_PEEK_DATA 0x0002
#define HCI_OCF_FM_POKE_DATA 0x0003
@@ -1250,6 +1255,7 @@
int hci_fm_set_recv_conf_req (struct hci_fm_recv_conf_req *conf);
int hci_fm_get_program_service_req ();
int hci_fm_get_rds_grpcounters_req (int val);
+int hci_fm_get_rds_grpcounters_ext_req (int val);
int hci_fm_set_notch_filter_req (int val);
int helium_set_sig_threshold_req(char th);
int helium_rds_grp_mask_req(struct hci_fm_rds_grp_req *rds_grp_msk);
diff --git a/helium/radio_helium_hal.c b/helium/radio_helium_hal.c
index 2412b42..c3dc559 100644
--- a/helium/radio_helium_hal.c
+++ b/helium/radio_helium_hal.c
@@ -105,7 +105,7 @@
static void hci_cc_fm_disable_rsp(char *ev_buff)
{
char status;
- int ret;
+ int ret;
if (ev_buff == NULL) {
ALOGE("%s:%s, buffer is null\n", LOG_TAG, __func__);
@@ -115,15 +115,13 @@
status = (char) *ev_buff;
radio_hci_req_complete(status);
if (radio->mode == FM_TURNING_OFF) {
- jni_cb->disabled_cb();
radio->mode = FM_OFF;
jni_cb->disabled_cb();
jni_cb->thread_evt_cb(1);
//close the userial port and power off the chip
ret = fm_power(FM_RADIO_DISABLE);
ALOGI("fm power off status = %d", ret);
- ALOGE("%s:calling fm userial close\n", LOG_TAG );
- // sleep(1);
+ ALOGI("%s:calling fm userial close\n", LOG_TAG );
fm_userial_close();
// fm_power(FM_RADIO_DISABLE);
}
@@ -150,14 +148,29 @@
return;
}
status = ev_buff[0];
- ALOGE("%s:%s, status =%d\n", LOG_TAG, __func__,status);
- if(status < 0)
- {
+ ALOGI("%s:%s, status =%d\n", LOG_TAG, __func__,status);
+ if (status < 0) {
ALOGE("%s:%s, read rds_grp_cntrs failed status=%d\n", LOG_TAG, __func__,status);
}
jni_cb->rds_grp_cntrs_rsp_cb(&ev_buff[1]);
}
+static void hci_cc_rds_grp_cntrs_ext_rsp(char *ev_buff)
+{
+ char status;
+ int i;
+ if (ev_buff == NULL) {
+ ALOGE("%s:%s, buffer is null\n", LOG_TAG, __func__);
+ return;
+ }
+ status = ev_buff[0];
+ ALOGI("%s:%s, status =%d\n", LOG_TAG, __func__,status);
+ if (status < 0) {
+ ALOGE("%s:%s, read rds_grp_cntrs_ext failed status=%d\n", LOG_TAG, __func__,status);
+ }
+ jni_cb->rds_grp_cntrs_ext_rsp_cb(&ev_buff[1]);
+}
+
static void hci_cc_riva_peek_rsp(char *ev_buff)
{
char status;
@@ -440,6 +453,9 @@
case hci_status_param_op_pack(HCI_OCF_FM_READ_GRP_COUNTERS):
hci_cc_rds_grp_cntrs_rsp(pbuf);
break;
+ case hci_status_param_op_pack(HCI_OCF_FM_READ_GRP_COUNTERS_EXT):
+ hci_cc_rds_grp_cntrs_ext_rsp(pbuf);
+ break;
case hci_diagnostic_cmd_op_pack(HCI_OCF_FM_PEEK_DATA):
hci_cc_riva_peek_rsp(buff);
break;
@@ -761,7 +777,7 @@
static void hci_ev_ext_country_code(char *buff)
{
char *data = NULL;
- int len = 15;
+ int len = ECC_EVENT_BUFSIZE;
ALOGD("%s:%s: start", LOG_TAG, __func__);
data = malloc(len);
if (data != NULL) {
@@ -1293,6 +1309,15 @@
}
break;
+ case HCI_FM_HELIUM_RDS_GRP_COUNTERS_EXT:
+ ALOGD("%s: rds_grp counter read value=%d ", LOG_TAG,val);
+ ret = hci_fm_get_rds_grpcounters_ext_req(val);
+ if (ret < 0) {
+ radio->g_rds_grp_proc_ps = saved_val;
+ goto end ;
+ }
+ break;
+
case HCI_FM_HELIUM_SET_NOTCH_FILTER:
ALOGD("%s: set notch filter notch=%d ", LOG_TAG,val);
ret = hci_fm_set_notch_filter_req(val);
diff --git a/helium/radio_helium_hal_cmds.c b/helium/radio_helium_hal_cmds.c
index f9c307a..8feb41f 100644
--- a/helium/radio_helium_hal_cmds.c
+++ b/helium/radio_helium_hal_cmds.c
@@ -178,6 +178,16 @@
return send_fm_cmd_pkt(opcode, sizeof(val), &val);
}
+int hci_fm_get_rds_grpcounters_ext_req (int val)
+{
+ uint16_t opcode = 0;
+
+ opcode = hci_opcode_pack(HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ,
+ HCI_OCF_FM_READ_GRP_COUNTERS_EXT);
+ return send_fm_cmd_pkt(opcode, sizeof(val), &val);
+}
+
+
int hci_fm_set_notch_filter_req (int val)
{
uint16_t opcode = 0;
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index dd439fc..163ce9b 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -104,6 +104,8 @@
typedef void (*disable_cb)();
typedef void (*callback_thread_event)(unsigned int evt);
typedef void (*rds_grp_cntrs_cb)(char *rds_params);
+typedef void (*rds_grp_cntrs_ext_cb)(char *rds_params);
+
typedef void (*fm_peek_cb)(char *peek_rsp);
typedef void (*fm_ssbi_peek_cb)(char *ssbi_peek_rsp);
typedef void (*fm_agc_gain_cb)(char *agc_gain_rsp);
@@ -363,6 +365,11 @@
ALOGD("rds_grp_cntrs_rsp_cb");
}
+void rds_grp_cntrs_ext_rsp_cb(char * evt_buffer)
+{
+ ALOGE("rds_grp_cntrs_ext_rsp_cb");
+}
+
void fm_disabled_cb()
{
ALOGE("DISABLE");
@@ -485,6 +492,7 @@
ert_cb ert_update_cb;
disable_cb disabled_cb;
rds_grp_cntrs_cb rds_grp_cntrs_rsp_cb;
+ rds_grp_cntrs_ext_cb rds_grp_cntrs_ext_rsp_cb;
fm_peek_cb fm_peek_rsp_cb;
fm_ssbi_peek_cb fm_ssbi_peek_rsp_cb;
fm_agc_gain_cb fm_agc_gain_rsp_cb;
@@ -527,6 +535,7 @@
fm_ert_update_cb,
fm_disabled_cb,
rds_grp_cntrs_rsp_cb,
+ rds_grp_cntrs_ext_rsp_cb,
fm_peek_rsp_cb,
fm_ssbi_peek_rsp_cb,
fm_agc_gain_rsp_cb,