PacMan 2.0(r200)
Runs on digital PAC measurement computers
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008-2010 by Matthias Nagl * 00003 * mnagl@uni-goettingen.de * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef PACNETCOM_H 00022 #define PACNETCOM_H 00023 00024 #include <QObject> 00025 #include <QTcpSocket> 00026 #include <QTimer> 00027 #include "pacDataTypes.h" 00028 #include "PropertyBranch.h" 00029 #include "TransmittableProperty.h" 00030 00031 class WaveformDataInterface; 00032 class QTcpServer; 00033 class WaveformDataInterface; 00034 class PacPropertyBranch; 00035 00041 class PacNetCom : public QObject, public PropertyBranch 00042 { 00043 Q_OBJECT 00044 public: 00045 PacNetCom(PropertyBranchInterface *parentbranch = 0); 00046 ~PacNetCom(); 00047 00048 public slots: 00049 void updateState(); 00050 void sendMessage(Pac::NetMsgType type, QByteArray data = QByteArray()); 00051 void setLastSeqNum(qlonglong l); 00052 void sendWaveformTeaser(WaveformDataInterface *w); 00053 void waitingForOffsetSignal(); 00054 void foundOffsetSignal(); 00055 void sendProperty(QByteArray data); 00056 void sendPropertyConfirmation(QByteArray data); 00057 void numAnalyzerThreads(unsigned int newnum); 00058 00059 private slots: 00060 void newConnection(); 00061 void update_state(QAbstractSocket::SocketState socketState); 00062 void receivedData(); 00063 void sendNewResults(); 00064 void updateStats(); 00065 00066 signals: 00067 void startSynchronization(); 00068 void startRecording(); 00069 void stopRecording(); 00070 void recordingFinished(); 00071 void initializeDigitizer(); 00072 void threadReady(QString s); 00073 void connectionState(QString s); 00074 void connectionStats(qulonglong bytes); 00075 void requestSetup(); 00076 void propertyChanged(QByteArray data); 00077 00078 private: 00079 QTcpServer *server; 00080 QTcpSocket *socket; 00081 QString state; 00082 bool sendingData; 00083 long long seqnum; 00084 qulonglong sentbytes; 00085 unsigned int numanalyzerthreads; 00086 QTimer *sendtimer, *stattimer; 00087 long long lastseqnum; 00088 TransmittableProperty p_port; 00089 }; 00090 00091 #endif