×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    21

    NDEF_TAG is detected but ISO14443_card is not detected

    hi everybody

    i am using Nokia_6131_NFC_SDK_1_1. i wrote the code for to detect uid of smartcard ,when i am using Target_type.NDEF_TAG its detecting and displaying the taguid and Url , but when i am using Target_type.ISO14443_CARD its not getting detected.Its doesnt display anything.

    So wat would be the problem? Can anyone give the solution for this problem?
    Pleasseeeeeeee...


    Thanks in advance..

    Jhansi

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    182

    Re: NDEF_TAG is detected but ISO14443_card is not detected

    i think card is not a ISO14443 type card. which card you are using ?

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    21

    Re: NDEF_TAG is detected but ISO14443_card is not detected

    Quote Originally Posted by esunilkumare View Post
    i think card is not a ISO14443 type card. which card you are using ?
    Thanks for the reply...........

    I am using ISO14443CARD...

    if the code is in a single class it is working but when divide into two classes its not working..........
    like one is for midletclass and another is for tagdetectionclass

    here i am calling detections method.......

    see in the bellow code..........

    package test;

    import javax.microedition.contactless.DiscoveryManager;
    import javax.microedition.contactless.TargetListener;
    import javax.microedition.contactless.TargetProperties;
    import javax.microedition.contactless.TargetType;
    import javax.microedition.contactless.sc.ISO14443Connection;
    import javax.microedition.io.Connector;


    public class Detection implements TargetListener{
    ISO14443Connection isoConnection ;
    ShowISO14443Connection s;
    Detection(){

    }
    public void detections(){
    try
    {
    System.out.println("_________start__________");

    DiscoveryManager.getInstance().addTargetListener(this,TargetType.ISO14443_CARD);
    // s.Display();
    }
    catch (Exception ex)
    {
    s.Display();
    }
    }
    public void targetDetected(TargetProperties[] targetProperties)
    {
    System.out.println("_________11111111111__________");
    for (int i = 0; i < targetProperties.length; i++)
    {
    TargetProperties tp = targetProperties[i];
    //form.append("uid before ISOConnection: " + tp.getUid() + "\n");
    if (tp.hasTargetType(TargetType.ISO14443_CARD))
    {

    System.out.println("_________2222222222222__________");
    //form.append("Target is ISO14443_CARD\n");
    try
    {
    /*form.append("url: " + tp.getUrl(Class.forName(
    "javax.microedition.contactless.sc.ISO14443Connection"))
    + "\n");*/
    isoConnection = getISO14443Connection(targetProperties);
    //String statusWord=doSelect(isoConnection,APDU_SELECT,"SELECT");
    //form.append("uid: after ISO===============> " + tp.getUid() + "\n"+statusWord);
    }
    catch (Exception ex)
    {
    //form.append(ex.toString());
    }
    }
    else
    {
    //form.append("Target is NOT ISO14443_CARD\n");
    }
    }
    }
    public static ISO14443Connection getISO14443Connection(TargetProperties[] tProp) {

    for (int j = 0; j < tProp.length; j++) {

    TargetProperties tp = tProp[j];
    String tagID = tp.getUid();

    /*for(int i=0; i<cardUids.length; i++) {
    if(transFailUid.equalsIgnoreCase(uid)) {
    isTransactionInitiated = true;
    isTransactionFailed = true;
    return null;
    }
    if(cardUids[i].equalsIgnoreCase(uid)) {

    isTransactionInitiated = true;
    smsData = cardUids[i]+"4";
    validCardIndex = i;
    break;
    }
    }*/

    Class[] connections = tProp[j].getConnectionNames();
    if (connections != null)
    {
    for (int i = 0; i < connections.length; i++)
    {
    if (connections[i].getName().indexOf("ISO14443Connection") != -1)
    {
    try
    {
    return (ISO14443Connection) Connector.open(tProp[0].getUrl(connections[i]));
    }
    catch (Exception e)
    {
    e.printStackTrace();
    }
    }
    }
    }
    }

    return null;
    }
    public String doSelect(ISO14443Connection isoConnection,byte[] APDU,String APDUType)
    {
    byte[] resByteArr;
    StringBuffer sb = new StringBuffer();
    String SW1="";
    //successFlag=false;
    try
    {
    resByteArr = isoConnection.exchangeData(APDU);
    for(int i=0 ;i < resByteArr.length;i++)
    {
    sb.append(resByteArr[i]+ " ");
    }
    SW1 = sb.toString();
    //form.append(""+SW1);
    System.out.println("SW1==========>"+SW1);
    if(SW1.startsWith("-112"))
    {
    //successFlag=true;
    }
    else
    {
    //successFlag=false;
    }
    //waitForm.append("\n"+SW1);
    }
    catch (Exception e)
    {
    return SW1;
    }

    return SW1;
    }

    }


    please solve the problem................

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    182

    Re: NDEF_TAG is detected but ISO14443_card is not detected

    please use the CODE tags (also well intended) while posting codes so that it is readable.

    in this case please post the output of the above code-listing while showing a ISO14443 card

  5. #5
    Registered User
    Join Date
    Nov 2008
    Posts
    21

    Re: NDEF_TAG is detected but ISO14443_card is not detected

    package test;

    import javax.microedition.contactless.DiscoveryManager;
    import javax.microedition.contactless.TargetListener;
    import javax.microedition.contactless.TargetProperties;
    import javax.microedition.contactless.TargetType;
    import javax.microedition.contactless.sc.ISO14443Connection;



    public class Detection implements TargetListener{
    ISO14443Connection isoConnection ;
    ShowISO14443Connection s;
    String Uid;


    Detection(){
    detections();
    }





    public void detections(){
    try
    {
    //s.Display();
    System.out.println("_________start__________");
    DiscoveryManager.getInstance().addTargetListener(this,TargetType.ISO14443_CARD);
    }
    catch (Exception ex)
    {
    s.Display();
    }
    }




    public void targetDetected(TargetProperties[] targetProperties)
    {
    System.out.println("_________11111111111__________");
    for (int i = 0; i < targetProperties.length; i++)
    {
    TargetProperties tp = targetProperties[i];
    Uid=tp.getUid();
    s.display(Uid);//its the method in midlet class
    }
    }
    }

    output:

    while showing the card its display nothing
    Last edited by jhansiprasad; 2008-12-22 at 08:52.

Posting Permissions

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