bool QQnxFilePicker::nativeEventFilter(const QByteArray&, void *message, long*) { bps_event_t * const event = static_cast<bps_event_t*>(message); if (!event) return false; if (bps_event_get_code(event) == NAVIGATOR_INVOKE_TARGET_RESULT) { const char *id = navigator_event_get_id(event); const char *err = navigator_event_get_err(event); qFilePickerDebug("received invocation response: id=%s err=%s", id, err); } else if (bps_event_get_code(event) == NAVIGATOR_CHILD_CARD_CLOSED) { const char *data = navigator_event_get_card_closed_data(event); qFilePickerDebug("received data: data='%s'", data); handleFilePickerResponse(data); } return false; // do not drop the event }
/* * navigator events are generated when we're launched by the Invoke Framework (IF) * due to a tag we're interested in (as declared in the bar-descriptor.xml file) * is presented to the device. There are other situations that generate navigator * events but in this specific case, we look to acquire the tag data which * the IF has and process it. * */ void NfcWorker::handleNavigatorNdefEvent(bps_event_t *event) { uint16_t code = bps_event_get_code(event); if (NAVIGATOR_INVOKE_TARGET == code) { emit message("Navigator invoke target received"); const navigator_invoke_invocation_t *invocation = navigator_invoke_event_get_invocation(event); if (!invocation) { qDebug() << "XXXX No invocation for invoke NDEF event"; } const char *invokeAction = navigator_invoke_invocation_get_action(invocation); if (!invokeAction) { qDebug() << "XXXX No action for invoke NDEF event"; } const QString actionToPerform(invokeAction); if (actionToPerform == "bb.action.OPEN") { emit message("Navigator bb.action.OPEN received"); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": navigator_invoke_invocation_get_type() - entering"; const char *mimeType = navigator_invoke_invocation_get_type(invocation); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": navigator_invoke_invocation_get_type() - exited"; if (!mimeType) { qDebug() << "XXXX No Mime Type with invoke request"; } const QString mimeTypeRequested(mimeType); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": navigator_invoke_invocation_get_data_length() - entering"; int invokeDataLength = navigator_invoke_invocation_get_data_length(invocation); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": navigator_invoke_invocation_get_data_length() - exited"; if (invokeDataLength == -1) { qDebug() << "XXXX Invalid invoke data length"; } qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": navigator_invoke_invocation_get_data() - entering"; const void *invokeData = navigator_invoke_invocation_get_data(invocation); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": navigator_invoke_invocation_get_data() - exited"; if (!invokeData) { qDebug() << "XXXX Invalid invoke data"; } nfc_ndef_message_t *ndefMessage; qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": nfc_create_ndef_message_from_bytes() - entering"; CHECK( nfc_create_ndef_message_from_bytes(reinterpret_cast<const uchar_t *>(invokeData), invokeDataLength, &ndefMessage)); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": nfc_create_ndef_message_from_bytes() - exited"; // cause event log to be displayed now StateManager* state_mgr = StateManager::getInstance(); qDebug() << "XXXX NfcWorker::readTag() isEventLogShowing()=" << state_mgr->isEventLogShowing(); emit clearMessages(); if (!state_mgr->isEventLogShowing()) { qDebug() << "XXXXX NfcWorker emiting read_selected"; emit read_selected(); } parseNdefMessage(ndefMessage); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": nfc_delete_ndef_message() - entering"; CHECK(nfc_delete_ndef_message(ndefMessage, true)); qDebug() << "XXXX Time(ms) : " << getSysTimeMs() << ": nfc_delete_ndef_message() - exited"; } } else if (NAVIGATOR_INVOKE_QUERY_RESULT == code) { emit message("Navigator invoke query received"); // just log and ignore query requests for the moment const char *id = navigator_event_get_id(event); const char *err = navigator_event_get_err(event); qDebug() << QString("XXXX Invoke Query Result, Id: '%1' Error: '%2'").arg(id).arg(err); } else { qDebug() << "XXXX Received Navigation event we don't handle: " << getNavigatorEventName(code); } }