×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    4

    Reading data from an External MiFare 1k card

    Hey guys, I have been struggling with this for a few days, and I am sure that you can all help.

    I have a card withone target and two connections for that target. One of the connections is a MFStandard connection to a MiFare 1k. I am simply trying to read the value of the first block of this card. I have been told the key of the card, so I am pretty sure that it is correct.

    Please look at my code and tell me what I am doing wrong.

    /*****/

    MFBlock tempMFB;
    MFValue tempMFV;
    byte key[] = {(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff};
    MFKey.KeyA KA = new MFKey.KeyA(key);

    try
    {
    System.err.println("a");
    this.MFSConn = (MFStandardConnection)Connector.open("nfc:rf;type=mf1k;uid=31;timeout=5000", Connector.READ_WRITE, true);
    System.err.println(MFSConn.toString());
    System.err.println("b");
    tempMFB = MFSConn.getBlock(0); //Get the first block, which should hold the UID
    System.err.println("c");
    tempMFV = tempMFB.readValue(KA);
    System.err.println("d");
    UID = tempMFV.getValue();
    System.err.println("e");
    append(" " + UID + "\n");
    }
    catch (Exception e)
    {
    System.err.println("Caught an exception during connection.");
    System.err.println(e.toString());

    }
    /*****/

    The output I get is:
    a
    1k:0:1024
    b
    c
    Caught an exception during connection.
    java.lang.NullPointerException

    and so this means that it is failing during the call to readValue. Am I using the key correctly?

    Thanks in advance,

    Cam

  2. #2
    Nokia Developer Expert
    Join Date
    Oct 2005
    Posts
    21

    Re: Reading data from an External MiFare 1k card

    Hi,

    You cannot use readValue method to read the content of the manufacturer block as it is not Value Block. For more information about Value Blocks see MF1 IC S50 Functional Specification, Chapter 6.6.2.1 http://www.nxp.com/acrobat_download/...on/m001052.pdf

    Use read method of MFBlock instead. Structure of manufacturer block is defined in same document chapter 6.6.1

  3. #3
    Nokia Developer Expert
    Join Date
    Dec 2003
    Posts
    38

    Re: Reading data from an External MiFare 1k card

    To read UID of a tag you might want to check "Read serial number of NDEF (NFC) tag" and "Reading UID from embedded Mifare tag" examples in
    http://wiki.forum.nokia.com/index.ph..._Code_Examples

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    3

    Re: Reading data from an External MiFare 1k card

    hey guys,...
    i just had one simple question.
    what are the parameters in the MFBlock.read(key,byte[],ar2,ar3,ar4);
    what are arg3,arg3,arg4 stand for.

    is the and API,so i can read and understand for this!?

    thank you in advance

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    23

    Re: Reading data from an External MiFare 1k card

    download S40 nokia 6212 NFC sdk and install it ( http://www.forum.nokia.com/info/sw.n...2_NFC_SDK.html ), then you will find the API.

Similar Threads

  1. Help!! Reading and writing to cards from the 6131 and from a card reader
    By wobbly101 in forum Near Field Communication
    Replies: 1
    Last Post: 2008-02-23, 21:08
  2. Communicate with external Mifare 4k
    By eltria in forum Near Field Communication
    Replies: 4
    Last Post: 2007-11-12, 11:52
  3. Connection to an external Mifare card
    By d.wileman in forum Near Field Communication
    Replies: 1
    Last Post: 2007-10-17, 14:30
  4. Read an external MiFare card - using MFStandardConnection
    By zinxed in forum Near Field Communication
    Replies: 0
    Last Post: 2007-08-10, 10:35
  5. data reading di lemma?
    By jump_912 in forum Bluetooth Technology
    Replies: 0
    Last Post: 2003-11-26, 10:26

Posting Permissions

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