From 5795791eaca1125660eab1d071df5eb62b515fe2 Mon Sep 17 00:00:00 2001 From: Kyle Schwarz Date: Thu, 19 Jun 2025 16:48:15 -0400 Subject: [PATCH] Driver: Servd: Fix Address creation --- include/icsneo/communication/livedata.h | 1 + platform/servd.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/icsneo/communication/livedata.h b/include/icsneo/communication/livedata.h index 1a2d47a..801dbdb 100644 --- a/include/icsneo/communication/livedata.h +++ b/include/icsneo/communication/livedata.h @@ -88,6 +88,7 @@ inline std::ostream& operator<<(std::ostream& os, const LiveDataValueType cmd) { case LiveDataValueType::GPS_TIME_VALID: return os << "GPS Time Valid"; case LiveDataValueType::DAQ_ENABLE: return os << "DAQ Enable"; case LiveDataValueType::MANUAL_TRIGGER: return os << "Manual Trigger"; + case LiveDataValueType::TIME_SINCE_MSG: return os << "Time Since Msg"; } return os; } diff --git a/platform/servd.cpp b/platform/servd.cpp index f50d48a..e8659b9 100644 --- a/platform/servd.cpp +++ b/platform/servd.cpp @@ -1,5 +1,7 @@ #include "icsneo/platform/servd.h" +#include + using namespace icsneo; #define SERVD_VERSION 1 @@ -12,9 +14,9 @@ bool Servd::Enabled() { return enabled ? enabled[0] == '1' : false; } -std::vector split(const std::string_view& str, char delim = ' ') +std::vector split(const std::string_view& str, char delim = ' ') { - std::vector ret; + std::vector ret; size_t tail = 0; size_t head = 0; while (head < str.size()) { @@ -114,8 +116,8 @@ bool Servd::open() { return false; } aliveThread = std::thread(&Servd::alive, this); - readThread = std::thread(&Servd::read, this, Address{tokens[2].data(), (uint16_t)std::stol(tokens[3].data())}); - writeThread = std::thread(&Servd::write, this, Address{tokens[0].data(), (uint16_t)std::stol(tokens[1].data())}); + readThread = std::thread(&Servd::read, this, Address{tokens[2].c_str(), (uint16_t)std::stol(tokens[3].c_str())}); + writeThread = std::thread(&Servd::write, this, Address{tokens[0].c_str(), (uint16_t)std::stol(tokens[1].c_str())}); opened = true; return true; }