1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #ifndef APPMGR_SERVICES_H |
|
23 #define APPMGR_SERVICES_H |
|
24 |
|
25 #include <xqaiwdecl.h> |
|
26 |
|
27 // All the services should be declared in a component specific header file |
|
28 // In order to avoid any mistakes in service naming. |
|
29 // In QtHighway service interface is described in XML file, operation is not |
|
30 |
|
31 // Service interfaces and related operations |
|
32 #define SERVICE1 QLatin1String("serviceapp") |
|
33 #define IDIAL QLatin1String("dialer") |
|
34 #define OPERATION1 QLatin1String("dial(QString,bool)") |
|
35 |
|
36 // Erroneus services |
|
37 #define ERR_IDIAL QLatin1String("xxxx.yyy") |
|
38 #define ERR_OPERATION1 QLatin1String("dial(QString,QString)") |
|
39 |
|
40 #define TESTCASE_INFO_KEY QLatin1String("XQTestCase") |
|
41 |
|
42 // Few dummy metatypes |
|
43 class MetaDummy1 |
|
44 { |
|
45 public: |
|
46 MetaDummy1() {}; |
|
47 virtual ~MetaDummy1() {}; |
|
48 |
|
49 QString mTest; |
|
50 template <typename Stream> void serialize(Stream &stream) const; |
|
51 template <typename Stream> void deserialize(Stream &stream); |
|
52 }; |
|
53 |
|
54 template <typename Stream> inline void MetaDummy1::serialize(Stream &s) const |
|
55 { |
|
56 s << mTest; |
|
57 } |
|
58 |
|
59 template <typename Stream> inline void MetaDummy1::deserialize(Stream &s) |
|
60 { |
|
61 s >> mTest; |
|
62 } |
|
63 |
|
64 |
|
65 class MetaDummy2 |
|
66 { |
|
67 public: |
|
68 MetaDummy2() {}; |
|
69 virtual ~MetaDummy2() {}; |
|
70 |
|
71 QString mTest; |
|
72 template <typename Stream> void serialize(Stream &stream) const; |
|
73 template <typename Stream> void deserialize(Stream &stream); |
|
74 }; |
|
75 |
|
76 template <typename Stream> inline void MetaDummy2::serialize(Stream &s) const |
|
77 { |
|
78 s << mTest; |
|
79 } |
|
80 |
|
81 template <typename Stream> inline void MetaDummy2::deserialize(Stream &s) |
|
82 { |
|
83 s >> mTest; |
|
84 } |
|
85 |
|
86 // Testing QVariant |
|
87 class TestServiceData |
|
88 { |
|
89 public: |
|
90 |
|
91 TestServiceData() : mType(-1) {} |
|
92 TestServiceData(int aType, const QVariant &aData) : |
|
93 mType(aType), |
|
94 mData(aData) |
|
95 {} |
|
96 |
|
97 virtual ~TestServiceData() {} |
|
98 |
|
99 |
|
100 int mType; |
|
101 QVariant mData; |
|
102 |
|
103 template <typename Stream> void serialize(Stream &aStream) const; |
|
104 template <typename Stream> void deserialize(Stream &aStream); |
|
105 }; |
|
106 |
|
107 template <typename Stream> inline void TestServiceData::serialize(Stream &aStream) const |
|
108 { |
|
109 qDebug() << "TestServiceData::serialize 1"; |
|
110 aStream << mType; |
|
111 qDebug() << "TestServiceData::serialize 2"; |
|
112 aStream << mData; |
|
113 qDebug() << "TestServiceData::serialize 3"; |
|
114 } |
|
115 |
|
116 template <typename Stream> inline void TestServiceData::deserialize(Stream &aStream) |
|
117 { |
|
118 qDebug() << "TestServiceData::deserialize 1"; |
|
119 aStream >> mType; |
|
120 qDebug() << "TestServiceData::deserialize 2"; |
|
121 aStream >> mData; |
|
122 qDebug() << "TestServiceData::deserialize 3"; |
|
123 } |
|
124 |
|
125 typedef QList<TestServiceData> TestServiceDataList; |
|
126 |
|
127 Q_DECLARE_USER_METATYPE(TestServiceData) |
|
128 Q_DECLARE_USER_METATYPE_NO_OPERATORS(TestServiceDataList) |
|
129 Q_DECLARE_USER_METATYPE(MetaDummy1) |
|
130 Q_DECLARE_USER_METATYPE(MetaDummy2) |
|
131 |
|
132 #endif |
|