OpenSRX 0.1.0
C++ library for interfacing with Keyence SR series barcode readers
Loading...
Searching...
No Matches
SocketInterface.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <fineftp/fineftp_version.h>
4#include <fineftp/server.h>
5
6#include <thread>
7
9
10namespace OpenSRX {
11
17class SocketInterface : public AsioInterface<asio::ip::tcp::socket> {
18 public:
25 SocketInterface(const std::string& ip = "192.168.100.100", int port = 9004);
26 ~SocketInterface() override;
27
29 std::string describe() const override { return ip + ":" + std::to_string(port); };
30
39 void startFtpServer(const std::string& address, int port, const std::string& mountPoint,
40 int threadPoolSize = 4);
41
42 private:
43 std::string ip;
44 int port;
45
47 std::unique_ptr<fineftp::FtpServer> pFtpServer = nullptr;
48};
49
50} // namespace OpenSRX
AsioInterface(Args &&... args)
Definition AsioInterface.hpp:52
std::string describe() const override
Return a human-readable description of this interface.
Definition SocketInterface.hpp:29
int port
Scanner command port.
Definition SocketInterface.hpp:44
void startFtpServer(const std::string &address, int port, const std::string &mountPoint, int threadPoolSize=4)
Start a local FTP server for receiving data from the scanner.
SocketInterface(const std::string &ip="192.168.100.100", int port=9004)
Open a TCP socket connection to the scanner.
std::string ip
Scanner IP address.
Definition SocketInterface.hpp:43
std::unique_ptr< fineftp::FtpServer > pFtpServer
FTP server instance (heap-allocated because FtpServer is non-copyable).
Definition SocketInterface.hpp:47
Definition AsioInterface.hpp:5