|
1 #include <QtCore/QCoreApplication> |
|
2 #include <QtCore/QUrl> |
|
3 |
|
4 #include <QtDebug> |
|
5 #include <QtNetwork/QNetworkAccessManager> |
|
6 #include <QtNetwork/QNetworkReply> |
|
7 #include <QtNetwork/QNetworkRequest> |
|
8 |
|
9 #include "buffer.h" |
|
10 |
|
11 QNetworkReply *addIMEI(QNetworkAccessManager *mgr) |
|
12 { |
|
13 QString reqPOST = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=addIMEI"; |
|
14 QNetworkRequest request(QUrl(reqPOST.toUtf8())); |
|
15 request.setHeader(QNetworkRequest::ContentTypeHeader,"application/xhtml+xml"); |
|
16 |
|
17 QByteArray data; |
|
18 data.append("<SymbianSigned>"); |
|
19 data.append("<IMEI>"); |
|
20 data.append("<number>"); |
|
21 data.append("356945030065847"); |
|
22 data.append("</number>"); |
|
23 data.append("<description>"); |
|
24 data.append("X6 from Angela"); |
|
25 data.append("</description>"); |
|
26 data.append("</IMEI>"); |
|
27 data.append("</SymbianSigned>"); |
|
28 |
|
29 return mgr->post(request,data); |
|
30 } |
|
31 |
|
32 QNetworkReply *getDevCert(QNetworkAccessManager *mgr) |
|
33 { |
|
34 QString reqPOST = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=getDevCert&genID=456723322"; |
|
35 QNetworkRequest request(QUrl(reqPOST.toUtf8())); |
|
36 request.setHeader(QNetworkRequest::ContentTypeHeader,"application/xhtml+xml"); |
|
37 |
|
38 return mgr->get(request); |
|
39 } |
|
40 |
|
41 QNetworkReply *getSubmission() |
|
42 { |
|
43 QString reqGET = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=getSubmission&genID=456723322"; |
|
44 QNetworkRequest request(QUrl(reqGET.toUtf8())); |
|
45 |
|
46 return mgr->get(request); |
|
47 } |
|
48 |
|
49 int main(int argc, char **argv) |
|
50 { |
|
51 QCoreApplication app(argc, argv); |
|
52 QNetworkAccessManager *manager = new QNetworkAccessManager(); |
|
53 Buffer *buf = new Buffer(); |
|
54 QString reqGet = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=GetUIDList" ; |
|
55 |
|
56 app.connect(manager, SIGNAL(finished(QNetworkReply*)), |
|
57 buf, SLOT(replyFinished(QNetworkReply*))); |
|
58 // QNetworkReply *reply = manager->get(QNetworkRequest(QUrl::fromEncoded(reqGet.toUtf8()))); |
|
59 |
|
60 // addIMEI(manager); |
|
61 getDevCert(manager); |
|
62 // app.connect(reply, SIGNAL(finished()), SLOT(quit())); |
|
63 return app.exec(); |
|
64 } |