~thomas-voss/media-hub/externalize-all-dependencies

« back to all changes in this revision

Viewing changes to src/core/media/telephony/call_monitor.h

  • Committer: thomas-voss
  • Date: 2014-11-26 12:28:23 UTC
  • Revision ID: thomas.voss@canonical.com-20141126122823-19qnbe3t8txdkylg
Move src/core/media/call-monitor to src/core/media/telephony.
Introduce a proper interface media::telephony::CallMonitor.
Slightly adjust existing implementation based on Qt.
Adjust media::ServiceImplementation to account for changes in media::telephony::CallMonitor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
 
20
 
#ifndef CALLMONITOR_H
21
 
#define CALLMONITOR_H
 
20
#ifndef CORE_UBUNTU_MEDIA_TELEPHONY_CALL_MONITOR_H_
 
21
#define CORE_UBUNTU_MEDIA_TELEPHONY_CALL_MONITOR_H_
 
22
 
 
23
#include <core/signal.h>
22
24
 
23
25
#include <functional>
24
 
 
25
 
class CallMonitorPrivate;
26
 
 
27
 
class CallMonitor
28
 
{
29
 
public:
30
 
    enum State { OffHook, OnHook };
31
 
 
32
 
    CallMonitor();
33
 
    ~CallMonitor();
34
 
 
35
 
    void on_change(const std::function<void(CallMonitor::State)>& func);
36
 
 
37
 
private:
38
 
    CallMonitorPrivate *d;
 
26
#include <memory>
 
27
 
 
28
namespace core
 
29
{
 
30
namespace ubuntu
 
31
{
 
32
namespace media
 
33
{
 
34
namespace telephony
 
35
{
 
36
// CallMonitor models the ability to observe and react
 
37
// to changes of the overall call state of the system.
 
38
struct CallMonitor
 
39
{
 
40
    // Save us some typing.
 
41
    typedef std::shared_ptr<CallMonitor> Ptr;
 
42
 
 
43
    // All known call states
 
44
    enum class State
 
45
    {
 
46
        // No current call.
 
47
        OffHook,
 
48
        // Call in progress.
 
49
        OnHook
 
50
    };
 
51
 
 
52
    CallMonitor() = default;
 
53
    virtual ~CallMonitor() = default;
 
54
 
 
55
    // Emitted whenever the current call state of the system changes.
 
56
    virtual const core::Signal<State>& on_call_state_changed() const = 0;
39
57
};
40
58
 
41
 
#endif // CALLMONITOR_H
 
59
// Returns a platform default implementation of CallMonitor.
 
60
CallMonitor::Ptr make_platform_default_call_monitor();
 
61
}
 
62
}
 
63
}
 
64
}
 
65
 
 
66
#endif // CORE_UBUNTU_MEDIA_TELEPHONY_CALL_MONITOR_H_