* [PATCH] Add CDMA voice call sending DTMF tone support
@ 2011-08-12 9:20 Caiwen Zhang
2011-08-15 6:01 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Caiwen Zhang @ 2011-08-12 9:20 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2602 bytes --]
---
include/cdma-voicecall.h | 3 ++
src/cdma-voicecall.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/include/cdma-voicecall.h b/include/cdma-voicecall.h
index b170e39..f12e0b6 100644
--- a/include/cdma-voicecall.h
+++ b/include/cdma-voicecall.h
@@ -61,6 +61,9 @@ struct ofono_cdma_voicecall_driver {
void (*send_flash)(struct ofono_cdma_voicecall *vc, const char *string,
ofono_cdma_voicecall_cb_t cb, void *data);
+
+ void (*send_tones)(struct ofono_cdma_voicecall *vc, const char *tones,
+ ofono_cdma_voicecall_cb_t cb, void *data);
};
void ofono_cdma_voicecall_disconnected(struct ofono_cdma_voicecall *vc,
diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
index 37db8d5..bbf805f 100644
--- a/src/cdma-voicecall.c
+++ b/src/cdma-voicecall.c
@@ -330,6 +330,58 @@ static DBusMessage *voicecall_manager_flash(DBusConnection *conn,
return NULL;
}
+static ofono_bool_t is_valid_tones(const char *tones)
+{
+ int len;
+ int i;
+
+ if (tones == NULL)
+ return FALSE;
+
+ len = strlen(tones);
+ if (len == 0)
+ return FALSE;
+
+ for (i = 0; i < len; i++) {
+ if (g_ascii_isdigit(tones[i]) || tones[i] == '*' ||
+ tones[i] == '#')
+ continue;
+ else
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static DBusMessage *voicecall_manager_tone(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_cdma_voicecall *vc = data;
+ const char *tones;
+
+ if (vc->pending)
+ return __ofono_error_busy(msg);
+
+ if (vc->driver->send_tones == NULL)
+ return __ofono_error_not_implemented(msg);
+
+ if (vc->status != CDMA_CALL_STATUS_ACTIVE)
+ return __ofono_error_failed(msg);
+
+ if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &tones,
+ DBUS_TYPE_INVALID) == FALSE)
+ return __ofono_error_invalid_args(msg);
+
+ if (is_valid_tones(tones) == FALSE)
+ return __ofono_error_invalid_args(msg);
+
+ vc->pending = dbus_message_ref(msg);
+
+ vc->driver->send_tones(vc, tones, generic_callback, vc);
+
+ return NULL;
+}
+
static GDBusMethodTable manager_methods[] = {
{ "GetProperties", "", "a{sv}",
voicecall_manager_get_properties },
@@ -341,6 +393,8 @@ static GDBusMethodTable manager_methods[] = {
G_DBUS_METHOD_FLAG_ASYNC },
{ "SendFlash", "s", "", voicecall_manager_flash,
G_DBUS_METHOD_FLAG_ASYNC },
+ { "SendTones", "s", "", voicecall_manager_tone,
+ G_DBUS_METHOD_FLAG_ASYNC },
{ }
};
--
1.7.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Add CDMA voice call sending DTMF tone support
2011-08-12 9:20 [PATCH] Add CDMA voice call sending DTMF tone support Caiwen Zhang
@ 2011-08-15 6:01 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-08-15 6:01 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 405 bytes --]
On 08/12/2011 04:20 AM, Caiwen Zhang wrote:
> ---
> include/cdma-voicecall.h | 3 ++
> src/cdma-voicecall.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 57 insertions(+), 0 deletions(-)
>
Patch has been applied, but I broke it up into two commits:
b24ccd3f849460394ef41ae415d8d166cb2b662c and
041f8dbb06f7158a0e050d7d4e328adcbb3eb441
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-15 6:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12 9:20 [PATCH] Add CDMA voice call sending DTMF tone support Caiwen Zhang
2011-08-15 6:01 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.