/*************************************************************************** * Copyright (C) 2004 by Johan Maes - ON4QZ * * on4qz@telenet.be * * http://users.telenet.be/on4qz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef IMAGEBASE_H #define IMAGEBASE_H #include #include #include "sstvparam.h" #include "dspfunctions.h" class imageView; enum embState {ERROR,SETUPLINE,PIXELS,SYNC,ENDOFLINE,ENDOFIMAGE,RXWAIT,TXGAP,TXGAPROBOT}; enum etxState {TXDONE,TXWAIT,TXENDOFIMAGE,TXCONT}; /** @author Johan Maes - ON4QZ */ class modeBase : public QObject { Q_OBJECT public: modeBase(QObject *parent = 0, const char *name = 0); virtual ~modeBase(); virtual void init(sstvMode imode,imageView *ptr,bool tx,bool initClock); // virtual bool decode(float f)=0; virtual embState setupLine(int &subLine,unsigned char **buf)=0; int decodeLine(float f,bool s); virtual bool showLine(); void clearImage(); bool slantAdjust; bool useVIS; bool dxMode; float newClock; // int sensitivity; bool useCW; bool useVOX; etxState transmit(); void initTX(QProgressBar *pb); void sendHeader(); void sendTail(); // virtual void sendImage()=0; etxState txHeader(); etxState txVisCode(); etxState txLine(); etxState txTail(); etxState txCW(); void initCW(QString cwText); etxState txDELAYEDSTOP(); etxState txWAITSTOP(); virtual embState txSetupLine(int &subln,unsigned char **buf)=0; etxState txSingleTone(float freq,float dur); etxState txMultiTone(float freq,float dur, float freqB,float durB); void setUse(bool slantAdj,bool dxMode) { mslantAdjust=slantAdj; mdxMode=dxMode; } unsigned int getLineCounter() {return lineCounter;} unsigned int getSampleCounter() {return sampleCounter;} int offset; // used by syncproc evauluatTrackSync // int offsetCompensation; // for scottie (sync is not end of line) int compensateSyncPosition(sstvMode imode,bool afterVIS); public slots: void slotDeactivatePTT(); signals: void signalDisplaySync(unsigned int); protected: // sstvMode mode; imageView *displayPtr; unsigned int lineCounter; unsigned int pixelCounter; unsigned int sampleCounter; unsigned int syncPosition; int waitForSync(); virtual void setSize(); float syncDuration; float fp; float bp; float blank; unsigned int sptr; bool syncStartDetected; unsigned int *pixelPositionTable; unsigned char *greenArray; unsigned char *blueArray; unsigned char *redArray; unsigned char *yArray; unsigned char *buf; void deleteBuffers(); virtual void calcPixelPositionTable(unsigned int colorLine,bool tx)=0; virtual bool getPixels(unsigned char *pixelArray); void colorConversion(unsigned char *array,unsigned int line); bool checkFrequency(float freq,float duration,float tolerance); void combineColors(); float visibleLineLength; float txFreq; float txDur; void sendSync(); void sendGap(); etxState sendTone(float freq,float duration); etxState sendPixelBuffer(unsigned char *pixelArray); virtual void getLine(); void getLineBW(); void getLineY(bool evenodd); bool activatePTT(bool b); bool done; embState mbState; float sample; bool sync; int subLine; int headerPhase; unsigned char vc; etxState txWait(float dur); unsigned int savedSampleCounter; bool mslantAdjust; bool mdxMode; unsigned int marker; QProgressBar *pbPtr; }; #endif