Commit 5c239cd9 authored by pixhawk's avatar pixhawk

Working on Qt watchdog control

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