Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions co_sim_io/impl/co_sim_io_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,18 @@ inline ReturnInfo Connect(const std::string& rConnectionName, CoSimIO::SettingsT

inline ReturnInfo Connect(const std::string& rConnectionName, const std::string& rSettingsFileName)
{
Connect(rConnectionName, Internals::ReadSettingsFile(rSettingsFileName)); // forward call to funciton above

return ReturnInfo(); // TODO use this
return Connect(rConnectionName, Internals::ReadSettingsFile(rSettingsFileName)); // forward call to funciton above
}

inline ReturnInfo Disconnect(const std::string& rConnectionName)
{
using namespace Internals;
CO_SIM_IO_ERROR_IF_NOT(HasIO(rConnectionName)) << "Trying to disconnect connection \"" << rConnectionName << "\" which does not exist!" << std::endl;

auto info = GetConnection(rConnectionName).Disconnect();
auto ret_info = GetConnection(rConnectionName).Disconnect();
s_co_sim_connections.erase(rConnectionName);

return ReturnInfo(); // TODO use this
return ret_info;
}

// Version for C++, there this input is a std::vector, which we have to wrap before passing it on
Expand Down
12 changes: 8 additions & 4 deletions co_sim_io/impl/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@ class Connection

ReturnInfo Connect()
{
mpComm->Connect();
return ReturnInfo(); // TODO use this, should put a return code based on the bool that comes back from mpComm->Connect()
const bool is_connected = mpComm->Connect();
ReturnInfo ret_info;
ret_info.Set<int>("connection_status", is_connected);
return ret_info;
}

ReturnInfo Disconnect()
{
mpComm->Disconnect();
return ReturnInfo(); // TODO use this
const bool is_disconnected = mpComm->Disconnect();
ReturnInfo ret_info;
ret_info.Set<int>("connection_status", is_disconnected!=true);
return ret_info;
}

ReturnInfo SendControlSignal(const std::string& rIdentifier, const CoSimIO::ControlSignal Signal)
Expand Down