OpenSRX 0.1.0
C++ library for interfacing with Keyence SR series barcode readers
Loading...
Searching...
No Matches
AsioInterface.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace OpenSRX {
6
16template <typename StreamT>
18 public:
19 ~AsioInterface() override = default;
20
31 std::string sendCommand(const std::string& command) override;
32
39 std::string sendCommandUnlocked(const std::string& command) override;
40
41 protected:
42 asio::io_context ioContext;
43 StreamT stream;
44
51 template <typename... Args>
52 explicit AsioInterface(Args&&... args) : stream(std::forward<Args>(args)...) {}
53};
54
55} // namespace OpenSRX
std::string sendCommandUnlocked(const std::string &command) override
Sends a command without acquiring the communication mutex.
StreamT stream
Definition AsioInterface.hpp:43
asio::io_context ioContext
Definition AsioInterface.hpp:42
AsioInterface(Args &&... args)
Construct an AsioInterface, forwarding arguments to the stream.
Definition AsioInterface.hpp:52
std::string sendCommand(const std::string &command) override
Sends a command over the Asio stream and reads the response.
~AsioInterface() override=default
Abstract interface for communicating with a scanner.
Definition ICommInterface.hpp:45
Definition AsioInterface.hpp:5