diff options
-rw-r--r-- | introspection/org.freedesktop.ModemManager1.Call.xml | 25 | ||||
-rw-r--r-- | libmm-glib/mm-call.c | 88 | ||||
-rw-r--r-- | libmm-glib/mm-call.h | 17 |
3 files changed, 126 insertions, 4 deletions
diff --git a/introspection/org.freedesktop.ModemManager1.Call.xml b/introspection/org.freedesktop.ModemManager1.Call.xml index 41112d50..727b703c 100644 --- a/introspection/org.freedesktop.ModemManager1.Call.xml +++ b/introspection/org.freedesktop.ModemManager1.Call.xml @@ -29,7 +29,7 @@ Accept: Accept incoming call (answer). - Applicable only if state is MM_CALL_STATE_RINGING and direction is MM_CALL_DIRECTION_INCOMING + Applicable only if state is MM_CALL_STATE_RINGING_IN and direction is MM_CALL_DIRECTION_INCOMING --> <method name="Accept" /> @@ -37,11 +37,32 @@ Hangup: Hangup the active call. - Applicable only if states are MM_CALL_STATE_RINGING and MM_CALL_STATE_ACCEPTED + Applicable only if state is not MM_CALL_STATE_UNKNOWN or MM_CALL_STATE_TERMINATED --> <method name="Hangup"/> <!-- + SendTone: + @tone: Tone identifier. (Admitter chars are [0-9A-D*#]) + + Send a DTMF tone (Dual Tone Multi-Frequency) (only on supported modem) + Applicable only if state is MM_CALL_STATE_ACTIVE + --> + <method name="SendTone"> + <arg name="tone" type="s" direction="in"/> + </method> + + <!-- + ToneReceived: + @tone: Tone identifier. (Admitter chars are [0-9A-D*#]) + + Emitted when a DTMF tone is received (only on supported modem) + --> + <signal name="ToneReceived"> + <arg name="tone" type="s" /> + </signal> + + <!-- StateChanged: @old: Old state MMCallState @new: New state MMCallState diff --git a/libmm-glib/mm-call.c b/libmm-glib/mm-call.c index ec93663b..652bfb14 100644 --- a/libmm-glib/mm-call.c +++ b/libmm-glib/mm-call.c @@ -13,6 +13,7 @@ * GNU General Public License for more details: * * Copyright (C) 2015 Riccardo Vangelisti <riccardo.vangelisti@sadel.it> + * Copyright (C) 2015 Marco Bascetta <marco.bascetta@sadel.it> */ #include "string.h" @@ -260,7 +261,7 @@ mm_call_start_sync (MMCall *self, * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_call_accept(). * @error: Return location for error or %NULL. * - * Finishes an operation accepted with mm_call_accept(). + * Finishes an operation started with mm_call_accept(). * * Returns: %TRUE if the operation succeded, %FALSE if @error is set. */ @@ -339,7 +340,7 @@ mm_call_accept_sync (MMCall *self, * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_call_hangup(). * @error: Return location for error or %NULL. * - * Finishes an operation hanguped with mm_call_hangup(). + * Finishes an operation started with mm_call_hangup(). * * Returns: %TRUE if the operation succeded, %FALSE if @error is set. */ @@ -411,6 +412,89 @@ mm_call_hangup_sync (MMCall *self, } /*****************************************************************************/ + +/** + * mm_call_send_tone_finish: + * @self: A #MMCall. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_call_send_tone(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with mm_call_send_tone(). + * + * Returns: %TRUE if the operation succeded, %FALSE if @error is set. + */ +gboolean +mm_call_send_tone_finish (MMCall *self, + GAsyncResult *res, + GError **error) +{ + g_return_val_if_fail (MM_IS_CALL (self), FALSE); + + return mm_gdbus_call_call_send_tone_finish (MM_GDBUS_CALL (self), res, error); +} + +/** + * mm_call_send_tone: + * @self: A #MMCall. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously requests to send_tone the call. + * + * Call objects can only be executed once. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call mm_call_send_tone_finish() to get the result of the operation. + * + * See mm_call_send_tone_sync() for the synchronous, blocking version of this method. + */ +void +mm_call_send_tone (MMCall *self, + const gchar *tone, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_return_if_fail (MM_IS_CALL (self)); + + mm_gdbus_call_call_send_tone (MM_GDBUS_CALL (self), + tone, + cancellable, + callback, + user_data); +} + +/** + * mm_call_send_tone_sync: + * @self: A #MMCall. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously requests to send_tone the call. + * + * Call objects can only be sent once. + * + * The calling thread is blocked until an incoming call is ready. + * See mm_call_send_tone() for the asynchronous version of this method. + * + * Returns: %TRUE if the operation succeded, %FALSE if @error is set. + */ +gboolean +mm_call_send_tone_sync (MMCall *self, + const gchar *tone, + GCancellable *cancellable, + GError **error) +{ + g_return_val_if_fail (MM_IS_CALL (self), FALSE); + + return mm_gdbus_call_call_send_tone_sync (MM_GDBUS_CALL (self), + tone, + cancellable, + error); +} + +/*****************************************************************************/ static void mm_call_init (MMCall *self) { diff --git a/libmm-glib/mm-call.h b/libmm-glib/mm-call.h index 3b7894c4..53c6bf1a 100644 --- a/libmm-glib/mm-call.h +++ b/libmm-glib/mm-call.h @@ -13,6 +13,7 @@ * GNU General Public License for more details: * * Copyright (C) 2015 Riccardo Vangelisti <riccardo.vangelisti@sadel.it> + * Copyright (C) 2015 Marco Bascetta <marco.bascetta@sadel.it> */ #ifndef _MM_CALL_H_ @@ -113,6 +114,22 @@ gboolean mm_call_hangup_sync (MMCall *self, GCancellable *cancellable, GError **error); + +void mm_call_send_tone (MMCall *self, + const gchar *tone, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean mm_call_send_tone_finish (MMCall *self, + GAsyncResult *res, + GError **error); + +gboolean mm_call_send_tone_sync (MMCall *self, + const gchar *tone, + GCancellable *cancellable, + GError **error); + G_END_DECLS #endif /* _MM_CALL_H_ */ |