diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/common/utils/QKafkaConsumer.h b/DeviceHub/common/utils/QKafkaConsumer.h index 49c9f01..745ad68 100644 --- a/DeviceHub/common/utils/QKafkaConsumer.h +++ b/DeviceHub/common/utils/QKafkaConsumer.h @@ -4,7 +4,7 @@ #include #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaConsumer : public QThread { diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/common/utils/QKafkaConsumer.h b/DeviceHub/common/utils/QKafkaConsumer.h index 49c9f01..745ad68 100644 --- a/DeviceHub/common/utils/QKafkaConsumer.h +++ b/DeviceHub/common/utils/QKafkaConsumer.h @@ -4,7 +4,7 @@ #include #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaConsumer : public QThread { diff --git a/DeviceHub/common/utils/QKafkaProducer.h b/DeviceHub/common/utils/QKafkaProducer.h index d560bb1..bd0cc15 100644 --- a/DeviceHub/common/utils/QKafkaProducer.h +++ b/DeviceHub/common/utils/QKafkaProducer.h @@ -3,7 +3,7 @@ #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaProducer : public QObject { diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/common/utils/QKafkaConsumer.h b/DeviceHub/common/utils/QKafkaConsumer.h index 49c9f01..745ad68 100644 --- a/DeviceHub/common/utils/QKafkaConsumer.h +++ b/DeviceHub/common/utils/QKafkaConsumer.h @@ -4,7 +4,7 @@ #include #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaConsumer : public QThread { diff --git a/DeviceHub/common/utils/QKafkaProducer.h b/DeviceHub/common/utils/QKafkaProducer.h index d560bb1..bd0cc15 100644 --- a/DeviceHub/common/utils/QKafkaProducer.h +++ b/DeviceHub/common/utils/QKafkaProducer.h @@ -3,7 +3,7 @@ #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaProducer : public QObject { diff --git a/DeviceHub/device/DeviceBase.h b/DeviceHub/device/DeviceBase.h index e06bee3..8a3b271 100644 --- a/DeviceHub/device/DeviceBase.h +++ b/DeviceHub/device/DeviceBase.h @@ -3,7 +3,7 @@ #include #include "common/utils/QSerialPortUtil.h" -//#include "common/utils/QKafkaProducer.h" +#include "common/utils/QKafkaProducer.h" #include "common/utils/QByteUtil.h" #include "common/utils/QLogUtil.h" #include "common/utils/SettingConfig.h" @@ -43,7 +43,7 @@ QString devType; QSerialPortUtil serialUtil; -// QKafkaProducer kafkaProducer; + QKafkaProducer kafkaProducer; QByteArray dataBuff; }; diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/common/utils/QKafkaConsumer.h b/DeviceHub/common/utils/QKafkaConsumer.h index 49c9f01..745ad68 100644 --- a/DeviceHub/common/utils/QKafkaConsumer.h +++ b/DeviceHub/common/utils/QKafkaConsumer.h @@ -4,7 +4,7 @@ #include #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaConsumer : public QThread { diff --git a/DeviceHub/common/utils/QKafkaProducer.h b/DeviceHub/common/utils/QKafkaProducer.h index d560bb1..bd0cc15 100644 --- a/DeviceHub/common/utils/QKafkaProducer.h +++ b/DeviceHub/common/utils/QKafkaProducer.h @@ -3,7 +3,7 @@ #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaProducer : public QObject { diff --git a/DeviceHub/device/DeviceBase.h b/DeviceHub/device/DeviceBase.h index e06bee3..8a3b271 100644 --- a/DeviceHub/device/DeviceBase.h +++ b/DeviceHub/device/DeviceBase.h @@ -3,7 +3,7 @@ #include #include "common/utils/QSerialPortUtil.h" -//#include "common/utils/QKafkaProducer.h" +#include "common/utils/QKafkaProducer.h" #include "common/utils/QByteUtil.h" #include "common/utils/QLogUtil.h" #include "common/utils/SettingConfig.h" @@ -43,7 +43,7 @@ QString devType; QSerialPortUtil serialUtil; -// QKafkaProducer kafkaProducer; + QKafkaProducer kafkaProducer; QByteArray dataBuff; }; diff --git a/DeviceHub/device/FreqSwitcher.cpp b/DeviceHub/device/FreqSwitcher.cpp index 5851f26..3873c13 100644 --- a/DeviceHub/device/FreqSwitcher.cpp +++ b/DeviceHub/device/FreqSwitcher.cpp @@ -14,12 +14,12 @@ connect(this, &FreqSwitcher::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->freqSwitForm, &FreqSwitcherForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &FreqSwitcher::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &FreqSwitcher::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -112,7 +112,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -137,7 +137,7 @@ void FreqSwitcher::commandReceivedHandler(QJsonObject command) { - if (command.contains("deviceType") == false || command.value("deviceType").toString() != "03") + if (command.contains("deviceType") == false || command.value("deviceType").toString() != "06") { std::cout << "device type [" << command.value("deviceType").toString().toStdString() << "] not matched. return" << std::endl; return; @@ -167,7 +167,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/common/utils/QKafkaConsumer.h b/DeviceHub/common/utils/QKafkaConsumer.h index 49c9f01..745ad68 100644 --- a/DeviceHub/common/utils/QKafkaConsumer.h +++ b/DeviceHub/common/utils/QKafkaConsumer.h @@ -4,7 +4,7 @@ #include #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaConsumer : public QThread { diff --git a/DeviceHub/common/utils/QKafkaProducer.h b/DeviceHub/common/utils/QKafkaProducer.h index d560bb1..bd0cc15 100644 --- a/DeviceHub/common/utils/QKafkaProducer.h +++ b/DeviceHub/common/utils/QKafkaProducer.h @@ -3,7 +3,7 @@ #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaProducer : public QObject { diff --git a/DeviceHub/device/DeviceBase.h b/DeviceHub/device/DeviceBase.h index e06bee3..8a3b271 100644 --- a/DeviceHub/device/DeviceBase.h +++ b/DeviceHub/device/DeviceBase.h @@ -3,7 +3,7 @@ #include #include "common/utils/QSerialPortUtil.h" -//#include "common/utils/QKafkaProducer.h" +#include "common/utils/QKafkaProducer.h" #include "common/utils/QByteUtil.h" #include "common/utils/QLogUtil.h" #include "common/utils/SettingConfig.h" @@ -43,7 +43,7 @@ QString devType; QSerialPortUtil serialUtil; -// QKafkaProducer kafkaProducer; + QKafkaProducer kafkaProducer; QByteArray dataBuff; }; diff --git a/DeviceHub/device/FreqSwitcher.cpp b/DeviceHub/device/FreqSwitcher.cpp index 5851f26..3873c13 100644 --- a/DeviceHub/device/FreqSwitcher.cpp +++ b/DeviceHub/device/FreqSwitcher.cpp @@ -14,12 +14,12 @@ connect(this, &FreqSwitcher::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->freqSwitForm, &FreqSwitcherForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &FreqSwitcher::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &FreqSwitcher::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -112,7 +112,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -137,7 +137,7 @@ void FreqSwitcher::commandReceivedHandler(QJsonObject command) { - if (command.contains("deviceType") == false || command.value("deviceType").toString() != "03") + if (command.contains("deviceType") == false || command.value("deviceType").toString() != "06") { std::cout << "device type [" << command.value("deviceType").toString().toStdString() << "] not matched. return" << std::endl; return; @@ -167,7 +167,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/device/FrequencyTuning.cpp b/DeviceHub/device/FrequencyTuning.cpp index 07780d9..e2038c2 100644 --- a/DeviceHub/device/FrequencyTuning.cpp +++ b/DeviceHub/device/FrequencyTuning.cpp @@ -14,12 +14,12 @@ connect(this, &FrequencyTuning::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->freqTunForm, &FrequencyTuningForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &FrequencyTuning::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &FrequencyTuning::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -111,7 +111,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -166,7 +166,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/common/utils/QKafkaConsumer.h b/DeviceHub/common/utils/QKafkaConsumer.h index 49c9f01..745ad68 100644 --- a/DeviceHub/common/utils/QKafkaConsumer.h +++ b/DeviceHub/common/utils/QKafkaConsumer.h @@ -4,7 +4,7 @@ #include #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaConsumer : public QThread { diff --git a/DeviceHub/common/utils/QKafkaProducer.h b/DeviceHub/common/utils/QKafkaProducer.h index d560bb1..bd0cc15 100644 --- a/DeviceHub/common/utils/QKafkaProducer.h +++ b/DeviceHub/common/utils/QKafkaProducer.h @@ -3,7 +3,7 @@ #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaProducer : public QObject { diff --git a/DeviceHub/device/DeviceBase.h b/DeviceHub/device/DeviceBase.h index e06bee3..8a3b271 100644 --- a/DeviceHub/device/DeviceBase.h +++ b/DeviceHub/device/DeviceBase.h @@ -3,7 +3,7 @@ #include #include "common/utils/QSerialPortUtil.h" -//#include "common/utils/QKafkaProducer.h" +#include "common/utils/QKafkaProducer.h" #include "common/utils/QByteUtil.h" #include "common/utils/QLogUtil.h" #include "common/utils/SettingConfig.h" @@ -43,7 +43,7 @@ QString devType; QSerialPortUtil serialUtil; -// QKafkaProducer kafkaProducer; + QKafkaProducer kafkaProducer; QByteArray dataBuff; }; diff --git a/DeviceHub/device/FreqSwitcher.cpp b/DeviceHub/device/FreqSwitcher.cpp index 5851f26..3873c13 100644 --- a/DeviceHub/device/FreqSwitcher.cpp +++ b/DeviceHub/device/FreqSwitcher.cpp @@ -14,12 +14,12 @@ connect(this, &FreqSwitcher::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->freqSwitForm, &FreqSwitcherForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &FreqSwitcher::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &FreqSwitcher::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -112,7 +112,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -137,7 +137,7 @@ void FreqSwitcher::commandReceivedHandler(QJsonObject command) { - if (command.contains("deviceType") == false || command.value("deviceType").toString() != "03") + if (command.contains("deviceType") == false || command.value("deviceType").toString() != "06") { std::cout << "device type [" << command.value("deviceType").toString().toStdString() << "] not matched. return" << std::endl; return; @@ -167,7 +167,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/device/FrequencyTuning.cpp b/DeviceHub/device/FrequencyTuning.cpp index 07780d9..e2038c2 100644 --- a/DeviceHub/device/FrequencyTuning.cpp +++ b/DeviceHub/device/FrequencyTuning.cpp @@ -14,12 +14,12 @@ connect(this, &FrequencyTuning::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->freqTunForm, &FrequencyTuningForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &FrequencyTuning::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &FrequencyTuning::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -111,7 +111,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -166,7 +166,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/device/SignalGenerator.cpp b/DeviceHub/device/SignalGenerator.cpp index e2e5733..e99ddc1 100644 --- a/DeviceHub/device/SignalGenerator.cpp +++ b/DeviceHub/device/SignalGenerator.cpp @@ -14,12 +14,12 @@ connect(this, &SignalGenerator::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->signGenForm, &SignalGeneratorForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &SignalGenerator::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &SignalGenerator::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -114,7 +114,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -169,7 +169,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/DeviceHubWindow.cpp b/DeviceHub/DeviceHubWindow.cpp index d2786ce..8050848 100644 --- a/DeviceHub/DeviceHubWindow.cpp +++ b/DeviceHub/DeviceHubWindow.cpp @@ -42,11 +42,11 @@ ui->stackedWidget->addWidget(freqSwitForm); // kafka consumer -// kafkaConsumer = new QKafkaConsumer(this); -// kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); -// kafkaConsumer->createConsumer(); -// kafkaConsumer->start(); + kafkaConsumer = new QKafkaConsumer(this); + kafkaConsumer->setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaConsumer->setTopic(SettingConfig::getInstance().KAFKA_CMD_TOPIC); + kafkaConsumer->createConsumer(); + kafkaConsumer->start(); // init device type and device list httpReq = new HttpRequestController(this); diff --git a/DeviceHub/DeviceHubWindow.h b/DeviceHub/DeviceHubWindow.h index ad91f95..bdc0749 100644 --- a/DeviceHub/DeviceHubWindow.h +++ b/DeviceHub/DeviceHubWindow.h @@ -5,7 +5,7 @@ #include #include "common/HttpRequestController.h" -//#include "common/utils/QKafkaConsumer.h" +#include "common/utils/QKafkaConsumer.h" #include "device/DeviceBase.h" #include "FrequencyTuningForm.h" #include "SignalGeneratorForm.h" @@ -28,7 +28,7 @@ int currentDevIndex; QMap> allTypeDevList; -// QKafkaConsumer * kafkaConsumer; + QKafkaConsumer * kafkaConsumer; QComboBox * getDevTypeSelect(); QComboBox * getDevSelect(); diff --git a/DeviceHub/FreqSwitcherForm.cpp b/DeviceHub/FreqSwitcherForm.cpp index 4714891..55d83c0 100644 --- a/DeviceHub/FreqSwitcherForm.cpp +++ b/DeviceHub/FreqSwitcherForm.cpp @@ -74,10 +74,10 @@ void FreqSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("06"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "06") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/TimeSwitcherForm.cpp b/DeviceHub/TimeSwitcherForm.cpp index 82fe96d..83278db 100644 --- a/DeviceHub/TimeSwitcherForm.cpp +++ b/DeviceHub/TimeSwitcherForm.cpp @@ -66,10 +66,10 @@ void TimeSwitcherForm::displayDeviceCommandOnForm(QJsonObject command) { QString deviceId = command.value("deviceId").toString(); - QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("04"); + QList typeDevList = ((DeviceHubWindow *) this->parent()->parent())->allTypeDevList.value("05"); for (int i = 0; i < ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->count(); i++) { - if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "04") + if (((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->itemData(i) == "05") { ((DeviceHubWindow *)this->parent()->parent())->getDevTypeSelect()->setCurrentIndex(i); } diff --git a/DeviceHub/common/common.pri b/DeviceHub/common/common.pri index feeba36..86259e8 100644 --- a/DeviceHub/common/common.pri +++ b/DeviceHub/common/common.pri @@ -3,8 +3,8 @@ SOURCES += $$PWD/utils/QByteUtil.cpp SOURCES += $$PWD/utils/QSerialPortUtil.cpp SOURCES += $$PWD/utils/QLogUtil.cpp -#SOURCES += $$PWD/utils/QKafkaConsumer.cpp -#SOURCES += $$PWD/utils/QKafkaProducer.cpp +SOURCES += $$PWD/utils/QKafkaConsumer.cpp +SOURCES += $$PWD/utils/QKafkaProducer.cpp SOURCES += $$PWD/utils/HttpRequestUtil.cpp SOURCES += $$PWD/utils/MD5.cpp SOURCES += $$PWD/HttpRequestController.cpp @@ -13,8 +13,8 @@ HEADERS += $$PWD/utils/QByteUtil.h HEADERS += $$PWD/utils/QSerialPortUtil.h HEADERS += $$PWD/utils/QLogUtil.h -#HEADERS += $$PWD/utils/QKafkaConsumer.h -#HEADERS += $$PWD/utils/QKafkaProducer.h +HEADERS += $$PWD/utils/QKafkaConsumer.h +HEADERS += $$PWD/utils/QKafkaProducer.h HEADERS += $$PWD/utils/HttpRequestUtil.h HEADERS += $$PWD/utils/DefHead.h HEADERS += $$PWD/utils/MD5.h diff --git a/DeviceHub/common/utils/QKafkaConsumer.h b/DeviceHub/common/utils/QKafkaConsumer.h index 49c9f01..745ad68 100644 --- a/DeviceHub/common/utils/QKafkaConsumer.h +++ b/DeviceHub/common/utils/QKafkaConsumer.h @@ -4,7 +4,7 @@ #include #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaConsumer : public QThread { diff --git a/DeviceHub/common/utils/QKafkaProducer.h b/DeviceHub/common/utils/QKafkaProducer.h index d560bb1..bd0cc15 100644 --- a/DeviceHub/common/utils/QKafkaProducer.h +++ b/DeviceHub/common/utils/QKafkaProducer.h @@ -3,7 +3,7 @@ #include -//#include "include/librdkafka/rdkafkacpp.h" +#include "include/librdkafka/rdkafkacpp.h" class QKafkaProducer : public QObject { diff --git a/DeviceHub/device/DeviceBase.h b/DeviceHub/device/DeviceBase.h index e06bee3..8a3b271 100644 --- a/DeviceHub/device/DeviceBase.h +++ b/DeviceHub/device/DeviceBase.h @@ -3,7 +3,7 @@ #include #include "common/utils/QSerialPortUtil.h" -//#include "common/utils/QKafkaProducer.h" +#include "common/utils/QKafkaProducer.h" #include "common/utils/QByteUtil.h" #include "common/utils/QLogUtil.h" #include "common/utils/SettingConfig.h" @@ -43,7 +43,7 @@ QString devType; QSerialPortUtil serialUtil; -// QKafkaProducer kafkaProducer; + QKafkaProducer kafkaProducer; QByteArray dataBuff; }; diff --git a/DeviceHub/device/FreqSwitcher.cpp b/DeviceHub/device/FreqSwitcher.cpp index 5851f26..3873c13 100644 --- a/DeviceHub/device/FreqSwitcher.cpp +++ b/DeviceHub/device/FreqSwitcher.cpp @@ -14,12 +14,12 @@ connect(this, &FreqSwitcher::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->freqSwitForm, &FreqSwitcherForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &FreqSwitcher::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &FreqSwitcher::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -112,7 +112,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -137,7 +137,7 @@ void FreqSwitcher::commandReceivedHandler(QJsonObject command) { - if (command.contains("deviceType") == false || command.value("deviceType").toString() != "03") + if (command.contains("deviceType") == false || command.value("deviceType").toString() != "06") { std::cout << "device type [" << command.value("deviceType").toString().toStdString() << "] not matched. return" << std::endl; return; @@ -167,7 +167,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/device/FrequencyTuning.cpp b/DeviceHub/device/FrequencyTuning.cpp index 07780d9..e2038c2 100644 --- a/DeviceHub/device/FrequencyTuning.cpp +++ b/DeviceHub/device/FrequencyTuning.cpp @@ -14,12 +14,12 @@ connect(this, &FrequencyTuning::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->freqTunForm, &FrequencyTuningForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &FrequencyTuning::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &FrequencyTuning::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -111,7 +111,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -166,7 +166,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/device/SignalGenerator.cpp b/DeviceHub/device/SignalGenerator.cpp index e2e5733..e99ddc1 100644 --- a/DeviceHub/device/SignalGenerator.cpp +++ b/DeviceHub/device/SignalGenerator.cpp @@ -14,12 +14,12 @@ connect(this, &SignalGenerator::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->signGenForm, &SignalGeneratorForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &SignalGenerator::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &SignalGenerator::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -114,7 +114,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -169,7 +169,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command); diff --git a/DeviceHub/device/TimeSwitcher.cpp b/DeviceHub/device/TimeSwitcher.cpp index 83f8f38..aa43822 100644 --- a/DeviceHub/device/TimeSwitcher.cpp +++ b/DeviceHub/device/TimeSwitcher.cpp @@ -14,12 +14,12 @@ connect(this, &TimeSwitcher::sendCommandToDisplay, ((DeviceHubWindow *)this->parent())->tmSwitForm, &TimeSwitcherForm::displayDeviceCommandOnForm); -// connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, -// this, &TimeSwitcher::commandReceivedHandler); + connect(((DeviceHubWindow *)this->parent())->kafkaConsumer, &QKafkaConsumer::messageRecieved, + this, &TimeSwitcher::commandReceivedHandler); -// kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); -// kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); -// kafkaProducer.createProducer(); + kafkaProducer.setBrokers(SettingConfig::getInstance().KAFKA_BROKERS); + kafkaProducer.setTopic(SettingConfig::getInstance().KAFKA_DATA_TOPIC); + kafkaProducer.createProducer(); this->protocol = DeviceProtocolBase::deviceProtocolFactory(devType); } @@ -112,7 +112,7 @@ QJsonObject jsonObj = frameDto->toJSON(); jsonObj.insert("clientId", SettingConfig::getInstance().CLIENT_ID); jsonObj.insert("deviceId", deviceId); -// kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); + kafkaProducer.produceMessage(QString(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact))); } // 4. 在界面上简单显示相差数据结果 @@ -137,7 +137,7 @@ void TimeSwitcher::commandReceivedHandler(QJsonObject command) { - if (command.contains("deviceType") == false || command.value("deviceType").toString() != "03") + if (command.contains("deviceType") == false || command.value("deviceType").toString() != "05") { std::cout << "device type [" << command.value("deviceType").toString().toStdString() << "] not matched. return" << std::endl; return; @@ -167,7 +167,7 @@ cmdcb.insert("commandId", command.value("commandId").toString()); cmdcb.insert("rawCommand", QString::fromUtf8(commandBytes)); cmdcb.insert("status", "1"); -// this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); + this->kafkaProducer.produceMessage(SettingConfig::getInstance().KAFKA_CMDCB_TOPIC, QString(QJsonDocument(cmdcb).toJson(QJsonDocument::Compact))); // display on page emit sendCommandToDisplay(command);