aboutsummaryrefslogtreecommitdiff
path: root/src/conversation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-15 22:58:21 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-15 22:58:21 +0000
commitbad1ac644457b2410e6f354dc52ba4857933ab26 (patch)
treea3328f18f51a4804c3ea66f226479a118a8894b3 /src/conversation
parentd87511e863db9e215c0ed8054897c49473c708f8 (diff)
downloadgnunet-bad1ac644457b2410e6f354dc52ba4857933ab26.tar.gz
gnunet-bad1ac644457b2410e6f354dc52ba4857933ab26.zip
-implementing missing resume/suspend functions for callee
Diffstat (limited to 'src/conversation')
-rw-r--r--src/conversation/conversation_api.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 1c71217bd..9a02811fe 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -811,7 +811,26 @@ GNUNET_CONVERSATION_phone_destroy (struct GNUNET_CONVERSATION_Phone *phone)
811void 811void
812GNUNET_CONVERSATION_caller_suspend (struct GNUNET_CONVERSATION_Caller *caller) 812GNUNET_CONVERSATION_caller_suspend (struct GNUNET_CONVERSATION_Caller *caller)
813{ 813{
814 GNUNET_break (0); 814 struct GNUNET_CONVERSATION_Phone *phone = caller->phone;
815 struct GNUNET_MQ_Envelope *e;
816 struct ClientPhoneSuspendMessage *suspend;
817
818 GNUNET_assert ( (CS_ACTIVE == caller->state) ||
819 (CS_CALLER_SUSPENDED == caller->state) );
820 if (CS_ACTIVE == caller->state)
821 {
822 caller->speaker->disable_speaker (caller->speaker->cls);
823 caller->mic->disable_microphone (caller->mic->cls);
824 }
825 caller->speaker = NULL;
826 caller->mic = NULL;
827 e = GNUNET_MQ_msg (suspend, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND);
828 suspend->cid = caller->cid;
829 GNUNET_MQ_send (phone->mq, e);
830 if (CS_ACTIVE == caller->state)
831 caller->state = CS_CALLEE_SUSPENDED;
832 else
833 caller->state = CS_BOTH_SUSPENDED;
815} 834}
816 835
817 836
@@ -827,7 +846,29 @@ GNUNET_CONVERSATION_caller_resume (struct GNUNET_CONVERSATION_Caller *caller,
827 struct GNUNET_SPEAKER_Handle *speaker, 846 struct GNUNET_SPEAKER_Handle *speaker,
828 struct GNUNET_MICROPHONE_Handle *mic) 847 struct GNUNET_MICROPHONE_Handle *mic)
829{ 848{
830 GNUNET_break (0); 849 struct GNUNET_CONVERSATION_Phone *phone = caller->phone;
850 struct GNUNET_MQ_Envelope *e;
851 struct ClientPhoneResumeMessage *resume;
852
853 GNUNET_assert ( (CS_CALLEE_SUSPENDED == caller->state) ||
854 (CS_BOTH_SUSPENDED == caller->state) );
855 caller->speaker = speaker;
856 caller->mic = mic;
857 e = GNUNET_MQ_msg (resume, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME);
858 resume->cid = caller->cid;
859 GNUNET_MQ_send (phone->mq, e);
860 if (CS_CALLEE_SUSPENDED == caller->state)
861 {
862 caller->state = CS_ACTIVE;
863 caller->speaker->enable_speaker (caller->speaker->cls);
864 caller->mic->enable_microphone (caller->mic->cls,
865 &transmit_phone_audio,
866 caller);
867 }
868 else
869 {
870 caller->state = CS_CALLER_SUSPENDED;
871 }
831} 872}
832 873
833/* end of conversation_api.c */ 874/* end of conversation_api.c */