LF config file

This commit is contained in:
wh201906
2021-09-20 15:32:00 +08:00
parent d56c5f8dc7
commit 24adc08d84
7 changed files with 276 additions and 168 deletions
+27 -26
View File
@@ -84,6 +84,7 @@ void MainWindow::loadConfig()
QByteArray configData = configList.readAll();
QJsonDocument configJson(QJsonDocument::fromJson(configData));
mifare->setConfigMap(configJson.object()["mifare classic"].toObject().toVariantMap());
lf->setConfigMap(configJson.object()["lf"].toObject().toVariantMap());
}
@@ -1182,7 +1183,7 @@ void MainWindow::setButtonsEnabled(bool st)
ui->MF_sniffGroupBox->setEnabled(st);
ui->Raw_CMDEdit->setEnabled(st);
ui->Raw_sendCMDButton->setEnabled(st);
ui->LF_configGroupBox->setEnabled(st);
ui->LF_LFconfigGroupBox->setEnabled(st);
ui->LF_operationGroupBox->setEnabled(st);
}
@@ -1279,37 +1280,37 @@ void MainWindow::on_Set_Client_keepClientActiveBox_stateChanged(int arg1)
emit setSerialListener(!keepClientActive);
}
void MainWindow::on_LF_Conf_freqSlider_valueChanged(int value)
void MainWindow::on_LF_LFConf_freqSlider_valueChanged(int value)
{
onLFfreqConfChanged(value, true);
}
void MainWindow::onLFfreqConfChanged(int value, bool isCustomized)
{
ui->LF_Conf_freqDivisorBox->blockSignals(true);
ui->LF_Conf_freqSlider->blockSignals(true);
ui->LF_LFConf_freqDivisorBox->blockSignals(true);
ui->LF_LFConf_freqSlider->blockSignals(true);
if(isCustomized)
ui->LF_Conf_freqOtherButton->setChecked(true);
ui->LF_Conf_freqLabel->setText(tr("Actural Freq: ") + QString("%1kHz").arg(LF::divisor2Freq(value), 0, 'f', 3));
ui->LF_Conf_freqDivisorBox->setValue(value);
ui->LF_Conf_freqSlider->setValue(value);
ui->LF_LFConf_freqOtherButton->setChecked(true);
ui->LF_LFConf_freqLabel->setText(tr("Actural Freq: ") + QString("%1kHz").arg(LF::divisor2Freq(value), 0, 'f', 3));
ui->LF_LFConf_freqDivisorBox->setValue(value);
ui->LF_LFConf_freqSlider->setValue(value);
ui->LF_Conf_freqDivisorBox->blockSignals(false);
ui->LF_Conf_freqSlider->blockSignals(false);
ui->LF_LFConf_freqDivisorBox->blockSignals(false);
ui->LF_LFConf_freqSlider->blockSignals(false);
}
void MainWindow::on_LF_Conf_freqDivisorBox_valueChanged(int arg1)
void MainWindow::on_LF_LFConf_freqDivisorBox_valueChanged(int arg1)
{
onLFfreqConfChanged(arg1, true);
}
void MainWindow::on_LF_Conf_freq125kButton_clicked()
void MainWindow::on_LF_LFConf_freq125kButton_clicked()
{
onLFfreqConfChanged(95, false);
}
void MainWindow::on_LF_Conf_freq134kButton_clicked()
void MainWindow::on_LF_LFConf_freq134kButton_clicked()
{
onLFfreqConfChanged(88, false);
}
@@ -1375,32 +1376,32 @@ void MainWindow::contextMenuEvent(QContextMenuEvent *event)
contextMenu->exec(event->globalPos());
}
void MainWindow::on_LF_Conf_getButton_clicked()
void MainWindow::on_LF_LFConf_getButton_clicked()
{
setState(false);
lf->getConfig();
lf->getLFConfig();
setState(true);
}
void MainWindow::on_LF_Conf_setButton_clicked()
void MainWindow::on_LF_LFConf_setButton_clicked()
{
LF::Config config;
LF::LFConfig config;
setState(false);
config.divisor = ui->LF_Conf_freqDivisorBox->value();
config.bitPerSample = ui->LF_Conf_bitPerSampleBox->value();
config.decimation = ui->LF_Conf_decimationBox->value();
config.averaging = ui->LF_Conf_averagingBox->isChecked();
config.triggerThreshold = ui->LF_Conf_thresholdBox->value();
config.samplesToSkip = ui->LF_Conf_skipsBox->value();
lf->setConfig(config);
config.divisor = ui->LF_LFConf_freqDivisorBox->value();
config.bitsPerSample = ui->LF_LFConf_bitsPerSampleBox->value();
config.decimation = ui->LF_LFConf_decimationBox->value();
config.averaging = ui->LF_LFConf_averagingBox->isChecked();
config.triggerThreshold = ui->LF_LFConf_thresholdBox->value();
config.samplesToSkip = ui->LF_LFConf_skipsBox->value();
lf->setLFConfig(config);
Util::gotoRawTab();
setState(true);
}
void MainWindow::on_LF_Conf_resetButton_clicked()
void MainWindow::on_LF_LFConf_resetButton_clicked()
{
setState(false);
lf->resetConfig();
lf->resetLFConfig();
setState(true);
}
+7 -7
View File
@@ -179,13 +179,13 @@ private slots:
void on_Set_Client_keepClientActiveBox_stateChanged(int arg1);
void on_LF_Conf_freqSlider_valueChanged(int value);
void on_LF_LFConf_freqSlider_valueChanged(int value);
void on_LF_Conf_freqDivisorBox_valueChanged(int arg1);
void on_LF_LFConf_freqDivisorBox_valueChanged(int arg1);
void on_LF_Conf_freq125kButton_clicked();
void on_LF_LFConf_freq125kButton_clicked();
void on_LF_Conf_freq134kButton_clicked();
void on_LF_LFConf_freq134kButton_clicked();
void on_LF_Op_searchButton_clicked();
@@ -195,11 +195,11 @@ private slots:
void on_LF_Op_sniffButton_clicked();
void on_LF_Conf_getButton_clicked();
void on_LF_LFConf_getButton_clicked();
void on_LF_Conf_setButton_clicked();
void on_LF_LFConf_setButton_clicked();
void on_LF_Conf_resetButton_clicked();
void on_LF_LFConf_resetButton_clicked();
void on_Set_Client_workingDirEdit_editingFinished();
+18 -19
View File
@@ -1247,7 +1247,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_14">
<item>
<widget class="QGroupBox" name="LF_configGroupBox">
<widget class="QGroupBox" name="LF_LFconfigGroupBox">
<property name="title">
<string>LF Config</string>
</property>
@@ -1268,7 +1268,7 @@
<number>2</number>
</property>
<item>
<widget class="QGroupBox" name="LF_Conf_freqGroupBox">
<widget class="QGroupBox" name="LF_LFConf_freqGroupBox">
<property name="title">
<string>Frequency</string>
</property>
@@ -1291,7 +1291,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QRadioButton" name="LF_Conf_freq125kButton">
<widget class="QRadioButton" name="LF_LFConf_freq125kButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -1307,7 +1307,7 @@
</widget>
</item>
<item>
<widget class="QRadioButton" name="LF_Conf_freq134kButton">
<widget class="QRadioButton" name="LF_LFConf_freq134kButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -1320,7 +1320,7 @@
</widget>
</item>
<item>
<widget class="QRadioButton" name="LF_Conf_freqOtherButton">
<widget class="QRadioButton" name="LF_LFConf_freqOtherButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -1340,7 +1340,7 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="LF_Conf_freqDivisorBox">
<widget class="QSpinBox" name="LF_LFConf_freqDivisorBox">
<property name="minimum">
<number>19</number>
</property>
@@ -1353,7 +1353,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="LF_Conf_freqLabel">
<widget class="QLabel" name="LF_LFConf_freqLabel">
<property name="text">
<string>Actural Freq: 125.000kHz</string>
</property>
@@ -1375,7 +1375,7 @@
</layout>
</item>
<item>
<widget class="QSlider" name="LF_Conf_freqSlider">
<widget class="QSlider" name="LF_LFConf_freqSlider">
<property name="minimum">
<number>19</number>
</property>
@@ -1393,8 +1393,7 @@
<item>
<widget class="QLabel" name="label_22">
<property name="text">
<string>Note:
You might need a modified LF antenna if the freq is not 125k/134k.
<string>You might need a modified LF antenna if the freq is not 125k/134k.
When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</string>
</property>
<property name="wordWrap">
@@ -1425,7 +1424,7 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Bit per sample:</string>
<string>Bits per sample:</string>
</property>
</widget>
</item>
@@ -1437,7 +1436,7 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="LF_Conf_decimationBox">
<widget class="QSpinBox" name="LF_LFConf_decimationBox">
<property name="minimum">
<number>1</number>
</property>
@@ -1454,7 +1453,7 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="LF_Conf_averagingBox">
<widget class="QCheckBox" name="LF_LFConf_averagingBox">
<property name="text">
<string/>
</property>
@@ -1468,7 +1467,7 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="LF_Conf_thresholdBox">
<widget class="QSpinBox" name="LF_LFConf_thresholdBox">
<property name="maximum">
<number>128</number>
</property>
@@ -1482,14 +1481,14 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="LF_Conf_skipsBox">
<widget class="QSpinBox" name="LF_LFConf_skipsBox">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="LF_Conf_bitPerSampleBox">
<widget class="QSpinBox" name="LF_LFConf_bitsPerSampleBox">
<property name="minimum">
<number>1</number>
</property>
@@ -1534,7 +1533,7 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
</spacer>
</item>
<item>
<widget class="QPushButton" name="LF_Conf_getButton">
<widget class="QPushButton" name="LF_LFConf_getButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -1553,7 +1552,7 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
</widget>
</item>
<item>
<widget class="QPushButton" name="LF_Conf_setButton">
<widget class="QPushButton" name="LF_LFConf_setButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -1572,7 +1571,7 @@ When setting the freq, the &quot;hw setlfdivisor&quot; will also be called.</str
</widget>
</item>
<item>
<widget class="QPushButton" name="LF_Conf_resetButton">
<widget class="QPushButton" name="LF_LFConf_resetButton">
<property name="text">
<string>Reset</string>
</property>