Initial Import
[profile/ivi/hfdialer.git] / src / callmanager.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 CALLMANAGER_H
12 #define CALLMANAGER_H
13
14 #include <ofonovoicecallmanager.h>
15
16 #include "callitem.h"
17 #include <QtDBus>
18
19 class CallManager: public OfonoVoiceCallManager
20 {
21     Q_OBJECT;
22
23     Q_PROPERTY(int multipartyCallCount READ multipartyCallCount NOTIFY multipartyCallCountChanged);
24     Q_PROPERTY(int callCount READ callCount NOTIFY callCountChanged);
25
26 public:
27     explicit CallManager(const QString &modemPath="", QObject *parent=0);
28     virtual ~CallManager();
29
30     /* Properties */
31     int multipartyCallCount() const;
32     int callCount() const;
33
34     // Extended version of OfonoVoiceCallManager::getCalls() that
35     // returns QList of CallItems rather than strings
36     Q_INVOKABLE QList<CallItem *> getCallItems() const;
37
38     Q_INVOKABLE CallItem *activeCall() const;
39     Q_INVOKABLE CallItem *heldCall() const;
40     Q_INVOKABLE CallItem *dialingCall() const;
41     Q_INVOKABLE CallItem *incomingCall() const;
42     Q_INVOKABLE CallItem *waitingCall() const;
43     Q_INVOKABLE CallItem *alertingCall() const;
44
45 public Q_SLOTS:
46     void setActiveCall(const CallItem &call);
47
48     // Overloaded version of OfonoVoiceCallManager::dial() that
49     // assumes CLIR == default
50     void dial(const QString &number);
51
52     // Overloaded version of OfonoVoiceCallManager::privateChat() that
53     // takes a CallItem rather than path string
54     void privateChat(const CallItem &call);
55
56     // Push denied answer signal to upper layers from call proxy
57     void deniedCallAnswer();
58
59 Q_SIGNALS:
60     // Abstracts both callAdded() and callRemoved() into a single event
61     void callsChanged();
62
63     void incomingCall(CallItem *call);
64     void incomingCall(QString path);
65     void callDisconnected(const CallItem &call);
66     void onlyEmergencyCalls();
67     void connected();
68     void multipartyCallCountChanged(const int &count);
69     void callCountChanged(const int &count);
70
71 private Q_SLOTS:
72     void callChangedSlot();
73     void updateCallItems();
74     void addCall(const QString &path);
75     void removeCall(const QString &path);
76     void dialFinished(const bool status);
77     void hangupAllFinished(const bool status);
78     void swapFinished(const bool status);
79     void holdAndAnswerFinished(const bool status);
80     void transferFinished(const bool status);
81     void releaseAndAnswerFinished(const bool status);
82     void privateChatFinished(const bool status);
83     void createMultipartyFinished(const bool status);
84     void hangupMultipartyFinished(const bool status);
85     void sendTonesFinished(const bool status);
86     void callStateChanged();
87     void callMultipartyChanged();
88     void modemValidityChanged(bool valid);
89
90     // Handlers for Resource Policy Manager states and conditions
91     void proceedCallDial(const QString number);
92     void deniedCallDial();
93     void lostCallDial();
94     void proceedIncomingCall(CallItem *call);
95     void deniedIncomingCall(CallItem *call);
96     void lostIncomingCall(CallItem *call);
97
98 private:
99     class CallManagerPrivate *d;
100
101     Q_DISABLE_COPY(CallManager);
102 };
103
104 #endif // CALLMANAGER_H
105
106 /* Local Variables:      */
107 /* mode:c++              */
108 /* c-basic-offset:4      */
109 /* indent-tabs-mode: nil */
110 /* End:                  */