|
@ -1,10 +1,9 @@ |
|
|
#include "mainwindow.h"
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
|
#include <QDateTime>
|
|
|
#include <QDateTime>
|
|
|
|
|
|
#include <QtConcurrent>
|
|
|
|
|
|
|
|
|
#include "./ui_mainwindow.h"
|
|
|
#include "./ui_mainwindow.h"
|
|
|
#include "src/logger.hpp"
|
|
|
|
|
|
#include "src/xsync_udp_factory_impl.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace iflytop; |
|
|
using namespace iflytop; |
|
|
using namespace std; |
|
|
using namespace std; |
|
@ -105,6 +104,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi |
|
|
|
|
|
|
|
|
m_thread.reset(new ZQThread("test", [this]() { mainWindowsRun(); })); |
|
|
m_thread.reset(new ZQThread("test", [this]() { mainWindowsRun(); })); |
|
|
m_thread->start(); |
|
|
m_thread->start(); |
|
|
|
|
|
|
|
|
|
|
|
// m_xsync.reset(new Xsync());
|
|
|
|
|
|
Xsync::Ins().initialize(XSyncUdpFactoryImpl::Ins()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MainWindow::~MainWindow() { delete ui; } |
|
|
MainWindow::~MainWindow() { delete ui; } |
|
@ -118,6 +120,29 @@ MainWindow::~MainWindow() { delete ui; } |
|
|
} \ |
|
|
} \ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_RefreshRegsButton_clicked() { //
|
|
|
|
|
|
ZLOGI(TAG, "on_refreshRegsButton_clicked"); |
|
|
|
|
|
|
|
|
|
|
|
// QtConcurrent::run([this]() {
|
|
|
|
|
|
// while (true) {
|
|
|
|
|
|
// ZLOGI(TAG, "on_refreshRegsButton_clicked......");
|
|
|
|
|
|
// ZQThread::sleep(1);
|
|
|
|
|
|
// auto ecode = Xsync::Ins().reg_write(0xABCDDCBA, 0x12345678);
|
|
|
|
|
|
// ZLOGI(TAG, "reg_read ecode:%s", xs_error_code_2_str(ecode));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
// xs_error_code_t ecode = Xsync::Ins().reg_write(0xABCDDCBA, 0x12345678);
|
|
|
|
|
|
// ZLOGI(TAG, "reg_write ecode:%s", xs_error_code_2_str(ecode));
|
|
|
|
|
|
} |
|
|
|
|
|
void MainWindow::on_ClearLogButton_clicked() { //
|
|
|
|
|
|
ui->logbrowser->clear(); |
|
|
|
|
|
} |
|
|
|
|
|
void MainWindow::on_Connect2XsyncButton_clicked() { //
|
|
|
|
|
|
ZLOGI(TAG, "connect %s", ui->IpInput->text().toStdString().c_str()); |
|
|
|
|
|
xs_error_code_t ecode = Xsync::Ins().connect(ui->IpInput->text().toStdString()); |
|
|
|
|
|
ZLOGI(TAG, "connect %s ecode:%s", ui->IpInput->text().toStdString().c_str(), xs_error_code_2_str(ecode)); |
|
|
|
|
|
} |
|
|
void MainWindow::mainWindowsRun() { //
|
|
|
void MainWindow::mainWindowsRun() { //
|
|
|
XSyncUdpFactoryImpl::Ins()->initialize(); |
|
|
XSyncUdpFactoryImpl::Ins()->initialize(); |
|
|
|
|
|
|
|
@ -127,6 +152,4 @@ void MainWindow::mainWindowsRun() { // |
|
|
// ZLOGI(TAG, "receive from <%s:%d> (%d) :%s", from.ip.c_str(), from.port, data, length);
|
|
|
// ZLOGI(TAG, "receive from <%s:%d> (%d) :%s", from.ip.c_str(), from.port, data, length);
|
|
|
// xsudp->sendto(from, "hello\n", 5, NULL);
|
|
|
// xsudp->sendto(from, "hello\n", 5, NULL);
|
|
|
// });
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |