00001 /*************************************************************************** 00002 frequencyseekhelper.h - description 00003 ------------------- 00004 begin : Fre Mai 9 2003 00005 copyright : (C) 2003 by Martin Witte 00006 email : witte@kawo1.rwth-aachen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef KRADIO_FREQUENCY_SEEKHELPER_H 00019 #define KRADIO_FREQUENCY_SEEKHELPER_H 00020 00021 #ifdef HAVE_CONFIG_H 00022 #include <config.h> 00023 #endif 00024 00025 #include <qobject.h> 00026 #include "radiodevice_interfaces.h" 00027 #include "seekhelper.h" 00028 00029 class FrequencySeekHelper : public QObject, 00030 public SeekHelper, 00031 public IFrequencyRadioClient 00032 { 00033 Q_OBJECT 00034 public: 00035 00036 FrequencySeekHelper(ISeekRadio &parent); 00037 virtual ~FrequencySeekHelper(); 00038 00039 // IFrequencyRadioClient 00040 RECEIVERS: 00041 bool noticeFrequencyChanged(float /*f*/, const RadioStation */*s*/) { return false; } 00042 bool noticeMinMaxFrequencyChanged(float /*min*/, float /*max*/) { return false; } 00043 bool noticeDeviceMinMaxFrequencyChanged(float /*min*/, float /*max*/){ return false; } 00044 bool noticeScanStepChanged(float /*s*/) { return false; } 00045 00046 public: 00047 00048 virtual bool connectI (Interface *i); 00049 virtual bool disconnectI(Interface *i); 00050 00051 virtual void start(const SoundStreamID &, direction_t dir); 00052 00053 public slots: 00054 00055 virtual void step() { SeekHelper::step(); } 00056 00057 protected: 00058 virtual void abort(); 00059 virtual bool isGood() const; 00060 virtual bool isBetter() const; 00061 virtual bool isWorse() const; 00062 virtual bool bestFound() const; 00063 virtual void getData(); 00064 virtual void rememberBest(); 00065 virtual bool nextSeekStep(); 00066 virtual void applyBest(); 00067 00068 protected: 00069 QTimer *m_timer; 00070 00071 float m_currentSignal, m_oldSignal; 00072 bool m_goodSignal; 00073 float m_currentFrequency, m_oldFrequency; 00074 float m_bestFrequency; 00075 }; 00076 00077 #endif