summaryrefslogtreecommitdiff
path: root/saltoqd/voicecallmanager.h
blob: 8bd2f5c93f7f0272bafbe5b6afb713f8119d3482 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef VOICECALLMANAGER_H
#define VOICECALLMANAGER_H

#include "toqmanager.h"

struct ProfileValue {
	QString key;
	QString val;
	QString type;
};

class ContactsManager;
class OrgNemomobileVoicecallVoiceCallInterface;

class VoiceCallManager : public QObject, public ToqManager::EndpointHandler
{
	Q_OBJECT
public:
	explicit VoiceCallManager(ContactsManager *contacts, ToqManager *toq);

	void handleMessage(const ToqConnection::Message &msg) Q_DECL_OVERRIDE;

	static void setSilentMode(bool silent);

private:
	void sendReply(const ToqConnection::Message &msg, int status, const QString &message);

	static QString getCurrentProfile();
	static void setProfile(const QString &name);

	QJsonObject buildPhoneStatus();
	void sendPhoneStatusMessage();
	void sendPhoneRingMessage();

private slots:
	void handleProfileChanged(bool changed, bool active, const QString &profile);
	void handleActiveVoiceCallChanged();
	void handleActiveVoiceCallStatusChanged();

private:
	ToqManager *_toq;
	ContactsManager *_contacts;
	OrgNemomobileVoicecallVoiceCallInterface *_activeCall;
};

class QDBusArgument;
QDBusArgument &operator<<(QDBusArgument &argument, const ProfileValue &value);
const QDBusArgument &operator>>(const QDBusArgument &argument, ProfileValue &value);

Q_DECLARE_METATYPE(ProfileValue)
Q_DECLARE_METATYPE(QList<ProfileValue>)

#endif // VOICECALLMANAGER_H