Skip to content

Commit

Permalink
Fixed subscription to Datarefs
Browse files Browse the repository at this point in the history
  • Loading branch information
cvu1998 committed Dec 2, 2022
1 parent 92313d5 commit 83ce242
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libXplane-udp-client/src/ClientManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void ClientManager::run()
m_XPlaneClient->setDebug(0);

// Read in the dataref Values
int result = readDataRefsFromFile(dataRefsFileName, m_DataRefs);
int result = readDataRefsFromFile(dataRefsFileName, dataRefsMap);
if (result != 0) LOG_ERROR("Subscriptions.txt missing or unable to open file");
m_ipcl_labels.assign("ipcl/");

Expand Down Expand Up @@ -361,7 +361,7 @@ void ClientManager::disconnect(size_t subscriber_index)
}


int ClientManager::readDataRefsFromFile(const std::string& fileName, std::unordered_map<std::string, DataRef>& map)
int ClientManager::readDataRefsFromFile(const std::string& fileName, std::unordered_map<std::string, int>& map)
{

std::string line;
Expand All @@ -380,7 +380,7 @@ int ClientManager::readDataRefsFromFile(const std::string& fileName, std::unorde
std::stringstream ssline(line);
while (getline(ssline, segment, ';')) seglist.push_back(segment);

map[seglist[0]] = DataRef(seglist[1], std::chrono::steady_clock::now());
map[seglist[0]] = std::stoi(seglist[1]);
seglist.clear();
}
myfile.close();
Expand Down
2 changes: 1 addition & 1 deletion libXplane-udp-client/src/ClientManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class ClientManager

void setDataRef(const std::string& dataref, const std::string& value, std::string& response);
void terminateWriter(const std::string& topic);
int readDataRefsFromFile(const std::string& fileName, std::unordered_map<std::string, DataRef>& map);
int readDataRefsFromFile(const std::string& fileName, std::unordered_map<std::string, int>& map);

size_t storeInDeque(zmq::socket_type socket_type, std::vector<size_t>& free,
std::deque<zmq::socket_t>& deque,
Expand Down

0 comments on commit 83ce242

Please sign in to comment.