Skip to content

Commit

Permalink
Fix for unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Oct 3, 2016
1 parent f69b38e commit 63f0271
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/uas/FileManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -731,16 +731,23 @@ void FileManager::_sendRequest(Request* request)
if (_systemIdQGC == 0) {
_systemIdQGC = qgcApp()->toolbox()->mavlinkProtocol()->getSystemId();
}

// Unit testing code can end up here without _dedicateLink set since it tests inidividual commands.
LinkInterface* link;
if (_dedicatedLink) {
link = _dedicatedLink;
} else {
link = _vehicle->priorityLink();
}

Q_ASSERT(_vehicle);
mavlink_msg_file_transfer_protocol_pack_chan(_systemIdQGC, // QGC System ID
0, // QGC Component ID
_dedicatedLink->mavlinkChannel(),
link->mavlinkChannel(),
&message, // Mavlink Message to pack into
0, // Target network
_systemIdServer, // Target system
0, // Target component
(uint8_t*)request); // Payload

_vehicle->sendMessageOnLink(_dedicatedLink, message);
_vehicle->sendMessageOnLink(link, message);
}

0 comments on commit 63f0271

Please sign in to comment.