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

40 lines
1.0 KiB
C++

#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow ( QWidget* parent ) :
QMainWindow ( parent ),
ui ( new Ui::MainWindow )
{
ui->setupUi ( this );
pm0 = QQtServerInstance ( this );
connect ( pm0, SIGNAL ( notifyToBusinessLevel ( const QQtProtocol*, const QQtMessage* ) ),
this, SLOT ( recvANotify ( const QQtProtocol*, const QQtMessage* ) ) );
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::recvANotify ( const QQtProtocol* protocol, const QQtMessage* message )
{
QQtServerProtocol* p = ( QQtServerProtocol* ) protocol;
QQtServerMessage* m = ( QQtServerMessage* ) message;
pline() << QString ( m->getAData() );
switch ( m->getACmd() )
{
case 0x01:
{
if ( QString ( m->getAData() ).contains ( "hello" ) )
p->sendB1Command();
else
p->sendB10Command();
break;
}
default:
break;
}
}