CStateOnInsertion::CStateOnInsertion(CChannelConfig* channelConfig, CSpliceSessions* spliceSessions, CChannelLogger* channelLogger, QObject* parent):
    CAdState(channelConfig, spliceSessions, channelLogger, parent)
{
  m_aliveTimer.setInterval(60000);
  m_aliveTimer.setSingleShot(false);
  connect(&m_aliveTimer, SIGNAL(timeout()), this, SLOT(sendAliveMessage()));
}
void CStateOnInsertion::enterState()
{
  CAdState::enterState();
  for (QList<CAdBlock>::iterator it = m_channelConfig->m_adBlocks.begin(); it != m_channelConfig->m_adBlocks.end(); ++it)
  {
    CAdBlock* adBlock = &(*it);
    connect(adBlock, SIGNAL(startB2bAd(CAdConfig,QDateTime)), this, SLOT(startB2bAd(CAdConfig,QDateTime)), Qt::UniqueConnection);
  }
  sendAliveMessage();
  m_aliveTimer.start();
}
void ConnectionServer::timerEvent(QTimerEvent *timerEvent)
{
    if (aliveTimerId == timerEvent->timerId())
        sendAliveMessage();
}