Changeset 42 in pacpussensors for trunk/Sick/SickSocket.h
- Timestamp:
- 04/01/14 14:47:39 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Sick/SickSocket.h
r37 r42 3 3 // filename: SickSocket.h 4 4 // 5 // author: Gerald Dherbomez & Cyril Fougeray 5 // author: Gerald Dherbomez 6 // Modified by Cyril Fougeray 6 7 // Copyright Heudiasyc UMR UTC/CNRS 6599 7 8 // … … 31 32 class SickLMSSensor; 32 33 34 /** 35 * @brief The SickFrame class 36 */ 33 37 class SickFrame 34 38 { 35 39 public: 40 /** 41 * @brief SickFrame constructor 42 */ 36 43 SickFrame() 37 44 { … … 41 48 } 42 49 50 /// Destructor 43 51 ~SickFrame() 44 52 { … … 46 54 } 47 55 48 qint64 size; 49 road_time_t time; 50 char * msg; 56 qint64 size; //!< Size of incoming packet. 57 road_time_t time; //!< Time when packet is received. 58 char * msg; //!< Packet (raw data). 51 59 }; 52 60 53 // forward declaration 54 61 /** 62 * @brief The SickFrameEvent class 63 * QEvent that encapsulates packets. 64 */ 55 65 class SickFrameEvent 56 66 : public QEvent 57 67 { 58 68 public: 69 /// Constructor 59 70 SickFrameEvent() 60 71 : QEvent((QEvent::Type)(QEvent::User + 522)) 61 72 {} 62 73 74 /// Destructor 63 75 ~SickFrameEvent() 64 76 {} 65 77 78 /// Packet data 66 79 SickFrame * frame; 67 80 }; 68 81 82 /** 83 * @brief The SickSocket class 84 * Handles the ethernet connection with the remote sensor. 85 */ 69 86 class SickSocket 70 87 : public QObject … … 73 90 74 91 public: 92 /// Constructor 75 93 SickSocket(AbstractSickSensor * parent); 94 95 /// Destructor 76 96 ~SickSocket(); 77 97 78 98 public Q_SLOTS: 79 // enable the connection to the server99 /// Enable the connection to the server 80 100 void connectToServer(QString host, int port); 81 101 82 // avertit que le socket est connecté102 /// Warns about connection of the socket and launch configuration of the socket. 83 103 int socketConnected(); 84 104 85 / / appelé lorsque de nouvelles données sont arrivées sur le socket105 /** Called when incoming data is received. Create an event and send it to the sensor's handler. @see AbstractSickComponent */ 86 106 void socketReadyRead(); 87 107 88 // close the connection with the server108 /// Close the connection with the server 89 109 void closeSocket() { socket->close(); } 90 110 91 // fonction d'envoi des données au télémètre 111 /** 112 * @brief sendToServer Sends data to the remote lidar. 113 * @param data Data to be sent, translated in ASCII. 114 */ 92 115 void sendToServer(QString data); 93 116 Q_SIGNALS: 94 // signal emis pour demander la configuration du télémètre117 /// Asked for configuring sensor. 95 118 void configuration(); 96 119 97 120 protected slots: 98 99 // le socket est fermé par le serveur 121 /// Says to the user the connection is closed. 100 122 void socketConnectionClosed(); 101 123 102 // une erreur est survenue124 /// Warns the user an error occured 103 125 void socketError(QAbstractSocket::SocketError e); 104 126 105 127 private: 128 /// Socket 106 129 QTcpSocket *socket; 130 131 /// Mutex to use socket resource. 107 132 QMutex mutex; 108 133 134 /// Parent (contains slots to connect to in order to pass the received data). 109 135 AbstractSickSensor *myParent; 110 136 };
Note:
See TracChangeset
for help on using the changeset viewer.