Esempio n. 1
0
void QDmxE131Controler::readDatagram()
{
    if(sender())
    {
        QUdpSocket* socket = qobject_cast<QUdpSocket*>(sender());
        if(socket)
        {
            while(socket->hasPendingDatagrams())
            {
                QNetworkDatagram datagram = socket->receiveDatagram();
                if(datagram.senderAddress().isInSubnet(_address, _entry.prefixLength()))
                {
                    QByteArray rawData = datagram.data();

                    if(_packetizer->checkPacket(rawData))
                    {
                        QByteArray dmx;
                        quint32 u;
                        _packetizer->fillDMXdata(rawData, dmx, u);
                        u--;

                        if(_listenedUniverse.contains(u))
                            emit hasDmx(u, dmx);
                    }
                }
            }
        }
    }
}
Esempio n. 2
0
void RacomClient::onUdpSocketReadyRead()
{
	if(status() != Status::Running)
		return;
	QUdpSocket *sock = udpSocket();
	QNetworkDatagram dg = sock->receiveDatagram();
	QByteArray data = dg.data();
	qfInfo() << data.toHex();
	// remove possible initial garbage
	int i = 0;
	for(i=0; i<data.size(); i++)
		if(data.at(i) == 0x02)
			break;
	data = data.mid(i);
	// remove possible multiple 0x02
	for(i=1; i<data.size(); i++)
		if(data.at(i) != 0x02)
			break;
	data = data.mid(i-1);
	qfInfo() << "stripped data:" << data.toHex();
	if(!m_siDriver) {
		m_siDriver = new siut::DeviceDriver(this);
		CardReader::CardReaderPlugin *plugin = cardReaderPlugin();
		if(plugin) {
			connect(m_siDriver, &siut::DeviceDriver::messageReady, plugin, &CardReader::CardReaderPlugin::emitSiMessagereceived);
		}
	}
	m_siDriver->processSiPacket(data);
}
Esempio n. 3
0
void RacomClient::onRawSIDataUdpSocketReadyRead()
{
	if(status() != Status::Running)
		return;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
	QUdpSocket *sock = rawDataUdpSocket();
	QNetworkDatagram dg = sock->receiveDatagram();
	QByteArray data = dg.data();
	qfInfo() << data.toHex();
	// remove possible initial garbage
	int i = 0;
	for(i=0; i<data.size(); i++)
		if(data.at(i) == 0x02)
			break;
	data = data.mid(i);
	// remove possible multiple 0x02
	for(i=1; i<data.size(); i++)
		if(data.at(i) != 0x02)
			break;
	data = data.mid(i-1);
	qfInfo() << "stripped data:" << data.toHex();
	CardReader::CardReaderPlugin *plugin = cardReaderPlugin();
	if(plugin) {
		if(!m_siDriver) {
			m_siDriver = new siut::DeviceDriver(this);
			connect(m_siDriver, &siut::DeviceDriver::siTaskFinished, plugin, &CardReader::CardReaderPlugin::emitSiTaskFinished);
		}
		m_siDriver->processData(data);
	}
#else
	qfWarning() << "Racom client is not supported with Qt < 5.8";
#endif
}
Esempio n. 4
0
void CondorDatasource::readPendingDatagrams() {
    while (m_udpSocket.hasPendingDatagrams()) {
        QNetworkDatagram datagram = m_udpSocket.receiveDatagram();
        QString data = QString::fromUtf8(datagram.data());

        QStringList lines = data.split("\r\n");
        for(QString line : lines) {
            QStringList splitLine = line.split("=");
            if(splitLine.length() == 2) {
                rxValue(splitLine[0], splitLine[1]);
            }
        }
        if(m_updatesReceived > 0) {
            setHelpText(QString("Received %1 value updates from Condor").arg(m_updatesReceived));
        }
    }
}