Changeset 61 in pacpussensors for trunk/Sick/SickLDMRSSensor.cpp
- Timestamp:
- Jul 22, 2014, 4:36:25 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Sick/SickLDMRSSensor.cpp
r52 r61 138 138 LOG_TRACE("destructor (" << this->name_ << ")"); 139 139 140 S_socket->sendToServer(QString((u _int32_t)0x0021));140 S_socket->sendToServer(QString((uint32_t)0x0021)); 141 141 142 142 S_socket->closeSocket(); … … 157 157 158 158 159 u _int32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length)159 uint32_t SickLDMRSSensor::findMagicWord(const char * message, const unsigned length) 160 160 { 161 161 if (length < 4) { … … 164 164 165 165 unsigned long i = 0; 166 while(*((u _int32_t*)(message+i)) != 0xC2C0FEAF){ // BigE166 while(*((uint32_t*)(message+i)) != 0xC2C0FEAF){ // BigE 167 167 if (i == length) { 168 168 return -1; … … 175 175 176 176 177 u _int32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex)177 uint32_t SickLDMRSSensor::getMessageSize(const char * message, const unsigned length, const long magicWordIndex) 178 178 { 179 179 … … 202 202 { 203 203 // address = base + Data header size (24-byte long) + offset 204 msg.hScan.scanNumber = *((u _int16_t*)(msg.body+24));205 msg.hScan.scannerStatus = *((u _int16_t*)(msg.body+24+2));206 msg.hScan.phaseOffset = *((u _int16_t*)(msg.body+24+4));207 msg.hScan.startNtpTime = *((u _int64_t*)(msg.body+24+6));208 msg.hScan.endNtpTime = *((u _int64_t*)(msg.body+24+14));209 msg.hScan.ticksPerRot= *((u _int16_t*)(msg.body+24+22)); // needed to compute angle (°)204 msg.hScan.scanNumber = *((uint16_t*)(msg.body+24)); 205 msg.hScan.scannerStatus = *((uint16_t*)(msg.body+24+2)); 206 msg.hScan.phaseOffset = *((uint16_t*)(msg.body+24+4)); 207 msg.hScan.startNtpTime = *((uint64_t*)(msg.body+24+6)); 208 msg.hScan.endNtpTime = *((uint64_t*)(msg.body+24+14)); 209 msg.hScan.ticksPerRot= *((uint16_t*)(msg.body+24+22)); // needed to compute angle (°) 210 210 msg.hScan.startAngle = *((int16_t*)(msg.body+24+24)); 211 211 msg.hScan.endAngle = *((int16_t*)(msg.body+24+26)); 212 msg.hScan.numPoints = *((u _int16_t*)(msg.body+24+28));212 msg.hScan.numPoints = *((uint16_t*)(msg.body+24+28)); 213 213 214 214 // msg.hScan.mountingYawAngle = *((int16_t*)(msg.body+24+30)); … … 369 369 } 370 370 371 ScanPoint scanPoints[msg.hScan.numPoints];371 ScanPoint * scanPoints = new ScanPoint[msg.hScan.numPoints]; 372 372 373 373 // replace memory with structured data … … 375 375 scanPoints[i].layerEcho = *((uchar*)(msg.body + index)); 376 376 scanPoints[i].flags = *((uchar*)(msg.body + index + 1)); 377 scanPoints[i].angle = *((u _int16_t*)(msg.body + index + 2));378 scanPoints[i].distance = *((u _int16_t*)(msg.body + index + 4));379 scanPoints[i].echoPulseWidth = *((u _int16_t*)(msg.body + index + 6));377 scanPoints[i].angle = *((uint16_t*)(msg.body + index + 2)); 378 scanPoints[i].distance = *((uint16_t*)(msg.body + index + 4)); 379 scanPoints[i].echoPulseWidth = *((uint16_t*)(msg.body + index + 6)); 380 380 } 381 381 382 382 memcpy(msg.body, scanPoints, sizeof(ScanPoint) * msg.hScan.numPoints); 383 384 delete[] scanPoints; 383 385 } 384 386 else if (msg.hData.dataType == SICKLDMRS_OBJECTDATA_TYPE){ … … 434 436 void SickLDMRSSensor::configure(){ 435 437 // Start measuring 436 // S_socket->sendToServer(QString((u _int32_t)0x0020));438 // S_socket->sendToServer(QString((uint32_t)0x0020)); 437 439 438 440 // LOG_TRACE(this->name_ +" configured.");
Note:
See TracChangeset
for help on using the changeset viewer.