添加心跳发送
This commit is contained in:
@@ -31,6 +31,20 @@ GlobalSetting::GlobalSetting(QWidget *parent) :
|
||||
on_pushButton_getServoOffset_clicked();
|
||||
|
||||
|
||||
ui->comboBox_HeartBeat_Frq->addItem(tr("1.0Hz"),1.0);
|
||||
ui->comboBox_HeartBeat_Frq->addItem(tr("2.0Hz"),2.0);
|
||||
ui->comboBox_HeartBeat_Frq->addItem(tr("5.0Hz"),5.0);
|
||||
ui->comboBox_HeartBeat_Frq->addItem(tr("10Hz"),10);
|
||||
ui->comboBox_HeartBeat_Frq->setCurrentIndex(0);
|
||||
|
||||
|
||||
ui->comboBox_HeartBeat_State->addItem(tr("发送心跳包"),true);
|
||||
ui->comboBox_HeartBeat_State->addItem(tr("关闭心跳包"),false);
|
||||
ui->comboBox_HeartBeat_State->setCurrentIndex(0);
|
||||
|
||||
on_pushButton_getHeartBeat_clicked();
|
||||
|
||||
|
||||
}
|
||||
|
||||
GlobalSetting::~GlobalSetting()
|
||||
@@ -134,3 +148,51 @@ void GlobalSetting::on_pushButton_setServoOffset_clicked()
|
||||
emit showMessage(tr("舵面偏差设置成功"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GlobalSetting::getHeartBeat(void)
|
||||
{
|
||||
on_pushButton_getHeartBeat_clicked();
|
||||
}
|
||||
|
||||
void GlobalSetting::on_pushButton_getHeartBeat_clicked()
|
||||
{
|
||||
Config *cfg = new Config();
|
||||
|
||||
QVariant state;
|
||||
QVariant frq;
|
||||
|
||||
cfg->getHeartBeat(&state,&frq);
|
||||
|
||||
ui->comboBox_HeartBeat_Frq->setCurrentIndex(ui->comboBox_HeartBeat_Frq->findData(frq));
|
||||
ui->comboBox_HeartBeat_State->setCurrentIndex(ui->comboBox_HeartBeat_State->findData(state));
|
||||
|
||||
delete cfg;
|
||||
|
||||
emit setHeartBeat(state,frq);
|
||||
|
||||
emit showMessage(tr("心跳读取成功"));
|
||||
}
|
||||
|
||||
|
||||
void GlobalSetting::on_pushButton_setHeartBeat_clicked()
|
||||
{
|
||||
QVariant state;
|
||||
QVariant frq;
|
||||
|
||||
state = ui->comboBox_HeartBeat_State->currentData();
|
||||
frq = ui->comboBox_HeartBeat_Frq->currentData();
|
||||
|
||||
emit setHeartBeat(state,frq);
|
||||
|
||||
|
||||
Config *cfg = new Config();
|
||||
|
||||
cfg->setHeartBeat(state,frq);
|
||||
|
||||
cfg->deleteLater();
|
||||
delete cfg;
|
||||
|
||||
|
||||
emit showMessage(tr("心跳设置成功"));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
|
||||
void getGCSID(void);
|
||||
void getServo(void);
|
||||
void getHeartBeat(void);
|
||||
|
||||
private slots:
|
||||
void on_pushButton_setGCSID_clicked();
|
||||
@@ -29,6 +30,10 @@ private slots:
|
||||
|
||||
void on_pushButton_setServoOffset_clicked();
|
||||
|
||||
void on_pushButton_getHeartBeat_clicked();
|
||||
|
||||
void on_pushButton_setHeartBeat_clicked();
|
||||
|
||||
signals:
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
@@ -39,6 +44,8 @@ signals:
|
||||
QVariant ru);
|
||||
|
||||
|
||||
void setHeartBeat(QVariant state,QVariant frq);
|
||||
|
||||
|
||||
private:
|
||||
Ui::GlobalSetting *ui;
|
||||
|
||||
@@ -14,6 +14,19 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>302</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
@@ -107,6 +120,19 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
@@ -134,30 +160,47 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>上传心跳</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>302</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_HeartBeat_State"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>频率</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>状态</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="pushButton_getHeartBeat">
|
||||
<property name="text">
|
||||
<string>读取</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="pushButton_setHeartBeat">
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_HeartBeat_Frq"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user