Skip to content

Commit

Permalink
Merge pull request #45 from mROS-base/unify_ipsetting
Browse files Browse the repository at this point in the history
implement `mros2::setIPAddressRTPS` to move its operation from config/rtps.h
  • Loading branch information
takasehideki authored Sep 13, 2023
2 parents 6532fc1 + 1b299f1 commit a0ce0f0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/mros2.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
extern void* __dso_handle;
#endif

namespace rtps
{
namespace Config
{
extern std::array<uint8_t, 4> IP_ADDRESS;
}
}

namespace mros2
{

Expand Down Expand Up @@ -81,6 +89,8 @@ class Subscriber

void spin();

void setIPAddrRTPS(std::array<uint8_t, 4> ipaddr);

} /* namespace mros2 */

namespace message_traits
Expand Down
15 changes: 15 additions & 0 deletions src/mros2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ void spin()
}
}

void setIPAddrRTPS(std::array<uint8_t, 4> ipaddr)
{
rtps::Config::IP_ADDRESS = ipaddr;

MROS2_DEBUG("[MROS2LIB] set IP address for RTPS communication");
}

} /* namespace mros2 */


Expand Down Expand Up @@ -311,6 +318,14 @@ void setTrue(void* args)
*static_cast<volatile bool*>(args) = true;
}

namespace rtps
{
namespace Config
{
std::array<uint8_t, 4> IP_ADDRESS;
}
} /* namespace rtps */

/*
* specialize template functions described in platform's workspace
*/
Expand Down

0 comments on commit a0ce0f0

Please sign in to comment.