seekhelper.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           seekhelper.h  -  description
00003                              -------------------
00004     begin                : Sam Mai 10 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_SEEKHELPER_H
00019 #define KRADIO_SEEKHELPER_H
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024 
00025 #include "radiodevice_interfaces.h"
00026 #include "soundstreamclient_interfaces.h"
00027 
00028 
00029 class SeekHelper : public IRadioDeviceClient,
00030                    public ISoundStreamClient
00031 {
00032 public:
00033     typedef enum { off, searchWorse, searchBest } state_t;
00034     typedef enum { up, down } direction_t;
00035 
00036     SeekHelper(ISeekRadio &parent);
00037     virtual ~SeekHelper();
00038 
00039     virtual bool     connectI   (Interface *i);
00040     virtual bool     disconnectI(Interface *i);
00041 
00042     virtual void start(const SoundStreamID &id, direction_t dir);
00043     virtual void step();
00044     virtual void stop();
00045 
00046     bool isRunning()     const { return m_state != off; }
00047     bool isRunningUp()   const { return m_state != off && m_direction == up; }
00048     bool isRunningDown() const { return m_state != off && m_direction == down; }
00049 
00050 
00051 // IRadioDeviceClient
00052 RECEIVERS:
00053     bool noticePowerChanged   (bool /*on*/, const IRadioDevice */*sender*/)          { return false; }
00054     bool noticeStationChanged (const RadioStation &, const IRadioDevice */*sender*/) { return false; }
00055     bool noticeDescriptionChanged (const QString &, const IRadioDevice */*sender*/)  { return false; }
00056 
00057     bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/, const IRadioDevice */*sender*/) { return false; }
00058 
00059 protected:
00060 
00061     virtual void finish();
00062 
00063     virtual void abort() = 0;
00064     virtual bool isGood() const = 0;
00065     virtual bool isBetter() const = 0;
00066     virtual bool isWorse() const = 0;
00067     virtual bool bestFound() const = 0;
00068     virtual void getData() = 0;
00069     virtual void rememberBest() = 0;
00070     virtual bool nextSeekStep() = 0;
00071     virtual void applyBest() = 0;
00072 
00073 protected:
00074     state_t        m_state;
00075     direction_t    m_direction;
00076     bool           m_oldMute;
00077 
00078     ISeekRadio    &m_parent;
00079     SoundStreamID  m_SoundStreamID;
00080 };
00081 
00082 #endif
00083 

Generated on Fri Jan 28 16:28:08 2011 for kradio by  doxygen 1.4.7