×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Connecting to an external card with random UID

    I'm currently playing around with the Nokia 6212 to see what NFC apps I can write for it.

    Currently I am looking to read off an external card which is a nfc cashless card.

    Using this code: Detect external ISO14443 card I can get it working in my phone.

    However the card I am testing always responds with a random uid so I always get:

    url: nfc:sc;type=iso4a;uid=08xxxxxx

    So since the uid changes each time I am unable to connect to that card.

    Any ideas what URL I should use to connect to the external device in range.

    does anyone know if there is something similar to:

    nfc:sc;type=iso4a;mode=external

    to connect to the external in range nfc device no matter what UID it has?

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

    Re: Connecting to an external card with random UID

    No, there is no generic URL for external targets. You should not try to use a static URL for external targets.

    Look at the example you cited:
    Code:
    public void targetDetected(TargetProperties[] targetProperties) {
      for (int i = 0; i < targetProperties.length; i++) {
        TargetProperties tp = targetProperties[i];
    
        (...)
    
        try {
          form.append("url: " + tp.getUrl(Class.forName(
                "javax.microedition.contactless.sc.ISO14443Connection"))
                              + "\n");
        } catch (Exception ex) {
          form.append(ex.toString());
        }
    
        (...)
    
    }
    You can retrieve the URL to the ISO14443Connection of your current target by calling the target properties' getURL() method:
    Code:
    tp.getUrl(Class.forName(
                "javax.microedition.contactless.sc.ISO14443Connection"))
    This URL can be used with the Connector.open() method.

    br,
    Michael

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Re: Connecting to an external card with random UID

    Quote Originally Posted by mroland View Post
    No, there is no generic URL for external targets. You should not try to use a static URL for external targets.

    Look at the example you cited:
    Code:
    public void targetDetected(TargetProperties[] targetProperties) {
      for (int i = 0; i < targetProperties.length; i++) {
        TargetProperties tp = targetProperties[i];
    
        (...)
    
        try {
          form.append("url: " + tp.getUrl(Class.forName(
                "javax.microedition.contactless.sc.ISO14443Connection"))
                              + "\n");
        } catch (Exception ex) {
          form.append(ex.toString());
        }
    
        (...)
    
    }
    You can retrieve the URL to the ISO14443Connection of your current target by calling the target properties' getURL() method:
    Code:
    tp.getUrl(Class.forName(
                "javax.microedition.contactless.sc.ISO14443Connection"))
    This URL can be used with the Connector.open() method.

    br,
    Michael
    Every time I try and use the Connector.open() method it says no such device.

    This is because each time you connect to the device it returns a different UID.

    I might try doing each poll of the token doing a .getUrl + open, but it seems less than ideal. Rather than getUrl + open + apdu... disconnect.

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

    Re: Connecting to an external card with random UID

    Quote Originally Posted by plambrechtsen View Post
    Every time I try and use the Connector.open() method it says no such device.

    This is because each time you connect to the device it returns a different UID.
    I'm not quite sure what you are trying to accomplish, but within one initialization cycle (i.e. field is on, anticollision has been performed) the UID of the device stays constant. Therefore, during the execution of the targetDetected callback the UID of the card stays constant, unless, of course, you remove the card from the phone's field again.

    => Within the targetDetected callback (or a thread spawned from it) you can grab the Url, open the connection, exchange the APDUs and the disconnect.

    br,
    Michael

Similar Threads

  1. Problem using MySQL on s60 3rd
    By DFurió in forum Mobile Web Server
    Replies: 14
    Last Post: 2008-12-11, 08:58
  2. Replies: 4
    Last Post: 2008-03-10, 02:23
  3. S80 Platform SDK and Visual Studio .NET Linking Error
    By jayantjain in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2005-10-07, 22:14
  4. Building
    By pacman2000z in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2003-07-17, 10:44
  5. Any external card to make 9210 a bluetooth phone?
    By bugum in forum Bluetooth Technology
    Replies: 1
    Last Post: 2003-02-12, 10:14

Posting Permissions

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