Initial Import
[profile/ivi/hfdialer.git] / src / dialercontext.h
1 /*
2  * hfdialer - Hands Free Voice Call Manager
3  * Copyright (c) 2012, Intel Corporation.
4  *
5  * This program is licensed under the terms and conditions of the
6  * Apache License, version 2.0.  The full text of the Apache License is at
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  */
10
11 #ifndef DIALERCONTEXT_H
12 #define DIALERCONTEXT_H
13
14 // libofono-qt headers
15 #include <ofonomodemmanager.h>
16 #include <ofonocallvolume.h>
17 #include <ofonomessagewaiting.h>
18
19 // local headers
20 #include "callmanager.h"
21
22 // Convienence Macro for access to Class instance
23 #define DC DialerContext::instance()
24
25 class DialerContext: public QObject
26 {
27     Q_OBJECT;
28
29     Q_PROPERTY(OfonoModemManager* modemManager READ modemManager);
30     Q_PROPERTY(OfonoCallVolume* volumeManager READ volumeManager);
31     Q_PROPERTY(OfonoMessageWaiting* voicemailManager READ voicemailManager);
32     Q_PROPERTY(CallManager* callManager READ callManager);
33     Q_PROPERTY(QStringList modes READ modes WRITE setModes);
34
35 public:
36     virtual ~DialerContext();
37
38     static DialerContext *instance();
39
40     OfonoModemManager*   modemManager() const;
41     OfonoCallVolume*     volumeManager() const;
42     OfonoMessageWaiting* voicemailManager() const;
43     CallManager*         callManager() const;
44     QStringList          modes() const;
45
46 public slots:
47     // Slot to set current mode at runtime
48     void setModes(const QStringList &modeList);
49
50 Q_SIGNALS:
51     void modesChanged();
52
53 private Q_SLOTS:
54
55     // Slots to handle signals from Manager oFono service
56     void onModemAdded(const QString &path);
57     void onModemRemoved(const QString &path);
58
59     // Slots to handle signals from CallVolume oFono service
60     void onCallVolumeValidityChanged(bool valid);
61
62     // Slots to handle signals from MessageWaiting oFono service
63     void onVoicemailValidityChanged(bool valid);
64     void onVoicemailWaitingChanged(bool waiting);
65     void onVoicemailCountChanged(int count);
66
67     // Slots to handle signals from CallManager oFono service
68     void onCallManagerValidityChanged(bool valid);
69     void onCallsChanged();
70
71     // Slot to handle runtime mode changes in GConf key
72     void onModesChanged();
73
74 protected:
75     DialerContext(QObject *parent = 0);
76
77 private:
78     DialerContext(const DialerContext&);
79     DialerContext& operator= (DialerContext&);
80
81     class DialerContextPrivate *d;
82
83     static DialerContext *gContext;
84 };
85
86 #endif // DIALERCONTEXT_H
87
88 /* Local Variables:      */
89 /* mode:c++              */
90 /* c-basic-offset:4      */
91 /* indent-tabs-mode: nil */
92 /* End:                  */