Commit 5c239cd9 authored by pixhawk's avatar pixhawk

Working on Qt watchdog control

parent b13a2a4c
......@@ -9,6 +9,7 @@
WatchdogControl::WatchdogControl(QWidget *parent) :
QWidget(parent),
mav(NULL),
updateInterval(2000000),
ui(new Ui::WatchdogControl)
{
ui->setupUi(this);
......@@ -43,14 +44,20 @@ void WatchdogControl::setUAS(UASInterface* uas)
void WatchdogControl::updateWatchdog(int systemId, int watchdogId, unsigned int processCount)
{
// request the watchdog with the given ID
// Get the watchdog and request the info for it
WatchdogInfo& watchdog = this->getWatchdog(systemId, watchdogId);
// if the proces count doesn't match, the watchdog is either new or has changed - create a new vector with new (and empty) ProcessInfo structs.
if (watchdog.processes_.size() != processCount)
{
watchdog.processes_ = std::vector<ProcessInfo>(processCount);
// Create new UI widget
//WatchdogView* view = new Watch
}
// start the timeout timer
//watchdog.timeoutTimer_.reset();
qDebug() << "WATCHDOG RECEIVED";
//qDebug() << "<-- received mavlink_watchdog_heartbeat_t " << msg->sysid << " / " << payload.watchdog_id << " / " << payload.process_count << std::endl;
}
......
......@@ -67,6 +67,7 @@ public:
uint16_t crashes_; ///< The number of crashes
int32_t pid_; ///< The PID of the process
//quint64_t requestTimeout;
// Timer requestTimer_; ///< Internal timer, used to repeat status and info requests after some time (in case of packet loss)
// Timer updateTimer_; ///< Internal timer, used to measure the time since the last update (used only for graphics)
};
......@@ -92,6 +93,7 @@ public:
ProcessInfo& getProcess(uint16_t index);
std::vector<ProcessInfo> processes_; ///< A vector containing all processes running on this watchdog
uint64_t timeout;
QTimer* timeoutTimer_; ///< Internal timer, used to measure the time since the last heartbeat message
};
......@@ -116,6 +118,7 @@ protected:
UASInterface* mav;
QVBoxLayout* listLayout;
uint64_t updateInterval;
private:
Ui::WatchdogControl *ui;
......
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