aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.ru>2010-01-14 23:29:59 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-01-15 08:53:44 +0200
commit0218ab79ea881c593111b7165cd57337c711d2ec (patch)
treec39f0dc1e591d1f954d77294949b82b07cdee288
parent3848d1157013504d0a835a69dbfce3ef02870d31 (diff)
Add preliminary voice dialling support for HSP
-rw-r--r--audio/headset.c23
-rw-r--r--audio/telephony-dummy.c21
-rw-r--r--audio/telephony-maemo.c8
-rw-r--r--audio/telephony-ofono.c8
-rw-r--r--audio/telephony.h2
5 files changed, 60 insertions, 2 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 765ddb0f09..7002a3a5dc 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1084,6 +1084,11 @@ int telephony_nr_and_ec_rsp(void *telephony_device, cme_error_t err)
return telephony_generic_rsp(telephony_device, err);
}
+int telephony_voice_dial_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)
@@ -1132,6 +1137,23 @@ static int nr_and_ec(struct audio_device *device, const char *buf)
return 0;
}
+static int voice_dial(struct audio_device *device, const char *buf)
+{
+ gboolean enable;
+
+ if (strlen(buf) < 9)
+ return -EINVAL;
+
+ if (buf[8] == '0')
+ enable = FALSE;
+ else
+ enable = TRUE;
+
+ telephony_voice_dial_req(device, enable);
+
+ return 0;
+}
+
static struct event event_callbacks[] = {
{ "ATA", answer_call },
{ "ATD", dial_number },
@@ -1152,6 +1174,7 @@ static struct event event_callbacks[] = {
{ "AT+CCWA", call_waiting_notify },
{ "AT+COPS", operator_selection },
{ "AT+NREC", nr_and_ec },
+ { "AT+BVRA", voice_dial },
{ 0 }
};
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 5478d03bf9..2409a4906a 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -36,6 +36,8 @@
#include "logging.h"
#include "telephony.h"
+static DBusConnection *connection = NULL;
+
static const char *chld_str = "0,1,1x,2,2x,3,4";
static char *subscriber_number = NULL;
static char *active_call_number = NULL;
@@ -205,6 +207,18 @@ void telephony_nr_and_ec_req(void *telephony_device, gboolean enable)
telephony_nr_and_ec_rsp(telephony_device, CME_ERROR_NONE);
}
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+ debug("telephony-dummy: got %s voice dial request",
+ enable ? "enable" : "disable");
+
+ g_dbus_emit_signal(connection, "/org/bluez/test",
+ "org.bluez.TelephonyTest", "VoiceDial",
+ DBUS_TYPE_INVALID);
+
+ telephony_voice_dial_rsp(telephony_device, CME_ERROR_NONE);
+}
+
void telephony_key_press_req(void *telephony_device, const char *keys)
{
debug("telephony-dummy: got key press request for %s", keys);
@@ -389,7 +403,10 @@ static GDBusMethodTable dummy_methods[] = {
{ }
};
-static DBusConnection *connection = NULL;
+static GDBusSignalTable dummy_signals[] = {
+ { "VoiceDial", "" },
+ { }
+};
int telephony_init(void)
{
@@ -401,7 +418,7 @@ int telephony_init(void)
g_dbus_register_interface(connection, "/org/bluez/test",
"org.bluez.TelephonyTest",
- dummy_methods, NULL,
+ dummy_methods, dummy_signals,
NULL, NULL, NULL);
telephony_ready_ind(features, dummy_indicators, response_and_hold,
diff --git a/audio/telephony-maemo.c b/audio/telephony-maemo.c
index f8da349842..98f4409907 100644
--- a/audio/telephony-maemo.c
+++ b/audio/telephony-maemo.c
@@ -887,6 +887,14 @@ void telephony_key_press_req(void *telephony_device, const char *keys)
telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
}
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+ debug("telephony-maemo: got %s voice dial request",
+ enable ? "enable" : "disable");
+
+ telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
static void handle_incoming_call(DBusMessage *msg)
{
const char *number, *call_path;
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index 2778cfcb36..3df76c3c38 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -387,6 +387,14 @@ void telephony_key_press_req(void *telephony_device, const char *keys)
telephony_key_press_rsp(telephony_device, CME_ERROR_NONE);
}
+void telephony_voice_dial_req(void *telephony_device, gboolean enable)
+{
+ debug("telephony-ofono: got %s voice dial request",
+ enable ? "enable" : "disable");
+
+ telephony_voice_dial_rsp(telephony_device, CME_ERROR_NOT_SUPPORTED);
+}
+
static gboolean iter_get_basic_args(DBusMessageIter *iter,
int first_arg_type, ...)
{
diff --git a/audio/telephony.h b/audio/telephony.h
index da39751916..0bc4769dbf 100644
--- a/audio/telephony.h
+++ b/audio/telephony.h
@@ -155,6 +155,7 @@ 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_nr_and_ec_req(void *telephony_device, gboolean enable);
+void telephony_voice_dial_req(void *telephony_device, gboolean enable);
void telephony_key_press_req(void *telephony_device, const char *keys);
/* AG responses to HF requests. These are implemented by headset.c */
@@ -170,6 +171,7 @@ 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_nr_and_ec_rsp(void *telephony_device, cme_error_t err);
+int telephony_voice_dial_rsp(void *telephony_device, cme_error_t err);
int telephony_key_press_rsp(void *telephony_device, cme_error_t err);
/* Event indications by AG. These are implemented by headset.c */