43 lines
978 B
C++
43 lines
978 B
C++
#ifndef SERIAL_SAMPLE_CONNECTIONWINDOW_H
|
|
#define SERIAL_SAMPLE_CONNECTIONWINDOW_H
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
#include <libserialport.h>
|
|
|
|
struct SerialPortInfo {
|
|
std::string port_name;
|
|
std::string description;
|
|
};
|
|
|
|
class ConnectionWindow {
|
|
public:
|
|
ConnectionWindow();
|
|
~ConnectionWindow();
|
|
|
|
void Initialize();
|
|
void Render(bool* p_open);
|
|
|
|
bool IsConnected() const { return is_connected; }
|
|
struct sp_port* GetActivePort() const { return active_port; }
|
|
|
|
void ForceLogMessage(const std::string& msg);
|
|
std::string& GetSharedLog() { return tx_log; }
|
|
|
|
private:
|
|
void RefreshPorts();
|
|
|
|
std::vector<SerialPortInfo> ports;
|
|
int selected_port_idx;
|
|
|
|
// Новые переменные для выпадающего списка Baud Rate
|
|
std::vector<int> baud_rates;
|
|
int selected_baud_idx;
|
|
|
|
bool is_connected;
|
|
struct sp_port* active_port;
|
|
std::string tx_log;
|
|
};
|
|
|
|
#endif // SERIAL_SAMPLE_CONNECTIONWINDOW_H
|