Beaconing
This commit is contained in:
		
							parent
							
								
									d048f5a2ab
								
							
						
					
					
						commit
						e3a9762179
					
				| @ -716,6 +716,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, | ||||
|   TxAgainTimer.setSingleShot(true); | ||||
|   connect(&TxAgainTimer, SIGNAL(timeout()), this, SLOT(TxAgain())); | ||||
| 
 | ||||
|   beaconTimer.setSingleShot(true); | ||||
|   connect(&beaconTimer, &QTimer::timeout, this, &MainWindow::prepareBeacon); | ||||
| 
 | ||||
|   connect(m_wideGraph.data (), SIGNAL(setFreq3(int,int)),this, | ||||
|           SLOT(setFreq4(int,int))); | ||||
| 
 | ||||
| @ -4965,6 +4968,14 @@ void MainWindow::resetMessageUI(){ | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::createMessage(QString const& text){ | ||||
|     //resetMessage();
 | ||||
| 
 | ||||
|     //ui->extFreeTextMsgEdit->setPlainText(text);
 | ||||
| 
 | ||||
|     //createMessageTransmitQueue(text);
 | ||||
| } | ||||
| 
 | ||||
| void MainWindow::createMessageTransmitQueue(QString const& text){ | ||||
|   resetMessageTransmitQueue(); | ||||
| 
 | ||||
| @ -5044,6 +5055,23 @@ void MainWindow::on_extFreeTextMsgEdit_currentTextChanged (QString const& text) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_tableWidgetCalls_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected){ | ||||
|     /*
 | ||||
|     if(selected.isEmpty()){ | ||||
|         return; | ||||
|     } | ||||
|     QString selectedCall = ui->tableWidgetCalls->selectedItems().first()->text(); | ||||
|     int offset = m_callActivity[selectedCall].freq; | ||||
| 
 | ||||
|     QList<QTableWidgetItem*> items = ui->tableWidgetRXAll->findItems(QString("%1").arg(offset), Qt::MatchExactly); | ||||
|     if(items.isEmpty()){ | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     ui->tableWidgetRXAll->setItemSelected(items.first(), true); | ||||
|     */ | ||||
| } | ||||
| 
 | ||||
| QStringList MainWindow::buildFT8MessageFrames(QString const& text){ | ||||
|     QStringList frames; | ||||
|     QString input = QString(text).replace("\n", " ").replace("  ", " "); | ||||
| @ -5142,6 +5170,33 @@ bool MainWindow::prepareNextMessageFrame() | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| void MainWindow::scheduleBeacon(){ | ||||
|     int timestamp = QDateTime::currentDateTimeUtc().addSecs(300).toSecsSinceEpoch(); | ||||
|     m_nextBeacon = QDateTime::fromSecsSinceEpoch(roundUp(timestamp, 15) + 1, QTimeZone::utc()); | ||||
|     beaconTimer.start(QDateTime::currentDateTimeUtc().msecsTo(m_nextBeacon) - 2*1000); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::prepareBeacon(){ | ||||
|     if(!ui->beaconButton->isChecked()){ | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if(QDateTime::currentDateTimeUtc().msecsTo(m_nextBeacon) > 15*1000){ | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if(!m_txFrameQueue.isEmpty()){ | ||||
|         beaconTimer.start(15*1000); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     QString message = QString("DE %1 %2\nDE %1 %2").arg(m_config.my_callsign()).arg(m_config.my_grid().mid(0, 4)); | ||||
|     ui->extFreeTextMsgEdit->setPlainText(message); | ||||
|     ui->startTxButton->setChecked(true); | ||||
| 
 | ||||
|     scheduleBeacon(); | ||||
| } | ||||
| 
 | ||||
| // this function is called by auto_tx_mode, which is called by autoButton.clicked
 | ||||
| void MainWindow::on_startTxButton_toggled(bool checked) | ||||
| { | ||||
| @ -6320,26 +6375,13 @@ void MainWindow::on_pbT2R_clicked() | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static int roundUp(int numToRound, int multiple) | ||||
| { | ||||
|  if(multiple == 0) | ||||
|  { | ||||
|   return numToRound; | ||||
|  } | ||||
| 
 | ||||
|  int roundDown = ( (int) (numToRound) / multiple) * multiple; | ||||
|  return roundDown + multiple; | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_beaconButton_clicked() | ||||
| { | ||||
|     if(ui->beaconButton->isChecked()){ | ||||
|         int timestamp = QDateTime::currentDateTimeUtc().addSecs(300).toSecsSinceEpoch(); | ||||
|         m_nextBeacon = QDateTime::fromSecsSinceEpoch(roundUp(timestamp, 15) + 1, QTimeZone::utc()); | ||||
|         scheduleBeacon(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void MainWindow::on_readFreq_clicked() | ||||
| { | ||||
|   if (m_transmitting) return; | ||||
|  | ||||
							
								
								
									
										17
									
								
								mainwindow.h
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								mainwindow.h
									
									
									
									
									
								
							| @ -121,6 +121,7 @@ public slots: | ||||
| 
 | ||||
|   void resetMessage(); | ||||
|   void resetMessageUI(); | ||||
|   void createMessage(QString const& text); | ||||
|   void createMessageTransmitQueue(QString const& text); | ||||
|   void resetMessageTransmitQueue(); | ||||
|   QString popMessageFrame(); | ||||
| @ -188,6 +189,7 @@ private slots: | ||||
|   void on_txb5_clicked(); | ||||
|   void on_txb5_doubleClicked (); | ||||
|   void on_txb6_clicked(); | ||||
|   void on_tableWidgetCalls_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); | ||||
|   void on_startTxButton_toggled(bool checked); | ||||
|   void splitAndSendNextMessage(); | ||||
|   void on_rbNextFreeTextMsg_toggled (bool status); | ||||
| @ -234,6 +236,8 @@ private slots: | ||||
|   QString parseFT8Message(QString input); | ||||
|   int countFreeTextMsgs(QString input); | ||||
|   bool prepareNextMessageFrame(); | ||||
|   void scheduleBeacon(); | ||||
|   void prepareBeacon(); | ||||
|   void on_rptSpinBox_valueChanged(int n); | ||||
|   void killFile(); | ||||
|   void on_tuneButton_clicked (bool); | ||||
| @ -567,6 +571,7 @@ private: | ||||
|   QTimer minuteTimer; | ||||
|   QTimer splashTimer; | ||||
|   QTimer p1Timer; | ||||
|   QTimer beaconTimer; | ||||
| 
 | ||||
|   QString m_path; | ||||
|   QString m_baseCall; | ||||
| @ -760,6 +765,18 @@ protected: | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| static int roundUp(int numToRound, int multiple) | ||||
| { | ||||
|  if(multiple == 0) | ||||
|  { | ||||
|   return numToRound; | ||||
|  } | ||||
| 
 | ||||
|  int roundDown = ( (int) (numToRound) / multiple) * multiple; | ||||
|  return roundDown + multiple; | ||||
| } | ||||
| 
 | ||||
| extern int killbyname(const char* progName); | ||||
| extern void getDev(int* numDevices,char hostAPI_DeviceName[][50], | ||||
|                    int minChan[], int maxChan[], | ||||
|  | ||||
| @ -254,6 +254,19 @@ o</string> | ||||
|               <property name="bottomMargin"> | ||||
|                <number>0</number> | ||||
|               </property> | ||||
|               <item> | ||||
|                <spacer name="verticalSpacer_4"> | ||||
|                 <property name="orientation"> | ||||
|                  <enum>Qt::Vertical</enum> | ||||
|                 </property> | ||||
|                 <property name="sizeHint" stdset="0"> | ||||
|                  <size> | ||||
|                   <width>20</width> | ||||
|                   <height>40</height> | ||||
|                  </size> | ||||
|                 </property> | ||||
|                </spacer> | ||||
|               </item> | ||||
|               <item> | ||||
|                <widget class="QLabel" name="labUTC"> | ||||
|                 <property name="sizePolicy"> | ||||
| @ -316,6 +329,19 @@ color : white; | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item> | ||||
|                <spacer name="verticalSpacer"> | ||||
|                 <property name="orientation"> | ||||
|                  <enum>Qt::Vertical</enum> | ||||
|                 </property> | ||||
|                 <property name="sizeHint" stdset="0"> | ||||
|                  <size> | ||||
|                   <width>20</width> | ||||
|                   <height>40</height> | ||||
|                  </size> | ||||
|                 </property> | ||||
|                </spacer> | ||||
|               </item> | ||||
|              </layout> | ||||
|             </widget> | ||||
|            </item> | ||||
| @ -394,7 +420,7 @@ background-color: #00ff00; | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="0" column="1"> | ||||
|                <widget class="QPushButton" name="logButton"> | ||||
|                <widget class="QPushButton" name="logQSOButton"> | ||||
|                 <property name="enabled"> | ||||
|                  <bool>true</bool> | ||||
|                 </property> | ||||
| @ -836,6 +862,12 @@ QTextEdit[readOnly="true"] { | ||||
|         </widget> | ||||
|        </widget> | ||||
|        <widget class="QTableWidget" name="tableWidgetCalls"> | ||||
|         <property name="editTriggers"> | ||||
|          <set>QAbstractItemView::NoEditTriggers</set> | ||||
|         </property> | ||||
|         <property name="showDropIndicator" stdset="0"> | ||||
|          <bool>false</bool> | ||||
|         </property> | ||||
|         <property name="selectionMode"> | ||||
|          <enum>QAbstractItemView::SingleSelection</enum> | ||||
|         </property> | ||||
| @ -3507,7 +3539,7 @@ list. The list can be maintained in Settings (F2).</string> | ||||
|         </widget> | ||||
|        </item> | ||||
|        <item> | ||||
|         <widget class="QPushButton" name="logQSOButton"> | ||||
|         <widget class="QPushButton" name="logQSOButton_old"> | ||||
|          <property name="minimumSize"> | ||||
|           <size> | ||||
|            <width>50</width> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jordan Sherer
						Jordan Sherer