×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    130

    SimpleTagConnection

    I am trying this code from Programmer's Guide

    import com.nokia.nfc.nxp.simpletag.SimpleTagConnection;
    ..
    ..
    try {
    SimpleTagConnection conn = (SimpleTagConnection) Connector.open(target.getUrl(SimpleTagConnection.class));
    } catch (Exception e) {}

    But I've got error during build: Cannot find class java/lang/NoClassDefFoundError

  2. #2
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Helsinki, Finland
    Posts
    91

    Re: SimpleTagConnection

    Try this code:

    for (int j = 0; j < target.length; j++){
    Class[] connections = target[j].getConnectionNames();
    if(connections != null){
    for (int i = 0; i < connections.length; i++){
    if (connections[i].getName().equals("com.nokia.nfc.nxp.simpletag.SimpleTagConnection")){
    try{
    c=(SimpleTagConnection) Connector.open(target[0].getUrl(connections[i]));
    }catch (Exception e) {}
    }
    }
    }
    }

    It should work just fine on the 6131 NFC SDK Emulator.
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    130

    Re: SimpleTagConnection

    I am using prototype Nokia 6131 NFC phone.

    When I am reading MIFARE UltraLight tag, connections[i].getName() is not
    "com.nokia.nfc.nxp.simpletag.SimpleTagConnection" but
    "com.nxp.rf.SimpleTagConnection"

    And then at this line

    SimpleTagConnection c=(SimpleTagConnection) Connector.open(properties[0].getUrl(connections[i]));

    I'got Exception: No Class Def Found Error com/nokia/nfc/nxp/simpletag/SimpleTagConnection

  4. #4
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Helsinki, Finland
    Posts
    91

    Re: SimpleTagConnection

    This is apparently a bug on the phone software side and it will be fixed in future software updates.

    However, in the meantime, you can use the Nokia 6131 NFC SDK Emulator to develop, test and run MIDlets that use the SimpleTagConnection. You can use the simulated Ultralight tags provided with the emulator for read and write operations or you could use real Ultralight tags placed in an external reader - these will be detected by the Emulator and you can physically read and write data from/to them.

    Once the issue is fixed on the phone software side, you will be able to run the same MIDlets on the phone as well.

    Thank you for your patience in dealing with this.
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    11

    Re: SimpleTagConnection

    Quote Originally Posted by Raluca_
    This is apparently a bug on the phone software side and it will be fixed in future software updates.

    However, in the meantime, you can use the Nokia 6131 NFC SDK Emulator to develop, test and run MIDlets that use the SimpleTagConnection. You can use the simulated Ultralight tags provided with the emulator for read and write operations or you could use real Ultralight tags placed in an external reader - these will be detected by the Emulator and you can physically read and write data from/to them.

    Once the issue is fixed on the phone software side, you will be able to run the same MIDlets on the phone as well.

    Thank you for your patience in dealing with this.
    Hi, What firmware version will it work with? Higher than 3.12?

  6. #6
    Registered User
    Join Date
    Jun 2007
    Location
    Palo Alto, CA, USA
    Posts
    1

    Re: SimpleTagConnection

    I found a workaround for this problem, which let me use SimpleTagConnection to talk to Mifare Ultralight tags in the Nokia 6131 NFC phone.

    In the phone, connections[i].getName() returns com.nxp.rf.SimpleTagConnection.

    Fortunately, SimpleTagConnection is a Java interface, and the complete source is provided in the Nokia 6131 NFC SDK Programmers Guide (starting on pg 10). Copy the source into your source tree as com/nxp/rf/SimpleTagConnection.java, and build it into your MIDlet. This will allow you to cast the connecton returned by Connector.open(url) to an instance of com.nxp.rf.SimpleTagConnection.

    Dave Hendricks

  7. #7
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Re: SimpleTagConnection

    I am trying this code from Programmer's Guide

    import com.nokia.nfc.nxp.simpletag.SimpleTagConnection;
    ..
    ..
    try {
    SimpleTagConnection conn = (SimpleTagConnection) Connector.open(target.getUrl(SimpleTagConnection.class));
    } catch (Exception e) {}

    the error with target.getUrl(SimpleTagConnection.class));
    Exception:java.lang.IllegalArgumentException:Connection isn't supported Writing data to a Mifare Ultralight tag.

  8. #8
    Registered User
    Join Date
    Feb 2009
    Location
    Hagenberg, Austria
    Posts
    121

    Re: SimpleTagConnection

    Hallo,

    what type of tag are you trying to access. This exception suggests that SimpleTagConnection is not supported with your tag. You can get an array of supported connections with the method target.getConnectionNames(). SimpleTagConnection is for MIFARE Ultralight only. MIFARE Classic for instance needs a different connection interface.

    br,
    Michael

  9. #9
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Re: SimpleTagConnection

    Quote Originally Posted by mroland View Post
    Hallo,

    what type of tag are you trying to access. This exception suggests that SimpleTagConnection is not supported with your tag. You can get an array of supported connections with the method target.getConnectionNames(). SimpleTagConnection is for MIFARE Ultralight only. MIFARE Classic for instance needs a different connection interface.

    br,
    Michael
    hello
    I just want to read the Ultralight card
    try{
    TargetProperties target = prop[0];
    Class[] connections =prop[0].getConnectionNames();
    Connection conn=Connector.open(target.getUrl(com.nxp.rf.SimpleTagConnection.class));
    f.append("1,connection open:"+conn+"\n");
    stConn= (SimpleTagConnection)conn;
    f.append("2,CastClass"+"\n");
    } catch (Exception e) {}

    But the execution to step 2 when the error will be reported.
    error:java.lang.ClassCastException.
    at the first step the Connection result:com.nokia.mid.impl.isa.io.protocol.external.nfc.SimpleTagConnectionImpl@eca2530f.
    Thank you for answering my post.

  10. #10
    Registered User
    Join Date
    Feb 2009
    Location
    Hagenberg, Austria
    Posts
    121

    Re: SimpleTagConnection

    Hallo,

    Quote Originally Posted by skydreamlxg View Post
    Class[] connections =prop[0].getConnectionNames();
    So what classes did this line return? And are you using the emulator or a real phone? In the latter case which phone model and which firmware version do you use?

    br,
    Michael

  11. #11
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Re: SimpleTagConnection

    I can not determine whether the relationship between software and hardware,
    My phone version is nokia 6131nfc
    Vp 03.10
    23-01-07
    RM-216
    (C) Nokia

    You are now able to read Ultralight Card source code, send me a copy, by the way I test my phone (6131NFC)!
    My email is skydreamlxg@163.com
    Last edited by skydreamlxg; 2010-09-10 at 07:00.

  12. #12
    Registered User
    Join Date
    Feb 2009
    Location
    Hagenberg, Austria
    Posts
    121

    Re: SimpleTagConnection

    Hallo,

    Quote Originally Posted by skydreamlxg View Post
    Vp 03.10
    Then I would strongly suggest you update the phone to the latest firmware version which is V 05.12. Besides the Sproblem with the SimpleTagConnection, there are further issues with the old firmware.

    As Racula mentioned below (#4) that's a bug in the older firmware. If you had taken a look at the result of the getConnectionNames() method, you would have noticed that instead of "com.nokia.nfc.nxp.simpletag.SimpleTagConnection" it lists "com.nxp.rf.SimpleTagConnection".
    You might want to try Dave's approach (#6) to work around the bug without updating the firmware.

    br,
    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×