~ubuntu-branches/ubuntu/vivid/ekiga/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/engine/protocol/call-core.h

  • Committer: Bazaar Package Importer
  • Author(s): Kilian Krause
  • Date: 2011-07-17 00:24:50 UTC
  • mfrom: (5.1.5 upstream) (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110717002450-ytg3wsrc1ptd3153
Tags: 3.3.1-1
* New upstream release.
 - Required libpt-dev 2.10 and libopal-dev 3.10
* Fix debian/watch to catch new version
* Remove libnotify0.7.patch - included upstream
* Add libboost-dev and libboost-signals-dev to Build-Depends
* debian/rules: Don't install *.la files for new internal shared libs
* Fix Vcs URIs to point to correct desktop/experimental/ekiga tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * Ekiga -- A VoIP and Video-Conferencing application
 
4
 * Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
 
5
 
 
6
 * This program is free software; you can  redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or (at
 
9
 * your option) any later version. This program is distributed in the hope
 
10
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
 
11
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
12
 * See the GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
16
 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 * Ekiga is licensed under the GPL license and as a special exception, you
 
19
 * have permission to link or otherwise combine this program with the
 
20
 * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
 
21
 * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
 
22
 * programs, as long as you do follow the requirements of the GNU GPL for all
 
23
 * the rest of the software thus combined.
 
24
 */
 
25
 
 
26
 
 
27
/*
 
28
 *                         call-core.h  -  description
 
29
 *                         ------------------------------------------
 
30
 *   begin                : written in 2007 by Damien Sandras 
 
31
 *   copyright            : (c) 2007 by Damien Sandras
 
32
 *   description          : declaration of the interface of a call core.
 
33
 *                          A call core manages CallManagers.
 
34
 *
 
35
 */
 
36
 
 
37
#ifndef __CALL_CORE_H__
 
38
#define __CALL_CORE_H__
 
39
 
 
40
#include "form-request.h"
 
41
#include "chain-of-responsibility.h"
 
42
#include "services.h"
 
43
#include "call.h"
 
44
#include "call-manager.h"
 
45
#include "call-protocol-manager.h"
 
46
#include <boost/smart_ptr.hpp>
 
47
 
 
48
#include <boost/signals.hpp>
 
49
#include <boost/bind.hpp>
 
50
#include <set>
 
51
#include <map>
 
52
#include <iostream>
 
53
 
 
54
 
 
55
namespace Ekiga
 
56
{
 
57
 
 
58
/**
 
59
 * @defgroup calls Calls and protocols
 
60
 * @{
 
61
 */
 
62
 
 
63
  class CallManager;
 
64
 
 
65
  class CallCore
 
66
    : public Service
 
67
    {
 
68
 
 
69
  public:
 
70
      typedef std::set<boost::shared_ptr<CallManager> >::iterator iterator;
 
71
      typedef std::set<boost::shared_ptr<CallManager> >::const_iterator const_iterator;
 
72
 
 
73
      /** The constructor
 
74
       */
 
75
      CallCore () { nr_ready = 0; }
 
76
 
 
77
      /** The destructor
 
78
       */
 
79
      ~CallCore ();
 
80
 
 
81
 
 
82
      /*** Service Implementation ***/
 
83
 
 
84
      /** Returns the name of the service.
 
85
       * @return The service name.
 
86
       */
 
87
      const std::string get_name () const
 
88
        { return "call-core"; }
 
89
 
 
90
 
 
91
      /** Returns the description of the service.
 
92
       * @return The service description.
 
93
       */
 
94
      const std::string get_description () const
 
95
        { return "\tCall Core managing Call Manager objects"; }
 
96
 
 
97
 
 
98
      /** Adds a call handled by the CallCore serice.
 
99
       * @param call is the call to be added.
 
100
       * @param manager is the CallManager handling it.
 
101
       */
 
102
      void add_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
103
 
 
104
      /** Remove a call handled by the CallCore serice.
 
105
       * @param call is the call to be removed.
 
106
       */
 
107
      void remove_call (boost::shared_ptr<Call> call);
 
108
 
 
109
      /** Adds a CallManager to the CallCore service.
 
110
       * @param The manager to be added.
 
111
       */
 
112
      void add_manager (boost::shared_ptr<CallManager> manager);
 
113
 
 
114
      /** Return iterator to beginning
 
115
       * @return iterator to beginning
 
116
       */
 
117
      iterator begin ();
 
118
      const_iterator begin () const;
 
119
 
 
120
      /** Return iterator to end
 
121
       * @return iterator to end 
 
122
       */
 
123
      iterator end ();
 
124
      const_iterator end () const;
 
125
 
 
126
      /** This signal is emitted when a Ekiga::CallManager has been
 
127
       * added to the CallCore Service.
 
128
       */
 
129
      boost::signal1<void, boost::shared_ptr<CallManager> > manager_added;
 
130
 
 
131
 
 
132
      /*** Call Management ***/                 
 
133
 
 
134
      /** Create a call based on the remote uri given as parameter
 
135
       * @param: an uri to call
 
136
       * @return: true if a Ekiga::Call could be created
 
137
       */
 
138
      bool dial (const std::string uri); 
 
139
 
 
140
      /*** Call Related Signals ***/
 
141
      
 
142
      /** See call.h for the API
 
143
       */
 
144
      boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > ringing_call;
 
145
      boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > setup_call;
 
146
      boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > missed_call;
 
147
      boost::signal3<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string> cleared_call;
 
148
      boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > established_call;
 
149
      boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > held_call;
 
150
      boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > retrieved_call;
 
151
      boost::signal5<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType, bool> stream_opened;
 
152
      boost::signal5<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType, bool> stream_closed;
 
153
      boost::signal4<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType> stream_paused;
 
154
      boost::signal4<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType> stream_resumed;
 
155
 
 
156
      /*** Misc ***/
 
157
      boost::signal1<void, boost::shared_ptr<CallManager> > manager_ready;
 
158
      boost::signal0<void> ready;
 
159
 
 
160
      /** This chain allows the CallCore to report errors to the user
 
161
       */
 
162
      ChainOfResponsibility<std::string> errors;
 
163
 
 
164
  private:
 
165
      void on_new_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
166
      void on_ringing_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
167
      void on_setup_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
168
      void on_missed_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
169
      void on_cleared_call (std::string, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
170
      void on_established_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
171
      void on_held_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
172
      void on_retrieved_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
173
      void on_stream_opened (std::string name, Call::StreamType type, bool is_transmitting, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
174
      void on_stream_closed (std::string name, Call::StreamType type, bool is_transmitting, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
175
      void on_stream_paused (std::string name, Call::StreamType type, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
176
      void on_stream_resumed (std::string name, Call::StreamType type, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
 
177
 
 
178
      void on_im_failed (std::string, std::string, boost::shared_ptr<CallManager> manager);
 
179
      void on_im_sent (std::string, std::string, boost::shared_ptr<CallManager> manager);
 
180
      void on_im_received (std::string, std::string, std::string, boost::shared_ptr<CallManager> manager);
 
181
      void on_new_chat (std::string, std::string, boost::shared_ptr<CallManager> manager);
 
182
 
 
183
      void on_manager_ready (boost::shared_ptr<CallManager> manager);
 
184
 
 
185
      void on_call_removed (boost::shared_ptr<Call> call);
 
186
 
 
187
      
 
188
      std::set<boost::shared_ptr<CallManager> > managers;
 
189
      std::list<boost::signals::connection> manager_connections;
 
190
      std::map<std::string, std::list<boost::signals::connection> > call_connections;
 
191
      unsigned nr_ready;
 
192
    };
 
193
 
 
194
/**
 
195
 * @}
 
196
 */
 
197
 
 
198
};
 
199
 
 
200
 
 
201
#endif