×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Problems Reading External Mifare 1k

    I'm trying to read blocks of my mifare card.
    i've made the detection (targetDetected) of my card and want to setup an connection.

    i've used:
    Code:
    conn = (MFStandardConnection)Connector.open(url);
    wereas the url is the target of my card ("nfc:ndef;type=mf1k;uid=c4adc907").
    but if i put a printline after the line:
    Code:
    conn = (MFStandardConnection)Connector.open(url);
    as example:
    Code:
    MFStandardConnection conn = getMFStandardConnection(tProp);
    form.append("The tag has "+conn2.getBlockCount()+" blocks.");
    MFBlock block = conn2.getBlock(6);
    ...
    it never does so.. So it blocks when the connection is made.

    can someone tell me what i'm doing wrong ?

    thx

  2. #2
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    173

    Re: Problems Reading External Mifare 1k

    I'd start by renaming "conn" to "conn2"
    also: Make sure tProp is not an array

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Re: Problems Reading External Mifare 1k

    Quote Originally Posted by alixwarnke View Post
    I'd start by renaming "conn" to "conn2"
    also: Make sure tProp is not an array
    thx i'll try that

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Red face Re: Problems Reading External Mifare 1k

    Quote Originally Posted by aajf View Post
    thx i'll try that
    ok i didn't had that wrong in my code but i have following error with the MFStandardConnection:

    Code:
    java.lang.ClassCastException
    	at TestFase.targetDetected(+74)
    	at com.nokia.phone.ri.contactless.DiscoveryManagerImpl.fireTargetDetected(+116)
    	at com.nokia.phone.sdk.concept.event.ContactlessEventHandler.handleEvent0(+50)
    	at com.nokia.phone.sdk.concept.event.ContactlessEventHandler.run(+23)
    ContactlessEventHandler:: event handler error: null
    anyone ?

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Re: Problems Reading External Mifare 1k

    Maybe someone has some Example code for me to just read a single block of an external mifare card?

    regards Ive

  6. #6
    Registered User
    Join Date
    Mar 2008
    Posts
    2

    Re: Problems Reading External Mifare 1k

    I read one block with this:

    Code:
    if (cmd.equals(this.cmdRead)) {		
     MFKey.KeyA key = new MFKey.KeyA(rF.getKey());//read Key from TextField
     MFBlock block = conn.getBlock(Integer.valueOf(rF.getBlock()).intValue());//Block with Nr X
     try	{
    	byte[] mem = new byte[16];//read 16 Byte - one Block	
    	block.read(key, mem, 0, 0, 16);
    	rF.setOutput_(new String(mem));
     } catch (Exception e){
    	System.out.println(e);
     }				
    		}

Similar Threads

  1. error LNK2019: unresolved external symbol ???
    By wgarnett in forum Symbian
    Replies: 3
    Last Post: 2009-09-28, 06:53
  2. Reading Mifare 1K contents after autolaunching the midlet
    By sujithjoseph in forum Near Field Communication
    Replies: 1
    Last Post: 2007-11-27, 14:13
  3. Replies: 16
    Last Post: 2007-01-09, 21:20
  4. still have problems?
    By khossy in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-11-09, 10:59

Posting Permissions

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