43 lines
1002 B
C++
43 lines
1002 B
C++
#ifndef SERIAL_SAMPLE_CONNECTIONWINDOW_H
|
|
#define SERIAL_SAMPLE_CONNECTIONWINDOW_H
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
#include <libserialport.h>
|
|
|
|
class ConnectionWindow {
|
|
public:
|
|
ConnectionWindow();
|
|
~ConnectionWindow();
|
|
|
|
void initialize();
|
|
void render(bool* paramOpen);
|
|
|
|
[[nodiscard]] bool isConnected() const { return connected; }
|
|
[[nodiscard]] sp_port* getActivePort() const { return activePort; }
|
|
|
|
void forceLogMessage(const std::string& msg);
|
|
std::string& getSharedLog() { return txLog; }
|
|
|
|
private:
|
|
void refreshPorts();
|
|
|
|
struct SerialPortInfo {
|
|
std::string portName;
|
|
std::string description;
|
|
};
|
|
|
|
std::vector<SerialPortInfo> ports;
|
|
int selectedPortIdx;
|
|
|
|
// Новые переменные для выпадающего списка Baud Rate
|
|
std::vector<int> baudRates;
|
|
int selectedBaudIdx;
|
|
|
|
bool connected;
|
|
struct sp_port* activePort;
|
|
std::string txLog;
|
|
};
|
|
|
|
#endif // SERIAL_SAMPLE_CONNECTIONWINDOW_H
|