Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62169

QtNFC differ between available and enabled

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.0 Alpha
    • 5.10.1, 5.11.0 Beta 2
    • Connectivity: NFC
    • None
    • Android

    Description

      We need to know if a smartphone has NFC and if it is enabled. To show better user information we need to differ between this state.

      It would help a lof if the QtNFC API would support it. I would commit a changeset to gerrit to add "isEnabled" and change "isAvailable". But that would change the existing isAvailable behaviour a little bit. Would that be ok?

       

      diff --git a/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java b/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java
      index 345b87d3..1ff752e5 100644
      --- a/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java
      +++ b/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java
      @@ -161,6 +161,11 @@ public class QtNfc
       
           static public boolean isAvailable()
           {
      +        return m_adapter != null;
      +    }
      +
      +    static public boolean isEnabled()
      +    {
               if (m_adapter == null) {
                   //Log.e(TAG, "No NFC available (Adapter is null)");
                   return false;
      
      

       

      Of course.... every usage in qt would be switched to isEnabled and there are more API layer that needs to be added.....

       

      Attachments

        For Gerrit Dashboard: QTBUG-62169
        # Subject Branch Project Status CR V

        Activity

          People

            adoherty Andrew O'Doherty
            misery André Klitzing
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes