Skip to content

Commit

Permalink
AP_Networking: added SITL backend
Browse files Browse the repository at this point in the history
this allows the net tests to run on SITL, and for DDS testing using
the SocketAPM API
  • Loading branch information
tridge authored and magicrub committed Nov 15, 2023
1 parent f4cd136 commit aafd6d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/AP_Networking/AP_Networking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ extern const AP_HAL::HAL& hal;
#include <arpa/inet.h>
#endif

#if AP_NETWORKING_BACKEND_SITL
#include "AP_Networking_SITL.h"
#endif

const AP_Param::GroupInfo AP_Networking::var_info[] = {
// @Param: ENABLED
Expand Down Expand Up @@ -114,6 +117,9 @@ void AP_Networking::init()
#if AP_NETWORKING_BACKEND_CHIBIOS
backend = new AP_Networking_ChibiOS(*this);
#endif
#if AP_NETWORKING_BACKEND_SITL
backend = new AP_Networking_SITL(*this);
#endif

if (backend == nullptr) {
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "NET: backend failed");
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_Networking/AP_Networking_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#define AP_NETWORKING_BACKEND_CHIBIOS AP_NETWORKING_BACKEND_DEFAULT_ENABLED && CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
#endif

#ifndef AP_NETWORKING_BACKEND_SITL
#define AP_NETWORKING_BACKEND_SITL AP_NETWORKING_BACKEND_DEFAULT_ENABLED && CONFIG_HAL_BOARD == HAL_BOARD_SITL
#endif

#define AP_NETWORKING_SOCKETS_ENABLED (HAL_OS_SOCKETS || AP_NETWORKING_BACKEND_CHIBIOS)

// ---------------------------
Expand Down

0 comments on commit aafd6d3

Please sign in to comment.