Initial Import
[profile/ivi/hfdialer.git] / src / dbustypes.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 DIALERDBUSTYPES_H
12 #define DIALERDBUSTYPES_H
13
14 #include <QtCore/QList>
15 #include <QtCore/QMetaType>
16 #include <QtDBus/QtDBus>
17
18 struct CallHistoryEvent
19 {
20     uint    id;
21     QString lineid;
22     ushort  type;
23     int     start;
24     int     end;
25 };
26
27 Q_DECLARE_METATYPE ( CallHistoryEvent )
28
29 // Marshall the CallHistoryEvent data into a D-BUS argument
30 QDBusArgument &operator<<(QDBusArgument &argument,
31                           const CallHistoryEvent &mystruct);
32
33 // Retrieve the CallHistoryEvent data from the D-BUS argument
34 const QDBusArgument &operator>>(const QDBusArgument &argument,
35                                 CallHistoryEvent &mystruct);
36
37 typedef QList< CallHistoryEvent > QArrayOfHistoryEvent;
38
39 Q_DECLARE_METATYPE ( QArrayOfHistoryEvent )
40
41 /*
42  * New DBus type needed for Ofono calls that expect an array of
43  * Object paths and that objects properties: "a(oa{sv})"
44  *
45  * Used in:
46  *     org.ofono.VoiceCallManager.GetCalls()
47  *     org.ofono.NetworkRegistraion.GetOperators()
48  *     org.ofono.NetworkRegistration.Scan()
49  *     org.ofono.ConnectionManager.GetContexts()
50  *     org.ofono.MessageManager.GetMessages()
51  */
52 struct OfonoPathProperties
53 {
54     QDBusObjectPath path;
55     QVariantMap     properties;
56 };
57
58 Q_DECLARE_METATYPE ( OfonoPathProperties )
59
60 // Marshall the OfonoPathProperties data into a D-BUS argument
61 QDBusArgument &operator<<(QDBusArgument &argument,
62                           const OfonoPathProperties &mystruct);
63
64 // Retrieve the CallHistoryEvent data from the D-BUS argument
65 const QDBusArgument &operator>>(const QDBusArgument &argument,
66                                 OfonoPathProperties &mystruct);
67
68 typedef QList< OfonoPathProperties > QArrayOfPathProperties;
69
70 Q_DECLARE_METATYPE ( QArrayOfPathProperties )
71
72 inline void registerMyDataTypes() {
73     qDBusRegisterMetaType< OfonoPathProperties >();
74     qDBusRegisterMetaType< QArrayOfPathProperties >();
75     qDBusRegisterMetaType< CallHistoryEvent >();
76     qDBusRegisterMetaType< QArrayOfHistoryEvent >();
77 }
78
79 #endif   //DIALERDBUSTYPES_H
80
81 /* Local Variables:      */
82 /* mode:c++              */
83 /* c-basic-offset:4      */
84 /* indent-tabs-mode: nil */
85 /* End:                  */