Skip to content

Commit

Permalink
fix ifm3d discovery issue on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
vksgaikwad3 committed Jan 31, 2024
1 parent 2eab41e commit 446a0ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions modules/device/src/libifm3d_device/discovery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,25 @@ namespace ifm3d
{
device_list_.clear();

#ifdef __unix__

/* Creating universal listener udp connecton */
asio::ip::udp::endpoint endpoint(asio::ip::address_v4::any(),
BCAST_DEFAULT_PORT);
auto con = std::make_shared<UDPConnection>(io_context_, endpoint);

con->RegisterOnReceive(std::bind(&IFMDeviceDiscovery::_OnReceive,
this,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
con->RegisterOnClose(std::bind(&IFMDeviceDiscovery::_RemoveConnection,
this,
std::placeholders::_1));

connection_list_.push_back(con);
#endif

try
{
auto addresses = _GetAllInterfaceAddress();
Expand Down
2 changes: 1 addition & 1 deletion modules/tools/src/libifm3d_tools/discover_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ifm3d::DiscoverApp::DiscoverApp(int argc,
const char** argv,
const std::string& name)
: ifm3d::CmdLineApp(argc, argv, name)
: ifm3d::CmdLineApp(argc, argv, name, false)
{}

int
Expand Down

0 comments on commit 446a0ee

Please sign in to comment.