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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
/***************************************************************************
radio_interfaces.cpp - description
-------------------
begin : Don Apr 17 2003
copyright : (C) 2003 by Martin Witte
email : emw-kradio@nocabal.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. *
* *
***************************************************************************/
#include "radio_interfaces.h"
#include "stationlist.h"
#include "radiostation.h"
// IRadio
IF_IMPL_SENDER ( IRadio::notifyPowerChanged(bool on),
noticePowerChanged(on) );
IF_IMPL_SENDER ( IRadio::notifyStationChanged (const RadioStation &s, int idx),
noticeStationChanged (s, idx) );
IF_IMPL_SENDER ( IRadio::notifyStationsChanged(const StationList &sl),
noticeStationsChanged(sl) );
IF_IMPL_SENDER ( IRadio::notifyPresetFileChanged(const QString &f),
noticePresetFileChanged(f) );
IF_IMPL_SENDER ( IRadio::notifyCurrentSoundStreamSinkIDChanged(SoundStreamID id),
noticeCurrentSoundStreamSinkIDChanged(id) );
IF_IMPL_SENDER ( IRadio::notifyCurrentSoundStreamSourceIDChanged(SoundStreamID id),
noticeCurrentSoundStreamSourceIDChanged(id) );
IF_IMPL_SENDER ( IRadio::notifyRDSStateChanged (bool enabled),
noticeRDSStateChanged(enabled) );
IF_IMPL_SENDER ( IRadio::notifyRDSRadioTextChanged (const QString &s),
noticeRDSRadioTextChanged(s) );
IF_IMPL_SENDER ( IRadio::notifyRDSStationNameChanged(const QString &s),
noticeRDSStationNameChanged(s) );
// IRadioClient
IF_IMPL_SENDER ( IRadioClient::sendPowerOn(),
powerOn() );
IF_IMPL_SENDER ( IRadioClient::sendPowerOff(),
powerOff() );
IF_IMPL_SENDER ( IRadioClient::sendActivateStation(const RadioStation &rs),
activateStation(rs) );
IF_IMPL_SENDER ( IRadioClient::sendActivateStation(int index),
activateStation(index) );
IF_IMPL_SENDER ( IRadioClient::sendStations(const StationList &sl),
setStations(sl) );
IF_IMPL_SENDER ( IRadioClient::sendPresetFile(const QString &f),
setPresetFile(f) );
IF_IMPL_QUERY ( bool IRadioClient::queryIsPowerOn(),
isPowerOn(),
false
);
IF_IMPL_QUERY ( bool IRadioClient::queryIsPowerOff(),
isPowerOff(),
true
);
IF_IMPL_QUERY ( const RadioStation & IRadioClient::queryCurrentStation(),
getCurrentStation(),
undefinedRadioStation
);
IF_IMPL_QUERY ( int IRadioClient::queryCurrentStationIdx(),
getCurrentStationIdx(),
-1
);
IF_IMPL_QUERY ( int IRadioClient::queryStationIdx(const RadioStation &rs),
getStationIdx(rs),
-1
);
IF_IMPL_QUERY ( const StationList & IRadioClient::queryStations(),
getStations(),
emptyStationList
);
static QString emptyString;
IF_IMPL_QUERY ( const QString & IRadioClient::queryPresetFile(),
getPresetFile(),
emptyString
);
IF_IMPL_QUERY ( SoundStreamID IRadioClient::queryCurrentSoundStreamSourceID(),
getCurrentSoundStreamSourceID(),
SoundStreamID::InvalidID
);
IF_IMPL_QUERY ( SoundStreamID IRadioClient::queryCurrentSoundStreamSinkID(),
getCurrentSoundStreamSinkID(),
SoundStreamID::InvalidID
);
IF_IMPL_QUERY ( bool IRadioClient::queryRDSState (),
getRDSState(),
false
);
IF_IMPL_QUERY ( const QString &IRadioClient::queryRDSRadioText(),
getRDSRadioText(),
emptyString
);
IF_IMPL_QUERY ( const QString &IRadioClient::queryRDSStationName(),
getRDSStationName(),
emptyString
);
void IRadioClient::noticeConnectedI (cmplInterface *, bool /*pointer_valid*/)
{
noticeStationsChanged (queryStations());
noticeStationChanged (queryCurrentStation(), queryCurrentStationIdx());
noticePowerChanged (queryIsPowerOn());
noticeRDSStateChanged (queryRDSState());
noticeRDSStationNameChanged(queryRDSStationName());
noticeRDSRadioTextChanged (queryRDSRadioText());
}
void IRadioClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
{
noticeStationsChanged (queryStations());
noticeStationChanged (queryCurrentStation(), queryCurrentStationIdx());
noticePowerChanged (queryIsPowerOn());
noticeRDSStateChanged (queryRDSState());
noticeRDSStationNameChanged(queryRDSStationName());
noticeRDSRadioTextChanged (queryRDSRadioText());
}
|