APRSIS delay / skip percentage is now configurable on the client (not exposed to user though)

This commit is contained in:
Jordan Sherer 2020-04-11 11:46:12 -04:00
parent 7fa2f355d3
commit defc99c274
4 changed files with 9 additions and 1 deletions

View File

@ -301,7 +301,7 @@ void APRSISClient::processQueue(bool disconnect){
}
// random delay 25% of the time for throttling (a skip will add 60 seconds to the processing time)
if(qrand() % 100 <= 25){
if(m_skipPercent > 0 && qrand() % 100 <= int(m_skipPercent*100)){
qDebug() << "APRSISClient Throttle: Skipping Frame";
delayed.enqueue(m_frameQueue.dequeue());
continue;

View File

@ -27,6 +27,10 @@ public:
public slots:
void setSkipPercent(float skipPercent){
m_skipPercent = skipPercent;
}
void setServer(QString host, quint16 port){
if(state() == QTcpSocket::ConnectedState){
disconnectFromHost();
@ -65,6 +69,7 @@ private:
quint16 m_port;
QTimer m_timer;
bool m_paused;
float m_skipPercent;
};
#endif // APRSISCLIENT_H

View File

@ -504,6 +504,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
connect (this, &MainWindow::aprsClientSetLocalStation, m_aprsClient, &APRSISClient::setLocalStation);
connect (this, &MainWindow::aprsClientSetPaused, m_aprsClient, &APRSISClient::setPaused);
connect (this, &MainWindow::aprsClientSetServer, m_aprsClient, &APRSISClient::setServer);
connect (this, &MainWindow::aprsClientSetSkipPercent, m_aprsClient, &APRSISClient::setSkipPercent);
connect (&m_networkThread, &QThread::finished, m_aprsClient, &QObject::deleteLater);
// hook up sound output stream slots & signals and disposal
@ -3207,6 +3208,7 @@ void MainWindow::prepareSpotting(){
spotSetLocal();
pskSetLocal();
aprsSetLocal();
emit aprsClientSetSkipPercent(0.25);
emit aprsClientSetServer(m_config.aprs_server_name(), m_config.aprs_server_port());
emit aprsClientSetPaused(false);
ui->spotButton->setChecked(true);

View File

@ -448,6 +448,7 @@ private:
Q_SIGNAL void aprsClientEnqueueSpot(QString by_call, QString from_call, QString grid, QString comment);
Q_SIGNAL void aprsClientEnqueueThirdParty(QString by_call, QString from_call, QString text);
Q_SIGNAL void aprsClientSetSkipPercent(float skipPercent);
Q_SIGNAL void aprsClientSetServer(QString host, quint16 port);
Q_SIGNAL void aprsClientSetPaused(bool paused);
Q_SIGNAL void aprsClientSetLocalStation(QString mycall, QString passcode);