diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-11-30 13:05:19 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-11-30 13:05:19 +0100 |
commit | 97b79eeb86eedee57630b8d29f6eeab08ccb02b0 (patch) | |
tree | f1944c54ac2ab4650221974e81dc14809550cc7c /client/resourceaccess.cpp | |
parent | 0bcfc57f24adf8ce8dfb2fad33b294b5f0110a89 (diff) | |
download | sink-97b79eeb86eedee57630b8d29f6eeab08ccb02b0.tar.gz sink-97b79eeb86eedee57630b8d29f6eeab08ccb02b0.zip |
add flatbuffer support and use that for the handshake
Diffstat (limited to 'client/resourceaccess.cpp')
-rw-r--r-- | client/resourceaccess.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/client/resourceaccess.cpp b/client/resourceaccess.cpp index 2972316..b0a26e7 100644 --- a/client/resourceaccess.cpp +++ b/client/resourceaccess.cpp | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include "common/console.h" | 3 | #include "common/console.h" |
4 | #include "common/commands.h" | 4 | #include "common/commands.h" |
5 | #include "common/commands/handshake_generated.h" | ||
5 | 6 | ||
6 | #include <QDebug> | 7 | #include <QDebug> |
7 | #include <QProcess> | 8 | #include <QProcess> |
@@ -67,12 +68,15 @@ void ResourceAccess::connected() | |||
67 | Console::main()->log(QString("Connected: %1").arg(m_socket->fullServerName())); | 68 | Console::main()->log(QString("Connected: %1").arg(m_socket->fullServerName())); |
68 | 69 | ||
69 | { | 70 | { |
70 | const QByteArray name = QString::number((long long)this).toLatin1(); | 71 | flatbuffers::FlatBufferBuilder fbb; |
72 | auto name = fbb.CreateString("Client PID: " + QString::number((long long)this).toLatin1() + "!"); | ||
73 | auto command = Toynadi::CreateHandshake(fbb, name); | ||
74 | Toynadi::FinishHandshakeBuffer(fbb, command); | ||
71 | const int commandId = Commands::HandshakeCommand; | 75 | const int commandId = Commands::HandshakeCommand; |
72 | const int dataSize = name.size(); | 76 | const int dataSize = fbb.GetSize(); |
73 | m_socket->write((const char*)&commandId, sizeof(int)); | 77 | m_socket->write((const char*)&commandId, sizeof(int)); |
74 | m_socket->write((const char*)&dataSize, sizeof(int)); | 78 | m_socket->write((const char*)&dataSize, sizeof(int)); |
75 | m_socket->write(name.data(), name.size()); | 79 | m_socket->write((const char*)fbb.GetBufferPointer(), dataSize); |
76 | } | 80 | } |
77 | 81 | ||
78 | emit ready(true); | 82 | emit ready(true); |