mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 00:45:46 +08:00
Some minor network context upfront fixes discovered:
* readAtcBookingsFromSource() const; to non const, it changes data in the context * better adjusting of update time for bookings * No updates if URL is empty, checked.
This commit is contained in:
@@ -38,7 +38,7 @@ namespace BlackCore
|
|||||||
this->m_atcBookingTimer = new QTimer(this);
|
this->m_atcBookingTimer = new QTimer(this);
|
||||||
this->connect(this->m_networkManager, &QNetworkAccessManager::finished, this, &CContextNetwork::psAtcBookingsRead);
|
this->connect(this->m_networkManager, &QNetworkAccessManager::finished, this, &CContextNetwork::psAtcBookingsRead);
|
||||||
this->connect(this->m_atcBookingTimer, &QTimer::timeout, this, &CContextNetwork::readAtcBookingsFromSource);
|
this->connect(this->m_atcBookingTimer, &QTimer::timeout, this, &CContextNetwork::readAtcBookingsFromSource);
|
||||||
this->m_atcBookingTimer->start(15 * 1000);
|
this->m_atcBookingTimer->start(10 * 1000); // will be reset in method to a longer time
|
||||||
|
|
||||||
// 4. connect signals and slots
|
// 4. connect signals and slots
|
||||||
this->connect(this->m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::psFsdConnectionStatusChanged);
|
this->connect(this->m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::psFsdConnectionStatusChanged);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace BlackCore
|
|||||||
/*!
|
/*!
|
||||||
* \copydoc IContextNetwork::readAtcBookingsFromSource()
|
* \copydoc IContextNetwork::readAtcBookingsFromSource()
|
||||||
*/
|
*/
|
||||||
virtual void readAtcBookingsFromSource() const;
|
virtual void readAtcBookingsFromSource();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \copydoc IContextNetwork::getAtcStationsOnline()
|
* \copydoc IContextNetwork::getAtcStationsOnline()
|
||||||
|
|||||||
@@ -28,9 +28,14 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Read bookings
|
* Read bookings
|
||||||
*/
|
*/
|
||||||
void CContextNetwork::readAtcBookingsFromSource() const
|
void CContextNetwork::readAtcBookingsFromSource()
|
||||||
{
|
{
|
||||||
|
const int updateTime = 60 * 1000; // 1min
|
||||||
|
if (!(this->m_atcBookingTimer->interval() == updateTime)) this->m_atcBookingTimer->setInterval(updateTime); // 1min
|
||||||
|
|
||||||
QUrl url(this->getNetworkSettings().getBookingServiceUrl());
|
QUrl url(this->getNetworkSettings().getBookingServiceUrl());
|
||||||
|
if (url.isEmpty()) return;
|
||||||
|
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
this->m_networkManager->get(request);
|
this->m_networkManager->get(request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace BlackCore
|
|||||||
qDebug() << " LOG: " << method << m1 << m2 << m3 << m4;
|
qDebug() << " LOG: " << method << m1 << m2 << m3 << m4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IContextNetwork::readAtcBookingsFromSource() const
|
void IContextNetwork::readAtcBookingsFromSource()
|
||||||
{
|
{
|
||||||
this->m_dBusInterface->callDBus(QLatin1Literal("readAtcBookingsFromSource"));
|
this->m_dBusInterface->callDBus(QLatin1Literal("readAtcBookingsFromSource"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace BlackCore
|
|||||||
* \brief Read ATC bookings
|
* \brief Read ATC bookings
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual void readAtcBookingsFromSource() const;
|
virtual void readAtcBookingsFromSource();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The ATC list with online ATC controllers
|
* \brief The ATC list with online ATC controllers
|
||||||
|
|||||||
Reference in New Issue
Block a user