//! [4]
void NfcShareHandler::setShareMode(ShareMode mode)
{
    if (m_shareMode == mode)
        return;

    m_shareMode = mode;

    // Clear all previous set data
    //m_nfcShareManager->reset();

    // HACK: Needed in R9, since reset() does not work as supposed
    m_nfcShareManager->setShareMode(bb::system::NfcShareMode::Disabled);

    switch (m_shareMode) {
        case DataShare:
            m_nfcShareManager->setShareMode(bb::system::NfcShareMode::Data);
            prepareDataShareContent();
            break;
        case FileShare:
            m_nfcShareManager->setShareMode(bb::system::NfcShareMode::File);
            prepareFileShareContent();
            break;
    }

    emit shareModeChanged();
}
예제 #2
0
NFCHandler::NFCHandler(){
		share_manager = new bb::system::NfcShareManager();

	    QObject::connect(share_manager, SIGNAL(shareModeChanged(bb::system::NfcShareMode::Type)), this, SLOT(shareModeChanged(bb::system::NfcShareMode::Type)));
	    QObject::connect(share_manager, SIGNAL(finished(bb::system::NfcShareSuccess::Type)), this, SLOT(finished(bb::system::NfcShareSuccess::Type)));
	    QObject::connect(share_manager, SIGNAL(error(bb::system::NfcShareError::Type)), this, SLOT(error(bb::system::NfcShareError::Type)));

	    QObject::connect( this, SIGNAL(setShareMode(bb::system::NfcShareMode::Type)), share_manager, SLOT(setShareMode(bb::system::NfcShareMode::Type)));
}