Skip to content

Commit a0ce0f0

Browse files
authored
Merge pull request #45 from mROS-base/unify_ipsetting
implement `mros2::setIPAddressRTPS` to move its operation from config/rtps.h
2 parents 6532fc1 + 1b299f1 commit a0ce0f0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

include/mros2.h

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
extern void* __dso_handle;
1414
#endif
1515

16+
namespace rtps
17+
{
18+
namespace Config
19+
{
20+
extern std::array<uint8_t, 4> IP_ADDRESS;
21+
}
22+
}
23+
1624
namespace mros2
1725
{
1826

@@ -81,6 +89,8 @@ class Subscriber
8189

8290
void spin();
8391

92+
void setIPAddrRTPS(std::array<uint8_t, 4> ipaddr);
93+
8494
} /* namespace mros2 */
8595

8696
namespace message_traits

src/mros2.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ void spin()
282282
}
283283
}
284284

285+
void setIPAddrRTPS(std::array<uint8_t, 4> ipaddr)
286+
{
287+
rtps::Config::IP_ADDRESS = ipaddr;
288+
289+
MROS2_DEBUG("[MROS2LIB] set IP address for RTPS communication");
290+
}
291+
285292
} /* namespace mros2 */
286293

287294

@@ -311,6 +318,14 @@ void setTrue(void* args)
311318
*static_cast<volatile bool*>(args) = true;
312319
}
313320

321+
namespace rtps
322+
{
323+
namespace Config
324+
{
325+
std::array<uint8_t, 4> IP_ADDRESS;
326+
}
327+
} /* namespace rtps */
328+
314329
/*
315330
* specialize template functions described in platform's workspace
316331
*/

0 commit comments

Comments
 (0)