mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-04 05:50:31 -05:00 
			
		
		
		
	PSK Reporter connection opened & closed at the correct times
This commit is contained in:
		
							parent
							
								
									491a7b9a05
								
							
						
					
					
						commit
						50da40413f
					
				@ -165,6 +165,16 @@ public:
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void stop ()
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    if (socket_)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        socket_->disconnectFromHost ();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    descriptor_timer_.stop ();
 | 
				
			||||||
 | 
					    report_timer_.stop ();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void send_report (bool send_residue = false);
 | 
					  void send_report (bool send_residue = false);
 | 
				
			||||||
  void build_preamble (QDataStream&);
 | 
					  void build_preamble (QDataStream&);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -484,6 +494,7 @@ void PSKReporter::reconnect ()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void PSKReporter::setLocalStation (QString const& call, QString const& gridSquare, QString const& antenna)
 | 
					void PSKReporter::setLocalStation (QString const& call, QString const& gridSquare, QString const& antenna)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  m_->check_connection ();
 | 
				
			||||||
  if (call != m_->rx_call_ || gridSquare != m_->rx_grid_ || antenna != m_->rx_ant_)
 | 
					  if (call != m_->rx_call_ || gridSquare != m_->rx_grid_ || antenna != m_->rx_ant_)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      m_->send_receiver_data_ = m_->socket_
 | 
					      m_->send_receiver_data_ = m_->socket_
 | 
				
			||||||
@ -510,7 +521,14 @@ bool PSKReporter::addRemoteStation (QString const& call, QString const& grid, Ra
 | 
				
			|||||||
  return false;
 | 
					  return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void PSKReporter::sendReport ()
 | 
					void PSKReporter::sendReport (bool last)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_->send_report (true);
 | 
					  if (m_->socket_ && QAbstractSocket::ConnectedState == m_->socket_->state ())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      m_->send_report (true);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  if (last)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      m_->stop ();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,7 @@ public:
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  // Flush any pending spots to PSK Reporter
 | 
					  // Flush any pending spots to PSK Reporter
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  void sendReport ();
 | 
					  void sendReport (bool last = false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Q_SIGNAL void errorOccurred (QString const& reason);
 | 
					  Q_SIGNAL void errorOccurred (QString const& reason);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1801,6 +1801,7 @@ void MainWindow::on_actionSettings_triggered()               //Setup Dialog
 | 
				
			|||||||
  auto callsign = m_config.my_callsign ();
 | 
					  auto callsign = m_config.my_callsign ();
 | 
				
			||||||
  auto my_grid = m_config.my_grid ();
 | 
					  auto my_grid = m_config.my_grid ();
 | 
				
			||||||
  SpecOp nContest0=m_config.special_op_id();
 | 
					  SpecOp nContest0=m_config.special_op_id();
 | 
				
			||||||
 | 
					  auto psk_on = m_config.spot_to_psk_reporter ();
 | 
				
			||||||
  if (QDialog::Accepted == m_config.exec ()) {
 | 
					  if (QDialog::Accepted == m_config.exec ()) {
 | 
				
			||||||
    checkMSK144ContestType();
 | 
					    checkMSK144ContestType();
 | 
				
			||||||
    if (m_config.my_callsign () != callsign) {
 | 
					    if (m_config.my_callsign () != callsign) {
 | 
				
			||||||
@ -1815,6 +1816,12 @@ void MainWindow::on_actionSettings_triggered()               //Setup Dialog
 | 
				
			|||||||
    enable_DXCC_entity (m_config.DXCC ());  // sets text window proportions and (re)inits the logbook
 | 
					    enable_DXCC_entity (m_config.DXCC ());  // sets text window proportions and (re)inits the logbook
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pskSetLocal ();
 | 
					    pskSetLocal ();
 | 
				
			||||||
 | 
					    // this will close the connection to PSKReporter if it has been
 | 
				
			||||||
 | 
					    // disabled
 | 
				
			||||||
 | 
					    if (psk_on && !m_config.spot_to_psk_reporter ())
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        m_psk_Reporter.sendReport (true);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(m_config.restart_audio_input ()) {
 | 
					    if(m_config.restart_audio_input ()) {
 | 
				
			||||||
      Q_EMIT startAudioInputStream (m_config.audio_input_device ()
 | 
					      Q_EMIT startAudioInputStream (m_config.audio_input_device ()
 | 
				
			||||||
@ -7238,9 +7245,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
 | 
				
			|||||||
               || !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) {
 | 
					               || !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) {
 | 
				
			||||||
            m_lastDialFreq = m_freqNominal;
 | 
					            m_lastDialFreq = m_freqNominal;
 | 
				
			||||||
            m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
 | 
					            m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
 | 
				
			||||||
            if (m_config.spot_to_psk_reporter ()) {
 | 
					            pskSetLocal ();
 | 
				
			||||||
              pskSetLocal ();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            statusChanged();
 | 
					            statusChanged();
 | 
				
			||||||
            m_wideGraph->setDialFreq(m_freqNominal / 1.e6);
 | 
					            m_wideGraph->setDialFreq(m_freqNominal / 1.e6);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user