1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

43 lines
1.1 KiB
C++
Raw Normal View History

2018-04-23 21:04:58 +08:00
#include "mainwindow.h"
2018-04-22 13:03:28 +08:00
#include "ui_mainwindow.h"
2018-04-22 23:00:42 +08:00
MainWindow::MainWindow ( QWidget* parent ) :
QMainWindow ( parent ),
ui ( new Ui::MainWindow )
2018-04-22 13:03:28 +08:00
{
2018-04-22 23:00:42 +08:00
ui->setupUi ( this );
2018-04-29 23:43:19 +08:00
pm0 = QQtServerInstance ( this );
//pm0 = QQtServer2Instance(this);
2018-04-23 10:00:09 +08:00
connect ( pm0, SIGNAL ( notifyToBusinessLevel ( const QQtProtocol*, const QQtMessage* ) ),
this, SLOT ( recvANotify ( const QQtProtocol*, const QQtMessage* ) ) );
2018-04-23 20:25:18 +08:00
2018-04-29 12:11:19 +08:00
//QQtServer2ConnectionInstance ( this );
2018-04-22 13:03:28 +08:00
}
MainWindow::~MainWindow()
{
delete ui;
}
2018-04-22 23:00:42 +08:00
void MainWindow::recvANotify ( const QQtProtocol* protocol, const QQtMessage* message )
{
2018-04-29 12:36:11 +08:00
QQtServerProtocol* p = ( QQtServerProtocol* ) protocol;
2018-04-23 10:00:09 +08:00
QQtServerMessage* m = ( QQtServerMessage* ) message;
2018-04-23 13:39:10 +08:00
pline() << QString ( m->getAData() );
2018-04-23 10:00:09 +08:00
2018-04-23 13:39:10 +08:00
switch ( m->getACmd() )
2018-04-23 10:00:09 +08:00
{
case 0x01:
{
2018-04-23 14:44:08 +08:00
if ( QString ( m->getAData() ).contains ( "hello" ) )
2018-04-23 10:00:09 +08:00
p->sendB1Command();
else
p->sendB10Command();
break;
}
default:
break;
}
2018-04-22 23:00:42 +08:00
}