Commit 6917d469 authored by Patrick José Pereira's avatar Patrick José Pereira

FirmwareUpgradeController: Add availableBoardsName function

Signed-off-by: 's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent aa446903
......@@ -127,6 +127,23 @@ void FirmwareUpgradeController::cancel(void)
_threadController->cancel();
}
QStringList FirmwareUpgradeController::availableBoardsName(void)
{
QGCSerialPortInfo::BoardType_t boardType;
QString boardName;
QStringList names;
auto ports = QGCSerialPortInfo::availablePorts();
for(const auto info : ports) {
if(info.canFlash()) {
info.getBoardInfo(boardType, boardName);
names.append(boardName);
}
}
return names;
}
void FirmwareUpgradeController::_foundBoard(bool firstAttempt, const QSerialPortInfo& info, int boardType, QString boardName)
{
_foundBoardInfo = info;
......
......@@ -152,6 +152,13 @@ public:
bool pixhawkBoard(void) const { return _foundBoardType == QGCSerialPortInfo::BoardTypePixhawk; }
bool px4FlowBoard(void) const { return _foundBoardType == QGCSerialPortInfo::BoardTypePX4Flow; }
/**
* @brief Return a human friendly string of available boards
*
* @return availableBoardNames
*/
Q_INVOKABLE QStringList availableBoardsName(void);
signals:
void boardFound(void);
void noBoardFound(void);
......
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