// %flair:license{ // This file is part of the Flair framework distributed under the // CECILL-C License, Version 1.0. // %flair:license} #include "ConnectionLayout.h" #include "UdtSocket.h" #include "DataRemote.h" #include #include "communication.h" ConnectionLayout::ConnectionLayout(UdtSocket *socket, QString name) : Layout(NULL, name, "root") { this->socket = socket; this->name = name; } ConnectionLayout::~ConnectionLayout() { } QString ConnectionLayout::getUDTStats() { return socket->getUDTStats(); } void ConnectionLayout::receive(char *buf, int size) { // printf("trame %x\n",buf[0]); // for(int i=0; iwrite(doc.toString().toLocal8Bit().constData(),doc.toString().toLocal8Bit().length());/* QMetaObject::invokeMethod( socket, "write", Qt::BlockingQueuedConnection, Q_ARG(const char *, doc.toString().toLocal8Bit().constData()), Q_ARG(qint64, doc.toString().toLocal8Bit().length()));*/ } void ConnectionLayout::LoadXml(QDomDocument to_parse) { QDomElement tmp = to_parse.firstChildElement("root"); while (tmp.attribute("name") != name && !tmp.isNull()) tmp = to_parse.nextSiblingElement("root"); if (!tmp.isNull()) { XmlWidget::LoadXml(tmp); } else { printf("%s not found in xml file \n", name.toLocal8Bit().constData()); } } void ConnectionLayout::removeDataRemote(DataRemote *data) { dataremotes.removeOne(data); } void ConnectionLayout::addDataRemote(DataRemote *data) { dataremotes.append(data); } QString ConnectionLayout::getName() { return name; } void ConnectionLayout::drawDatas(char *buf, int buf_size, uint16_t period, bool big_endian) { for (int i = 0; i < dataremotes.count(); i++) { dataremotes.at(i)->BufEvent(&buf, &buf_size, period, big_endian); } } QString ConnectionLayout::getDocRootName(char* buf, int size) { QString xml; QDomDocument doc; xml = QString((char *)buf); xml.resize(size); if (!doc.setContent(xml)) { printf("prob setContent fichier\n"); } return doc.firstChildElement("root").attribute("name"); }