Driver: Servd: Refactor to TCP

This commit is contained in:
Kyle Schwarz
2026-01-12 13:03:55 -05:00
parent 530a99d264
commit d74051f57e
3 changed files with 289 additions and 339 deletions
+4 -7
View File
@@ -18,27 +18,24 @@ class Servd : public Driver {
public:
static void Find(std::vector<FoundDevice>& foundDevices);
static bool Enabled();
Servd(const device_eventhandler_t& err, neodevice_t& forDevice, const std::unordered_set<std::string>& availableDrivers);
Servd(const device_eventhandler_t& err, neodevice_t& forDevice, const Address& address);
~Servd() override;
bool open() override;
bool isOpen() override;
bool close() override;
bool faa(const std::string& key, int32_t inc, int32_t& orig);
bool enableCommunication(bool enable, bool& sendMsg) override;
driver_finder_t getFinder() override { return Servd::Find; }
private:
void alive();
void read(Address&& address);
void write(Address&& address);
void read();
void write();
neodevice_t& device;
std::thread aliveThread; // makes sure the client and server are healthy
std::thread writeThread;
std::thread readThread;
Socket messageSocket;
bool opened = false;
bool comEnabled = false;
std::string driver;
std::unique_ptr<Socket> dataSocket;
};
}