23 #include <QDockWidget> 24 #include <QMainWindow> 26 #include "boost/format.hpp" 46 #include "ui_bfmdemodgui.h" 86 ui->g00AltFrequenciesBox->setEnabled(
false);
87 ui->g14MappedFrequencies->setEnabled(
false);
88 ui->g14AltFrequencies->setEnabled(
false);
117 qDebug(
"BFMDemodGUI::handleMessage: MsgReportChannelSampleRateChanged: %d S/s",
m_rate);
118 ui->glSpectrum->setCenterFrequency(
m_rate / 4);
119 ui->glSpectrum->setSampleRate(
m_rate / 2);
124 qDebug(
"BFMDemodGUI::handleMessage: BFMDemod::MsgConfigureBFMDemod");
180 ui->afBWText->setText(QString(
"%1 kHz").
arg(value));
187 ui->volumeText->setText(QString(
"%1").
arg(value / 10.0, 0,
'f', 1));
194 ui->squelchText->setText(QString(
"%1 dB").
arg(value));
203 ui->audioStereo->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
231 if (
ui->rds->isChecked())
235 ui->g14ProgServiceNames->clear();
236 ui->g14MappedFrequencies->clear();
237 ui->g14AltFrequencies->clear();
239 ui->g00AltFrequenciesBox->setEnabled(
false);
240 ui->g14MappedFrequencies->setEnabled(
false);
241 ui->g14AltFrequencies->setEnabled(
false);
249 uint32_t index = _index & 0x7FFFFFF;
258 ui->g14MappedFrequencies->clear();
259 RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
260 const RDSParser::freqs_set_t::iterator sItEnd = (mIt->second).end();
262 for (; sIt != sItEnd; ++sIt)
264 std::ostringstream os;
265 os << std::fixed << std::showpoint << std::setprecision(2) << *sIt;
266 ui->g14MappedFrequencies->addItem(os.str().c_str());
269 ui->g14MappedFrequencies->setEnabled(
ui->g14MappedFrequencies->count() > 0);
276 ui->g14AltFrequencies->clear();
277 RDSParser::freqs_set_t::iterator sIt = (mIt->second).begin();
278 const RDSParser::freqs_set_t::iterator sItEnd = (mIt->second).end();
280 for (; sIt != sItEnd; ++sIt)
282 std::ostringstream os;
283 os << std::fixed << std::showpoint << std::setprecision(2) << *sIt;
284 ui->g14AltFrequencies->addItem(os.str().c_str());
287 ui->g14AltFrequencies->setEnabled(
ui->g14AltFrequencies->count() > 0);
295 qint64 f = (qint64) ((
ui->g00AltFrequenciesBox->currentText()).toDouble() * 1e6);
302 qint64 f = (qint64) ((
ui->g14MappedFrequencies->currentText()).toDouble() * 1e6);
309 qint64 f = (qint64) ((
ui->g14AltFrequencies->currentText()).toDouble() * 1e6);
361 ui->deltaFrequencyLabel->setText(QString(
"%1f").
arg(QChar(0x94, 0x03)));
363 ui->deltaFrequency->setValueRange(
false, 7, -9999999, 9999999);
367 connect(audioMuteRightClickEnabler, SIGNAL(rightClick(
const QPoint &)),
this, SLOT(
audioSelect()));
369 setAttribute(Qt::WA_DeleteOnClose,
true);
371 connect(
this, SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
onMenuDialogCalled(
const QPoint &)));
379 ui->glSpectrum->setCenterFrequency(
m_rate / 4);
380 ui->glSpectrum->setSampleRate(
m_rate / 2);
381 ui->glSpectrum->setDisplayWaterfall(
false);
382 ui->glSpectrum->setDisplayMaxHold(
false);
383 ui->glSpectrum->setSsbSpectrum(
true);
416 ui->g00AltFrequenciesBox->setEnabled(
false);
417 ui->g14MappedFrequencies->setEnabled(
false);
418 ui->g14AltFrequencies->setEnabled(
false);
501 qDebug(
"BFMDemodGUI::audioSelect");
514 double magsqAvg, magsqPeak;
520 ui->channelPowerMeter->levelChanged(
521 (100.0f + powDbAvg) / 100.0f,
522 (100.0f + powDbPeak) / 100.0f,
525 ui->channelPower->setText(QString::number(powDbAvg,
'f', 1));
528 QString pilotPowDbStr;
529 pilotPowDbStr.sprintf(
"%+02.1f", pilotPowDb);
530 ui->pilotPower->setText(pilotPowDbStr);
534 if (
ui->audioStereo->isChecked())
536 ui->audioStereo->setStyleSheet(
"QToolButton { background-color : green; }");
541 if (
ui->audioStereo->isChecked())
543 ui->audioStereo->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
590 ui->accumText->setText(QString(
"%1 dB").
arg(accDb, 0,
'f', 1));
594 ui->decoderQLabel->setStyleSheet(
"QLabel { background-color : green; }");
596 ui->decoderQLabel->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
602 ui->piLabel->setStyleSheet(
"QLabel { background-color : green; }");
605 ui->piText->setText(pistring);
608 ui->piTPIndicator->setStyleSheet(
"QLabel { background-color : green; }");
610 ui->piTPIndicator->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
618 ui->piLabel->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
624 ui->g00Label->setStyleSheet(
"QLabel { background-color : green; }");
632 ui->g00TrafficAnnouncement->setStyleSheet(
"QLabel { background-color : green; }");
634 ui->g00TrafficAnnouncement->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
642 ui->g00AltFrequenciesBox->clear();
648 std::ostringstream os;
649 os << std::fixed << std::showpoint << std::setprecision(2) << *it;
650 ui->g00AltFrequenciesBox->addItem(QString(os.str().c_str()));
654 ui->g00AltFrequenciesBox->setEnabled(
ui->g00AltFrequenciesBox->count() > 0);
659 ui->g00Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
665 ui->g01Label->setStyleSheet(
"QLabel { background-color : green; }");
680 ui->g01Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
686 ui->g02Label->setStyleSheet(
"QLabel { background-color : green; }");
692 ui->g02Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
698 ui->g03Label->setStyleSheet(
"QLabel { background-color : green; }");
701 ui->g03Data->setText(QString(g3str.c_str()));
705 ui->g03Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
711 ui->g04Label->setStyleSheet(
"QLabel { background-color : green; }");
713 std::string time = str(boost::format(
"%4i-%02i-%02i %02i:%02i (%+.1fh)")\
715 ui->g04Time->setText(QString(time.c_str()));
719 ui->g04Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
743 ui->g08Label->setStyleSheet(
"QLabel { background-color : green; }");
746 std::ostringstream os;
748 ui->g08Extent->setText(QString(os.str().c_str()));
752 ui->g08Location->setText(pistring);
762 ui->g08Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
768 ui->g09Label->setStyleSheet(
"QLabel { background-color : green; }");
771 ui->g09Data->setText(QString(g9str.c_str()));
775 ui->g09Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
785 ui->g14Label->setStyleSheet(
"QLabel { background-color : green; }");
787 ui->g14ProgServiceNames->clear();
793 for (; it != itEnd; ++it, i++)
796 QString pistring(str(boost::format(
"%04X:%s") % it->first % it->second).c_str());
797 ui->g14ProgServiceNames->addItem(pistring);
802 ui->g14Label->setStyleSheet(
"QLabel { background:rgb(79,79,79); }");
812 qDebug() <<
"BFMDemodGUI::changeFrequency: " << f - df;
unsigned int m_pi_program_identification
static MainWindow * getInstance()
QByteArray serialize() const
const QString & getReverseAPIAddress() const
void onWidgetRolled(QWidget *widget, bool rollDown)
QString m_reverseAPIAddress
std::vector< unsigned int > m_g14ComboIndex
int getCenterFrequency() const
bool getDecoderSynced() const
bool deserialize(const QByteArray &data)
void push(Message *message, bool emitSignal=true)
Push message onto queue.
bool deserialize(const QByteArray &data)
virtual bool handleMessage(const Message &message)
void on_squelch_valueChanged(int value)
uint16_t m_reverseAPIChannelIndex
static double dbPower(double magsq, double floor=1e-12)
static const QString m_channelIdURI
qint64 m_inputFrequencyOffset
void changeFrequency(qint64 f)
virtual qint64 getCenterFrequency() const
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
BFMDemodSettings m_settings
void channelMarkerChangedByCursor()
void enterEvent(QEvent *)
static const std::string pty_table[32]
ChannelMarker m_channelMarker
static int getRFBWIndex(int rfbw)
void channelMarkerHighlightedByCursor()
psns_map_t m_g14_program_service_names
key: PI, value: PSN
char m_g0_program_service_name[8+1]
void on_rfBW_valueChanged(int value)
void rdsUpdate(bool force)
bool m_pi_traffic_program
void setReverseAPIChannelIndex(uint16_t channelIndex)
freqs_map_t m_g14_mapped_freqs
key: PI, value: set of mapped frequencies (MHz)
uint16_t getReverseAPIPort() const
void addChannelMarker(ChannelMarker *channelMarker)
Add channel marker to spectrum.
freqs_map_t m_g14_alt_freqs
key: PI, value: set of alternate frequencies (MHz)
void on_afBW_valueChanged(int value)
void rdsUpdateFixedFields()
void on_g14AltFrequencies_activated(int index)
unsigned char m_pi_program_type
uint16_t m_reverseAPIDeviceIndex
unsigned int m_g8_location
static int requiredBW(int rfBW)
static int getRFBW(int index)
unsigned int m_g1_pin_minute
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
void setSampleSink(BasebandSampleSink *sampleSink)
void on_showPilot_clicked()
uint16_t getReverseAPIDeviceIndex() const
QByteArray serialize() const
static const std::string rds_group_acronym_tags[16]
bool m_g14_data_available
static const std::string label_descriptions[16]
static const std::string language_codes[44]
unsigned int m_g1_pin_day
bool m_g0_traffic_announcement
int m_g1_country_index
negative if not received
unsigned int m_g4_minutes
virtual void setMessageQueueToGUI(MessageQueue *queue)
unsigned char m_g0_psn_bitmap
static DSPEngine * instance()
void on_g14ProgServiceNames_currentIndexChanged(int index)
std::set< double > m_g0_alt_freq
void setHighlighted(bool highlighted)
uint16_t m_reverseAPIPort
char m_g2_radiotext[64+1]
void onMenuDialogCalled(const QPoint &p)
void registerRxChannelInstance(const QString &channelName, PluginInstanceGUI *pluginGUI)
static const std::string pi_country_codes[15][5]
void addRollupWidget(QWidget *widget)
Add rollup widget to channel window.
void removeRxChannelInstance(PluginInstanceGUI *pluginGUI)
void setSpectrumGUI(Serializable *spectrumGUI)
const QString & getTitle() const
unsigned int m_g3_appGroup
bool useReverseAPI() const
static bool match(const Message *message)
bool getHighlighted() const
static const std::string coverage_area_codes[16]
int m_g8_label_index
negative if not received
void handleInputMessages()
unsigned int m_g3_message
int getSampleRate() const
void setName(const QString &name)
void applySettings(bool force=false)
void blockApplySettings(bool block)
QString m_audioDeviceName
void setReverseAPIAddress(const QString &address)
int m_g1_language_index
negative if not received
static int get_tmc_event_code_index(unsigned int i, unsigned int j)
virtual MessageQueue * getInputMessageQueue()
void on_volume_valueChanged(int value)
unsigned int m_g1_pin_hour
int m_pi_area_coverage_index
DeviceUISet * m_deviceUISet
void setColor(const QColor &color)
Real getDecoderQua() const
void setChannelMarker(Serializable *channelMarker)
void leaveEvent(QEvent *)
Real getDemodFclk() const
Real getPilotLevel() const
void getMagSqLevels(double &avg, double &peak, int &nbSamples)
void on_lsbStereo_toggled(bool lsb)
void setVisible(bool visible)
void setReverseAPIPort(uint16_t port)
uint16_t getReverseAPIChannelIndex() const
void configure(MessageQueue *msgQueue, int fftSize, int overlapPercent, unsigned int averagingNb, int averagingMode, FFTWindow::Function window, bool m_linear)
void setBandwidth(int bandwidth)
const QColor & getColor() const
void setTitle(const QString &title)
QString m_audioDeviceName
int m_g1_country_page_index
negative if not received
static BFMDemodGUI * create(PluginAPI *pluginAPI, DeviceUISet *deviceAPI, BasebandSampleSink *rxChannel)
void setCenterFrequency(int centerFrequency)
RDSParser & getRDSParser()
void on_clearData_clicked(bool checked)
double m_g4_local_time_offset
void on_g00AltFrequenciesBox_activated(int index)
static std::string get_tmc_events(unsigned int i, unsigned int j)
void on_g14MappedFrequencies_activated(int index)
SpectrumVis * m_spectrumVis
void setUseReverseAPI(bool useReverseAPI)
bool getPilotLock() const
void on_audioStereo_toggled(bool stereo)
BFMDemodGUI(PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget *parent=0)
virtual void setCenterFrequency(qint64 centerFrequency)
void on_deltaFrequency_changed(qint64 value)