2012-12-18 17:25:00 -05:00
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
#include "RsGxsUpdateBroadcast.h"
|
|
|
|
|
|
|
|
|
2013-02-28 16:58:38 -05:00
|
|
|
RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceHelper *ifaceImpl, float dt, QObject *parent) :
|
2012-12-18 17:25:00 -05:00
|
|
|
QObject(parent), mIfaceImpl(ifaceImpl), mDt(dt)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void RsGxsUpdateBroadcast::startMonitor()
|
|
|
|
{
|
|
|
|
slowPoll();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RsGxsUpdateBroadcast::fastPoll()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void RsGxsUpdateBroadcast::slowPoll()
|
|
|
|
{
|
|
|
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
|
|
|
std::list<RsGxsGroupId> grps;
|
|
|
|
|
|
|
|
if(mIfaceImpl->updated())
|
|
|
|
{
|
|
|
|
mIfaceImpl->msgsChanged(msgs);
|
|
|
|
if(!msgs.empty())
|
|
|
|
{
|
|
|
|
emit msgsChanged(msgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
mIfaceImpl->groupsChanged(grps);
|
|
|
|
|
|
|
|
if(!grps.empty())
|
|
|
|
{
|
|
|
|
emit grpsChanged(grps);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTimer::singleShot((int) (mDt * 1000.0), this, SLOT(slowPoll()));
|
|
|
|
}
|
|
|
|
}
|