×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    45

    MFStandardConnection

    The following code causes classCast exception.

    MFStandardConnection conn = null;

    public void targetDetected(TargetProperties[] properties)
    ...

    try{

    conn = (MFStandardConnection)Connector.open(properties[0].getUrl());

    ...
    }

    ...

    If there is anything that I am doing wrong, then please let me know.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: MFStandardConnection

    See you local
    C:\Nokia\Devices\Nokia_6131_NFC_SDK_1_1\examples\MFStandardExample\src\com\nokia\nfc\app\mfstdexample

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    45

    Re: MFStandardConnection

    That example is all about creating a connection with an INTERNAL TAG OF 6131 NFC.

    I am trying to build a connection with an external MiFare card....

    well...is there anything wrong with my understanding...?

  4. #4
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: MFStandardConnection

    more information for the assistance.

    View the URL to screen to intern and extern?!
    What is indicated?
    Reads the documentations to the SDK!

    java.lang.String getUrl(java.lang.Class connectionName)
    Returns the URL for the requested connection to the discovered target.
    Last edited by mariosas; 2007-08-08 at 11:07.

  5. #5
    Registered User
    Join Date
    Jun 2007
    Posts
    45

    Re: MFStandardConnection

    Well, the problem is not in getting the right URL.
    With the same URL, we are able to establish a NDEFTagConnection but when we typecast the connection to MFStandardConnection, we get classCast exception.

    Incase, if MFStandardConnection needs to be established using some other method, then you may help me out.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: MFStandardConnection

    See you file.
    C:/Nokia/Devices/Nokia_6131_NFC_SDK_1_1/docs/nfc/index.html

    Interface TargetProperties
    java.lang.String getUrl()
    Returns the URL to open a connection to the NDEF_TAG target.

    to classCast exception.

    java.lang.String getUrl(java.lang.Class connectionName)
    Returns the URL for the requested connection to the discovered target.

    to no classCast exception.

    ? OR ?
    Last edited by mariosas; 2007-08-10 at 10:08.

  7. #7
    Registered User
    Join Date
    Aug 2007
    Posts
    2

    Re: MFStandardConnection

    Hi,
    i got the same problem when using MFStandardConnection.
    (Class Def not found)
    I read hear on the board that i have to update the phone software to version 5.11 to support mifare functionallty.
    Now i have updated to this version, but still get this error on the real device.
    In the emulator the code works perfectly.

    Can anyone help me?

  8. #8
    Registered User
    Join Date
    Jun 2007
    Posts
    45

    Re: MFStandardConnection

    yes the target type we are trying to listen is : RFID_TAG....

    but yet, simpletagconnection or MFstandardConnection casting is causing a problem.

    One thing observed as output of the following code:

    public void targetDetected(TargetProperties[] properties)
    {
    //System.out.println(properties[0].getUrl());

    Class[] trial = properties[0].getConnectionNames();
    System.out.println(properties[0].getUrl(trial[0]));
    System.out.println(trial[0].getName()
    ---- "javax.microedition.contactless.ndef.NDEFTagConnection"

    and if you take a look at programmers guide distributed by the 6131 NFC SDK,
    one of the section briefing on MFStandardConnection is checking for the string from getName method as "com.nokia.mfstd.MFStandardConnection"

    Well, I think this is the problem that we are trying to typecast a NDEFTagConnection to MFStandardConnection...

    well..is my analysis of the problem correct? Or the problem is altogether different.

    Whatever be the problem, we need a solution for this....

    ANybody who has any knowledge regarding the same, may please contribute and hence help us advance to the next stage of development.

    Thanks in advance.

    Kind Regards.

  9. #9
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: MFStandardConnection

    !Reads my last entries!

    getUrl

    java.lang.String getUrl(java.lang.Class connectionName)

    Returns the URL for the requested connection to the discovered target. This URL used to open a connection to the target.

    Parameters:
    connectionName - name of the connection
    Returns:
    the URL to the target
    Throws:
    java.lang.NullPointerException - if connectionName is null
    java.lang.IllegalArgumentException - if the URL for the given connectionName is not supported or allowed by the target


    Still more help?
    Last edited by mariosas; 2007-08-17 at 12:10.

  10. #10
    Regular Contributor
    Join Date
    Dec 2004
    Posts
    53

    Re: MFStandardConnection

    mariosas, Thanks for your input on this thread. I was having the same problem trying to open a connection to an external MiFare card. Passing the class name to the TargetProperties.getURL() method works.

    Regards,
    -Jeff

  11. #11
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Re: MFStandardConnection

    Try this out

    It works !!


    MFStandardConnection conn = null;
    String internalUrl = System.getProperty("internal.mf.url");
    conn = (MFStandardConnection) Connector.open(internalUrl);

    MFBlock block;
    byte KAbytes[] = { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF};
    MFKey.KeyA KA = new MFKey.KeyA(KAbytes);

    block = conn.getBlock(-1); // getBlock(256);

    java.lang.IllegalArgumentException: Invalid block index
    at com.nokia.mid.impl.isa.io.protocol.external.nfc.MFStandardConnectionImpl.getBlock(+21)
    at nokiatest.startApp(+157)
    at javax.microedition.midlet.MIDletProxy.startApp(+7)
    at com.nokia.mid.impl.isa.ui.MIDletManager.callStartApp(+4)
    at com.nokia.mid.impl.isa.ui.MIDletManager.activateMIDlet(+10)
    at com.nokia.mid.impl.isa.ui.MIDletManager.run(+15)

Similar Threads

  1. Authenticate & read the Card
    By phoenix__ in forum Near Field Communication
    Replies: 4
    Last Post: 2007-08-13, 07:35

Posting Permissions

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