refs #246 refactor setting of timer intervals

This commit is contained in:
Mathew Sutcliffe
2014-06-11 19:11:38 +01:00
parent 6ee14128bd
commit cdd0ae6324
2 changed files with 4 additions and 6 deletions

View File

@@ -45,8 +45,6 @@ namespace BlackCore
*/
void CContextNetwork::psReceivedBookings(const CAtcStationList &bookedStations)
{
const int interval = 180 * 1000;
if (this->m_vatsimBookingReader->interval() < interval) this->m_vatsimBookingReader->setInterval(interval);
this->m_atcStationsBooked.clear();
foreach(CAtcStation bookedStation, bookedStations)
{

View File

@@ -43,13 +43,15 @@ namespace BlackCore
// 2. Init VATSIM bookings
this->m_vatsimBookingReader = new CVatsimBookingReader(this->getRuntime()->getIContextSettings()->getNetworkSettings().getBookingServiceUrl(), this);
this->connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CContextNetwork::psReceivedBookings);
this->m_vatsimBookingReader->setInterval(15 * 1000); // first read
this->m_vatsimBookingReader->read(); // first read
this->m_vatsimBookingReader->setInterval(180 * 1000);
// 3. VATSIM data file
const QStringList dataFileUrls = { "http://info.vroute.net/vatsim-data.txt" };
this->m_vatsimDataFileReader = new CVatsimDataFileReader(dataFileUrls, this);
this->connect(this->m_vatsimDataFileReader, &CVatsimDataFileReader::dataRead, this, &CContextNetwork::psDataFileRead);
this->m_vatsimDataFileReader->setInterval(5 * 1000); // first read, will be fixed when first read to longer period
this->m_vatsimDataFileReader->read(); // first read
this->m_vatsimDataFileReader->setInterval(90 * 1000);
// 4. Update timer for data (network data such as frequency)
this->m_dataUpdateTimer = new QTimer(this);
@@ -375,8 +377,6 @@ namespace BlackCore
void CContextNetwork::psDataFileRead()
{
if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
const int interval = 90 * 1000;
if (this->m_vatsimDataFileReader->interval() < interval) this->m_vatsimDataFileReader->setInterval(interval);
this->getIContextApplication()->sendStatusMessage(CStatusMessage::getInfoMessage("Read VATSIM data file", CStatusMessage::TypeTrafficNetwork));
}