From a04f48420ffc2c1a33e743d5075f24809161b2fd Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 27 Nov 2008 18:38:03 +0200 Subject: Implement support for AT+NREC This patch adds support for the AT+NREC command which can be used for disabling noice reduction and echo canceling features on the AG side. --- audio/headset.c | 16 ++++++++++++++++ audio/telephony-dummy.c | 6 ++++++ audio/telephony.h | 2 ++ 3 files changed, 24 insertions(+) diff --git a/audio/headset.c b/audio/headset.c index be07e424..c21c208d 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -1007,6 +1007,11 @@ int telephony_call_hold_rsp(void *telephony_device, cme_error_t err) return telephony_generic_rsp(telephony_device, err); } +int telephony_disable_nr_and_ec_rsp(void *telephony_device, cme_error_t err) +{ + return telephony_generic_rsp(telephony_device, err); +} + int telephony_operator_selection_ind(int mode, const char *oper) { if (!active_devices) @@ -1037,6 +1042,16 @@ static int operator_selection(struct audio_device *device, const char *buf) return 0; } +static int disable_nr_and_ec(struct audio_device *device, const char *buf) +{ + if (strlen(buf) < 9) + return -EINVAL; + + telephony_disable_nr_and_ec_req(device); + + return 0; +} + static struct event event_callbacks[] = { { "ATA", answer_call }, { "ATD", dial_number }, @@ -1056,6 +1071,7 @@ static struct event event_callbacks[] = { { "AT+CMEE", extended_errors }, { "AT+CCWA", call_waiting_notify }, { "AT+COPS", operator_selection }, + { "AT+NREC", disable_nr_and_ec }, { 0 } }; diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c index b857183f..0c7ff9d9 100644 --- a/audio/telephony-dummy.c +++ b/audio/telephony-dummy.c @@ -196,6 +196,12 @@ 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) +{ + debug("telephony-dummy: got disable NR and EC request"); + telephony_disable_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE); +} + /* D-Bus method handlers */ static DBusMessage *outgoing_call(DBusConnection *conn, DBusMessage *msg, void *data) diff --git a/audio/telephony.h b/audio/telephony.h index 5e972e74..0eb0f44e 100644 --- a/audio/telephony.h +++ b/audio/telephony.h @@ -146,6 +146,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); /* AG responses to HF requests. These are implemented by headset.c */ int telephony_event_reporting_rsp(void *telephony_device, cme_error_t err); @@ -159,6 +160,7 @@ int telephony_subscriber_number_rsp(void *telephony_device, cme_error_t err); int telephony_list_current_calls_rsp(void *telephony_device, cme_error_t err); int telephony_operator_selection_rsp(void *telephony_device, cme_error_t err); 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); /* Event indications by AG. These are implemented by headset.c */ int telephony_event_ind(int index); -- cgit