summaryrefslogtreecommitdiffstats
path: root/src/include/seekhelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/seekhelper.h')
-rw-r--r--src/include/seekhelper.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/include/seekhelper.h b/src/include/seekhelper.h
new file mode 100644
index 0000000..f61ad9d
--- /dev/null
+++ b/src/include/seekhelper.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ seekhelper.h - description
+ -------------------
+ begin : Sam Mai 10 2003
+ copyright : (C) 2003 by Martin Witte
+ email : witte@kawo1.rwth-aachen.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KRADIO_SEEKHELPER_H
+#define KRADIO_SEEKHELPER_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "radiodevice_interfaces.h"
+#include "soundstreamclient_interfaces.h"
+
+
+class SeekHelper : public IRadioDeviceClient,
+ public ISoundStreamClient
+{
+public:
+ typedef enum { off, searchWorse, searchBest } state_t;
+ typedef enum { up, down } direction_t;
+
+ SeekHelper(ISeekRadio &parent);
+ virtual ~SeekHelper();
+
+ virtual bool connectI (Interface *i);
+ virtual bool disconnectI(Interface *i);
+
+ virtual void start(const SoundStreamID &id, direction_t dir);
+ virtual void step();
+ virtual void stop();
+
+ bool isRunning() const { return m_state != off; }
+ bool isRunningUp() const { return m_state != off && m_direction == up; }
+ bool isRunningDown() const { return m_state != off && m_direction == down; }
+
+
+// IRadioDeviceClient
+RECEIVERS:
+ bool noticePowerChanged (bool /*on*/, const IRadioDevice */*sender*/) { return false; }
+ bool noticeStationChanged (const RadioStation &, const IRadioDevice */*sender*/) { return false; }
+ bool noticeDescriptionChanged (const TQString &, const IRadioDevice */*sender*/) { return false; }
+
+ bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/, const IRadioDevice */*sender*/) { return false; }
+
+protected:
+
+ virtual void finish();
+
+ virtual void abort() = 0;
+ virtual bool isGood() const = 0;
+ virtual bool isBetter() const = 0;
+ virtual bool isWorse() const = 0;
+ virtual bool bestFound() const = 0;
+ virtual void getData() = 0;
+ virtual void rememberBest() = 0;
+ virtual bool nextSeekStep() = 0;
+ virtual void applyBest() = 0;
+
+protected:
+ state_t m_state;
+ direction_t m_direction;
+ bool m_oldMute;
+
+ ISeekRadio &m_parent;
+ SoundStreamID m_SoundStreamID;
+};
+
+#endif
+