[telepathy-qt4/master] StreamedMediaChannel: Added DTMF interface support.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Wed Aug 12 20:18:05 PDT 2009
---
TelepathyQt4/streamed-media-channel.cpp | 56 +++++++++++++++++++++++++++++++
TelepathyQt4/streamed-media-channel.h | 3 ++
2 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/TelepathyQt4/streamed-media-channel.cpp b/TelepathyQt4/streamed-media-channel.cpp
index 8856353..e5197e0 100644
--- a/TelepathyQt4/streamed-media-channel.cpp
+++ b/TelepathyQt4/streamed-media-channel.cpp
@@ -369,6 +369,62 @@ PendingOperation *MediaStream::requestDirection(
}
/**
+ * Start sending a DTMF tone on this stream. Where possible, the tone will
+ * continue until stopDTMFTone() is called. On certain protocols, it may only be
+ * possible to send events with a predetermined length. In this case, the
+ * implementation may emit a fixed-length tone, and the stopDTMFTone() method
+ * call should return %TELEPATHY_ERROR_NOT_AVAILABLE.
+ *
+ * If the channel() does not support the %TELEPATHY_INTERFACE_CHANNEL_INTERFACE_DTMF
+ * interface, the resulting PendingOperation will fail with error code
+ * %TELEPATHY_ERROR_NOT_IMPLEMENTED.
+
+ * \param event A numeric event code from the %DTMFEvent enum.
+ * \return A PendingOperation which will emit PendingOperation::finished
+ * when the request finishes.
+ * \sa stopDTMFTone()
+ */
+PendingOperation *MediaStream::startDTMFTone(DTMFEvent event)
+{
+ StreamedMediaChannelPtr chan(mPriv->channel);
+ if (!chan->interfaces().contains(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_DTMF)) {
+ warning() << "MediaStream::startDTMFTone() used with no dtmf interface";
+ return new PendingFailure(this, TELEPATHY_ERROR_NOT_IMPLEMENTED,
+ "StreamedMediaChannel does not support dtmf interface");
+ }
+ return new PendingVoidMethodCall(this,
+ chan->DTMFInterface()->StartTone(mPriv->id, event));
+}
+
+/**
+ * Stop sending any DTMF tone which has been started using the startDTMFTone()
+ * method. If there is no current tone, the resulting PendingOperation will
+ * finish successfully.
+ *
+ * If continuous tones are not supported by this stream, the resulting
+ * PendingOperation will fail with error code %TELEPATHY_ERROR_NOT_AVAILABLE.
+ *
+ * If the channel() does not support the %TELEPATHY_INTERFACE_CHANNEL_INTERFACE_DTMF
+ * interface, the resulting PendingOperation will fail with error code
+ * %TELEPATHY_ERROR_NOT_IMPLEMENTED.
+ *
+ * \return A PendingOperation which will emit PendingOperation::finished
+ * when the request finishes.
+ * \sa startDTMFTone()
+ */
+PendingOperation *MediaStream::stopDTMFTone()
+{
+ StreamedMediaChannelPtr chan(mPriv->channel);
+ if (!chan->interfaces().contains(TELEPATHY_INTERFACE_CHANNEL_INTERFACE_DTMF)) {
+ warning() << "MediaStream::stopDTMFTone() used with no dtmf interface";
+ return new PendingFailure(this, TELEPATHY_ERROR_NOT_IMPLEMENTED,
+ "StreamedMediaChannel does not support dtmf interface");
+ }
+ return new PendingVoidMethodCall(this,
+ chan->DTMFInterface()->StopTone(mPriv->id));
+}
+
+/**
* Request a change in the direction of this stream. In particular, this
* might be useful to stop sending media of a particular type, or inform the
* peer that you are no longer using media that is being sent to you.
diff --git a/TelepathyQt4/streamed-media-channel.h b/TelepathyQt4/streamed-media-channel.h
index 7b369c7..0bf0d89 100644
--- a/TelepathyQt4/streamed-media-channel.h
+++ b/TelepathyQt4/streamed-media-channel.h
@@ -94,6 +94,9 @@ public:
PendingOperation *requestDirection(
bool send, bool receive);
+ PendingOperation *startDTMFTone(DTMFEvent event);
+ PendingOperation *stopDTMFTone();
+
private Q_SLOTS:
void gotContact(Tp::PendingOperation *op);
--
1.5.6.5
More information about the telepathy-commits
mailing list