12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include "writecore.h"
- WriteCore::WriteCore(QObject *parent) : QObject(parent)
- {
- dbthread = new DatabaseThread(this);
- dbthread->start();
- connect(dbthread,&DatabaseThread::mqtt_conf,this,&WriteCore::mqtt_data);
- connect(dbthread,&DatabaseThread::dbdata_log,this,&WriteCore::dbdata_log);
- logthread = new LogThread(this);
- logthread->start();
- mqthread = new MqttDataThread(this);
- connect(mqthread,&MqttDataThread::mq_log,this,&WriteCore::mq_log);
- connect(mqthread,&MqttDataThread::sendMqttData,this,&WriteCore::sendMqttData);
- dealmqthread = new DealMqttThread(this);
- connect(dealmqthread,&DealMqttThread::dmq_log,this,&WriteCore::dmq_log);
- connect(dealmqthread,&DealMqttThread::dmqSql,this,&WriteCore::appendSql);
- connect(dealmqthread,&DealMqttThread::dmqAlarm,this,&WriteCore::appendAlarm);
- }
- WriteCore::~WriteCore()
- {
- dbthread->stop();
- logthread->stop();
- dealmqthread->stop();
- }
- void WriteCore::start()
- {
- mqthread->start();
- dealmqthread->start();
- }
- void WriteCore::mqtt_data(QString ip,QString port,QString username,QString password)
- {
- mqthread->mqtt_conf(ip,port,username,password);
- }
- void WriteCore::dbdata_log(QString log)
- {
- logthread->appendData(log);
- }
- void WriteCore::mq_log(QString log)
- {
- logthread->appendData(log);
- }
- void WriteCore::sendMqttData(QString topic,QByteArray data)
- {
- dealmqthread->appendMqttData(MqttData(topic,data));
- }
- void WriteCore::dmq_log(QString log)
- {
- logthread->appendData(log);
- }
- void WriteCore::appendSql(QString sql)
- {
- dbthread->appendSql(sql);
- }
- void WriteCore::appendAlarm(QString sql)
- {
- dbthread->appendAlarm(sql);
- }
|