Browse code

PySemsB2ABCalleeDialog added, which has onPyB2ABEvent handler to pass events between b2ab sessions

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@366 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Stefan Sayer authored on 12/06/2007 16:33:09
Showing 4 changed files
... ...
@@ -44,6 +44,11 @@ void PySemsB2ABDialog::onSessionStart(const AmSipRequest& req)
44 44
     AmB2ABCallerSession::onSessionStart(req);
45 45
 }
46 46
 
47
+AmB2ABCalleeSession* PySemsB2ABDialog::createCalleeSession() {
48
+  return new PySemsB2ABCalleeDialog(getLocalTag());
49
+
50
+}
51
+
47 52
 void PySemsB2ABDialog::process(AmEvent* event) 
48 53
 {
49 54
     DBG("PySemsB2ABDialog::process\n");
... ...
@@ -68,3 +73,18 @@ void PySemsB2ABDialog::process(AmEvent* event)
68 73
     return;
69 74
 }
70 75
 
76
+void PySemsB2ABCalleeDialog::onB2ABEvent(B2ABEvent* ev) {
77
+  PySemsB2ABEvent* py_ev = dynamic_cast<PySemsB2ABEvent*>(ev);
78
+  if (NULL != py_ev) {
79
+    DBG("calling onPyB2AB...\n");
80
+    onPyB2ABEvent(py_ev);
81
+  } else {
82
+    AmB2ABCalleeSession::onB2ABEvent(ev);
83
+  }
84
+}
85
+
86
+
87
+void PySemsB2ABCalleeDialog::onPyB2ABEvent(PySemsB2ABEvent* py_ev) {
88
+  DBG("ignoring PySemsB2ABEvent\n");
89
+  delete py_ev; //-- don't delete, ownership already been transfered to python?
90
+}
... ...
@@ -27,6 +27,8 @@
27 27
 #include "AmB2ABSession.h"
28 28
 #include "AmPlaylist.h"
29 29
 
30
+class PySemsB2ABCalleeDialog;
31
+
30 32
 class PySemsB2ABDialog : public AmB2ABCallerSession, 
31 33
   public PySemsDialogBase
32 34
 {
... ...
@@ -42,6 +44,28 @@ public:
42 44
 
43 45
     // @see AmEventHandler
44 46
     void process(AmEvent* event);
47
+
48
+    AmB2ABCalleeSession* createCalleeSession();
49
+};
50
+
51
+/** \brief base class for events in Py-B2AB sessions */
52
+struct PySemsB2ABEvent: public B2ABEvent
53
+{
54
+  public:
55
+  PySemsB2ABEvent(int ev_id) 
56
+    : B2ABEvent(ev_id)
57
+  {}
45 58
 };
46 59
 
60
+class PySemsB2ABCalleeDialog : public AmB2ABCalleeSession
61
+{
62
+ public:
63
+  PySemsB2ABCalleeDialog(const string& other_local_tag)
64
+    : AmB2ABCalleeSession(other_local_tag) { }
65
+
66
+ protected:
67
+  void onB2ABEvent(B2ABEvent* ev);
68
+
69
+  virtual void onPyB2ABEvent(PySemsB2ABEvent* py_ev);
70
+};
47 71
 #endif
... ...
@@ -49,14 +49,14 @@ public:
49 49
 protected:
50 50
   virtual AmB2ABCalleeSession* createCalleeSession() /Factory/;
51 51
 
52
-  virtual void onB2ABEvent(B2ABEvent* /In,Out/);
52
+  virtual void onB2ABEvent(PySemsB2ABEvent* /TransferBack/);
53 53
 
54
-  virtual void relayEvent(AmEvent* ev);	
54
+  virtual void relayEvent(PySemsB2ABEvent* ev /Transfer/);	
55 55
 private:
56 56
   PySemsB2ABDialog(const PySemsB2ABDialog&);
57 57
 };
58 58
 
