Skip to content

Commit

Permalink
update linux pointer cast to abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
admercs committed Mar 4, 2024
1 parent 06bfcee commit 165a61c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions MavLinkCom/src/impl/AdHocConnectionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectLocalUdp(const std:
std::string localAddr, int localPort) {
std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(localAddr, localPort, "", 0);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(socket));
}

std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectRemoteUdp(const std::string &nodeName,
Expand All @@ -51,7 +51,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectRemoteUdp(const std

std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(local, 0, remoteAddr, remotePort);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(socket));
}

std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectTcp(const std::string &nodeName, std::string localAddr,
Expand All @@ -64,7 +64,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectTcp(const std::stri

std::shared_ptr<TcpClientPort> socket = std::make_shared<TcpClientPort>();
socket->connect(local, 0, remoteIpAddr, remotePort);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(socket));
}

std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectSerial(const std::string &nodeName, std::string name,
Expand All @@ -79,7 +79,7 @@ std::shared_ptr<AdHocConnection> AdHocConnectionImpl::connectSerial(const std::s
if (initString.size() > 0) {
serial->write(reinterpret_cast<const uint8_t *>(initString.c_str()), static_cast<int>(initString.size()));
}
return createConnection(nodeName, std::shared_ptr<Port>(serial));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(serial));
}

void AdHocConnectionImpl::startListening(std::shared_ptr<AdHocConnection> parent, const std::string &nodeName,
Expand Down
8 changes: 4 additions & 4 deletions MavLinkCom/src/impl/MavLinkConnectionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectLocalUdp(const
const std::string &localAddr, int localPort) {
std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(localAddr, localPort, "", 0);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(socket));
}

std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectRemoteUdp(const std::string &nodeName,
Expand All @@ -60,7 +60,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectRemoteUdp(const
}
std::shared_ptr<UdpClientPort> socket = std::make_shared<UdpClientPort>();
socket->connect(local, 0, remoteAddr, remotePort);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(socket));
}

std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectTcp(const std::string &nodeName,
Expand All @@ -73,7 +73,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectTcp(const std::
}
std::shared_ptr<TcpClientPort> socket = std::make_shared<TcpClientPort>();
socket->connect(local, 0, remoteIpAddr, remotePort);
return createConnection(nodeName, std::shared_ptr<Port>(socket));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(socket));
}

std::string MavLinkConnectionImpl::acceptTcp(std::shared_ptr<MavLinkConnection> parent, const std::string &nodeName,
Expand Down Expand Up @@ -107,7 +107,7 @@ std::shared_ptr<MavLinkConnection> MavLinkConnectionImpl::connectSerial(const st
if (initString.size() > 0) {
serial->write(reinterpret_cast<const uint8_t *>(initString.c_str()), static_cast<int>(initString.size()));
}
return createConnection(nodeName, std::shared_ptr<Port>(serial));
return createConnection(nodeName, std::reinterpret_pointer_cast<Port>(serial));
}

void MavLinkConnectionImpl::startListening(std::shared_ptr<MavLinkConnection> parent, const std::string &nodeName,
Expand Down

0 comments on commit 165a61c

Please sign in to comment.