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 #include <QDebug> |
|
23 #include <xqservicelog.h> |
|
24 #include <QApplication> |
|
25 #include <QKeyEvent> |
|
26 #include <QLabel> |
|
27 #include <QVBoxLayout> |
|
28 #include <QStackedWidget> |
|
29 #include <QImageReader> |
|
30 #include <QDebug> |
|
31 #include <QTimer> |
|
32 #include <QPushButton> |
|
33 #include <QLineEdit> |
|
34 #include <QDebug> |
|
35 #include <QString> |
|
36 #include <QCheckBox> |
|
37 |
|
38 #include <QListView> |
|
39 |
|
40 #include "TestDll.h" |
|
41 |
|
42 TestDll::TestDll(QObject *parent) : QObject(parent) |
|
43 { |
|
44 qDebug() << "[QTH] [TestDll] MyServiceTester: START"; |
|
45 i = 0; |
|
46 request = NULL; |
|
47 //asyncsend(); |
|
48 qDebug() << "[QTH] [TestDll] MyServiceTester: END"; |
|
49 } |
|
50 |
|
51 |
|
52 void TestDll::requestCompleted(const QVariant& data) |
|
53 { |
|
54 i++; |
|
55 qDebug() << "[QTH] [TestDll] requestCompleted START "; |
|
56 qDebug() << "[QTH] [TestDll] \t data: " << data.toString() << ", i: " << i; |
|
57 |
|
58 if ( i <= 20 ) |
|
59 { |
|
60 qDebug() << "[QTH] [TestDll] \t i <= 20 trigger again()"; |
|
61 QString string; |
|
62 qDebug() << "Test app3 --> " << 48 << i << " times"; |
|
63 asyncsend(); |
|
64 } |
|
65 else |
|
66 { |
|
67 /*qDebug() << "[QTH] [MyServiceTester] \t i > 20, setText()"; |
|
68 label->setText("Test app1 Done!"); |
|
69 if(request) |
|
70 { |
|
71 qDebug() << "[QTH] [MyServiceTester] \t \t request != null, delete request"; |
|
72 delete request; |
|
73 request=NULL; |
|
74 }*/ |
|
75 qDebug() << "[QTH] [TestDll] \t request sent 20 times!!!"; |
|
76 } |
|
77 |
|
78 qDebug() << "[QTH] [TestDll] requestCompleted STOP"; |
|
79 } |
|
80 |
|
81 |
|
82 |
|
83 void TestDll::asyncsend() |
|
84 { |
|
85 qDebug() << "[QTH] [TestDll] asyncsend: START"; |
|
86 |
|
87 QString testString("Test Application 3"); |
|
88 int testInt(112233); |
|
89 |
|
90 QString service("com.nokia.services.testservice.TestService"); |
|
91 QString method("asyncWithParams(QString,int)"); |
|
92 |
|
93 if (!request) |
|
94 { |
|
95 qDebug() << "[QTH] [TestDll] \t creating request"; |
|
96 request = new XQServiceRequest(service, method, false); |
|
97 qDebug() << "[QTH] [TestDll] \t connectint signal request->requestCompleted to slot this.requestCompleted"; |
|
98 bool res = connect(request, SIGNAL(requestCompleted(QVariant)), this, SLOT(requestCompleted(QVariant)) ); |
|
99 qDebug() << "[QTH] [TestDll] \t connect = " << res; |
|
100 *request << testString; |
|
101 *request << testInt; |
|
102 qDebug() << "[QTH] [TestDll] \t request: " << testString << ", " << testInt; |
|
103 } |
|
104 |
|
105 qDebug() << "[QTH] [TestDll] \t before request->send()"; |
|
106 bool res = request->send(); |
|
107 qDebug() << "[QTH] [TestDll] \t after request->send()"; |
|
108 qDebug() << "[QTH] [TestDll] asyncsend: STOP"; |
|
109 } |
|