Forum Replies Created

  • Re: Reply To: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

    13. February 2017 at 14:04
    in reply to: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()
    Hello,

    Unfrotunately if getFreeMemory() doesn't act as it's supposed to act, that would create problems for certain use cases. For example, if I have a DESFire EV 4K which has 1 application on it (e.g. application with id 1) which consumes 128 bytes of the available user memory. If I wanted to write the remaining 3968 bytes in another application (e.g. application with id 2), how would I know how much space to reserve on the createFile method of IDESFireEV1 since in this case getFreeMemory() returns more than 4096 and clearly there aren't 4096 free bytes?

    I see two problems with the check that you mention in (2):

    1. That logic should be embedded in the library because it's responsibility of the library to deal with properties of the tags, and the free available user memory is a property of a tag.

    2. That 'if' would be still throw an exception if the space consumed is sufficiently small as in the example presented earlier. It would be impossible to know how much memory is there remaining since getTotalMemory() would still return the same value and getFreeMemory() would return a smaller value but still greater than the one returned by getTotalMemory()


    In reality there could be 3 distinct methods:

    getTotalMemory(): Returns the total available memory of a card including controller. For example in an DESFire EV 1 4K should return 4864
    getFreeUserMemory(): Returns the available remaining memory usable by the user (i.e. file system). For example in an DESFire EV 1 4K with a file that consumes 128 bytes it should return 3968
    getTotalUserMemory(): Returns the total available memory usable by the user (i.e file system). For example in an DESFire EV 1 4K should return 4096



    Is there any way to calculate the available user memory?


    Regards
    + 0  |  - 0

    Re: Reply To: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

    9. February 2017 at 13:01
    in reply to: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()
    Thank you for your answer. I'll be awaiting for the new library version. How do I know when a new version is released?

    Regards
    + 0  |  - 0

    Re: Reply To: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

    7. February 2017 at 14:09
    in reply to: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()
    Hi,

    Perfect. I'll be waiting for your results.

    Regards.
    + 0  |  - 0

    Re: Reply To: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

    1. February 2017 at 15:13
    in reply to: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()
    Hello,

    Thank you for your comprehensive explanation. I am perfectly aware of the intended meaning of getFreeMemory and getTotalMemory, that's the reason why I asked in the first place, because I am experiencing the behavior I described. We are on the same page here, so that's good.

    I am using an empty DESFire EV 1 (4K) card, with a Sony Xperia Z3 Compact (D5803) device, with Android 6.0.1 version.

    I believe you are reading a smaller value for getFreeMemory() than for getTotalMemory() since your tag is not empty. If you were to read the same card but empty, I reckon you would find that the value of getFreeMemory() is greater than that of getTotalMemory(). I imagine this is so because the name of "getFreeMemory" got swapped with "getTotalMemory".

    I just tested with the same card, but this time with some data in it, and effectively the amount returned by getFreeMemory() is lesser than getTotalMemory().

    getFreeMemory() with empty tag: 4864
    getTotalMemory() with empty tag: 4096
    getFreeMemory() with data on the tag: 3576
    getTotalMemory() with data on the tag: 4096

    I recommend that you try the same test but with an empty card and watch the values returned.
    + 0  |  - 0

    Re: Reply To: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

    1. February 2017 at 13:55
    in reply to: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()
    I am sorry but I see that we have a language barrier and my question hasn't been understood. What is your primary language so that I can use Google Translate to translate my question.
    + 0  |  - 0

    Re: Reply To: How to limit negative verification attemps with Ultralight EV 1

    16. January 2017 at 14:10
    in reply to: How to limit negative verification attemps with Ultralight EV 1
    Thank you very much for your answer.
    + 0  |  - 0

    Re: Reply To: How to limit negative verification attemps with Ultralight EV 1

    13. January 2017 at 16:55
    in reply to: How to limit negative verification attemps with Ultralight EV 1
    Sorry but that is an very inadequate answer. As clearly stated in the title I am asking for Ultralight EV 1, not Ultralight C.

    According to this document (http://www.nxp.com/documents/data_sheet/MF0ULX1.pdf), as stated in page 17, section 8.6.2; Ultralight EV 1 does in fact count with such feature. I just want to know if Taplinx SDK provides access to that feature in Ultralight EV 1.

    Am I missing something?

    Regards
    + 0  |  - 0

    Re: Reply To: How to limit negative verification attemps with Ultralight EV 1

    13. January 2017 at 15:36
    in reply to: How to limit negative verification attemps with Ultralight EV 1
    Perfect. Do you know when I will have an answer to the question?

    Regards.
    + 0  |  - 0

    Re: Reply To: What does registerActivity do?

    27. December 2016 at 14:17
    in reply to: What does registerActivity do?
    As you can see in the example app and in the skeletons, enclosed with the AN, the library is initialized in onCreate() (like all other libraries would do it) and the library is located in the main activity, because only the main activity will receive NFC intents from Android. Of course, you can have more activities in your app, but only the main activity should be able to receive NFC intents


    And that's a design flaw. You are forcing the users of the SDK to have only one activity capable of receiving NFC intents and then forcing to use some complicated methods to retrieve the data.

    If you need processing of NFC data in other activities of your app, you should do it via separate threads or use other mechanisms of inter-app-communication.
    This also doesn't make to me sense because: (1). using different threads has nothing with the problem at hand since once an activity is paused you can't access its intents. (2). Inter-app-communication in this scenario tells me that the SDK wasn't thought to be used in more than one activity (and Android doesn't restrict you to only use NFC in one activity).

    The attempt to try to get NFC intents to multiple activities of the same app makes no sense for me, because this opens synchronization troubles
    I don't understand what you mean by this. Imagine this use case: The user will be presented with an UI screen in activity A, and in this activity A will be able to receive NFC intents. Then the user navigates to activity B, with a different UI, and will also receive NFC intents. Nowhere did I state that I wanted to receive intents simultaneously in various activities.

    but I do not have time to download customer code and start investigations on this code.
    Don't worry, it isn't customer code, it is the example app enclosed in the AN which only has one activity more (a very simple one in fact). But now I see it is unnecessary for you to download it since you already solved my issue which was: The library doesn't support more than one activity.
    + 0  |  - 0

    Re: Reply To: What does registerActivity do?

    15. December 2016 at 15:17
    in reply to: What does registerActivity do?
    Something happened with the links, please copy & paste them directly in the browser navigation bar. The link for the erro demo app expires in 48 hours.
    + 0  |  - 0

    Re: Reply To: What does registerActivity do?

    15. December 2016 at 14:57
    in reply to: What does registerActivity do?
    I am sorry but seems that we aren't on the same page, let me quote myself here:

    But if instead I put it on the onResume() of every NFC activity, before calling startForeGroundDispatch() it works flawlessly.


    Here I am refering to registerActivity().

    My calls to the method startForeGroundDispatch() are in the right place, as well as those for stopForeGroundDispatch(). Conversely, I am quite sure that it has something to do with the SDK since changing where I put the registerACtivity() determines whether it works or not. So to be clear:

    If I put registerActivity() after super.onResume() and before startForeGroundDispatch() then the code works.


    There's probably also a design flaw in Taplinx's SDK since taking into account what you said about registerActivity():

    Well, registerActivity() in TapLinx SDK means, that the activity should be able to receive NFC intents from the operating system


    Then one should invoke this method for every activity that needs to utilize NFC to be able to receive intents, since only invoking it once will cause that only the first registered activity receives intents. And since you said we should only call it once:

    This means, you can have more activities in your Android application, but the (TapLinx)registerActivity() must be called only once, for instance in your main activity.


    and the method belongs to a single instance (singleton of NxpNfcLib), then a global object (NxpNfcLib) is storing a local reference (the activity), for this reason I can surely tell you: that is a design flaw since it doesn't make any sense.

    Finally I am so sure that there's a problem (or at least it isn't well explained how to use the SDK) that I modified the demo application of the SDK found here (https://www.mifare.net/wp-content/uploads/2016/08/SrcsampleNxpNfcLib-1.0.zip ), added a new activity and as you'll experience it will crash with the same error.

    Here is the link: https://expirebox.com/download/4467168ea746a1f78f07a91742e3c15c.html

    Regards
    + 0  |  - 0

    Re: Reply To: What does registerActivity do?

    14. December 2016 at 15:36
    in reply to: What does registerActivity do?
    Yes, I followed the application note tutorial, and even downloaded the source code, but there there is only one activity, not multiple.

    Here is the error regarding the dispatch:


    --------- beginning of crash
    E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.SOMETHING.SOMETHING.debug, PID: 8608
    java.lang.RuntimeException: Unable to resume activity {com.SOMETHING.SOMETHING.debug/com.SOMETHING.SOMETHING.mypackagename.AnActivityThatIsntMainActivity}: java.lang.IllegalStateException: Foreground dispatch can only be enabled when your activity is resumed
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3160)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3191)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2529)
    at android.app.ActivityThread.access$900(ActivityThread.java:154)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:234)
    at android.app.ActivityThread.main(ActivityThread.java:5526)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    Caused by: java.lang.IllegalStateException: Foreground dispatch can only be enabled when your activity is resumed
    at android.nfc.NfcAdapter.enableForegroundDispatch(NfcAdapter.java:1200)
    at com.nxp.nfclib.NxpNfcLib.startForeGroundDispatch(:4065)
    at com.SOMETHING.SOMETHING.mypackagename.NFCActivityUpInTheHierarchy.onResume(NFCActivityUpInTheHierarchy.kt:77)
    at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1259)
    at android.app.Activity.performResume(Activity.java:6361)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3149)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3191) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2529) 
    at android.app.ActivityThread.access$900(ActivityThread.java:154) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:234) 
    at android.app.ActivityThread.main(ActivityThread.java:5526) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

    + 0  |  - 0

    Re: Reply To: What does registerActivity do?

    14. December 2016 at 14:29
    in reply to: What does registerActivity do?
    Thank you for the explanation, that was helpful. But unfortunately I tried what you said and placed the call to registerActivity() only on the onCreate() of my main activity, and the application crashes. But if instead I put it on the onResume() of every NFC activity, before calling startForeGroundDispatch() it works flawlessly. I suspect there might be a bug in which once the library is initialized it doesn't update its state to recognize other activities since invocations to startForeGroundDispatch() and stopForeGroundDispatch() always end in error.

    There's also a question regarding

    if it never happened before, it connects to the NXP server one time

    How can that be if I uninstalled the app completely, disabled any Internet connection in my device, then deployed from Android Studio the app again, and still isActivityRegistered() returns true?


    Regards.
    + 0  |  - 0

    Re: Reply To: What does registerActivity do?

    13. December 2016 at 14:28
    in reply to: What does registerActivity do?
    Thank you for your explanation but I already know that. As stated in the documentation the parameters are explained there. But what isn't explained is what does registerActivity really do. For example do I have to use it only once per lifetime of the application? Once for every activity? Also, I have uninstalled the application in which I use the SDK, installed it again fresh from scratch, and when I call isActivityRegistered() in the launcher activity, without having registered any other activity before, it tells me it is already registered. I repeated the procedure and this time without any Internet connection and the same result. Why is it still registered?

    This is causing me problems because another activity (e.g. activity A) is intercepting the NFC intents of another one (e.g. activity B). If I call registerActivity() everytime I start a NFC activity then I am getting errors related to "java.lang.illegalStateException: Foreground dispatch can only be enabled when your activity is resumed"
    + 0  |  - 0
Viewing 14 posts - 1 through 14 (of 14 total)