Changeset 42 in pacpussensors for trunk/Sick/SickLDMRSSensor.cpp
- Timestamp:
- Apr 1, 2014, 2:47:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Sick/SickLDMRSSensor.cpp
r37 r42 43 43 static const int SICKLDMRS_OBJECTDATA_TYPE = 0x2221; 44 44 45 ////////////////////////////////////////////////////////////////////////// 46 /// Constructor. 45 47 46 SickLDMRSSensor::SickLDMRSSensor(QObject *parent) 48 47 : ipaddr_("192.168.0.1"), … … 83 82 } 84 83 85 ////////////////////////////////////////////////////////////////////////// 86 /// Destructor. 84 87 85 SickLDMRSSensor::~SickLDMRSSensor() 88 86 { … … 91 89 } 92 90 93 ////////////////////////////////////////////////////////////////////////// 94 /// Called by the ComponentManager to start the component 91 95 92 void SickLDMRSSensor::startActivity() 96 93 { … … 104 101 105 102 try { 106 dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK , sizeof(SickLDMRS_dbt));103 dbtFile_.open(kSickDbtFileName, WriteMode, TELEM_SICK_LDMRS, sizeof(SickLDMRS_dbt)); 107 104 } catch (DbiteException & e) { 108 105 cerr << "error opening dbt file: "<< kSickDbtFileName << ", " << e.what() << endl; … … 136 133 } 137 134 138 ////////////////////////////////////////////////////////////////////////// 139 /// Called by the ComponentManager to stop the component 135 140 136 void SickLDMRSSensor::stopActivity() 141 137 { … … 161 157 162 158 163 //////////////////////////////////////////////////////////////////////////164 /// look for the position of the magic word in the packet.165 /// Return it if found else return -1166 159 u_int32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length) 167 160 { … … 181 174 } 182 175 183 ////////////////////////////////////////////////////////////////////////// 184 /// Return the size of the message contained in the packet 185 /// You have to provide the position of the magic word in the packet 176 186 177 u_int32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex) 187 178 { … … 198 189 } 199 190 200 ////////////////////////////////////////////////////////////////////////// 201 /// @param size the total size of the message including the 2 headers and the body 202 /// @param length the number of available bytes in the packet 191 203 192 bool SickLDMRSSensor::isMessageComplete(const unsigned length, const long size) 204 193 { … … 276 265 } 277 266 278 ////////////////////////////////////////////////////////////////////////// 279 /// this function is called when no complete message has been found 280 /// we set the flag previousData to true for the next processing stage 281 /// and we store the timestamp of the bytes acquisition 267 282 268 void SickLDMRSSensor::storePendingBytes(road_time_t time) 283 269 { … … 406 392 } 407 393 408 ////////////////////////////////////////////////////////////////////////// 409 /// write the data on the disk: 410 /// - complete the dbt file with msg.hData 411 /// - complete the binary data file with the alascaData.point 394 412 395 void SickLDMRSSensor::writeData(MessageLDMRS &msg) 413 396 { … … 419 402 entry.hScan = msg.hScan; 420 403 entry.dataPos = dataFile_.tellp(); // absolute position of pointer in UTC file 421 entry.time = msg.time;422 entry.timerange = msg.timerange;404 // entry.time = msg.time; 405 // entry.timerange = msg.timerange; 423 406 424 407 // write DBT … … 442 425 443 426 444 ///445 427 void SickLDMRSSensor::configure(){ 446 428 // Start measuring … … 451 433 452 434 453 //////////////////////////////////////////////////////////////////////////454 /// Event call by the SickSocket class when new data has been arrived455 /// on the network.456 435 void SickLDMRSSensor::customEvent(QEvent * e) 457 436 { … … 476 455 // write data on the disk 477 456 if (recording_) 478 writeData(msg List.front());457 writeData(msgToProcess); 479 458 480 459 #ifdef SICKLDMRS_SH_MEM 460 /// NOT TESTED ! 481 461 /// push data in shared memory 482 462 // First the scan info … … 499 479 } 500 480 501 // (malloced memory) ScanPoints[] or ScanObjects[] no longer needed502 free(msgToProcess.body);503 504 481 // removes the processed item of the list 505 482 msgList.pop_front();
Note:
See TracChangeset
for help on using the changeset viewer.