summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Pessi <Pekka.Pessi@nokia.com>2011-01-24 20:29:18 +0200
committerPekka Pessi <Pekka.Pessi@nokia.com>2011-01-24 20:29:18 +0200
commit692497fa5951b00a9d406c5fb7f3aa212e943fe1 (patch)
tree2410ab19bb473d90b4501d1aac32b38fa684d8da
parent653532918d68517d2e2bd8c995aa3ce1d9dee10c (diff)
parent5080d7fcf3bb6234c5e4ae020cbb000b4a57e784 (diff)
Merge commit 'refs/merge-requests/9' of git://gitorious.org/meego-cellular/telepathy-ring into merger
-rw-r--r--src/ring-conference-channel.c59
-rw-r--r--src/ring-media-channel.c4
-rw-r--r--src/ring-media-channel.h9
3 files changed, 60 insertions, 12 deletions
diff --git a/src/ring-conference-channel.c b/src/ring-conference-channel.c
index 8636f13..5989653 100644
--- a/src/ring-conference-channel.c
+++ b/src/ring-conference-channel.c
@@ -314,6 +314,21 @@ ring_mergeable_conference_merge(RingSvcChannelInterfaceMergeableConference *ifac
* Telepathy.Channel.Interface.DTMF DBus interface - version 0.19.6
*/
+static RingMemberChannel *
+ring_conference_get_first_active_member (RingConferenceChannel *self)
+{
+ RingConferenceChannelPrivate *priv = self->priv;
+ int i;
+
+ for (i = 0; i < MODEM_MAX_CALLS; i++) {
+ RingMemberChannel *member = priv->members[i];
+ if (member && priv->is_current[i])
+ return member;
+ }
+
+ return 0;
+}
+
/** DBus method StartTone ( u: stream_id, y: event ) -> nothing
*
* Start sending a DTMF tone on this stream. Where possible, the tone will
@@ -328,11 +343,23 @@ ring_conference_channel_dtmf_start_tone(TpSvcChannelInterfaceDTMF *iface,
guchar event,
DBusGMethodInvocation *context)
{
- GError error[] = {{
- TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
- "Not implemented"
- }};
- dbus_g_method_return_error(context, error);
+ RingConferenceChannel *self = RING_CONFERENCE_CHANNEL (iface);
+ RingMemberChannel *member = ring_conference_get_first_active_member (self);
+
+ if (member)
+ {
+ TpSvcChannelInterfaceDTMF *dtmf_if = TP_SVC_CHANNEL_INTERFACE_DTMF (member);
+ g_assert (dtmf_if != NULL);
+ return ring_media_channel_dtmf_start_tone (dtmf_if, stream_id, event, context);
+ }
+ else
+ {
+ GError error[] = {{
+ TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+ "No member channels to send DTMFs through"
+ }};
+ dbus_g_method_return_error(context, error);
+ }
}
/** DBus method StopTone ( u: stream_id ) -> nothing
@@ -345,11 +372,23 @@ ring_conference_channel_dtmf_stop_tone(TpSvcChannelInterfaceDTMF *iface,
guint stream_id,
DBusGMethodInvocation *context)
{
- GError error[] = {{
- TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
- "Not implemented"
- }};
- dbus_g_method_return_error(context, error);
+ RingConferenceChannel *self = RING_CONFERENCE_CHANNEL (iface);
+ RingMemberChannel *member = ring_conference_get_first_active_member (self);
+
+ if (member)
+ {
+ TpSvcChannelInterfaceDTMF *dtmf_if = TP_SVC_CHANNEL_INTERFACE_DTMF (member);
+ g_assert (dtmf_if != NULL);
+ return ring_media_channel_dtmf_stop_tone (dtmf_if, stream_id, context);
+ }
+ else
+ {
+ GError error[] = {{
+ TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+ "No member channels to send DTMFs through"
+ }};
+ dbus_g_method_return_error(context, error);
+ }
}
static void
diff --git a/src/ring-media-channel.c b/src/ring-media-channel.c
index 8c63ef5..f89b3b2 100644
--- a/src/ring-media-channel.c
+++ b/src/ring-media-channel.c
@@ -1217,7 +1217,7 @@ static char const ring_media_channel_dtmf_events[16] = "0123456789*#ABCD";
* implementation may emit a fixed-length tone, and the StopTone method call
* should return NotAvailable.
*/
-static void
+void
ring_media_channel_dtmf_start_tone(TpSvcChannelInterfaceDTMF *iface,
guint stream_id,
guchar event,
@@ -1316,7 +1316,7 @@ ring_media_channel_dtmf_start_tone_replied(ModemCall *call_instance,
* Stop sending any DTMF tone which has been started using the StartTone
* method. If there is no current tone, this method will do nothing.
*/
-static void
+void
ring_media_channel_dtmf_stop_tone(TpSvcChannelInterfaceDTMF *iface,
guint stream_id,
DBusGMethodInvocation *context)
diff --git a/src/ring-media-channel.h b/src/ring-media-channel.h
index 665f083..8213564 100644
--- a/src/ring-media-channel.h
+++ b/src/ring-media-channel.h
@@ -26,6 +26,7 @@
#include <telepathy-glib/base-channel.h>
#include <telepathy-glib/dbus-properties-mixin.h>
+#include <telepathy-glib/svc-channel.h>
G_BEGIN_DECLS
@@ -128,6 +129,14 @@ void ring_media_channel_set_state(RingMediaChannel *self,
guint causetype,
guint cause);
+void ring_media_channel_dtmf_start_tone(TpSvcChannelInterfaceDTMF *iface,
+ guint stream_id,
+ guchar event,
+ DBusGMethodInvocation *context);
+void ring_media_channel_dtmf_stop_tone(TpSvcChannelInterfaceDTMF *iface,
+ guint stream_id,
+ DBusGMethodInvocation *context);
+
G_END_DECLS
#endif /* #ifndef RING_MEDIA_CHANNEL_H*/