Skip to content

Commit

Permalink
chore(aeva): move hardcoded port numbers to constants
Browse files Browse the repository at this point in the history
Signed-off-by: Max SCHMELLER <[email protected]>
  • Loading branch information
mojomex committed Nov 18, 2024
1 parent 88823d9 commit f5bd7fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ namespace nebula::drivers::connections::aeva

static const uint16_t g_aeva_header = 0xAEFA;

static const uint16_t g_port_spherical_point_cloud = 41000;
static const uint16_t g_port_health = 41001;
static const uint16_t g_port_config = 41002;
static const uint16_t g_port_telemetry = 41003;
static const uint16_t g_port_calibration = 41005;
static const uint16_t g_port_image = 41006;
static const uint16_t g_port_reconfig_request = 21901;
static const uint16_t g_port_reconfig_response = 41007;
static const uint16_t g_port_log = 41009;
static const uint16_t g_port_imu = 41010;

enum class AevaStreamType : uint16_t {
kSphericalPointCloud = 0,
kHealth = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "nebula_hw_interfaces/nebula_hw_interfaces_aeva/aeva_hw_interface.hpp"

#include "nebula_hw_interfaces/nebula_hw_interfaces_aeva/connections/aeva_api.hpp"

namespace nebula::drivers
{

Expand Down Expand Up @@ -94,25 +96,29 @@ std::shared_ptr<ReconfigParser> AevaHwInterface::make_reconfig_api(
const aeva::Aeries2Config & config, const std::shared_ptr<loggers::Logger> & logger)
{
return std::make_shared<ReconfigParser>(
std::make_shared<TcpStream>(config.sensor_ip, 41007),
std::make_shared<TcpSender>(config.sensor_ip, 21901), logger->child("ReconfigApi"));
std::make_shared<TcpStream>(config.sensor_ip, connections::aeva::g_port_reconfig_response),
std::make_shared<TcpSender>(config.sensor_ip, connections::aeva::g_port_reconfig_request),
logger->child("ReconfigApi"));
}

std::shared_ptr<PointcloudParser> AevaHwInterface::make_pointcloud_api(
const aeva::Aeries2Config & config)
{
return std::make_shared<PointcloudParser>(std::make_shared<TcpStream>(config.sensor_ip, 41000));
return std::make_shared<PointcloudParser>(
std::make_shared<TcpStream>(config.sensor_ip, connections::aeva::g_port_spherical_point_cloud));
}

std::shared_ptr<HealthParser> AevaHwInterface::make_health_api(const aeva::Aeries2Config & config)
{
return std::make_shared<HealthParser>(std::make_shared<TcpStream>(config.sensor_ip, 41001));
return std::make_shared<HealthParser>(
std::make_shared<TcpStream>(config.sensor_ip, connections::aeva::g_port_health));
}

std::shared_ptr<TelemetryParser> AevaHwInterface::make_telemetry_api(
const aeva::Aeries2Config & config)
{
return std::make_shared<TelemetryParser>(std::make_shared<TcpStream>(config.sensor_ip, 41003));
return std::make_shared<TelemetryParser>(
std::make_shared<TcpStream>(config.sensor_ip, connections::aeva::g_port_telemetry));
}

} // namespace nebula::drivers

0 comments on commit f5bd7fc

Please sign in to comment.