#ifndef DATAPROCESSING_H #define DATAPROCESSING_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include "matrixData.h" #include "client.h" #include "loadRef.h" #include "channelMasks.h" #include #include using namespace std; class DataProcessing : public QWidget { Q_OBJECT public: DataProcessing( QString rDir, LoadRefPulse* rPulse, ChannelMasks* cMasks, ProcParams* pParams, MatrixData* uavData, QWidget* parent, bool rec ); //Constructor function. ~DataProcessing(); void refreshData(); // Get new data and store it in the data container. void setTimeOffset( double offset ); // Set the time offset value (us). void setRecordingPath( QString path ); // Set the path to the recording folder. void startRec(); // Start recording the data. void stopRec(); // Stop recording the data. void changeRefWaves(); // Change the reference waveforms for processing. QTime watch; public slots: void copyData( float* newD, uint32_t* newH, int newDSize, int c ); void disableChan( int c ); void writeToLog( QString msg, int type ); void closeQL(); signals: void refresh(); void notNull(); void disableC( int ); void status( QString utc, uint32_t pps, uint32_t epri ); void errorClose(); void writeMsg( QString text, int type ); // Signal to write message to the log. private: void getData(); // Connects to the UAV channels and gets more data. void processData(); // Performs real-time processing on the new data from the UAV channels. void storePulseData( int chan ); // Stores the data in the data container. void storeFreqData( int chan ); // Stores the data in the data container. void storeRawData( int chan ); // Stores the data in the data container. void fileOutput(); // Check if the maximum data sets have been written to files. If so, close files and create next set. void writeRawData(); void writeFFTScaled(); void resetReceived(); void processHeaderData( uint32_t* headers, int chan ); // Format and break up header information. void setRefWaves(); // Get the current reference waveforms to use in the FFTs. void readVars(); // Read in configuration variables from file. void setDepths(); // Set the depth scales for water and ice meters. void setConstants(); // Set up constants that are used for the processing. void setFFTs(); // Set up the variables needed for FFTs. QString timeStamp(); // Return a string containing the current timestamp. (YYYYMMDDHHMMSS). MatrixData* data; // Pointer to the data storage container. LoadRefPulse* refPulse; // Pointer to the reference pulse data for each channel. ChannelMasks* chanMasks; // Pointer to the channel masks. ProcParams* procParams; // Pointer to a processing parameters structure. void executeFFTs( fftwf_plan p, fftwf_plan r, int channel ); fftwf_complex* data_pc; fftwf_complex* data_pc_ref; fftwf_complex* data_pc_final; fftwf_complex* data_pc_final_trunc; fftwf_complex* data_pc_final_complex; fftwf_complex* data_raw; fftwf_complex* data_freq; fftwf_plan* pFor; fftwf_plan* pForRef; fftwf_plan pInv; float f_samp; float tau; float chirp_rate; float* tTime; float** data_in; float** data_in_ref; float* data_ref_weight; float* data_final; float nyquist_zone; float* f_axis; long int f_start; long int f_stop; long int bw; int dataSize; int size_pc; int start_trunc; int stop_trunc; long int refLen; int truncLen; int dataSizeFinal; int dataSizeFinalOld; double* hz; double timeOffset; FILE** outRaw; FILE** outFinal; int numOutput; // Number of data sets written to the current set of binary files. int fileNum; // The current set of binary files being written. std::string path; // The path to the directory to write the files. bool dataReady; bool* received; bool recordingOn; bool recStart; bool setRefs; uint32_t* utcTime; uint32_t* ppsTime; uint32_t* epriNum; Client** clientSockets; // Pointers to Client objects for each channel. QString* serverAddr; // Server addresses for each channel. QString rPath; // Path to the recording directory. int cNum; // Number of channels. }; #endif // DATAPROCESSING_H