Browse Source
* mavlink/master: Increase size of controls for tablet Make sync warning less tall Use Flickable to allow scroll on Tablet More header fixes for Mobile build More header moves for Mobile build More header moves for no widgets in Mobile build Move widget controllers out of Mobile build QGCUnconnectedInfoWidget needed in Mobile builds Remove widget code from Mobile buildsQGC4.4
27 changed files with 362 additions and 998 deletions
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
#include "QGCMainWindowAPConfigurator.h" |
||||
|
||||
QGCMainWindowAPConfigurator::QGCMainWindowAPConfigurator(QObject *parent) : |
||||
QObject(parent) |
||||
{ |
||||
} |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
#ifndef QGCMAINWINDOWAPCONFIGURATOR_H |
||||
#define QGCMAINWINDOWAPCONFIGURATOR_H |
||||
|
||||
#include <QObject> |
||||
|
||||
class QGCMainWindowAPConfigurator : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit QGCMainWindowAPConfigurator(QObject *parent = 0); |
||||
|
||||
signals: |
||||
|
||||
public slots: |
||||
|
||||
}; |
||||
|
||||
#endif // QGCMAINWINDOWAPCONFIGURATOR_H
|
@ -1,510 +0,0 @@
@@ -1,510 +0,0 @@
|
||||
#include "QGCMAVLinkMessageSender.h" |
||||
#include "ui_QGCMAVLinkMessageSender.h" |
||||
#include "MAVLinkProtocol.h" |
||||
|
||||
QGCMAVLinkMessageSender::QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidget *parent) : |
||||
QWidget(parent), |
||||
protocol(mavlink), |
||||
ui(new Ui::QGCMAVLinkMessageSender) |
||||
{ |
||||
ui->setupUi(this); |
||||
mavlink_message_info_t msg[256] = MAVLINK_MESSAGE_INFO; |
||||
memcpy(messageInfo, msg, sizeof(mavlink_message_info_t)*256); |
||||
|
||||
QStringList header; |
||||
header << tr("Name"); |
||||
header << tr("Value"); |
||||
header << tr("Type"); |
||||
ui->treeWidget->setHeaderLabels(header); |
||||
createTreeView(); |
||||
connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); |
||||
//refreshTimer.start(1000); // Refresh at 1 Hz interval
|
||||
|
||||
connect(ui->sendButton, SIGNAL(pressed()), this, SLOT(sendMessage())); |
||||
} |
||||
|
||||
void QGCMAVLinkMessageSender::refresh() |
||||
{ |
||||
// Send messages
|
||||
foreach (unsigned int i, managementItems.keys()) |
||||
{ |
||||
if (!sendTimers.contains(i)) |
||||
{ |
||||
//sendTimers.insert(i, new QTimer())
|
||||
} |
||||
} |
||||
|
||||
// ui->treeWidget->topLevelItem(0)->children();
|
||||
} |
||||
|
||||
bool QGCMAVLinkMessageSender::sendMessage() |
||||
{ |
||||
return sendMessage(ui->messageIdSpinBox->value()); |
||||
} |
||||
|
||||
bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid) |
||||
{ |
||||
QString msgname(messageInfo[msgid].name); |
||||
if (msgid == 0 || msgid > 255 || messageInfo[msgid].name == NULL || msgname.compare(QString("EMPTY"))) |
||||
{ |
||||
return false; |
||||
} |
||||
bool result = true; |
||||
|
||||
if (treeWidgetItems.contains(msgid)) |
||||
{ |
||||
// Fill message fields
|
||||
|
||||
mavlink_message_t msg; |
||||
QList<QTreeWidgetItem*> fields;// = treeWidgetItems.value(msgid)->;
|
||||
|
||||
for (unsigned int i = 0; i < messageInfo[msgid].num_fields; ++i) |
||||
{ |
||||
QTreeWidgetItem* field = fields.at(i); |
||||
int fieldid = i; |
||||
uint8_t* m = ((uint8_t*)(&msg))+8; |
||||
switch (messageInfo[msgid].fields[fieldid].type) |
||||
{ |
||||
case MAVLINK_TYPE_CHAR: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
char* str = (char*)(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
// Copy data
|
||||
QString string = field->data(1, Qt::DisplayRole).toString(); |
||||
// Copy string size
|
||||
int len = qMin((unsigned int)string.length(), messageInfo[msgid].fields[fieldid].array_length); |
||||
memcpy(str, string.toStdString().c_str(), len); |
||||
// Enforce null termination
|
||||
str[len-1] = '\0'; |
||||
} |
||||
else |
||||
{ |
||||
// Single char
|
||||
char* b = ((char*)(m+messageInfo[msgid].fields[fieldid].wire_offset)); |
||||
*b = field->data(1, Qt::DisplayRole).toChar().toLatin1(); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_UINT8_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
uint8_t* nums = m+messageInfo[msgid].fields[fieldid].wire_offset; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) |
||||
{ |
||||
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toInt(); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
uint8_t* u = (m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
*u = field->data(1, Qt::DisplayRole).toChar().toLatin1(); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT8_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
int8_t* nums = reinterpret_cast<int8_t*>((m+messageInfo[msgid].fields[fieldid].wire_offset)); |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) |
||||
{ |
||||
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toInt(); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
int8_t* u = reinterpret_cast<int8_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
*u = field->data(1, Qt::DisplayRole).toChar().toLatin1(); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT16_T: |
||||
case MAVLINK_TYPE_UINT16_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
uint16_t* nums = reinterpret_cast<uint16_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) |
||||
{ |
||||
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toUInt(); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
uint16_t* u = reinterpret_cast<uint16_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
*u = field->data(1, Qt::DisplayRole).toUInt(); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT32_T: |
||||
case MAVLINK_TYPE_UINT32_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
int32_t* nums = reinterpret_cast<int32_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) |
||||
{ |
||||
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toUInt(); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
int32_t* u = reinterpret_cast<int32_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
*u = field->data(1, Qt::DisplayRole).toUInt(); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT64_T: |
||||
case MAVLINK_TYPE_UINT64_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
int64_t* nums = reinterpret_cast<int64_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) |
||||
{ |
||||
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toULongLong(); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
int64_t* u = reinterpret_cast<int64_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
*u = field->data(1, Qt::DisplayRole).toULongLong(); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_FLOAT: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
float* nums = reinterpret_cast<float*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) |
||||
{ |
||||
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toFloat(); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
float* u = reinterpret_cast<float*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
*u = field->data(1, Qt::DisplayRole).toFloat(); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_DOUBLE: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
double* nums = reinterpret_cast<double*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j) |
||||
{ |
||||
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toDouble(); |
||||
} |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
double* u = reinterpret_cast<double*>(m+messageInfo[msgid].fields[fieldid].wire_offset); |
||||
*u = field->data(1, Qt::DisplayRole).toDouble(); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
// Send message
|
||||
protocol->sendMessage(msg); |
||||
} |
||||
else |
||||
{ |
||||
result = false; |
||||
} |
||||
|
||||
return result; |
||||
} |
||||
|
||||
QGCMAVLinkMessageSender::~QGCMAVLinkMessageSender() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void QGCMAVLinkMessageSender::createTreeView() |
||||
{ |
||||
for (int i = 0; i < 256; ++i)//mavlink_message_t msg, receivedMessages)
|
||||
{ |
||||
// Update the tree view
|
||||
QString messageName("%1 (%2 Hz, #%3)"); |
||||
float msgHz = messagesHz.value(i, 0); |
||||
|
||||
// Ignore non-existent messages
|
||||
if (QString(messageInfo[i].name) == "EMPTY") continue; |
||||
|
||||
messageName = messageName.arg(messageInfo[i].name).arg(msgHz, 3, 'f', 1).arg(i); |
||||
if (!treeWidgetItems.contains(i)) |
||||
{ |
||||
QStringList fields; |
||||
fields << messageName; |
||||
QTreeWidgetItem* widget = new QTreeWidgetItem(fields); |
||||
widget->setFirstColumnSpanned(true); |
||||
|
||||
for (unsigned int j = 0; j < messageInfo[i].num_fields; ++j) |
||||
{ |
||||
QTreeWidgetItem* field = new QTreeWidgetItem(); |
||||
widget->addChild(field); |
||||
} |
||||
|
||||
treeWidgetItems.insert(i, widget); |
||||
ui->treeWidget->addTopLevelItem(widget); |
||||
|
||||
|
||||
QTreeWidgetItem* message = widget;//treeWidgetItems.value(msg->msgid);
|
||||
message->setFirstColumnSpanned(true); |
||||
message->setData(0, Qt::DisplayRole, QVariant(messageName)); |
||||
for (unsigned int j = 0; j < messageInfo[i].num_fields; ++j) |
||||
{ |
||||
createField(i, j, message->child(j)); |
||||
} |
||||
// Add management fields, such as update rate and send button
|
||||
// QTreeWidgetItem* management = new QTreeWidgetItem();
|
||||
// widget->addChild(management);
|
||||
// management->setData(0, Qt::DisplayRole, "Rate:");
|
||||
// management->setData(1, Qt::DisplayRole, 0);
|
||||
// management->setData(2, Qt::DisplayRole, "Hz");
|
||||
// managementItems.insert(i, management);
|
||||
} |
||||
} |
||||
} |
||||
|
||||
void QGCMAVLinkMessageSender::createField(int msgid, int fieldid, QTreeWidgetItem* item) |
||||
{ |
||||
// Add field tree widget item
|
||||
item->setData(0, Qt::DisplayRole, QVariant(messageInfo[msgid].fields[fieldid].name)); |
||||
//uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8;
|
||||
switch (messageInfo[msgid].fields[fieldid].type) |
||||
{ |
||||
case MAVLINK_TYPE_CHAR: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
item->setData(2, Qt::DisplayRole, "char"); |
||||
item->setData(1, Qt::DisplayRole, ""); |
||||
} |
||||
else |
||||
{ |
||||
// Single char
|
||||
item->setData(2, Qt::DisplayRole, QString("char[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, ""); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_UINT8_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("uint8_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "uint8_t"); |
||||
item->setData(1, Qt::DisplayRole, 0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT8_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("int8_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "int8_t"); |
||||
item->setData(1, Qt::DisplayRole, 0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_UINT16_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("uint16_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "uint16_t"); |
||||
item->setData(1, Qt::DisplayRole, 0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT16_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("int16_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "int16_t"); |
||||
item->setData(1, Qt::DisplayRole, 0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_UINT32_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("uint32_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "uint32_t"); |
||||
item->setData(1, Qt::DisplayRole, 0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT32_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("int32_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "int32_t"); |
||||
item->setData(1, Qt::DisplayRole, 0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_FLOAT: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0.0f); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("float[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "float"); |
||||
item->setData(1, Qt::DisplayRole, 0.0f); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_DOUBLE: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("double[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "double"); |
||||
item->setData(1, Qt::DisplayRole, 0.0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_UINT64_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("uint64_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "uint64_t"); |
||||
item->setData(1, Qt::DisplayRole, (quint64) 0); |
||||
} |
||||
break; |
||||
case MAVLINK_TYPE_INT64_T: |
||||
if (messageInfo[msgid].fields[fieldid].array_length > 0) |
||||
{ |
||||
// Enforce null termination
|
||||
QString tmp("%1, "); |
||||
QString string; |
||||
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j) |
||||
{ |
||||
string += tmp.arg(0); |
||||
} |
||||
item->setData(2, Qt::DisplayRole, QString("int64_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length)); |
||||
item->setData(1, Qt::DisplayRole, string); |
||||
} |
||||
else |
||||
{ |
||||
// Single value
|
||||
item->setData(2, Qt::DisplayRole, "int64_t"); |
||||
item->setData(1, Qt::DisplayRole, (qint64) 0); |
||||
} |
||||
break; |
||||
} |
||||
} |
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
#ifndef QGCMAVLINKMESSAGESENDER_H |
||||
#define QGCMAVLINKMESSAGESENDER_H |
||||
|
||||
#include <QWidget> |
||||
#include <QTreeWidgetItem> |
||||
#include <QMap> |
||||
#include <QTimer> |
||||
#include "MAVLinkProtocol.h" |
||||
|
||||
namespace Ui { |
||||
class QGCMAVLinkMessageSender; |
||||
} |
||||
|
||||
class QGCMAVLinkMessageSender : public QWidget |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
friend class QTimer; |
||||
|
||||
public: |
||||
explicit QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidget *parent = 0); |
||||
~QGCMAVLinkMessageSender(); |
||||
|
||||
public slots: |
||||
/** @brief Send message currently selected in ui, taking values from tree view */ |
||||
bool sendMessage(); |
||||
|
||||
protected: |
||||
mavlink_message_info_t messageInfo[256]; ///< Meta information about all messages
|
||||
MAVLinkProtocol* protocol; ///< MAVLink protocol
|
||||
QMap<int, float> messagesHz; ///< Used to store update rate in Hz
|
||||
QTimer refreshTimer; |
||||
QMap<unsigned int, QTimer*> sendTimers; |
||||
QMap<unsigned int, QTreeWidgetItem*> managementItems; |
||||
QMap<unsigned int, QTreeWidgetItem*> treeWidgetItems; ///< Messages
|
||||
|
||||
/** @brief Create the tree view of all messages */ |
||||
void createTreeView(); |
||||
/** @brief Create one field of one message in the tree view of all messages */ |
||||
void createField(int msgid, int fieldid, QTreeWidgetItem* item); |
||||
/** @brief Send message with values taken from tree view */ |
||||
bool sendMessage(unsigned int id); |
||||
|
||||
protected slots: |
||||
/** @brief Read / display values in UI */ |
||||
void refresh(); |
||||
|
||||
private: |
||||
Ui::QGCMAVLinkMessageSender *ui; |
||||
}; |
||||
|
||||
#endif // QGCMAVLINKMESSAGESENDER_H
|
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>QGCMAVLinkMessageSender</class> |
||||
<widget class="QWidget" name="QGCMAVLinkMessageSender"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>400</width> |
||||
<height>300</height> |
||||
</rect> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Form</string> |
||||
</property> |
||||
<layout class="QGridLayout" name="gridLayout"> |
||||
<property name="margin"> |
||||
<number>6</number> |
||||
</property> |
||||
<item row="0" column="0" colspan="2"> |
||||
<widget class="QTreeWidget" name="treeWidget"> |
||||
<column> |
||||
<property name="text"> |
||||
<string notr="true">1</string> |
||||
</property> |
||||
</column> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="0"> |
||||
<widget class="QSpinBox" name="messageIdSpinBox"/> |
||||
</item> |
||||
<item row="1" column="1"> |
||||
<widget class="QPushButton" name="sendButton"> |
||||
<property name="text"> |
||||
<string>Send Message</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<resources/> |
||||
<connections/> |
||||
</ui> |
Loading…
Reference in new issue