59
-class AmB2ABCalleeSession
59
+class AmB2ABCalleeSession 
60 60
 {
61 61
 %TypeHeaderCode
62 62
 #include "../../../core/AmB2ABSession.h"
... ...
@@ -64,8 +64,6 @@ class AmB2ABCalleeSession
64 64
 public:
65 65
   AmB2ABCalleeSession(const string& /*other_local_tag*/);
66 66
 
67
-  void onB2ABEvent(B2ABEvent* /*In,Out*/);
68
-
69 67
   void connectSession();
70 68
   void disconnectSession();
71 69
 
... ...
@@ -74,13 +72,28 @@ private:
74 72
 
75 73
 };
76 74
 
77
-class B2ABEvent
78
-: AmEvent 
75
+class PySemsB2ABCalleeDialog : AmB2ABCalleeSession
79 76
 {
80 77
 %TypeHeaderCode
78
+#include "../PySemsB2ABDialog.h"
81 79
 #include "../../../core/AmB2ABSession.h"
82 80
 %End
83 81
 public:
84
-  B2ABEvent(int /* ev_id */);
82
+  PySemsB2ABCalleeDialog(const string& /*other_local_tag*/);
83
+
84
+protected:
85
+  virtual void onPyB2ABEvent(PySemsB2ABEvent* /TransferBack/);
86
+
87
+private:
88
+  PySemsB2ABCalleeDialog(const PySemsB2ABCalleeDialog& /* other_s*/);
89
+};
90
+
91
+class PySemsB2ABEvent
92
+{
93
+%TypeHeaderCode
94
+#include "../PySemsB2ABDialog.h"
95
+%End
96
+public:
97
+  PySemsB2ABEvent(int /* ev_id */);
85 98
 };
86 99
 
... ...
@@ -1,3 +1,3 @@
1 1
 target = py_sems_lib
2
-sources = sippy_sems_libcmodule.cpp sippy_sems_libB2ABEvent.cpp sippy_sems_libAmB2ABCalleeSession.cpp sippy_sems_libPySemsB2ABDialog.cpp sippy_sems_libPySemsB2BDialog.cpp sippy_sems_libPySemsDialog.cpp sippy_sems_libAmAudioFile.cpp sippy_sems_libAmAudioEvent.cpp sippy_sems_libAmEvent.cpp sippy_sems_libAmSipDialog.cpp sippy_sems_libAmSipReply.cpp sippy_sems_libAmSipRequest.cpp sippy_sems_libstring.cpp
3
-headers = sipAPIpy_sems_lib.h sippy_sems_libB2ABEvent.h sippy_sems_libAmB2ABCalleeSession.h sippy_sems_libPySemsB2ABDialog.h sippy_sems_libPySemsB2BDialog.h sippy_sems_libPySemsDialog.h sippy_sems_libAmAudioFile.h sippy_sems_libAmAudioEvent.h sippy_sems_libAmEvent.h sippy_sems_libAmSipDialog.h sippy_sems_libAmSipReply.h sippy_sems_libAmSipRequest.h sippy_sems_libstring.h
2
+sources = sippy_sems_libcmodule.cpp sippy_sems_libPySemsB2ABEvent.cpp sippy_sems_libPySemsB2ABCalleeDialog.cpp sippy_sems_libAmB2ABCalleeSession.cpp sippy_sems_libPySemsB2ABDialog.cpp sippy_sems_libPySemsB2BDialog.cpp sippy_sems_libPySemsDialog.cpp sippy_sems_libAmAudioFile.cpp sippy_sems_libAmAudioEvent.cpp sippy_sems_libAmEvent.cpp sippy_sems_libAmSipDialog.cpp sippy_sems_libAmSipReply.cpp sippy_sems_libAmSipRequest.cpp sippy_sems_libstring.cpp
3
+headers = sipAPIpy_sems_lib.h sippy_sems_libPySemsB2ABEvent.h sippy_sems_libPySemsB2ABCalleeDialog.h sippy_sems_libAmB2ABCalleeSession.h sippy_sems_libPySemsB2ABDialog.h sippy_sems_libPySemsB2BDialog.h sippy_sems_libPySemsDialog.h sippy_sems_libAmAudioFile.h sippy_sems_libAmAudioEvent.h sippy_sems_libAmEvent.h sippy_sems_libAmSipDialog.h sippy_sems_libAmSipReply.h sippy_sems_libAmSipRequest.h sippy_sems_libstring.h