openETCS
case study for the European Train Control System developed for the authors dissertation
PlatformSpecificClientsMOC.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010-2012
3  Johannes Feuser <feuser@uni-bremen.de>
4  This file is part of the openETCS library.
5 
6  The openETCS library is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  any later version.
10 
11  The openETCS library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with the openETCS library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /*!
21  * \author Johannes Feuser <feuser@uni-bremen.de>
22  * \brief classes (for HW devices) for accessing HW elements through D-Bus interfaces needing the meta object compiler (moc)
23  */
24 
25 #ifndef __OETCS_DF_PLATFORMSPECIFICCLIENTSMOC_H__
26 #define __OETCS_DF_PLATFORMSPECIFICCLIENTSMOC_H__
27 
28 
29 #include <iostream>
30 
31 #include <vector>
32 #include "Error/ExceptionTypes.h"
33 #include <string>
34 #include <QBitArray>
35 #include "oETCS/DF/BaliseDeviceInInterface.h"
36 #include <mutex>
37 #include <QObject>
38 #include "oETCS/DF/BaliseDeviceOutInterface.h"
39 #include "EVCStateMachine.h"
40 #include "oETCS/DF/EmergencyBrakeInterface.h"
41 #include "oETCS/DF/OdometerInterface.h"
42 #include "oETCS/DF/ServiceBrakeInterface.h"
43 
44 
45 
46 
47 namespace oETCS { namespace DF { class CTelegram; } }
48 namespace oETCS { namespace DF { class CEVCStateMachine; } }
49 
50 
51 namespace oETCS {
52 
53 namespace DF {
54 
55 
56 /*!
57  * \brief base class for all balise devices for incomming messages
58  */
59 class CBaliseDeviceIn : public ::QObject
60 {
61  Q_OBJECT
62  public:
63  /*!
64  * \brief general constructor
65  *
66  * Parameterises the the communication incoming device with all constant members.
67  *
68  * \param[in] Telegrams vector with pointers to all telegrams supported
69  * \param[in] bUsePS optional flag for the usage of the platform specifc implementation via D-Bus
70  */
71  explicit CBaliseDeviceIn(const ::std::vector< oETCS::DF::CTelegram * >& Telegrams, const bool& bUsePS = false) throw();
72 
73 
74 
75  /*!
76  * \brief deleted copy constructor
77  */
78  CBaliseDeviceIn(const CBaliseDeviceIn& Source) = delete;
79 
80 
81 
82  /*!
83  * \brief destructor
84  */
85  virtual ~CBaliseDeviceIn() throw();
86 
87 
88 
89  /*!
90  * \brief deleted assignment operator
91  */
92  CBaliseDeviceIn& operator=(const CBaliseDeviceIn & Source) = delete;
93 
94 
95 
96  /*!
97  * \brief gets flag for a new telegram
98  *
99  * Starts the evaluation of a new telegram, if a new teleragm is available.
100  *
101  * \return non empty vector of received packet IDs, in case of a new telegram
102  */
103  ::std::vector< unsigned char > HasNewTelegram() throw(::oETCS::DF::Error::CException);
104 
105 
106 
107  /*!
108  * \brief clears all bit arrays
109  */
110  void Clear() throw();
111 
112 
113 
114 
115  public slots:
116  /*!
117  * \brief informs the stub about a new telegram available
118  *
119  * \remark this method should be called by a platform specific implementation
120  *
121  * \param[in] Bytes array of bytes of the new telegram
122  * \param[in] iBits number of bits only used from the beginning in the byte array
123  */
124  void NewTelegramReceived(const QByteArray & Bytes, int iBits);
125 
126 
127 
128  /*!
129  * \brief informs the stub about an error ocurred in the PS part
130  *
131  * \remark this method should be called by a platform specific implementation
132  *
133  * \param[in] ErrorMessage textual description of the error
134  */
135  void Error(const QString& ErrorMessage);
136 
137 
138 
139 
140  public:
141  /*!
142  * \brief flag for the usage of a platform specific implmentation via D-Bus
143  */
145 
146 
147 
148 
149  private:
150  /*!
151  * \brief stack with error messages from the platform specific adaptor implementation
152  */
153  ::std::vector< ::std::string > m_ErrorStack;
154 
155 
156 
157  /*!
158  * \brief locally stored bit arrays
159  */
160  ::std::vector< ::QBitArray > m_BitArrays;
161 
162 
163 
164  /*!
165  * \brief vector with pointers of all connected telegrams
166  */
167  const ::std::vector< oETCS::DF::CTelegram* > m_Telegrams;
168 
169 
170 
171  /*!
172  * \brief pointer to the proxy object
173  */
174  oETCS::DF::IBaliseDeviceIn* m_pProxy;
175 
176 
177 
178  /*!
179  * \brief muteable exclusion object
180  */
181  ::std::recursive_mutex m_Mutex;
182 
183 
184 
185 
186 }; // class CBaliseDeviceIn : public ::QObject
187 
188 
189 
190 /*!
191  * \brief base class for all balise devices for outgoing messages
192  */
194 {
195  Q_OBJECT
196  public:
197  /*!
198  * \brief general constructor
199  *
200  * Parameterises the the communication incoming device with all constant members.
201  *
202  * \param[in] Telegrams vector with pointers to all telegrams supported
203  * \param[in] bUsePS optional flag for the usage of the platform specifc implementation via D-Bus
204  */
205  explicit CBaliseDeviceOut(const ::std::vector< oETCS::DF::CTelegram * >& Telegrams, const bool& bUsePS = false) throw();
206 
207 
208 
209  /*!
210  * \brief deleted copy constructor
211  */
212  CBaliseDeviceOut(const CBaliseDeviceOut& Source) = delete;
213 
214 
215 
216  /*!
217  * \brief destructor
218  */
219  virtual ~CBaliseDeviceOut() throw();
220 
221 
222 
223  /*!
224  * \brief executes the sending of corresponding telegram
225  *
226  * \remark this method should be reimplemented by any inheriting class
227  */
228  virtual void SendTelegram() throw(::oETCS::DF::Error::CException);
229 
230 
231 
232  /*!
233  * \brief deleted assigment operator
234  */
235  CBaliseDeviceOut& operator=(const CBaliseDeviceOut& Source) = delete;
236 
237 
238 
239 
240  public slots:
241  /*!
242  * \brief informs the stub about an error ocurred in the PS part
243  *
244  * \remark this method should be called by a platform specific implementation
245  *
246  * \param[in] ErrorMessage textual description of the error
247  */
248  void Error(const QString& ErrorMessage);
249 
250 
251 
252 
253  public:
254  /*!
255  * \brief flag for the usage of a platform specific implmentation via D-Bus
256  */
258 
259 
260 
261 
262  private:
263  /*!
264  * \brief stack with error messages from the platform specific adaptor implementation
265  */
266  ::std::vector< ::std::string > m_ErrorStack;
267 
268 
269 
270  /*!
271  * \brief vector with pointers to all connected telegrams
272  */
273  const ::std::vector< oETCS::DF::CTelegram* > m_Telegrams;
274 
275 
276 
277  /*!
278  * \brief pointer to the proxy object
279  */
280  oETCS::DF::IBaliseDeviceOut* m_pProxy;
281 
282 
283 
284  /*!
285  * \brief muteable exclusion object
286  */
287  ::std::recursive_mutex m_Mutex;
288 
289 
290 
291 
292 }; // class CBaliseDeviceOut : public ::QObject
293 
294 
295 
296 /*!
297  * \brief super class for ememgerncy brake implementations
298  */
300 {
301  Q_OBJECT
302  public:
303  /*!
304  * \brief general constructor
305  *
306  * \param[in] pStateMachine pointer to the parent EVC state machine object
307  * \param[in] bUsePS optional flag for the usage of the platform specifc implementation via D-Bus
308  */
309  explicit CEmergencyBrake(oETCS::DF::CEVCStateMachine * pStateMachine, const bool & bUsePS = false) throw();
310 
311 
312 
313  /*!
314  * \brief destructor
315  */
316  virtual ~CEmergencyBrake() throw();
317 
318 
319 
320  /*!
321  * \brief method for computing all outputs
322  *
323  * \remark must be (re)implemented for all emergency brake implementations
324  */
325  virtual void Calculate() throw(::oETCS::DF::Error::CException);
326 
327 
328 
329 
330  public slots:
331  /*!
332  * \brief informs the stub about an error ocurred in the PS part
333  *
334  * \remark this method should be called by a platform specific implementation
335  *
336  * \param[in] ErrorMessage textual description of the error
337  */
338  void Error(const QString& ErrorMessage);
339 
340 
341 
342 
343  public:
344  /*!
345  * \brief storage of the activation flag
346  */
348 
349 
350 
351  /*!
352  * \brief flag for the usage of a platform specific implmentation via D-Bus
353  */
355 
356 
357 
358 
359  private:
360  /*!
361  * \brief stack with error messages from the platform specific adaptor implementation
362  */
363  ::std::vector< ::std::string > m_ErrorStack;
364 
365 
366 
367  oETCS::DF::IEmergencyBrake* m_pProxy;
368 
369 
370 
371  /*!
372  * \brief muteable exclusion object
373  */
374  ::std::recursive_mutex m_Mutex;
375 
376 
377 
378 
379 }; // class CEmergencyBrake : public ::QObject, public oETCS::DF::CFunctionBlock
380 
381 
382 
383 /*!
384  * \brief super class for odometer implementations
385  */
387 {
388  Q_OBJECT
389  public:
390  /*!
391  * \brief default/general constructor
392  *
393  * \param[in] pStateMachine pointer to the parent EVC state machine object
394  * \param[in] bUsePS optional flag for the usage of the platform specifc implementation via D-Bus
395  */
396  COdometer(oETCS::DF::CEVCStateMachine * const pStateMachine, const bool& bUsePS = false) throw();
397 
398 
399 
400  /*!
401  * \brief destructor
402  */
403  virtual ~COdometer() throw();
404 
405 
406 
407  /*!
408  * \brief method for computing all outputs
409  *
410  * \remark must be implemented for all odometer implementations
411  */
412  virtual void Calculate() throw(::oETCS::DF::Error::CException);
413 
414 
415 
416 
417  public slots:
418  /*!
419  * \brief informs the stub about an error ocurred in the PS part
420  *
421  * \remark this method should be called by a platform specific implementation
422  *
423  * \param[in] ErrorMessage textual description of the error
424  */
425  void Error(const QString& ErrorMessage);
426 
427 
428 
429 
430  public:
431  /*!
432  * \brief pointers to storage of the absolute position
433  */
434  ::std::vector< oETCS::DF::DOUBLE_OUTPUT_T > m_AbsolutePosition;
435 
436 
437 
438  /*!
439  * \brief pointers to storage of the velocity
440  */
441  ::std::vector< oETCS::DF::DOUBLE_OUTPUT_T > m_Velocity;
442 
443 
444 
445  /*!
446  * \brief flag for the usage of a platform specific implmentation via D-Bus
447  */
449 
450 
451 
452 
453  private:
454  /*!
455  * \brief stack with error messages from the platform specific adaptor implementation
456  */
457  ::std::vector< ::std::string > m_ErrorStack;
458 
459 
460 
461  /*!
462  * \brief pointer to the proxy object
463  */
464  oETCS::DF::IOdometer* m_pProxy;
465 
466 
467 
468  /*!
469  * \brief muteable exclusion object
470  */
471  ::std::recursive_mutex m_Mutex;
472 
473 
474 
475 
476 }; // class COdometer : public ::QObject, public oETCS::DF::CFunctionBlock
477 
478 
479 
480 /*!
481  * \brief super class for service brake implementations
482  */
484 {
485  Q_OBJECT
486  public:
487  /*!
488  * \brief general constructor
489  *
490  * \param[in] pStateMachine pointer to the parent EVC state machine object
491  * \param[in] bUsePS optional flag for the usage of the platform specifc implementation via D-Bus
492  */
493  explicit CServiceBrake(oETCS::DF::CEVCStateMachine * const pStateMachine, const bool& bUsePS = false) throw();
494 
495 
496 
497  /*!
498  * \brief destructor
499  */
500  virtual ~CServiceBrake() throw();
501 
502 
503 
504  /*!
505  * \brief method for computing all outputs
506  *
507  * \remark must be implemented for all service brake implementations
508  */
509  virtual void Calculate() throw(::oETCS::DF::Error::CException);
510 
511 
512 
513 
514  public slots:
515  /*!
516  * \brief informs the stub about an error ocurred in the PS part
517  *
518  * \remark this method should be called by a platform specific implementation
519  *
520  * \param[in] ErrorMessage textual description of the error
521  */
522  void Error(const QString& ErrorMessage);
523 
524 
525 
526 
527  public:
528  /*!
529  * \brief storage of the brake intensity value
530  */
532 
533 
534 
535  /*!
536  * \brief flag for the usage of a platform specific implmentation via D-Bus
537  */
539 
540 
541 
542 
543  private:
544  /*!
545  * \brief stack with error messages from the platform specific adaptor implementation
546  */
547  ::std::vector< ::std::string > m_ErrorStack;
548 
549 
550 
551  /*!
552  * \brief pointer to the proxy object
553  */
554  oETCS::DF::IServiceBrake* m_pProxy;
555 
556 
557 
558  /*!
559  * \brief muteable exclusion object
560  */
561  ::std::recursive_mutex m_Mutex;
562 
563 
564 
565 
566 }; // class CServiceBrake : public ::QObject, public oETCS::DF::CFunctionBlock
567 
568 
569 
570 
571 
572 } // namespace oETCS::DF
573 
574 } // namespace oETCS
575 
576 #endif // __ OETCS_DF_PLATFORMSPECIFICCLIENTSMOC_H__

Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
The openETCS library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the openETCS library. If not, see "http://www.gnu.org/licenses/.