25 #include "oETCS/DF/OdometerAdaptor.h"
26 #include "oETCS/DF/EmergencyBrakeAdaptor.h"
27 #include "oETCS/DF/ServiceBrakeAdaptor.h"
28 #include "oETCS/DF/BaliseDeviceInAdaptor.h"
29 #include "oETCS/DF/BaliseDeviceOutAdaptor.h"
41 ::std::cin.get(&cInput, 1);
44 pApplication->exit(0);
51 int main(
int argc,
char* argv[])
54 bool bConnected(
true);
55 QCoreApplication Application(argc, argv);
56 QDBusConnection Connection = QDBusConnection::sessionBus();
62 ::AOdometer* pOdometer(
nullptr);
63 ::AEmergencyBrake* pEmergencyBrake(
nullptr);
64 ::AServiceBrake* pServiceBrake(
nullptr);
65 ::ABaliseDeviceIn* pBaliseIn(
nullptr);
66 ::ABaliseDeviceOut* pBaliseOut(
nullptr);
67 ::std::thread* pEvent(
nullptr);
74 pOdometer = new ::AOdometer(&Odometer);
75 pEmergencyBrake = new ::AEmergencyBrake(&EmergencyBrake);
76 pServiceBrake = new ::AServiceBrake(&ServiceBrake);
77 pBaliseOut = new ::ABaliseDeviceOut(&BaliseOut);
78 pBaliseIn = new ::ABaliseDeviceIn(&BaliseIn);
82 bConnected &= Connection.registerService(
"oETCS.DF.IOdometer");
83 bConnected &= Connection.registerObject(
"/oETCS/Odometer", &Odometer);
84 bConnected &= Connection.registerService(
"oETCS.DF.IEmergencyBrake");
85 bConnected &= Connection.registerObject(
"/oETCS/EmergencyBrake", &EmergencyBrake);
86 bConnected &= Connection.registerService(
"oETCS.DF.IServiceBrake");
87 bConnected &= Connection.registerObject(
"/oETCS/ServiceBrake", &ServiceBrake);
88 bConnected &= Connection.registerService(
"oETCS.DF.IBaliseDeviceIn");
89 bConnected &= Connection.registerObject(
"/oETCS/BaliseDeviceIn", &BaliseIn);
90 bConnected &= Connection.registerService(
"oETCS.DF.IBaliseDeviceOut");
91 bConnected &= Connection.registerObject(
"/oETCS/BaliseDeviceOut", &BaliseOut);
98 ::std::cerr <<
"Could not register all adaptors!" << ::std::endl;
104 ::std::cout <<
"Executing adaptor event loop (<ENTER> to abort)..." << ::std::flush;
107 pEvent = new ::std::thread(&::
InputThread, &Application);
110 iResult = Application.exec();
114 if (pEvent->joinable())
123 ::std::cout <<
"terminated" << ::std::endl;
126 catch (const ::std::bad_alloc& Exception)
129 ::std::cerr <<
"Could not allocate all objects!" << Connection.lastError().message().toStdString() <<
"Aborting..." << ::std::endl;
134 delete pServiceBrake;
136 delete pEmergencyBrake;