summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-12-04 14:13:06 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2008-12-04 14:13:06 +0200
commit559e6476a17f8bfaff7ad79e0bfc04a87edc044b (patch)
treeae2df2f5a1a5e122aeee6f874efb103c0a19792b
parent2cfe2bae7b0e82ab61b0f28805c3312646b08b67 (diff)
Clean up AT+NREC behavior and API
In HFP 1.5 only AT+NREC=0 should be possible, but to accomodate for future profile changes make the telephony.h API such that AT+NREC=1 is possible without breaking the API.
-rw-r--r--audio/headset.c20
-rw-r--r--audio/telephony-dummy.c6
-rw-r--r--audio/telephony.h2
3 files changed, 24 insertions, 4 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 1510c27e..a5701018 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -145,6 +145,8 @@ struct headset {
gboolean cme_enabled;
gboolean cwa_enabled;
gboolean pending_ring;
+ gboolean nrec;
+ gboolean nrec_req;
headset_state_t state;
struct pending_connect *pending;
@@ -1009,6 +1011,12 @@ int telephony_call_hold_rsp(void *telephony_device, cme_error_t err)
int telephony_disable_nr_and_ec_rsp(void *telephony_device, cme_error_t err)
{
+ struct audio_device *device = telephony_device;
+ struct headset *hs = device->headset;
+
+ if (err == CME_ERROR_NONE)
+ hs->nrec = hs->nrec_req;
+
return telephony_generic_rsp(telephony_device, err);
}
@@ -1044,10 +1052,17 @@ static int operator_selection(struct audio_device *device, const char *buf)
static int disable_nr_and_ec(struct audio_device *device, const char *buf)
{
+ struct headset *hs = device->headset;
+
if (strlen(buf) < 9)
return -EINVAL;
- telephony_disable_nr_and_ec_req(device);
+ if (buf[8] == '0')
+ hs->nrec_req = FALSE;
+ else
+ hs->nrec_req = TRUE;
+
+ telephony_disable_nr_and_ec_req(device, hs->nrec_req);
return 0;
}
@@ -2006,6 +2021,7 @@ struct headset *headset_init(struct audio_device *dev, uint16_t svc,
hs->search_hfp = server_is_enabled(&dev->src, HANDSFREE_SVCLASS_ID);
hs->hfp_active = FALSE;
hs->cli_active = FALSE;
+ hs->nrec = TRUE;
record = btd_device_get_record(dev->btd_dev, uuidstr);
if (!record)
@@ -2276,6 +2292,8 @@ static int headset_close_rfcomm(struct audio_device *dev)
hs->data_start = 0;
hs->data_length = 0;
+ hs->nrec = TRUE;
+
return 0;
}
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 780d715d..9c13e91d 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -197,9 +197,11 @@ void telephony_call_hold_req(void *telephony_device, const char *cmd)
telephony_call_hold_rsp(telephony_device, CME_ERROR_NONE);
}
-void telephony_disable_nr_and_ec_req(void *telephony_device)
+void telephony_disable_nr_and_ec_req(void *telephony_device, gboolean enable)
{
- debug("telephony-dummy: got disable NR and EC request");
+ debug("telephony-dummy: got %s NR and EC request",
+ enable ? "enable" : "disable");
+
telephony_disable_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE);
}
diff --git a/audio/telephony.h b/audio/telephony.h
index ac7625ea..084b1571 100644
--- a/audio/telephony.h
+++ b/audio/telephony.h
@@ -153,7 +153,7 @@ void telephony_subscriber_number_req(void *telephony_device);
void telephony_list_current_calls_req(void *telephony_device);
void telephony_operator_selection_req(void *telephony_device);
void telephony_call_hold_req(void *telephony_device, const char *cmd);
-void telephony_disable_nr_and_ec_req(void *telephony_device);
+void telephony_disable_nr_and_ec_req(void *telephony_device, gboolean enable);
/* AG responses to HF requests. These are implemented by headset.c */
int telephony_event_reporting_rsp(void *telephony_device, cme_error_t err);