示例#1
0
文件: erro.c 项目: nereuls/zeromqTest
/* getError:
 *   retorna a mensagem de erro  
 * return:
 *   retorna a mensagem de erro
 */
char* getError(){
  char *msg;  

  if ((msg = searchError(error_msg_zeromq,errno)) || (msg = searchError(error_msg_internal,ierrno))){
    return msg;
  }

  if (errno){
    return strerror(errno);
  }

  return 0x00;
}
示例#2
0
void MarkerManager::search(QString query, qreal radius)
{
    QGeoSearchReply *reply;
    if (radius > 0) {
        QGeoBoundingCircle *boundingCircle = new QGeoBoundingCircle(
                    d->myLocation->coordinate(), radius);
        reply = d->searchManager->search(query,
                                        QGeoSearchManager::SearchAll,
                                        -1, 0,
                                        boundingCircle);
    } else {
        reply = d->searchManager->search(query);
    }

    d->forwardReplies.insert(reply);

    if (d->status) {
        d->status->setText("Searching...");
        d->status->show();
    }

    if (reply->isFinished()) {
        replyFinished(reply);
    } else {
        connect(reply, SIGNAL(error(QGeoSearchReply::Error,QString)),
                this, SIGNAL(searchError(QGeoSearchReply::Error,QString)));
    }
}
示例#3
0
void MainWindow::dataToPLC()
{
    SerialCommunication link;
    link.setVars(vars);
    CommunicationDialog* dialog = new CommunicationDialog;
    link.setData(lcd->getData());
    link.setFont(font);
    dialog->setMessage("Поиск устройства");
    connect(&link,SIGNAL(searchStep(float)),dialog,SLOT(updatePercent(float)));
    connect(&link,SIGNAL(searchError(QString)),dialog,SLOT(setMessage(QString)));
    connect(&link,SIGNAL(searchOK(QString)),dialog,SLOT(setMessage(QString)));
    connect(&link,SIGNAL(writeStep(float)),dialog,SLOT(updatePercent(float)));
    connect(&link,SIGNAL(writeError(QString)),dialog,SLOT(setMessage(QString)));
    connect(&link,SIGNAL(writeOK(QString)),dialog,SLOT(setMessage(QString)));
    link.searchController();
    dialog->exec();
    delete dialog;
}
示例#4
0
void Navigator::start()
{
    QList<QGeoCoordinate> waypoints = request.waypoints();
    waypoints.append(mapsWidget->markerManager()->myLocation());
    request.setWaypoints(waypoints);

    startMarker = new Marker(Marker::StartMarker);
    startMarker->setCoordinate(mapsWidget->markerManager()->myLocation());
    startMarker->setName("Start point");
    mapsWidget->map()->addMapObject(startMarker);

    addressReply = searchManager->search(address);
    if (addressReply->isFinished()) {
        on_addressSearchFinished();
    } else {
        connect(addressReply, SIGNAL(error(QGeoSearchReply::Error,QString)),
                this, SIGNAL(searchError(QGeoSearchReply::Error,QString)));
        connect(addressReply, SIGNAL(finished()),
                this, SLOT(on_addressSearchFinished()));
    }
}
示例#5
0
void GeoHelper::searchErrorSlot(QGeoSearchReply *reply, QGeoSearchReply::Error error, QString errorString)
{
    emit searchError(errorString);
}
示例#6
0
void JabberSearch::stanzaRequestResult(const Jid &AStreamJid, const Stanza &AStanza)
{
    Q_UNUSED(AStreamJid);
    if (FRequests.contains(AStanza.id()))
    {
        if (AStanza.type() == "result")
        {
            LOG_STRM_INFO(AStreamJid,QString("Search request result received, id=%1").arg(AStanza.id()));
            QDomElement query = AStanza.firstElement("query",NS_JABBER_SEARCH);

            ISearchFields fields;
            fields.serviceJid = AStanza.from();
            fields.fieldMask = 0;
            fields.instructions = query.firstChildElement("instructions").text();
            if (!query.firstChildElement("first").isNull())
            {
                fields.fieldMask += ISearchFields::First;
                fields.item.firstName = query.firstChildElement("first").text();
            }
            if (!query.firstChildElement("last").isNull())
            {
                fields.fieldMask += ISearchFields::Last;
                fields.item.lastName = query.firstChildElement("last").text();
            }
            if (!query.firstChildElement("nick").isNull())
            {
                fields.fieldMask += ISearchFields::Nick;
                fields.item.nick = query.firstChildElement("nick").text();
            }
            if (!query.firstChildElement("email").isNull())
            {
                fields.fieldMask += ISearchFields::Email;
                fields.item.email = query.firstChildElement("email").text();
            }

            if (FDataForms)
            {
                QDomElement formElem = query.firstChildElement("x");
                while (!formElem.isNull() && formElem.namespaceURI()!=NS_JABBER_DATA)
                    formElem = formElem.nextSiblingElement("x");
                if (!formElem.isNull())
                    fields.form = FDataForms->dataForm(formElem);
            }

            emit searchFields(AStanza.id(),fields);
        }
        else
        {
            XmppStanzaError err(AStanza);
            LOG_STRM_WARNING(AStreamJid,QString("Failed to receive search request result, id=%1: %2").arg(AStanza.id(),err.condition()));
            emit searchError(AStanza.id(),err);
        }
        FRequests.removeAll(AStanza.id());
    }
    else if (FSubmits.contains(AStanza.id()))
    {
        if (AStanza.type() == "result")
        {
            LOG_STRM_INFO(AStreamJid,QString("Search submit result received, id=%1").arg(AStanza.id()));
            QDomElement query = AStanza.firstElement("query",NS_JABBER_SEARCH);

            ISearchResult result;
            result.serviceJid = AStanza.from();
            QDomElement itemElem = query.firstChildElement("item");
            while (!itemElem.isNull())
            {
                ISearchItem item;
                item.itemJid = itemElem.attribute("jid");
                item.firstName = itemElem.firstChildElement("first").text();
                item.lastName = itemElem.firstChildElement("last").text();
                item.nick = itemElem.firstChildElement("nick").text();
                item.email = itemElem.firstChildElement("email").text();
                result.items.append(item);
            }

            if (FDataForms)
            {
                QDomElement formElem = query.firstChildElement("x");
                while (!formElem.isNull() && formElem.namespaceURI()!=NS_JABBER_DATA)
                    formElem = formElem.nextSiblingElement("x");
                if (!formElem.isNull())
                    result.form = FDataForms->dataForm(formElem);
            }

            emit searchResult(AStanza.id(),result);
        }
        else
        {
            XmppStanzaError err(AStanza);
            LOG_STRM_WARNING(AStreamJid,QString("Failed to receive search submit result, id=%1: %2").arg(AStanza.id(),err.condition()));
            emit searchError(AStanza.id(),err);
        }
        FSubmits.removeAll(AStanza.id());
    }
}
示例#7
0
Lexer::lexicalException::lexicalException(std::string msg, std::string line, int lineNb, std::list<std::string const> & errorList): std::logic_error(msg), _errorList(errorList)
{
    _msg = msg;
    searchError(line, lineNb);
}
示例#8
0
Parser::parsingException::parsingException(std::string msg, std::string line, std::list<std::string const> *errorList, int nbLine) : std::logic_error(msg),
_errorList(errorList)
{
    _msg = msg;
    searchError(line, nbLine);
}