Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
El Sayed, Nadim
ocpp-cp
Commits
553e9ba6
Commit
553e9ba6
authored
Sep 21, 2017
by
Gozutok, Recep
Browse files
Delete main.cpp
parent
16ed5613
Changes
1
Hide whitespace changes
Inline
Side-by-side
OPERATIONS/Authorize/main.cpp
deleted
100644 → 0
View file @
16ed5613
#include
"soapCentralSystemServiceSoapProxy.h"
// include the proxy declarations
#include
"CentralSystemServiceSoap.nsmap"
// include the XML namespace mappings
#include
<ctime>
#include
<thread>
#include
<mutex>
void
heartbeat
(){
std
::
mutex
mtx
;
int
b
=
0
;
while
(
b
==
0
){
sleep
(
3
);
mtx
.
lock
();
CentralSystemServiceSoapProxy
service
;
std
::
cout
<<
"Starting client"
<<
std
::
endl
;
ns1__HeartbeatRequest
req
;
ns1__HeartbeatResponse
res
;
SOAP_ENV__Header
rec
;
rec
.
ns1__chargeBoxIdentity
=
"CP1234"
;
rec
.
wsa5__MessageID
=
"file:///home/rgozutok/Belgeler/heartbeath/CentralSystemServiceSoap.Heartbeat.req.xml"
;
rec
.
wsa5__To
=
"http://130.149.159.42:9000/soap/CS?wsdl"
;
rec
.
wsa5__Action
=
"/Heartbeat"
;
service
.
soap_header
(
rec
.
ns1__chargeBoxIdentity
,
rec
.
wsa5__MessageID
,
rec
.
wsa5__RelatesTo
,
rec
.
wsa5__From
,
rec
.
wsa5__ReplyTo
,
rec
.
wsa5__FaultTo
,
rec
.
wsa5__To
,
rec
.
wsa5__Action
,
rec
.
chan__ChannelInstance
);
double
result
=
service
.
Heartbeat
(
"http://130.149.159.42:9000/soap/CS"
,
"/Heartbeat"
,
&
req
,
res
);
if
(
result
==
SOAP_OK
)
{
tm
*
ltm
=
localtime
(
&
res
.
currentTime
);
std
::
cout
<<
"Date: "
<<
ltm
->
tm_mday
<<
"/"
<<
1
+
ltm
->
tm_mon
<<
"/"
<<
1900
+
ltm
->
tm_year
<<
std
::
endl
;
std
::
cout
<<
"Time: "
<<
ltm
->
tm_hour
<<
":"
<<
ltm
->
tm_min
<<
":"
<<
1
+
ltm
->
tm_sec
<<
std
::
endl
;
}
mtx
.
unlock
();
}
}
void
authorize
(){
CentralSystemServiceSoapProxy
service
;
ns1__AuthorizeRequest
req
;
ns1__AuthorizeResponse
res
;
SOAP_ENV__Header
rec
;
rec
.
ns1__chargeBoxIdentity
=
"CP1234"
;
rec
.
wsa5__MessageID
=
"file:///home/rgozutok/Belgeler/authorize/CentralSystemServiceSoap.Authorize.req.xml"
;
rec
.
wsa5__To
=
"http://130.149.159.42:9000/soap/CS?wsdl"
;
rec
.
wsa5__Action
=
"/Authorize"
;
service
.
soap_header
(
rec
.
ns1__chargeBoxIdentity
,
rec
.
wsa5__MessageID
,
rec
.
wsa5__RelatesTo
,
rec
.
wsa5__From
,
rec
.
wsa5__ReplyTo
,
rec
.
wsa5__FaultTo
,
rec
.
wsa5__To
,
rec
.
wsa5__Action
,
rec
.
chan__ChannelInstance
);
req
.
idTag
;
double
result
=
service
.
Authorize
(
&
req
,
res
);
if
(
result
==
SOAP_OK
)
{
std
::
cout
<<
"Yes the binding is working..."
<<
std
::
endl
;
if
(
res
.
idTagInfo
->
status
==
0
)
std
::
cout
<<
"Authorization is Accepted..."
<<
std
::
endl
;
if
(
res
.
idTagInfo
->
status
==
1
)
std
::
cout
<<
"Authorization is Blocked..."
<<
std
::
endl
;
if
(
res
.
idTagInfo
->
status
==
2
)
std
::
cout
<<
"Authorization is Expired..."
<<
std
::
endl
;
if
(
res
.
idTagInfo
->
status
==
3
)
std
::
cout
<<
"Authorization is Invalid..."
<<
std
::
endl
;
if
(
res
.
idTagInfo
->
status
==
4
)
std
::
cout
<<
"Authorization is ConcurrentTx..."
<<
std
::
endl
;
}
tm
*
ltm
=
localtime
(
res
.
idTagInfo
->
expiryDate
);
std
::
cout
<<
"Date: "
<<
ltm
->
tm_mday
<<
"/"
<<
1
+
ltm
->
tm_mon
<<
"/"
<<
1900
+
ltm
->
tm_year
<<
std
::
endl
;
std
::
cout
<<
"Time: "
<<
ltm
->
tm_hour
<<
":"
<<
ltm
->
tm_min
<<
":"
<<
1
+
ltm
->
tm_sec
<<
std
::
endl
;
}
int
main
()
{
CentralSystemServiceSoapProxy
service
;
std
::
thread
t1
(
authorize
);
t1
.
join
();
std
::
cout
<<
"/* message */"
<<
std
::
endl
;
std
::
thread
t2
(
heartbeat
);
t2
.
join
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment