/*************************************************************************** * 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. * ***************************************************************************/ #include "rxtxfunctions.h" #include "imageview.h" #include "rgbmode.h" #include "gbrmode.h" #include "gbr2mode.h" #include "robotamode.h" #include "robotbmode.h" #include "pdmode.h" #include "bwmode.h" #include "calibmode.h" #include "utils.h" const char *rxtxStateText[]= { "Started", "Idle", "VisDetect", "Hunt", "Display" }; rxtxFunctions::rxtxFunctions(QObject *parent, const char *name):QObject(parent,name) { rxtxDisplay=NULL; } rxtxFunctions::~rxtxFunctions() { } /*! \fn rxtxFunctions::startSelectedMode(imageView *iv) \brief create and init instance of the different modes Create an instance of the selected mode. The parameters are updated (i.e. the user settings are read from the interface (e.g. useVis etc ..)). \return NULL if mode not found or creation failed */ bool rxtxFunctions::startSelectedMode(imageView *iv,bool tx) { logfile.add("Selected Mode:%d =%s \n",selectedMode,getMode(selectedMode)); if(rxtxDisplay) { delete rxtxDisplay; rxtxDisplay=NULL; } switch(selectedMode) { case M1: case M2: { rxtxDisplay=new gbrMode(this); } break; case S1: case S2: case SDX: { rxtxDisplay=new gbr2Mode(this); } break; case WS2: { rxtxDisplay=new rgbMode(this); } break; case R36: rxtxDisplay=new robotAMode(this); break; case R24: case R72: rxtxDisplay=new robotBMode(this); break; case P3: case P5: case P7: { rxtxDisplay=new rgbMode(this); } break; case BW8: case BW12: { rxtxDisplay=new bwMode(this); } break; case PD50: case PD90: case PD120: case PD160: case PD180: case PD240: case PD290: rxtxDisplay=new pdMode(this); break; case CALIB: rxtxDisplay=new calibMode(this); break; case NOTVALID: break; default: selectedMode=NOTVALID; break; } if(selectedMode!=NOTVALID) { initializeParametersIndex(selectedMode); rxtxDisplay->init(selectedMode,iv,tx,TRUE); updateParams(); nextState(DISPLAY); } return (rxtxDisplay!=NULL); } void rxtxFunctions::updateParams() { if(rxtxDisplay==NULL) return; // debug("params updated"); rxtxDisplay->slantAdjust=slantAdjust; rxtxDisplay->useVIS=useVIS; rxtxDisplay->dxMode=dxMode; // rxtxDisplay->sensitivity=sensitivity; rxtxDisplay->useCW=useCW; rxtxDisplay->useVOX=useVOX; } void rxtxFunctions::nextState(enum rxtxState st) { state=st; logfile.add("State=%s",rxtxStateText[state]); }