summaryrefslogtreecommitdiffstats
path: root/src/include/frequencyseekhelper.h
blob: 9fbdd875e96bbb87af77b31bf6597e402f077ef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/***************************************************************************
                          frequencyseekhelper.h  -  description
                             -------------------
    begin                : Fre Mai 9 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_FREQUENCY_SEEKHELPER_H
#define KRADIO_FREQUENCY_SEEKHELPER_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <tqobject.h>
#include <kdemacros.h>
#include "radiodevice_interfaces.h"
#include "seekhelper.h"

class KDE_EXPORT FrequencySeekHelper : public TQObject,
                                       public SeekHelper,
                                       public IFrequencyRadioClient
{
Q_OBJECT

public:

    FrequencySeekHelper(ISeekRadio &parent);
    virtual ~FrequencySeekHelper();

// IFrequencyRadioClient
RECEIVERS:
    bool noticeFrequencyChanged(float /*f*/, const RadioStation */*s*/)  { return false; }
    bool noticeMinMaxFrequencyChanged(float /*min*/, float /*max*/)      { return false; }
    bool noticeDeviceMinMaxFrequencyChanged(float /*min*/, float /*max*/){ return false; }
    bool noticeScanStepChanged(float /*s*/)                              { return false; }

public:

    virtual bool     connectI   (Interface *i);
    virtual bool     disconnectI(Interface *i);

    virtual void     start(const SoundStreamID &, direction_t dir);

public slots:

    virtual void step() { SeekHelper::step(); }

protected:
    virtual void abort();
    virtual bool isGood() const;
    virtual bool isBetter() const;
    virtual bool isWorse() const;
    virtual bool bestFound() const;
    virtual void getData();
    virtual void rememberBest();
    virtual bool nextSeekStep();
    virtual void applyBest();

protected:
    TQTimer  *m_timer;

    float    m_currentSignal, m_oldSignal;
    bool     m_goodSignal;
    float    m_currentFrequency, m_oldFrequency;
    float    m_bestFrequency;
};

#endif