Driver: Servd: Fix Address creation

pull/76/head
Kyle Schwarz 2025-06-19 16:48:15 -04:00
parent c91db6355c
commit 5795791eac
2 changed files with 7 additions and 4 deletions

View File

@ -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::GPS_TIME_VALID: return os << "GPS Time Valid";
case LiveDataValueType::DAQ_ENABLE: return os << "DAQ Enable"; case LiveDataValueType::DAQ_ENABLE: return os << "DAQ Enable";
case LiveDataValueType::MANUAL_TRIGGER: return os << "Manual Trigger"; case LiveDataValueType::MANUAL_TRIGGER: return os << "Manual Trigger";
case LiveDataValueType::TIME_SINCE_MSG: return os << "Time Since Msg";
} }
return os; return os;
} }

View File

@ -1,5 +1,7 @@
#include "icsneo/platform/servd.h" #include "icsneo/platform/servd.h"
#include <string_view>
using namespace icsneo; using namespace icsneo;
#define SERVD_VERSION 1 #define SERVD_VERSION 1
@ -12,9 +14,9 @@ bool Servd::Enabled() {
return enabled ? enabled[0] == '1' : false; return enabled ? enabled[0] == '1' : false;
} }
std::vector<std::string_view> split(const std::string_view& str, char delim = ' ') std::vector<std::string> split(const std::string_view& str, char delim = ' ')
{ {
std::vector<std::string_view> ret; std::vector<std::string> ret;
size_t tail = 0; size_t tail = 0;
size_t head = 0; size_t head = 0;
while (head < str.size()) { while (head < str.size()) {
@ -114,8 +116,8 @@ bool Servd::open() {
return false; return false;
} }
aliveThread = std::thread(&Servd::alive, this); aliveThread = std::thread(&Servd::alive, this);
readThread = std::thread(&Servd::read, this, Address{tokens[2].data(), (uint16_t)std::stol(tokens[3].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].data(), (uint16_t)std::stol(tokens[1].data())}); writeThread = std::thread(&Servd::write, this, Address{tokens[0].c_str(), (uint16_t)std::stol(tokens[1].c_str())});
opened = true; opened = true;
return true; return true;
} }