summaryrefslogtreecommitdiff
path: root/src/protocol/client.cc
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-06-07 01:40:32 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-12-02 04:05:15 +0300
commit3aed59276c2b7275603f6da18377b77718948667 (patch)
tree86816d82ab02b6e4761175d599f5749490706792 /src/protocol/client.cc
parentd86ca1e596b094cba101e0e3e6c8cdb71f8116e9 (diff)
wipp17
Diffstat (limited to 'src/protocol/client.cc')
-rw-r--r--src/protocol/client.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/protocol/client.cc b/src/protocol/client.cc
new file mode 100644
index 0000000..40ffa36
--- /dev/null
+++ b/src/protocol/client.cc
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+#include "client.h"
+
+namespace protocol {
+
+void BaseClient::setDevice(std::shared_ptr<voltronic::Device> device) {
+ device_ = std::move(device);
+}
+
+std::pair<std::shared_ptr<char>, size_t> BaseClient::runOnDevice(std::string& raw) {
+ size_t bufSize = 256;
+ std::shared_ptr<char> buf(new char[bufSize]);
+ size_t responseSize = device_->run(
+ (const u8*)raw.c_str(), raw.size(),
+ (u8*)buf.get(), bufSize);
+
+ return std::pair<std::shared_ptr<char>, size_t>(buf, responseSize);
+}
+
+} \ No newline at end of file