1
/***************************************************************************
2
radiodevice_interfaces.cpp - description
4
begin : Sam Apr 19 2003
5
copyright : (C) 2003 by Martin Witte
6
email : witte@kawo1.rwth-aachen.de
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
19
#include "include/radiodevice_interfaces.h"
20
#include "include/radiostation.h"
26
IF_IMPL_SENDER ( IRadioDevice::notifyPowerChanged(bool on),
27
noticePowerChanged(on, this) );
28
IF_IMPL_SENDER ( IRadioDevice::notifyStationChanged (const RadioStation &s),
29
noticeStationChanged (s, this) );
30
IF_IMPL_SENDER ( IRadioDevice::notifyDescriptionChanged (const QString&s),
31
noticeDescriptionChanged (s, this) );
32
IF_IMPL_SENDER ( IRadioDevice::notifyCurrentSoundStreamIDChanged(SoundStreamID id),
33
noticeCurrentSoundStreamIDChanged(id, this) );
37
IF_IMPL_SENDER ( IRadioDeviceClient::sendPower(bool on),
39
IF_IMPL_SENDER ( IRadioDeviceClient::sendPowerOn(),
41
IF_IMPL_SENDER ( IRadioDeviceClient::sendPowerOff(),
43
IF_IMPL_SENDER ( IRadioDeviceClient::sendActivateStation(const RadioStation &rs),
44
activateStation(rs) );
46
IF_IMPL_QUERY ( bool IRadioDeviceClient::queryIsPowerOn(),
49
IF_IMPL_QUERY ( bool IRadioDeviceClient::queryIsPowerOff(),
52
IF_IMPL_QUERY ( const RadioStation & IRadioDeviceClient::queryCurrentStation(),
54
undefinedRadioStation );
56
static QString IRadioDeviceClient_unknown("unknown");
57
IF_IMPL_QUERY ( const QString & IRadioDeviceClient::queryDescription(),
59
IRadioDeviceClient_unknown );
61
IF_IMPL_QUERY ( SoundStreamID IRadioDeviceClient::queryCurrentSoundStreamID(),
62
getCurrentSoundStreamID(),
63
SoundStreamID::InvalidID );
65
void IRadioDeviceClient::noticeConnectedI (cmplInterface *c, bool pointer_valid)
67
noticePowerChanged(queryIsPowerOn());
68
noticeStationChanged(queryCurrentStation(), pointer_valid ? c : NULL);
69
noticeDescriptionChanged(queryDescription(), pointer_valid ? c : NULL);
72
void IRadioDeviceClient::noticeDisconnectedI (cmplInterface *c, bool pointer_valid)
74
noticePowerChanged(queryIsPowerOn());
75
noticeStationChanged(queryCurrentStation(), pointer_valid ? c : NULL);
76
noticeDescriptionChanged(queryDescription(), pointer_valid ? c : NULL);
85
IF_IMPL_SENDER ( IRadioSound::notifyVolumeChanged(float v),
86
noticeVolumeChanged(v) )
87
IF_IMPL_SENDER ( IRadioSound::notifyTrebleChanged(float v),
88
noticeTrebleChanged(v) )
89
IF_IMPL_SENDER ( IRadioSound::notifyBassChanged(float v),
90
noticeBassChanged(v) )
91
IF_IMPL_SENDER ( IRadioSound::notifyBalanceChanged(float v),
92
noticeBalanceChanged(v) )
93
IF_IMPL_SENDER ( IRadioSound::notifySignalQualityChanged(float q),
94
noticeSignalQualityChanged(q) )
95
IF_IMPL_SENDER ( IRadioSound::notifySignalQualityBoolChanged(bool good),
96
noticeSignalQualityChanged(good) )
97
IF_IMPL_SENDER ( IRadioSound::notifySignalMinQualityChanged(float q),
98
noticeSignalMinQualityChanged(q) )
99
IF_IMPL_SENDER ( IRadioSound::notifyStereoChanged(bool s),
100
noticeStereoChanged(s) )
101
IF_IMPL_SENDER ( IRadioSound::notifyMuted(bool m),
106
IF_IMPL_SENDER ( IRadioSoundClient::sendVolume (float v),
108
IF_IMPL_SENDER ( IRadioSoundClient::sendTreble (float v),
110
IF_IMPL_SENDER ( IRadioSoundClient::sendBass (float v),
112
IF_IMPL_SENDER ( IRadioSoundClient::sendBalance (float v),
114
IF_IMPL_SENDER ( IRadioSoundClient::sendMute (bool mute),
116
IF_IMPL_SENDER ( IRadioSoundClient::sendUnmute (bool unmute),
118
IF_IMPL_SENDER ( IRadioSoundClient::sendSignalMinQuality (float q),
119
setSignalMinQuality (q) )
120
IF_IMPL_SENDER ( IRadioSoundClient::sendStereo(bool s),
123
IF_IMPL_QUERY ( float IRadioSoundClient::queryVolume(),
126
IF_IMPL_QUERY ( float IRadioSoundClient::queryTreble(),
129
IF_IMPL_QUERY ( float IRadioSoundClient::queryBass(),
132
IF_IMPL_QUERY ( float IRadioSoundClient::queryBalance(),
135
IF_IMPL_QUERY ( float IRadioSoundClient::querySignalQuality(),
138
IF_IMPL_QUERY ( float IRadioSoundClient::querySignalMinQuality(),
139
getSignalMinQuality(),
141
IF_IMPL_QUERY ( bool IRadioSoundClient::queryHasGoodQuality(),
144
IF_IMPL_QUERY ( bool IRadioSoundClient::queryIsStereo(),
147
IF_IMPL_QUERY ( bool IRadioSoundClient::queryIsMuted(),
152
void IRadioSoundClient::noticeConnectedI (cmplInterface *, bool pointer_valid)
154
noticeVolumeChanged (queryVolume());
155
noticeTrebleChanged (queryTreble());
156
noticeBassChanged (queryBass());
157
noticeBalanceChanged (queryBalance());
158
noticeSignalQualityChanged (querySignalQuality());
159
noticeSignalQualityChanged (queryHasGoodQuality());
160
noticeSignalMinQualityChanged(querySignalMinQuality());
161
noticeStereoChanged (queryIsStereo());
162
noticeMuted (queryIsMuted());
166
void IRadioSoundClient::noticeDisconnectedI (cmplInterface *, bool pointer_valid)
168
noticeVolumeChanged (queryVolume());
169
noticeTrebleChanged (queryTreble());
170
noticeBassChanged (queryBass());
171
noticeBalanceChanged (queryBalance());
172
noticeSignalQualityChanged (querySignalQuality());
173
noticeSignalQualityChanged (queryHasGoodQuality());
174
noticeSignalMinQualityChanged(querySignalMinQuality());
175
noticeStereoChanged (queryIsStereo());
176
noticeMuted (queryIsMuted());
185
IF_IMPL_SENDER ( ISeekRadio::notifySeekStarted (bool up),
186
noticeSeekStarted (up) );
187
IF_IMPL_SENDER ( ISeekRadio::notifySeekStopped (),
188
noticeSeekStopped () );
189
IF_IMPL_SENDER ( ISeekRadio::notifySeekFinished (const RadioStation &s, bool goodQuality),
190
noticeSeekFinished (s, goodQuality) );
191
IF_IMPL_SENDER ( ISeekRadio::notifyProgress (float f),
192
noticeProgress (f) );
197
IF_IMPL_SENDER ( ISeekRadioClient::sendToBeginning(),
199
IF_IMPL_SENDER ( ISeekRadioClient::sendToEnd(),
201
IF_IMPL_SENDER ( ISeekRadioClient::sendStartSeek (bool up),
203
IF_IMPL_SENDER ( ISeekRadioClient::sendStartSeekUp(),
205
IF_IMPL_SENDER ( ISeekRadioClient::sendStartSeekDown(),
207
IF_IMPL_SENDER ( ISeekRadioClient::sendStopSeek(),
210
IF_IMPL_QUERY ( bool ISeekRadioClient::queryIsSeekRunning(),
213
IF_IMPL_QUERY ( bool ISeekRadioClient::queryIsSeekUpRunning(),
216
IF_IMPL_QUERY ( bool ISeekRadioClient::queryIsSeekDownRunning(),
219
IF_IMPL_QUERY ( float ISeekRadioClient::queryProgress(),
224
void ISeekRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
226
if (queryIsSeekRunning()) {
227
noticeSeekStarted(queryIsSeekUpRunning());
231
noticeProgress(queryProgress());
235
void ISeekRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
238
noticeProgress(queryProgress());
244
IF_IMPL_SENDER ( IFrequencyRadio::notifyFrequencyChanged(float f, const RadioStation *s),
245
noticeFrequencyChanged(f, s) )
246
IF_IMPL_SENDER ( IFrequencyRadio::notifyMinMaxFrequencyChanged(float min, float max),
247
noticeMinMaxFrequencyChanged(min, max) )
248
IF_IMPL_SENDER ( IFrequencyRadio::notifyDeviceMinMaxFrequencyChanged(float min, float max),
249
noticeDeviceMinMaxFrequencyChanged(min, max) )
250
IF_IMPL_SENDER ( IFrequencyRadio::notifyScanStepChanged(float s),
251
noticeScanStepChanged(s) )
253
// IFrequencyRadioClient
255
IF_IMPL_SENDER ( IFrequencyRadioClient::sendFrequency(float f),
257
IF_IMPL_SENDER ( IFrequencyRadioClient::sendMinFrequency(float mf),
258
setMinFrequency(mf) )
259
IF_IMPL_SENDER ( IFrequencyRadioClient::sendMaxFrequency(float mf),
260
setMaxFrequency(mf) )
261
IF_IMPL_SENDER ( IFrequencyRadioClient::sendScanStep(float s),
264
IF_IMPL_QUERY ( float IFrequencyRadioClient::queryFrequency(),
267
IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMinFrequency(),
270
IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMinDeviceFrequency(),
271
getMinDeviceFrequency(),
273
IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMaxFrequency(),
276
IF_IMPL_QUERY ( float IFrequencyRadioClient::queryMaxDeviceFrequency(),
277
getMaxDeviceFrequency(),
279
IF_IMPL_QUERY ( float IFrequencyRadioClient::queryScanStep(),
283
void IFrequencyRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
285
noticeFrequencyChanged(queryFrequency(), NULL);
286
noticeMinMaxFrequencyChanged(queryMinFrequency(), queryMaxFrequency());
287
noticeDeviceMinMaxFrequencyChanged(queryMinDeviceFrequency(), queryMaxDeviceFrequency());
288
noticeScanStepChanged(queryScanStep());
292
void IFrequencyRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
294
noticeFrequencyChanged(queryFrequency(), NULL);
295
noticeMinMaxFrequencyChanged(queryMinFrequency(), queryMaxFrequency());
296
noticeDeviceMinMaxFrequencyChanged(queryMinDeviceFrequency(), queryMaxDeviceFrequency());
297
noticeScanStepChanged(queryScanStep());
304
IF_IMPL_SENDER ( IInternetRadio::notifyURLChanged(const KURL &u),
305
noticeURLChanged(u) )
307
// IInternetRadioClient
309
IF_IMPL_SENDER ( IInternetRadioClient::sendURL(const KURL &url),
313
static KURL emptyURL;
315
IF_IMPL_QUERY ( const KURL &IInternetRadioClient::queryURL(),
319
void IInternetRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
321
noticeURLChanged(queryURL());
325
void IInternetRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
327
noticeURLChanged(queryURL());