gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r30738 - gnunet/src/conversation


From: gnunet
Subject: [GNUnet-SVN] r30738 - gnunet/src/conversation
Date: Fri, 15 Nov 2013 23:58:21 +0100

Author: grothoff
Date: 2013-11-15 23:58:21 +0100 (Fri, 15 Nov 2013)
New Revision: 30738

Modified:
   gnunet/src/conversation/conversation_api.c
Log:
-implementing missing resume/suspend functions for callee

Modified: gnunet/src/conversation/conversation_api.c
===================================================================
--- gnunet/src/conversation/conversation_api.c  2013-11-15 22:45:59 UTC (rev 
30737)
+++ gnunet/src/conversation/conversation_api.c  2013-11-15 22:58:21 UTC (rev 
30738)
@@ -811,7 +811,26 @@
 void
 GNUNET_CONVERSATION_caller_suspend (struct GNUNET_CONVERSATION_Caller *caller)
 {
-  GNUNET_break (0);
+  struct GNUNET_CONVERSATION_Phone *phone = caller->phone;
+  struct GNUNET_MQ_Envelope *e;
+  struct ClientPhoneSuspendMessage *suspend;
+
+  GNUNET_assert ( (CS_ACTIVE == caller->state) ||
+                  (CS_CALLER_SUSPENDED == caller->state) );
+  if (CS_ACTIVE == caller->state)
+  {
+    caller->speaker->disable_speaker (caller->speaker->cls);
+    caller->mic->disable_microphone (caller->mic->cls);
+  }
+  caller->speaker = NULL;
+  caller->mic = NULL;
+  e = GNUNET_MQ_msg (suspend, 
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND);
+  suspend->cid = caller->cid;
+  GNUNET_MQ_send (phone->mq, e);
+  if (CS_ACTIVE == caller->state)
+    caller->state = CS_CALLEE_SUSPENDED;
+  else
+    caller->state = CS_BOTH_SUSPENDED;
 }
 
 
@@ -827,7 +846,29 @@
                                    struct GNUNET_SPEAKER_Handle *speaker,
                                    struct GNUNET_MICROPHONE_Handle *mic)
 {
-  GNUNET_break (0);
+  struct GNUNET_CONVERSATION_Phone *phone = caller->phone;
+  struct GNUNET_MQ_Envelope *e;
+  struct ClientPhoneResumeMessage *resume;
+
+  GNUNET_assert ( (CS_CALLEE_SUSPENDED == caller->state) ||
+                  (CS_BOTH_SUSPENDED == caller->state) );
+  caller->speaker = speaker;
+  caller->mic = mic;
+  e = GNUNET_MQ_msg (resume, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME);
+  resume->cid = caller->cid;
+  GNUNET_MQ_send (phone->mq, e);
+  if (CS_CALLEE_SUSPENDED == caller->state)
+  {
+    caller->state = CS_ACTIVE;
+    caller->speaker->enable_speaker (caller->speaker->cls);
+    caller->mic->enable_microphone (caller->mic->cls,
+                                    &transmit_phone_audio,
+                                    caller);
+  }
+  else
+  {
+    caller->state = CS_CALLER_SUSPENDED;
+  }
 }
 
 /* end of conversation_api.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]