removed CDRMonitor, ported to new Timer API

This commit is contained in:
Matej Sekoranja
2012-07-18 11:09:00 +02:00
parent 596d4ce899
commit 49bc940179
19 changed files with 144 additions and 150 deletions
@@ -35,13 +35,20 @@ const int SimpleChannelSearchManagerImpl::MAX_FRAMES_AT_ONCE = 10;
const int SimpleChannelSearchManagerImpl::DELAY_BETWEEN_FRAMES_MS = 50;
SimpleChannelSearchManagerImpl::shared_pointer
SimpleChannelSearchManagerImpl::create(Context::shared_pointer const & context)
{
SimpleChannelSearchManagerImpl::shared_pointer thisPtr(new SimpleChannelSearchManagerImpl(context));
thisPtr->activate();
return thisPtr;
}
SimpleChannelSearchManagerImpl::SimpleChannelSearchManagerImpl(Context::shared_pointer const & context) :
m_context(context),
m_canceled(),
m_sequenceNumber(0),
m_sendBuffer(MAX_UDP_SEND),
m_channels(),
m_timerNode(*this),
m_lastTimeSent(),
m_mockTransportSendControl(),
m_channelMutex(),
@@ -54,10 +61,16 @@ SimpleChannelSearchManagerImpl::SimpleChannelSearchManagerImpl(Context::shared_p
// initialize random seed with some random value
srand ( time(NULL) );
}
void SimpleChannelSearchManagerImpl::activate()
{
// add some jitter so that all the clients do not send at the same time
double period = ATOMIC_PERIOD + (rand() % (2*PERIOD_JITTER_MS+1) - PERIOD_JITTER_MS)/(double)1000;
context->getTimer()->schedulePeriodic(m_timerNode, period, period);
Context::shared_pointer context = m_context.lock();
if (context.get())
context->getTimer()->schedulePeriodic(shared_from_this(), period, period);
//new Thread(this, "pvAccess immediate-search").start();
}
@@ -75,7 +88,9 @@ void SimpleChannelSearchManagerImpl::cancel()
return;
m_canceled.set();
m_timerNode.cancel();
Context::shared_pointer context = m_context.lock();
if (context.get())
context->getTimer()->cancel(shared_from_this());
}
int32_t SimpleChannelSearchManagerImpl::registeredCount()