Skip to content
Snippets Groups Projects
Commit 590fbdbd authored by Hoop77's avatar Hoop77
Browse files

-

parent b2417f04
Branches
No related merge requests found
...@@ -49,6 +49,8 @@ private: ...@@ -49,6 +49,8 @@ private:
std::function<void()> cruiseControllerNotify = std::function<void()> cruiseControllerNotify =
[this] { cruiseControllerThread.notify(); }; [this] { cruiseControllerThread.notify(); };
platoonProtocol::VehicleId readVehicleId();
platoonProtocol::Vehicle::VehicleEndpoints readVehicleEndpoints();
}; };
} }
#endif #endif
...@@ -18,7 +18,8 @@ namespace car ...@@ -18,7 +18,8 @@ namespace car
// TODO: ConfigReader! // TODO: ConfigReader!
platoonProtocol::VehicleId readVehicleId() { platoonProtocol::VehicleId MainNode::readVehicleId()
{
// open config file // open config file
std::string userHome = getenv("HOME"); std::string userHome = getenv("HOME");
std::ifstream configFile; std::ifstream configFile;
...@@ -55,10 +56,12 @@ platoonProtocol::VehicleId readVehicleId() { ...@@ -55,10 +56,12 @@ platoonProtocol::VehicleId readVehicleId() {
configFile.close(); configFile.close();
messageOStream.write("vehicleId", vehicleId);
return vehicleId; return vehicleId;
} }
platoonProtocol::Vehicle::VehicleEndpoints readVehicleEndpoints() { platoonProtocol::Vehicle::VehicleEndpoints MainNode::readVehicleEndpoints()
{
// open config file // open config file
std::string userHome = getenv("HOME"); std::string userHome = getenv("HOME");
std::ifstream configFile; std::ifstream configFile;
...@@ -91,6 +94,13 @@ platoonProtocol::Vehicle::VehicleEndpoints readVehicleEndpoints() { ...@@ -91,6 +94,13 @@ platoonProtocol::Vehicle::VehicleEndpoints readVehicleEndpoints() {
configFile.close(); configFile.close();
for (const auto & endpoint : endpoints)
{
messageOStream << MessageOStream::key << "VehicleEndpoint"
<< MessageOStream::value << endpoint.getVehicleId() << " " << endpoint.getHost()
<< MessageOStream::flush;
}
return endpoints; return endpoints;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment