X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Fchannel%2Fcall.py;h=0e2bebfcf4f9070c061d32735fa988c64c133d0a;hp=21613b77da965ff7cb426f7151d48e2a74aa1eeb;hb=8b77cf6f2a6b8f1ec930395d8f9b762fa1d4bfbc;hpb=7912b2aa8daf492f3933d975fab97e59937981e1 diff --git a/src/channel/call.py b/src/channel/call.py index 21613b7..0e2bebf 100644 --- a/src/channel/call.py +++ b/src/channel/call.py @@ -1,40 +1,40 @@ -import weakref import logging import telepathy +import gtk_toolbox +import handle + _moduleLogger = logging.getLogger("channel.call") +# @todo Test Calls class CallChannel( telepathy.server.ChannelTypeStreamedMedia, telepathy.server.ChannelInterfaceCallState, ): def __init__(self, connection): - self._recv_id = 0 - self._connRef = weakref.ref(connection) - - telepathy.server.ChannelTypeText.__init__(self, connection, None) + telepathy.server.ChannelTypeStreamedMedia.__init__(self, connection, None) telepathy.server.ChannelInterfaceGroup.__init__(self) telepathy.server.ChannelInterfaceChatState.__init__(self) - self.GroupFlagsChanged(telepathy.CHANNEL_GROUP_FLAG_CAN_ADD, 0) - self.__add_initial_participants() - + @gtk_toolbox.log_exception(_moduleLogger) def ListStreams(self): """ For org.freedesktop.Telepathy.Channel.Type.StreamedMedia """ - pass + return () + @gtk_toolbox.log_exception(_moduleLogger) def RemoveStreams(self, streams): """ For org.freedesktop.Telepathy.Channel.Type.StreamedMedia """ - pass + raise telepathy.errors.NotImplemented("Cannot remove a stream") + @gtk_toolbox.log_exception(_moduleLogger) def RequestStreamDirection(self, stream, streamDirection): """ For org.freedesktop.Telepathy.Channel.Type.StreamedMedia @@ -42,15 +42,30 @@ class CallChannel( @note Since streams are short lived, not bothering to implement this """ _moduleLogger.info("A request was made to change the stream direction") + raise telepathy.errors.NotImplemented("Cannot change directions") - def RequestStreams(self, contact, streamType): + @gtk_toolbox.log_exception(_moduleLogger) + def RequestStreams(self, contact, streamTypes): """ For org.freedesktop.Telepathy.Channel.Type.StreamedMedia @returns [(Stream ID, contact, stream type, stream state, stream direction, pending send flags)] """ - pass + for streamType in streamTypes: + if streamType != telepathy.constants.MEDIA_STREAM_TYPE_AUDIO: + raise telepathy.errors.NotImplemented("Audio is the only stream type supported") + + contactId, contactNumber = handle.ContactHandle.from_handle_name(contact.name) + + self._conn.session.backend.dial(contactNumber) + + streamId = 0 + streamState = telepathy.constants.MEDIA_STREAM_STATE_DISCONNECTED + streamDirection = telepathy.constants.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL + pendingSendFlags = telepathy.constants.MEDIA_STREAM_PENDING_REMOTE_SEND + return [(streamId, contact, streamTypes[0], streamState, streamDirection, pendingSendFlags)] + @gtk_toolbox.log_exception(_moduleLogger) def GetCallStates(self): """ For org.freedesktop.Telepathy.Channel.Interface.CallState @@ -58,4 +73,4 @@ class CallChannel( Get the current call states for all contacts involved in this call. @returns {Contact: telepathy.constants.CHANNEL_CALL_STATE_*} """ - pass + return {}