SigningTS/client/main.cpp
author John Kern <johnk@symbian.org>
Wed, 12 May 2010 09:44:30 -0700
changeset 17 cad8819de653
child 18 5707b75503d5
permissions -rw-r--r--
adding preliminary code; very much a work in progress; it is too difficult to work on the file system any longer
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
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
    11
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
    12
{
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
    QString reqPOST = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=addIMEI";
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
    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
    15
    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
    16
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
    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
    18
    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
    19
    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
    20
    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
    21
    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
    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("<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
    24
    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
    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("</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
    27
    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
    28
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
    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
    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
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
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
    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
    QString reqPOST = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=getDevCert&genID=456723322";
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
    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
    36
    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
    37
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
    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
    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
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
QNetworkReply *getSubmission()
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
{
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
    43
    QString reqGET = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=getSubmission&genID=456723322";
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
    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
    45
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
    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
    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
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
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
    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
    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
    52
    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
    53
    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
    54
    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
    55
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
    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
    57
            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
    58
    // 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
    59
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
    // 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
    61
    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
    62
    // 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
    63
    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
    64
}