#ifndef DATASOURCE_H #define DATASOURCE_H #include #include #include #include #include "structures.h" enum ParserState { StateIdle = 0, StateHeader, StateData, }; /** */ class DataSource : public QObject { Q_OBJECT QSerialPort usart; TrigerSettings trigerSettings; char * in_buffer; ParserState state; char * packet_buf; int packet_cnt; SendHeader header; bool catching; public: explicit DataSource (QObject * p = nullptr); virtual ~DataSource (); TrigerSettings * getTrigger () { return & trigerSettings; } void SendTrigerMode (int n); void SendTrigerEdge (int n); void SendTrigerChan (int n); void SendBaseRange (int n); void Start (); public slots: void read_data (); void SettingChanged (int n); signals: void Channels_received(QVector, QVector); void PaketTriggered (); protected: void parse_input (const char * data, const long len); void parse_packet (); void parse_header (); protected: void send_trig_mode (); }; #endif // DATASOURCE_H