SigningTS/client/main.cpp
author John Kern <johnk@symbian.org>
Wed, 12 May 2010 11:54:19 -0700
changeset 18 5707b75503d5
parent 17 cad8819de653
permissions -rw-r--r--
working on test for common siging test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     1
#include <QtCore/QCoreApplication>
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     2
#include <QtCore/QUrl>
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     3
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     4
#include <QtDebug>
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     5
#include <QtNetwork/QNetworkAccessManager>
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     6
#include <QtNetwork/QNetworkReply>
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     7
#include <QtNetwork/QNetworkRequest>
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     8
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
     9
#include "buffer.h"
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    10
18
5707b75503d5 working on test for common siging test
John Kern <johnk@symbian.org>
parents: 17
diff changeset
    11
const QString BaseURL = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=";
5707b75503d5 working on test for common siging test
John Kern <johnk@symbian.org>
parents: 17
diff changeset
    12
17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    13
QNetworkReply *addIMEI(QNetworkAccessManager *mgr)
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    14
{
18
5707b75503d5 working on test for common siging test
John Kern <johnk@symbian.org>
parents: 17
diff changeset
    15
    QString reqPOST = BaseURL + "addIMEI";
17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    16
    QNetworkRequest request(QUrl(reqPOST.toUtf8()));
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    17
    request.setHeader(QNetworkRequest::ContentTypeHeader,"application/xhtml+xml");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    18
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    19
    QByteArray data;
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    20
    data.append("<SymbianSigned>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    21
    data.append("<IMEI>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    22
    data.append("<number>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    23
    data.append("356945030065847");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    24
    data.append("</number>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    25
    data.append("<description>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    26
    data.append("X6 from Angela");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    27
    data.append("</description>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    28
    data.append("</IMEI>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    29
    data.append("</SymbianSigned>");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    30
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    31
    return mgr->post(request,data);
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    32
}
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    33
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    34
QNetworkReply *getDevCert(QNetworkAccessManager *mgr)
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    35
{
18
5707b75503d5 working on test for common siging test
John Kern <johnk@symbian.org>
parents: 17
diff changeset
    36
    QString reqPOST = BaseURL + "getDevCert&genID=456723322";
17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    37
    QNetworkRequest request(QUrl(reqPOST.toUtf8()));
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    38
    request.setHeader(QNetworkRequest::ContentTypeHeader,"application/xhtml+xml");
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    39
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    40
    return mgr->get(request);
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    41
}
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    42
18
5707b75503d5 working on test for common siging test
John Kern <johnk@symbian.org>
parents: 17
diff changeset
    43
QNetworkReply *getSubmission(QNetworkAccessManager *mgr)
17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    44
{
18
5707b75503d5 working on test for common siging test
John Kern <johnk@symbian.org>
parents: 17
diff changeset
    45
    QString reqGET = BaseURL + "getSubmission&genID=456723322";
17
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    46
    QNetworkRequest request(QUrl(reqGET.toUtf8()));
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    47
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    48
    return mgr->get(request);
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    49
}
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    50
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    51
int main(int argc, char **argv)
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    52
{
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    53
    QCoreApplication app(argc, argv);
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    54
    QNetworkAccessManager *manager = new QNetworkAccessManager();
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    55
    Buffer *buf = new Buffer();
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    56
    QString reqGet = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=GetUIDList" ;
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    57
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    58
    app.connect(manager, SIGNAL(finished(QNetworkReply*)),
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    59
            buf, SLOT(replyFinished(QNetworkReply*)));
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    60
    // QNetworkReply *reply = manager->get(QNetworkRequest(QUrl::fromEncoded(reqGet.toUtf8())));
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    61
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    62
    // addIMEI(manager);
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    63
    getDevCert(manager);
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    64
    // app.connect(reply, SIGNAL(finished()), SLOT(quit()));
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    65
    return app.exec();
cad8819de653 adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
John Kern <johnk@symbian.org>
parents:
diff changeset
    66
}