1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-30 14:53:03 +00:00

Fix string comparisons, improve const correctness

This commit is contained in:
Carles Fernandez
2018-12-02 15:42:38 +01:00
parent cc58fbe30f
commit f7df714a7f
14 changed files with 300 additions and 299 deletions

View File

@@ -48,7 +48,7 @@
using google::LogMessage;
Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path)
Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path)
{
nmea_base_path = base_path;
d_flag_nmea_output_file = flag_nmea_output_file;
@@ -79,7 +79,7 @@ Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_output_file, boo
nmea_base_path = p.string();
}
if ((nmea_base_path.compare(".") != 0) and (d_flag_nmea_output_file == true))
if ((nmea_base_path != ".") and (d_flag_nmea_output_file == true))
{
std::cout << "NMEA files will be stored at " << nmea_base_path << std::endl;
}
@@ -99,7 +99,7 @@ Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_output_file, boo
}
}
nmea_devname = nmea_dump_devname;
nmea_devname = std::move(nmea_dump_devname);
if (flag_nmea_tty_port == true)
{
nmea_dev_descriptor = init_serial(nmea_devname.c_str());
@@ -126,20 +126,20 @@ Nmea_Printer::~Nmea_Printer()
}
int Nmea_Printer::init_serial(std::string serial_device)
int Nmea_Printer::init_serial(const std::string& serial_device)
{
/*!
* Opens the serial device and sets the default baud rate for a NMEA transmission (9600,8,N,1)
*/
int fd = 0;
struct termios options;
struct termios options = {};
int64_t BAUD;
int64_t DATABITS;
int64_t STOPBITS;
int64_t PARITYON;
int64_t PARITY;
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY | O_CLOEXEC);
if (fd == -1) return fd; // failed to open TTY port
if (fcntl(fd, F_SETFL, 0) == -1) LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O