Ejemplo n.º 1
0
//! [0]
void NfcSender::initialize()
{
    bps_initialize();
    subscribe(nfc_get_domain());

    const int rc = nfc_request_events();
    if (rc == NFC_RESULT_SUCCESS) {
        qDebug() << "[INFO] Request NFC Events: NFC_RESULT_SUCCESS" << endl;
    } else {
        nfc_stop_events();
        unsubscribe(nfc_get_domain());
        bps_shutdown();
        qDebug() << "[ERRO] Request NFC Events: NFC_RESULT_FAILURE" << endl;
    }
    nfc_register_snep_client();
}
Ejemplo n.º 2
0
void NfcWorker::prepareToSendVcard(const QVariant &the_first_name, const QVariant &the_last_name, const QVariant &the_address, const QVariant &the_email,
		const QVariant &the_mobile) {

	if (_failedToInitialize) {
		return;
	}

	QString first_name = the_first_name.toString();
	QString last_name = the_last_name.toString();
	QString address = the_address.toString();
	QString email = the_email.toString();
	QString mobile = the_mobile.toString();

	qDebug() << "XXXX NfcWorker::prepareToSendVcard entered ...";
	qDebug() << "XXXX First Name: " << first_name << ", Last Name: " << last_name << ", Address: " << address << ", Email: " << email << ", Mobile: " << mobile;

	qDebug() << "XXXX setting inNdefPushState=true";
	StateManager* state_mgr = StateManager::getInstance();
	state_mgr->setNdefPushState(true);

	emit message(QString("Preparing to send VCARD using SNEP"));
	emit message(QString("First Name: '%1'").arg(first_name));
	emit message(QString("Last Name: '%1'").arg(last_name));
	emit message(QString("Address: '%1'").arg(address));
	emit message(QString("Email: '%1'").arg(email));
	emit message(QString("Mobile: '%1'").arg(mobile));

	_first_name = first_name;
	_last_name = last_name;
	_address = address;
	_email = email;
	_mobile = mobile;
	_taskToPerform = SEND_VCARD;

	CHECK(nfc_register_snep_client());
	qDebug() << "XXXX NfcWorker::prepareToSendVcard registered SNEP client ...";
}