summaryrefslogtreecommitdiff
path: root/src/protocol/client.cc
diff options
context:
space:
mode:
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