Commit c106c615 authored by Don Gagne's avatar Don Gagne

Added CRC checking

parent d304ffd6
...@@ -261,7 +261,13 @@ void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t me ...@@ -261,7 +261,13 @@ void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t me
mavlink_msg_encapsulated_data_decode(&message, &data); mavlink_msg_encapsulated_data_decode(&message, &data);
Request* request = (Request*)&data.data[0]; Request* request = (Request*)&data.data[0];
// FIXME: Check CRC // Make sure we have a good CRC
if (request->hdr.crc32 != crc32(request)) {
_currentOperation = kCOIdle;
_emitErrorMessage(tr("Bad CRC on received message"));
return;
}
if (request->hdr.opcode == kRspAck) { if (request->hdr.opcode == kRspAck) {
...@@ -289,7 +295,7 @@ void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t me ...@@ -289,7 +295,7 @@ void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t me
break; break;
default: default:
_emitErrorMessage("Ack received in unexpected state"); _emitErrorMessage(tr("Ack received in unexpected state"));
break; break;
} }
} else if (request->hdr.opcode == kRspNak) { } else if (request->hdr.opcode == kRspNak) {
...@@ -462,7 +468,7 @@ void QGCUASFileManager::_setupAckTimeout(void) ...@@ -462,7 +468,7 @@ void QGCUASFileManager::_setupAckTimeout(void)
Q_ASSERT(!_ackTimer.isActive()); Q_ASSERT(!_ackTimer.isActive());
_ackTimer.setSingleShot(true); _ackTimer.setSingleShot(true);
_ackTimer.start(_ackTimerTimeoutMsecs); _ackTimer.start(ackTimerTimeoutMsecs);
} }
/// @brief Clears the ack timeout timer /// @brief Clears the ack timeout timer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment