11#ifndef _PATH_FINDER_HPP
12#define _PATH_FINDER_HPP
14#include <netinet/in.h>
43 struct sockaddr_in server;
45 static const size_t BUFFER_SIZE = 65536;
46 unsigned char buffer[BUFFER_SIZE];
57 int last_data_type = -1;
67 explicit Listener(
const char * _address,
const int _port,
const int _timeout_ms = 1000);
87 ssize_t
read(
unsigned char * buffer,
size_t size);
120 const char * address;
122 const int timeout_ms;
125 struct sockaddr_in server;
127 const std::string CRCF =
"\r\n";
128 const std::string ping_cmd =
"CS";
129 const std::string break_cmd =
"===";
138 explicit Sender(
const char * _address,
const int _port,
const int _timeout_ms = 1000);
151 ssize_t
read(
unsigned char * buffer,
size_t size);
164 bool send_cmd(
const std::string & cmd,
const uint & wait_time = 0,
bool newline =
true);
Handles TCP reception of DVL data and dispatches parsing to PD0 or PD5 parsers.
Definition: path_finder.hpp:36
bool has_pd0_data() const
Check if valid PD0 data is currently available.
Definition: path_finder.cpp:114
~Listener()
Destructor. Closes the socket.
Definition: path_finder.cpp:66
std::shared_ptr< pd5::Pd5Ensemble > get_pd5_data()
Retrieve the latest parsed PD5 data.
Definition: path_finder.cpp:123
bool listen()
Listen for incoming data and attempt to parse it.
Definition: path_finder.cpp:78
bool has_pd5_data() const
Check if valid PD5 data is currently available.
Definition: path_finder.cpp:116
std::shared_ptr< pd0::Pd0Ensemble > get_pd0_data()
Retrieve the latest parsed PD0 data.
Definition: path_finder.cpp:118
ssize_t read(unsigned char *buffer, size_t size)
Read raw bytes from the socket.
Definition: path_finder.cpp:73
Handles TCP transmission of commands to the DVL.
Definition: path_finder.hpp:119
bool send_break_cmd()
Send a Soft Break ("===") to wake up the DVL.
Definition: path_finder.cpp:218
bool send_cmd(const std::string &cmd, const uint &wait_time=0, bool newline=true)
Send a generic string command to the DVL.
Definition: path_finder.cpp:204
ssize_t read(unsigned char *buffer, size_t size)
Read response from DVL after sending a command.
Definition: path_finder.cpp:166
bool send_ping_cmd()
Send the Start Pinging command ("CS").
Definition: path_finder.cpp:220
void flush_buffer()
Clear socket buffer.
Definition: path_finder.cpp:171
~Sender()
Destructor. Closes the socket.
Definition: path_finder.cpp:159
Class to parse PD0 binary data packets.
Definition: pd0_parser.hpp:25
Class to parse PD4/PD5 binary data packets.
Definition: pd5_parser.hpp:25
Parser for Teledyne RDI PD0 Data Format.
Teledyne RDI PD0 Data Format.
Parser for Teledyne RDI PD4/PD5 Data Format.
Teledyne RDI PD5 Data Format.
Definition: pd0_types.hpp:117
Definition: pd5_types.hpp:22