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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#ifndef TOQMANAGER_H
#define TOQMANAGER_H
#include <QtCore/QObject>
#include "toqconnection.h"
#include "settings.h"
class ObexConnection;
class VersionManager;
class SystemManager;
class FmsManager;
class StorageManager;
class SettingsManager;
class MusicManager;
class ContactsManager;
class CommManager;
class AgendaManager;
class VoiceCallManager;
class WeatherManager;
class CardManager;
class NotificationManager;
class ToqManager : public QObject
{
Q_OBJECT
Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
friend class ToqManagerAdaptor;
public:
explicit ToqManager(Settings *settings, QObject *parent = 0);
struct EndpointHandler {
virtual void handleMessage(const ToqConnection::Message &msg) = 0;
};
void setEndpointListener(ToqConnection::Endpoint ep, EndpointHandler *handler);
bool isConnected() const;
quint16 newTransactionId();
void sendMessage(const ToqConnection::Message &msg);
void sendMessage(ToqConnection::Endpoint source, ToqConnection::Endpoint destination,
quint16 transactionId, quint32 type, const QByteArray &payload);
quint16 sendMessage(ToqConnection::Endpoint source, ToqConnection::Endpoint destination,
quint32 type, const QByteArray &payload);
void sendMessage(ToqConnection::Endpoint source, ToqConnection::Endpoint destination,
quint16 transactionId, quint32 type, const QJsonObject &payload);
quint16 sendMessage(ToqConnection::Endpoint source, ToqConnection::Endpoint destination,
quint32 type, const QJsonObject &payload);
void sendReply(const ToqConnection::Message &msg, quint32 type, const QJsonObject &payload);
signals:
void connected();
void disconnected();
void connectedChanged();
private slots:
void handleToqMessage(const ToqConnection::Message &msg);
void handleSettingsAddressChanged();
private:
Settings *_settings;
ToqConnection *_conn;
ObexConnection *_obex;
QHash<ToqConnection::Endpoint, EndpointHandler*> _handlers;
VersionManager *_versionManager;
SystemManager *_systemManager;
FmsManager *_fmsManager;
StorageManager *_storageManager;
SettingsManager *_settingsManager;
MusicManager *_musicManager;
ContactsManager *_contactsManager;
CommManager *_commManager;
AgendaManager *_agendaManager;
VoiceCallManager *_voiceCallManager;
WeatherManager *_weatherManager;
CardManager *_cardManager;
NotificationManager *_notificationManager;
};
inline bool ToqManager::isConnected() const
{
return _conn->isConnected();
}
inline quint16 ToqManager::newTransactionId()
{
return _conn->newTransactionId();
}
#endif // TOQMANAGER_H
|