protocol: add basic communicate protocol pack and unpack.
This commit is contained in:
19
Test/protocolTest.cpp
Normal file
19
Test/protocolTest.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <Protocol.h>
|
||||
#include <QDebug>
|
||||
|
||||
int main()
|
||||
{
|
||||
auto frame = QSharedPointer<FrameBuffer>::create();
|
||||
frame->type = FBT_CLI_BIN_FILEDATA;
|
||||
frame->fid = "client123";
|
||||
frame->tid = "file456";
|
||||
frame->data = QByteArray("This is test binary data", 24);
|
||||
|
||||
QByteArray packet = Protocol::PackBuffer(frame);
|
||||
qDebug() << "Test1 - Packed data size:" << packet.size();
|
||||
qDebug() << "Packed data hex:" << packet.toHex();
|
||||
|
||||
auto ret = Protocol::ParseBuffer(packet);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user