25 #include "cm256cc/cm256.h" 35 m_dataQueue(dataQueue),
36 m_address(QHostAddress::LocalHost),
40 connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()),
this, SLOT(handleInputMessages()), Qt::QueuedConnection);
45 qDebug(
"RemoteSourceThread::~RemoteSourceThread");
62 qDebug(
"RemoteSourceThread::startWork");
73 qDebug(
"RemoteSourceThread::stopWork");
82 qDebug(
"RemoteSourceThread::run: begin");
92 qDebug(
"RemoteSourceThread::run: end");
105 qDebug(
"RemoteSourceThread::handleInputMessages: MsgStartStop: %s", notif->
getStartStop() ?
"start" :
"stop");
118 qDebug(
"RemoteSourceThread::handleInputMessages: MsgDataBind: %s:%d", qPrintable(notif->
getAddress().toString()), notif->
getPort());
135 while (
m_socket->hasPendingDatagrams())
138 quint16 senderPort = 0;
140 size =
m_socket->readDatagram((
char *) &superBlock, (
long long int)
sizeof(
RemoteSuperBlock), &sender, &senderPort);
144 unsigned int dataBlockIndex = superBlock.m_header.m_frameIndex %
m_nbDataBlocks;
151 if (
m_dataBlocks[dataBlockIndex]->m_rxControlBlock.m_frameIndex < 0)
161 if (superBlock.m_header.m_frameIndex != frameIndex)
172 if (superBlock.m_header.m_blockIndex == 0) {
176 if (superBlock.m_header.m_blockIndex < RemoteNbOrginalBlocks) {
186 qWarning(
"RemoteSourceThread::readPendingDatagrams: wrong super block size not processing");
Message * pop()
Pop message from queue.
void push(Message *message, bool emitSignal=true)
Push message onto queue.
RemoteSuperBlock * m_superBlocks
QWaitCondition m_startWaiter
void readPendingDatagrams()
QHostAddress getAddress() const
RemoteDataQueue * m_dataQueue
void push(RemoteDataBlock *dataBlock, bool emitSignal=true)
Push daa block onto queue.
int m_recoveryCount
number of recovery blocks received
static MsgDataBind * create(const QString &address, uint16_t port)
static const uint32_t m_nbDataBlocks
number of data blocks in the ring buffer
void handleInputMessages()
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
RemoteRxControlBlock m_rxControlBlock
int m_originalCount
number of original blocks received
MessageQueue m_inputMessageQueue
static bool match(const Message *message)
void dataBind(const QString &address, uint16_t port)
static MsgStartStop * create(bool startStop)
RemoteDataBlock * m_dataBlocks[m_nbDataBlocks]
ring buffer of data blocks indexed by frame affinity
void startStop(bool start)
int m_frameIndex
this frame index or -1 if unset
int m_blockCount
number of blocks received for this frame
bool m_metaRetrieved
true if meta data (block zero) was retrieved
bool getStartStop() const