diff --git a/core/dronecore.h b/core/dronecore.h index 08b15f257f..85f67abb53 100644 --- a/core/dronecore.h +++ b/core/dronecore.h @@ -23,10 +23,15 @@ class System; class DroneCore { public: + /** @brief Default UDP bind IP (accepts any incoming connections). */ static constexpr auto DEFAULT_UDP_BIND_IP = "0.0.0.0"; + /** @brief Default UDP bind port (same port as used by MAVROS). */ static constexpr int DEFAULT_UDP_PORT = 14540; + /** @brief Default TCP remote IP (localhost). */ static constexpr auto DEFAULT_TCP_REMOTE_IP = "127.0.0.1"; + /**< @brief Default TCP remote port. */ static constexpr int DEFAULT_TCP_REMOTE_PORT = 5760; + /**< @brief Default serial baudrate. */ static constexpr int DEFAULT_SERIAL_BAUDRATE = 57600; /** @@ -50,9 +55,6 @@ class DroneCore * - TCP - tcp://[Remote_host][:Remote_port] * - Serial - serial://Dev_Node[:Baudrate] * - * Default URL : udp://0.0.0.0:14540. - * - Default Bind host IP is any local interface (0.0.0.0) - * * @param connection_url connection URL string. * @return The result of adding the connection. */ @@ -92,11 +94,11 @@ class DroneCore /** * @brief Adds a TCP connection with a specific IP address and port number. * - * @param remote_ip Remote IP address to connect to (defaults to 127.0.0.1). + * @param remote_ip Remote IP address to connect to. * @param remote_port The TCP port to connect to (defaults to 5760). * @return The result of adding the connection. */ - ConnectionResult add_tcp_connection(const std::string &remote_ip = DEFAULT_TCP_REMOTE_IP, + ConnectionResult add_tcp_connection(const std::string &remote_ip, int remote_port = DEFAULT_TCP_REMOTE_PORT); /** diff --git a/core/serial_connection.cpp b/core/serial_connection.cpp index e557903bfc..5d0a92e910 100644 --- a/core/serial_connection.cpp +++ b/core/serial_connection.cpp @@ -53,15 +53,7 @@ namespace dronecore { SerialConnection::SerialConnection(DroneCoreImpl &parent, const std::string &path, int baudrate): Connection(parent), _serial_node(path), - _baudrate(baudrate) -{ - if (baudrate == 0) { - _baudrate = DEFAULT_SERIAL_BAUDRATE; - } - if (path == "") { - _serial_node = DEFAULT_SERIAL_DEV_PATH; - } -} + _baudrate(baudrate) {} SerialConnection::~SerialConnection() { diff --git a/core/serial_connection.h b/core/serial_connection.h index b8a86acb48..64f0560bf8 100644 --- a/core/serial_connection.h +++ b/core/serial_connection.h @@ -32,10 +32,8 @@ class SerialConnection : public Connection void start_recv_thread(); static void receive(SerialConnection *parent); - static constexpr int DEFAULT_SERIAL_BAUDRATE = 9600; - static constexpr auto DEFAULT_SERIAL_DEV_PATH = "/dev/ttyS0"; - std::string _serial_node = {}; - int _baudrate = DEFAULT_SERIAL_BAUDRATE; + std::string _serial_node; + int _baudrate; std::mutex _mutex = {}; #if !defined(WINDOWS)