[37] | 1 | /*********************************************************************
|
---|
| 2 | // created: 2014-02-02
|
---|
| 3 | // filename: AbstractSickSensor.h
|
---|
| 4 | //
|
---|
| 5 | // author: Cyril Fougeray
|
---|
| 6 | // Copyright Heudiasyc UMR UTC/CNRS 6599
|
---|
| 7 | //
|
---|
| 8 | // version: $Id: $
|
---|
| 9 | //
|
---|
| 10 | // purpose: Abstract class to implement Sick sensors threads
|
---|
| 11 | //
|
---|
| 12 | *********************************************************************/
|
---|
| 13 |
|
---|
| 14 | #ifndef ABSTRACTSICKSENSOR_H
|
---|
| 15 | #define ABSTRACTSICKSENSOR_H
|
---|
| 16 |
|
---|
[72] | 17 | #include <QObject>
|
---|
[37] | 18 | #include "SickSocket.h"
|
---|
| 19 |
|
---|
| 20 | namespace pacpus {
|
---|
| 21 |
|
---|
| 22 | /// To separate data in UTC file = "UTC\0"
|
---|
| 23 | static const int32_t UTC_MAGIC_WORD = 0x55544300;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * \brief Structure used to stored Sick data between several decoding processes
|
---|
| 27 | *
|
---|
| 28 | * Note that data coming from sensors are split in IP packets. In order to get the
|
---|
| 29 | * whole message in one block, MessagePacket is used to reconstitue the raw data.
|
---|
| 30 | * As we want to reconstitute the message, it is useful to know if another packet
|
---|
| 31 | * belonging to the message was previously received. Also, the time of the reception of
|
---|
| 32 | * the first packet is carried into the structure in order to trace scans.
|
---|
| 33 | */
|
---|
| 34 | struct MessagePacket {
|
---|
| 35 | road_time_t time;
|
---|
| 36 | std::string data;
|
---|
| 37 | bool previousData;
|
---|
| 38 | };
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * @brief The AbstractSickSensor class
|
---|
| 43 | *
|
---|
| 44 | * The AbstractSickSensor class provides the abstract model for implementing sensor
|
---|
| 45 | * interfaces using SickComponent, used with the PACPUS Framework.
|
---|
| 46 | */
|
---|
[72] | 47 | class AbstractSickSensor : public QObject
|
---|
[37] | 48 | {
|
---|
| 49 | Q_OBJECT
|
---|
| 50 | public:
|
---|
| 51 |
|
---|
| 52 | virtual void stopActivity() = 0 ; /*!< to stop the processing thread */
|
---|
| 53 | virtual void startActivity() = 0; /*!< to start the processing thread */
|
---|
| 54 |
|
---|
| 55 | SickSocket * S_socket;
|
---|
| 56 |
|
---|
| 57 | signals:
|
---|
| 58 |
|
---|
| 59 | public slots:
|
---|
| 60 | /**
|
---|
| 61 | * @brief customEvent is a slot called when connected to a signal.
|
---|
| 62 | * @param e QEvent that carries information from sensor.
|
---|
| 63 | *
|
---|
| 64 | * Sick sensor interface implementation uses this slot to get data from the remote sensor,
|
---|
| 65 | * using IP packets. As long as Sick sensors use TCP/IP interface, it is advised to use this
|
---|
| 66 | * slot to get the packets from the device.
|
---|
| 67 | * @see SickFrameEvent
|
---|
| 68 | */
|
---|
| 69 | virtual void customEvent(QEvent * e) = 0;
|
---|
| 70 |
|
---|
| 71 | protected:
|
---|
| 72 | /// The SickLDMRS IP or hostname
|
---|
| 73 | QString host_;
|
---|
| 74 |
|
---|
| 75 | /// The SickLDMRS port
|
---|
| 76 | int port_;
|
---|
| 77 |
|
---|
| 78 | /// If data need to be recorded, set this member to true.
|
---|
| 79 | bool recording;
|
---|
| 80 | };
|
---|
| 81 |
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | #endif // ABSTRACTSICKSENSOR_H
|
---|