#ifndef REMOTEUSBCONNECTION_H #define REMOTEUSBCONNECTION_H #include #include #include #include "devicefinderinterface.h" #include "remoteconnectioninterface.h" #include "horalog.h" #include "Cliente.h" #include #include #include #include class RemoteUsbConnection : public RemoteConnectionInterface { Q_OBJECT public: explicit RemoteUsbConnection(QString id, std::optional& log_file, QObject *parent = nullptr); virtual ~RemoteUsbConnection() = default; void connect_device(); void disconnect_device(); void write(const QByteArray &data); signals: void device_found(const QSerialPortInfo &info); void device_not_found(); private: QString _id; QSerialPort* _serial_port; std::optional& _log_file; QSerialPortInfo* _portInfo; void find(); void on_device_not_discovered(); void on_device_found(const QSerialPortInfo &info); bool extractSerialNumber(QSerialPortInfo portinfo,const QString &name); void data_reading(); void handleSerialError(QSerialPort::SerialPortError error); void on_socket_disconnected(const QString& deviceName); void handleDTRChanged(bool set); }; #endif // REMOTEUSBCONNECTION_H