Line | |
---|
1 | #include "RtnetDataRequest.h"
|
---|
2 |
|
---|
3 | #include <cstdio>
|
---|
4 |
|
---|
5 | using namespace apache::thrift;
|
---|
6 | using namespace apache::thrift::protocol;
|
---|
7 | using namespace com::gpssolutions::rtnet;
|
---|
8 |
|
---|
9 | RtnetDataRequest::RtnetDataRequest(boost::shared_ptr<TProtocol>& protocol,
|
---|
10 | boost::shared_ptr<ConnectionStatusMonitor>& connectionMonitor)
|
---|
11 | : ConnectionRequiredRunnable(connectionMonitor,"RtnetDataRequestService"),
|
---|
12 | client_(new RtnetDataClient(protocol))
|
---|
13 | {
|
---|
14 | }
|
---|
15 |
|
---|
16 | void
|
---|
17 | RtnetDataRequest::run() {
|
---|
18 | printf("Starting RtnetDataRequest thread.\n");
|
---|
19 | while (!stop_) {
|
---|
20 | printf("waiting for connection\n");
|
---|
21 | connectWait();
|
---|
22 | printf("Connected to rtnet\n");
|
---|
23 | if (stop_) {
|
---|
24 | printf("Quitting RtnetDataRequest thread (stop is true)\n");
|
---|
25 | return;
|
---|
26 | }
|
---|
27 | try {
|
---|
28 | printf("sending request for rtnet data stream\n");
|
---|
29 | client_->startDataStream();
|
---|
30 | disconnectWait();
|
---|
31 | } catch (TException& e) {
|
---|
32 | fprintf(stderr,"Caught an exception generated by Thrift in RtnetDataRequest: %s\n",e.what());
|
---|
33 | }
|
---|
34 | }
|
---|
35 | printf("Quitting RtnetDataRequest thread\n");
|
---|
36 | }
|
---|
37 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.