diff options
Diffstat (limited to 'common/commands.cpp')
-rw-r--r-- | common/commands.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/commands.cpp b/common/commands.cpp new file mode 100644 index 0000000..b5773e7 --- /dev/null +++ b/common/commands.cpp | |||
@@ -0,0 +1,16 @@ | |||
1 | #include "commands.h" | ||
2 | |||
3 | #include <QIODevice> | ||
4 | |||
5 | namespace Commands | ||
6 | { | ||
7 | |||
8 | void write(QIODevice *device, int commandId, flatbuffers::FlatBufferBuilder &fbb) | ||
9 | { | ||
10 | const int dataSize = fbb.GetSize(); | ||
11 | device->write((const char*)&commandId, sizeof(int)); | ||
12 | device->write((const char*)&dataSize, sizeof(int)); | ||
13 | device->write((const char*)fbb.GetBufferPointer(), dataSize); | ||
14 | } | ||
15 | |||
16 | } \ No newline at end of file | ||