AP_DDS: Add user-selectable UDP IP
This commit is contained in:
parent
74f9b74fe7
commit
6cd24bb87b
@ -65,6 +65,10 @@ const AP_Param::GroupInfo AP_DDS_Client::var_info[] {
|
|||||||
// @User: Standard
|
// @User: Standard
|
||||||
AP_GROUPINFO("_PORT", 2, AP_DDS_Client, udp.port, 2019),
|
AP_GROUPINFO("_PORT", 2, AP_DDS_Client, udp.port, 2019),
|
||||||
|
|
||||||
|
// @Group: _IP
|
||||||
|
// @Path: ../AP_Networking/AP_Networking_address.cpp
|
||||||
|
AP_SUBGROUPINFO(udp.ip, "_IP", 3, AP_DDS_Client, AP_Networking_IPV4),
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AP_GROUPEND
|
AP_GROUPEND
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#if AP_DDS_UDP_ENABLED
|
#if AP_DDS_UDP_ENABLED
|
||||||
#include <AP_HAL/utility/Socket.h>
|
#include <AP_HAL/utility/Socket.h>
|
||||||
|
#include <AP_Networking/AP_Networking_address.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const AP_HAL::HAL& hal;
|
extern const AP_HAL::HAL& hal;
|
||||||
@ -138,7 +139,7 @@ private:
|
|||||||
struct {
|
struct {
|
||||||
AP_Int32 port;
|
AP_Int32 port;
|
||||||
// UDP endpoint
|
// UDP endpoint
|
||||||
const char* ip = "127.0.0.1";
|
AP_Networking_IPV4 ip{AP_DDS_DEFAULT_UDP_IP_ADDR};
|
||||||
// UDP Allocation
|
// UDP Allocation
|
||||||
uxrCustomTransport transport;
|
uxrCustomTransport transport;
|
||||||
SocketAPM *socket;
|
SocketAPM *socket;
|
||||||
|
@ -14,7 +14,7 @@ bool AP_DDS_Client::udp_transport_open(uxrCustomTransport *t)
|
|||||||
if (sock == nullptr) {
|
if (sock == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!sock->connect(dds->udp.ip, dds->udp.port.get())) {
|
if (!sock->connect(dds->udp.ip.get_str(), dds->udp.port.get())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
dds->udp.socket = sock;
|
dds->udp.socket = sock;
|
||||||
|
@ -9,10 +9,18 @@
|
|||||||
|
|
||||||
// UDP only on SITL for now
|
// UDP only on SITL for now
|
||||||
#ifndef AP_DDS_UDP_ENABLED
|
#ifndef AP_DDS_UDP_ENABLED
|
||||||
#define AP_DDS_UDP_ENABLED AP_DDS_ENABLED && AP_NETWORKING_SOCKETS_ENABLED
|
#define AP_DDS_UDP_ENABLED AP_DDS_ENABLED && AP_NETWORKING_ENABLED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <AP_VisualOdom/AP_VisualOdom_config.h>
|
#include <AP_VisualOdom/AP_VisualOdom_config.h>
|
||||||
#ifndef AP_DDS_VISUALODOM_ENABLED
|
#ifndef AP_DDS_VISUALODOM_ENABLED
|
||||||
#define AP_DDS_VISUALODOM_ENABLED HAL_VISUALODOM_ENABLED && AP_DDS_ENABLED
|
#define AP_DDS_VISUALODOM_ENABLED HAL_VISUALODOM_ENABLED && AP_DDS_ENABLED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef AP_DDS_DEFAULT_UDP_IP_ADDR
|
||||||
|
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
||||||
|
#define AP_DDS_DEFAULT_UDP_IP_ADDR "192.168.13.2"
|
||||||
|
#else
|
||||||
|
#define AP_DDS_DEFAULT_UDP_IP_ADDR "127.0.0.1"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user