-
Notifications
You must be signed in to change notification settings - Fork 1
/
milestonemanager.cpp
85 lines (78 loc) · 3.24 KB
/
milestonemanager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "milestonemanager.h"
#include <QDomDocument>
#include <QUuid>
MilestoneManager::MilestoneManager(QObject *parent) : QObject(parent),
m_server("")
{
}
void MilestoneManager::initialize(QString server)
{
qDebug() << Q_FUNC_INFO << server;
m_server = server;
}
void MilestoneManager::getVersion()
{
qDebug() << Q_FUNC_INFO;
QString xmlData =
QString("<?xml version=\"1.0\" encoding=\"utf-8\"?>") +
QString("<soap:Envelope ") +
QString("xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">") +
QString("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"") +
QString("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"") +
QString("<soap:Body>") +
QString("<GetVersion ") +
QString("xmlns=\"http://videoos.net/2/XProtectCSServerCommand\">") +
QString("</GetVersion>") +
QString("</soap:Body>") +
QString("</soap:Envelope>");
QString xmlResult = lSoapConnectionManager.httpcall(m_server, xmlData,
"http://videoos.net/2/XProtectCSServerCommand/GetVersion");
QDomDocument xmlDomDoc;
if (!xmlDomDoc.setContent(xmlResult))
{
qWarning() << "Error: Cannot parse data xml result";
return;
}
QDomNodeList nodes = xmlDomDoc.elementsByTagName("GetVersionResult");
for (int i= 0; i<nodes.count(); i++)
{
QDomNode lNode = nodes.at(i);
qDebug() << "GetVersionResult:" << lNode.toElement().firstChild().nodeValue();
}
}
void MilestoneManager::login(const QString &token)
{
qDebug() << Q_FUNC_INFO;
QString xmlData =
QString("<?xml version=\"1.0\" encoding=\"utf-8\"?>") +
QString("<soap:Envelope ") +
QString("xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">") +
QString("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"") +
QString("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"") +
QString("<soap:Body>") +
QString("<Login xmlns=\"http://videoos.net/2/XProtectCSServerCommand\">") +
QString("<instanceId>" + QUuid::createUuid().toString() + "</instanceId><currentToken>" + token + "</currentToken>") +
QString("</Login>") +
QString("</soap:Body>") +
QString("</soap:Envelope>");
QString xmlResult = lSoapConnectionManager.httpcall(m_server, xmlData,
"http://videoos.net/2/XProtectCSServerCommand/Login");
QDomDocument xmlDomDoc;
if (!xmlDomDoc.setContent(xmlResult))
{
qWarning() << "Error: Cannot parse data xml result";
return;
}
QDomNodeList nodes = xmlDomDoc.elementsByTagName("Token");
for (int i= 0; i<nodes.count(); i++)
{
QDomNode lNode = nodes.at(i);
qDebug() << "Token:" << lNode.toElement().firstChild().nodeValue();
}
nodes = xmlDomDoc.elementsByTagName("MicroSeconds");
for (int i= 0; i<nodes.count(); i++)
{
QDomNode lNode = nodes.at(i);
qDebug() << "MicroSeconds:" << lNode.toElement().firstChild().nodeValue();
}
}