00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ASPECT_DATAPEMCU_H
00013 #define ASPECT_DATAPEMCU_H
00014
00015
00016 #include <QFile>
00017 #include <QList>
00018 #include <QObject>
00019 #include <QPointer>
00020 #include <QStandardItemModel>
00021 #include <QTime>
00022 #include <QTimer>
00023 #include <QVector>
00024
00025
00026 class PecData;
00027
00028
00029 class PeRawSample
00030 {
00031 public:
00032 QTime m_oTime;
00033 double m_dfWorm;
00034 double m_dfRa;
00035 double m_dfDec;
00036 };
00037
00038
00039 class PePureSample
00040 {
00041 public:
00042 double m_dfWorm;
00043 double m_dfPe;
00044 };
00045
00046
00047 class Period
00048 {
00049 public:
00050 int m_nRowBeg;
00051 int m_nRowEnd;
00052 double m_dfPeMin;
00053 double m_dfPeMax;
00054 };
00055
00056
00057 class DataPeMcu : public QObject
00058 {
00059 Q_OBJECT
00060
00061 public:
00062 DataPeMcu();
00063 ~DataPeMcu();
00064
00065 void clearData();
00066 bool probePeFile(const QString &qsFileName) const;
00067 void setPeFileName(const QString &qsFileName);
00068 bool loadPeFile();
00069 bool pollPeFile(bool bOn);
00070
00071 void processData(int nBeg, int nEnd, bool bAverage, int nSmoothWidth,
00072 double dfDrift, double dfScale, double dfOffset,
00073 PecData *pPecTable, int nWormWheelTeeth, double dfPecPosScale);
00074
00075 QStandardItemModel *model() { return m_qpModel; };
00076 QList<PeRawSample> samples() const { return m_lstPeRaw; };
00077 QList<Period> periods() const { return m_lstPeriod; };
00078 QList<PePureSample> peSmoothed() const { return m_lstPeSmoothed; };
00079 QVector<double> peProcessed() const { return m_aPeProcessed; };
00080 QVector<double> pecIdeal() const { return m_aPecIdeal; };
00081
00082 signals:
00083 void dataPeChanged();
00084
00085 private:
00086 bool openPeFile();
00087 void closePeFile();
00088 void clearPeData();
00089
00090 private slots:
00091 void readPeFile();
00092 void changePeItem(QStandardItem *pItem);
00093
00094 private:
00095 QFile m_oPeFile;
00096 QTimer m_oPoller;
00097 QString m_qsLineFragment;
00098 bool m_bInModelRefill;
00099 QPointer<QStandardItemModel> m_qpModel;
00100 QList<PeRawSample> m_lstPeRaw;
00101 QList<PePureSample> m_lstPePure;
00102 QList<PePureSample> m_lstPeSmoothed;
00103 QList<Period> m_lstPeriod;
00104 QVector<double> m_aPeProcessed;
00105 QVector<double> m_aPecIdeal;
00106 };
00107
00108
00109 #endif // ASPECT_DATAPEMCU_H
00110