void Connection::readyRead() { while (m_socket && m_socket->bytesAvailable()) { long length; { QByteArray data; char c; while(m_socket->getChar(&c)) { if(c==0) break; data.append(c); } length = data.toLong(); } QByteArray data; while (data.length() <= length) { if (!data.isEmpty() && !m_socket->waitForReadyRead()) { return; } data += m_socket->read(length - data.length() + 1); } //kDebug() << data; QDomDocument doc; doc.setContent(data); if (doc.documentElement().tagName() == "init") { processInit(doc); } else if (doc.documentElement().tagName() == "response") { processResponse(doc); } else if (doc.documentElement().tagName() == "stream") { processStream(doc); } else { //kWarning() << "unknown element" << xml->name(); } } }
bool WLEMMCommandProcessor::process( WLEMMCommand::SPtr cmdIn ) { bool succes; switch( cmdIn->getCommand() ) { case WLEMMCommand::Command::COMPUTE: wlog::debug( CLASS ) << "Processing Command::COMPUTE"; succes = processCompute( cmdIn->getEmm() ); break; case WLEMMCommand::Command::INIT: wlog::debug( CLASS ) << "Processing Command::INIT"; succes = processInit( cmdIn ); break; case WLEMMCommand::Command::MISC: wlog::debug( CLASS ) << "Processing Command::MISC"; succes = processMisc( cmdIn ); break; case WLEMMCommand::Command::TIME_UPDATE: wlog::debug( CLASS ) << "Processing Command::TIME_UPDATE"; succes = processTime( cmdIn ); break; case WLEMMCommand::Command::RESET: wlog::debug( CLASS ) << "Processing Command::RESET"; succes = processReset( cmdIn ); break; default: wlog::error( CLASS ) << "Unknown Command::Enum!"; succes = false; } if( !succes ) { wlog::error( CLASS ) << "Error on processing command:\n" << *cmdIn; } return succes; }
void XDNet::processXML(const QString& xml) { QDomDocument* d = new QDomDocument(); d->setContent(xml); QDomElement root = d->documentElement(); QString name = root.tagName(); if(name == "init") { processInit(root); } else if(name == "response") { processResponse(root); } else if(name == "stream") { processOutput(root); } }
void initAll() { processedProgram = NULL; stack = NULL; processInit(); }