Commit 920d5e70 authored by matthew coleman's avatar matthew coleman

QGCUASFileManager - Fixed compiler warning on typecasting

writeFileAccumulator contents cleared on errors, nack or ack timeout
memcpy used to transfer data to request message buffer
parent 6b86cc59
......@@ -246,10 +246,10 @@ void QGCUASFileManager::_writeAckResponse(Request* writeAck)
}
if( *((uint32_t*)writeAck->data) !=_writeSize){
if( writeAck->writeFileLength !=_writeSize){
_currentOperation = kCOIdle;
_writeFileAccumulator.clear();
_emitErrorMessage(tr("Write: Size returned (%1) differs from size requested (%2)").arg(*((uint32_t*)writeAck->data)).arg(_writeSize));
_emitErrorMessage(tr("Write: Size returned (%1) differs from size requested (%2)").arg(writeAck->writeFileLength).arg(_writeSize));
return;
}
......@@ -283,9 +283,7 @@ void QGCUASFileManager::_writeFileDatablock(void)
request.hdr.size = _writeSize;
// memcpy this? _writeFileAccumulator.mid(_writeOffset, _writeSize), _writeSize);
for(uint32_t index=0; index < _writeSize; index++)
request.data[index] = _writeFileAccumulator.at(_writeOffset+index);
memcpy(request.data, &_writeFileAccumulator.data()[_writeOffset], _writeSize);
_sendRequest(&request);
}
......@@ -598,9 +596,14 @@ void QGCUASFileManager::_ackTimeout(void)
_sendTerminateCommand();
break;
case kCOCreate:
_currentOperation = kCOAck;
_writeFileAccumulator.clear();
_emitErrorMessage(tr("Timeout waiting for ack: Sending Create command"));
_sendTerminateCommand();
case kCOWrite:
_currentOperation = kCOAck;
_emitErrorMessage(tr("Timeout waiting for ack: Sending Terminate command"));
_writeFileAccumulator.clear();
_emitErrorMessage(tr("Timeout waiting for ack: Sending Write command"));
_sendTerminateCommand();
break;
default:
......
......@@ -111,6 +111,9 @@ protected:
// File length returned by Open command
uint32_t openFileLength;
// Length of file chunk written by write command
uint32_t writeFileLength;
};
};
......
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