mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
Merge branch 'master' of https://gitee.com/drabel/LibQQt
This commit is contained in:
commit
92b7b72cc6
@ -30,5 +30,5 @@ void MainWindow::on_pushButton_clicked()
|
|||||||
void MainWindow::on_recv_say_hello ( QString a )
|
void MainWindow::on_recv_say_hello ( QString a )
|
||||||
{
|
{
|
||||||
pline() << a;
|
pline() << a;
|
||||||
//ui->plainTextEdit->appendPlainText ( a );
|
ui->textBrowser->append(a + "\r\n");
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,6 @@
|
|||||||
<string>MainWindow</string>
|
<string>MainWindow</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>40</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>251</width>
|
|
||||||
<height>141</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pushButton">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@ -47,6 +37,16 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QTextBrowser" name="textBrowser">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>256</width>
|
||||||
|
<height>192</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#ifndef QQTCLIENTPROTOCOL_H
|
#ifndef QQTCLIENTPROTOCOL_H
|
||||||
#define QQTCLIENTPROTOCOL_H
|
#define QQTCLIENTPROTOCOL_H
|
||||||
|
|
||||||
#include <qqtmessage.h>
|
#include <qqtmessage.h>
|
||||||
@ -141,7 +141,7 @@ public slots:
|
|||||||
protected:
|
protected:
|
||||||
//报文的最小长度
|
//报文的最小长度
|
||||||
virtual quint16 minlength() override {
|
virtual quint16 minlength() override {
|
||||||
return 0x00;
|
return 0x03;
|
||||||
}
|
}
|
||||||
//报文的最大长度
|
//报文的最大长度
|
||||||
virtual quint16 maxlength() override {
|
virtual quint16 maxlength() override {
|
||||||
@ -149,16 +149,25 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual quint16 splitter ( const QByteArray& l ) override { //stream
|
virtual quint16 splitter ( const QByteArray& l ) override { //stream
|
||||||
|
pline() << l[0] << l[1] << l[2] << l[3] << l[4] << l[5] << l[6] << l[7];
|
||||||
|
for ( int i = 0; i < l.size(); i++ ) {
|
||||||
|
pline() << l[i];
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray s0 = l.left ( 3 );
|
QByteArray s0 = l.left ( 3 );
|
||||||
quint8 start = 0;
|
quint8 start = 0;
|
||||||
quint16 size = 0;
|
quint16 size = 0;
|
||||||
s0 << start;
|
pline() << s0[0] << s0[1] << s0[2];
|
||||||
s0 << size;
|
|
||||||
|
s0 >> start;
|
||||||
|
s0 >> size;
|
||||||
|
pline() << start << size;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
//报文现在被切开,发了进来,第二个字节是cmd,解析出来,在函数里处理处理数据,告诉业务层,拿到数据了干点什么。
|
//报文现在被切开,发了进来,第二个字节是cmd,解析出来,在函数里处理处理数据,告诉业务层,拿到数据了干点什么。
|
||||||
virtual bool dispatcher ( const QByteArray& m ) override { //message
|
virtual bool dispatcher ( const QByteArray& m ) override { //message
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
QQtClientMessage qMsg;
|
QQtClientMessage qMsg;
|
||||||
@ -170,7 +179,7 @@ protected:
|
|||||||
recvCommand1 ( qMsg );
|
recvCommand1 ( qMsg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0100://protocol command 2
|
case 0x0A://protocol command 2
|
||||||
recvCommand2 ( qMsg );
|
recvCommand2 ( qMsg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user