|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QRADIOTUNER_H |
|
43 #define QRADIOTUNER_H |
|
44 |
|
45 #include <QtCore/qobject.h> |
|
46 |
|
47 #include "qmediaobject.h" |
|
48 #include "qmediaserviceprovider.h" |
|
49 |
|
50 #include <QPair> |
|
51 |
|
52 QT_BEGIN_NAMESPACE |
|
53 |
|
54 class QRadioTunerPrivate; |
|
55 class Q_MULTIMEDIA_EXPORT QRadioTuner : public QMediaObject |
|
56 { |
|
57 Q_OBJECT |
|
58 Q_PROPERTY(State state READ state NOTIFY stateChanged) |
|
59 Q_PROPERTY(Band band READ band WRITE setBand NOTIFY bandChanged) |
|
60 Q_PROPERTY(int frequency READ frequency WRITE setFrequency NOTIFY frequencyChanged) |
|
61 Q_PROPERTY(bool stereo READ isStereo NOTIFY stereoStatusChanged) |
|
62 Q_PROPERTY(StereoMode stereoMode READ stereoMode WRITE setStereoMode) |
|
63 Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged) |
|
64 Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged) |
|
65 Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) |
|
66 Q_PROPERTY(bool searching READ isSearching NOTIFY searchingChanged) |
|
67 Q_ENUMS(State) |
|
68 Q_ENUMS(Band) |
|
69 Q_ENUMS(Error) |
|
70 Q_ENUMS(StereoMode) |
|
71 |
|
72 public: |
|
73 enum State { ActiveState, StoppedState }; |
|
74 enum Band { AM, FM, SW, LW, FM2 }; |
|
75 enum Error { NoError, ResourceError, OpenError, OutOfRangeError }; |
|
76 enum StereoMode { ForceStereo, ForceMono, Auto }; |
|
77 |
|
78 QRadioTuner(QObject *parent = 0, QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider()); |
|
79 ~QRadioTuner(); |
|
80 |
|
81 bool isAvailable() const; |
|
82 QtMultimediaKit::AvailabilityError availabilityError() const; |
|
83 |
|
84 State state() const; |
|
85 |
|
86 Band band() const; |
|
87 |
|
88 bool isBandSupported(Band b) const; |
|
89 |
|
90 int frequency() const; |
|
91 int frequencyStep(Band band) const; |
|
92 QPair<int,int> frequencyRange(Band band) const; |
|
93 |
|
94 bool isStereo() const; |
|
95 void setStereoMode(QRadioTuner::StereoMode mode); |
|
96 StereoMode stereoMode() const; |
|
97 |
|
98 int signalStrength() const; |
|
99 |
|
100 int volume() const; |
|
101 bool isMuted() const; |
|
102 |
|
103 bool isSearching() const; |
|
104 |
|
105 Error error() const; |
|
106 QString errorString() const; |
|
107 |
|
108 public Q_SLOTS: |
|
109 void searchForward(); |
|
110 void searchBackward(); |
|
111 void cancelSearch(); |
|
112 |
|
113 void setBand(Band band); |
|
114 void setFrequency(int frequency); |
|
115 |
|
116 void setVolume(int volume); |
|
117 void setMuted(bool muted); |
|
118 |
|
119 void start(); |
|
120 void stop(); |
|
121 |
|
122 Q_SIGNALS: |
|
123 void stateChanged(QRadioTuner::State state); |
|
124 void bandChanged(QRadioTuner::Band band); |
|
125 void frequencyChanged(int frequency); |
|
126 void stereoStatusChanged(bool stereo); |
|
127 void searchingChanged(bool searching); |
|
128 void signalStrengthChanged(int signalStrength); |
|
129 void volumeChanged(int volume); |
|
130 void mutedChanged(bool muted); |
|
131 void error(Error err); |
|
132 |
|
133 private: |
|
134 Q_DISABLE_COPY(QRadioTuner) |
|
135 Q_DECLARE_PRIVATE(QRadioTuner) |
|
136 }; |
|
137 |
|
138 QT_END_NAMESPACE |
|
139 |
|
140 Q_DECLARE_METATYPE(QRadioTuner::State) |
|
141 Q_DECLARE_METATYPE(QRadioTuner::Band) |
|
142 Q_DECLARE_METATYPE(QRadioTuner::Error) |
|
143 Q_DECLARE_METATYPE(QRadioTuner::StereoMode) |
|
144 |
|
145 #endif // QRADIOPLAYER_H |