Unable to compile ... (Preverfiying Error!)

View: New views
10 Messages — Rating Filter:   Alert me  

Unable to compile ... (Preverfiying Error!)

by geri-m :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

I try to compile the following app with WTK 2.5.2 and both the SiritnFCControl:jar and the extension_jsr57_share.jar:

<code>
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package at.nfcresearch.benq;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

import com.sirit.nfc.Hardware;
import javax.microedition.contactless.TargetListener;
import javax.microedition.contactless.TargetProperties;

/**
 * @author Madlmayr
 */
public class BenqTester extends MIDlet implements CommandListener, TargetListener {

    private Form form;
    private Command exitCommand;
    private Command openCMCommand;
    private Command openAppCommand;
    private StringItem str;
   
   
    public BenqTester() {
        exitCommand = new Command("Exit", Command.EXIT, 1);
        openCMCommand = new Command("Open CM", Command.OK, 1);
        openAppCommand = new Command("Open App", Command.OK, 1);

        form = new Form("Benq Tester");
        str = new StringItem("Test:", "x");
       
        form.addCommand(openCMCommand);
        form.addCommand(openAppCommand);
        form.append(str);
       
        form.addCommand(exitCommand);

        form.append("Slots: " + System.getProperty("microedition.smartcardslots") + "\n");

        form.setCommandListener(this);
    }

    public void startApp() {
        setCurrentScreen(form);
        Hardware.NFCRequestEnabledADD(true);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
        Hardware.NFCRequestEnabledADD(false);
    }

    public void commandAction(Command cmd, Displayable arg1) {
        if (cmd == exitCommand) {

            destroyApp(false);
            notifyDestroyed();
        }
    }

       /**
     * Implementation of the Call-Back Function of the TargetListener
     * @param targetProperties: Array of Targets found by the Phone
     *
     */
    public void targetDetected(TargetProperties[] targetProperties) {

        // in case no targets found, exit the method
        if (targetProperties.length == 0) {
            return;
        }

        String temp = str.getText();
        str.setText(temp + "x");
       
        // show the UID of the first tag found
        TargetProperties tmp = targetProperties[0];
        displayAlert("UID read: " + tmp.getUid(), AlertType.INFO);
    }
    public static String arrayToHex(byte[] data) {
        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < data.length; i++) {
            String bs = Integer.toHexString(data[i] & 0xFF);
            if (bs.length() == 1) {
                sb.append(0);
            }
            sb.append(bs);
            sb.append((i + 1) % 4 == 0 ? '\n' : ' ');
        }

        return sb.toString();
    }

    private void setCurrentScreen(Displayable display) {

        Display.getDisplay(this).setCurrent(display);
    }
   
        private void displayAlert(String error, AlertType type) {
        Alert err = new Alert(form.getTitle(), error, null, type);
        Display.getDisplay(this).setCurrent(err, form);
    }
}
</code>

And I do get a

Error preverifying class com.jblend.io.ndef.Protocol
    java/lang/NoClassDefFoundError: com/jblend/io/ConnectionImplFactory
D:\Develop\research\J2ME\Benq_Test\nbproject\build-impl.xml:431: Preverification failed with error code 1.
BUILD FAILED (total time: 0 seconds)

Looks like the JARs is not complet ... could someone verify this?

Additionall: in the handbook it says, there is function for pause:

protected void pauseApp(){
    Hardware.NFCPauseADD();
}

This is not included in my JARs either ....

Any feedback is appreciated.

Cheers, geri-m




Re: Unable to compile ... (Preverfiying Error!)

by Zec54 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey geri-m,

I have had the same problem. Then I used a little trick, I compile the applications with the Nokia 6131 NFC set as device and not the Suns WTK. I thught it ought to work, because they both support JSR-257 and it works. Downside is that I can not use the emulator to test the applications on my computer.
Hope this helps you.

regards,
Samo

Re: Unable to compile ... (Preverfiying Error!)

by josergc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are two ways to compile your application:

* One is using the Eclipse Framework to manage mobile projects and then add the .JARs with the NFC+extension that we have sent to you. With the Netbeans will be the same.

* Two is a trick I made too, creating my own BenQ T80 from the DefaultColorPhone in the WTK:
1.- I copied the folder DefaultColorPhone that you will find in C:\WTK2.5.2\wtklib\devices to BenQT80 for instace. So you will have the same folders:
C:\WTK2.5.2\wtklib\devices\DefaultColorPhone
and
C:\WTK2.5.2\wtklib\devices\BenqT80
2.- I renamed every file. Where it said DefaultColorPhone, now it says BenQT80. Like the folder.
3.- The important part is the .properties file because you must to put here where are each extension. So, after rename the files inside, I put at the end these two lines:

api.class.path: lib\\cldcapi11.jar;lib\\cldcapi10.jar;lib\\jsr75.jar;lib\\jsr184.jar;lib\\midpapi20.jar;lib\\midpapi10.jar;lib\\mmapi.jar;lib\\wma11.jar;lib\\ext\\SiritNFCControl.zip;lib\\ext\\extensions_jsr257_share.jar

emulator.library: lib\\cldcapi11.jar;lib\\cldcapi10.jar;lib\\jsr75.jar;lib\\jsr184.jar;lib\\midpapi20.jar;lib\\midpapi10.jar;lib\\mmapi.jar;lib\\wma11.jar;lib\\ext\\SiritNFCControl.zip;lib\\ext\\extensions_jsr257_share.jar

4.- As you can see, it is configured to use files inside of the folder
C:\WTK2.5.2\wtklib\devices\BenqT80
I create in it the folder lib and ext:
C:\WTK2.5.2\wtklib\devices\BenqT80\lib
C:\WTK2.5.2\wtklib\devices\BenqT80\lib\ext

5.- Placed in the folder lib the common files. I got them from the Nokia SDK, but you can use the default files from the WTK. And I placed the JSR257 + Sirit extensions in the ext folder.

I relaunch the WTK and it will show the new configuration BenQT80 in the Device list, and now I can compile for this configuration.

----------------------------------------

The three differences with the SDK of Nokia are:

1.- you must to call the static method

com.sirit.nfc.Hardware.NFCRequestEnabledADD(true);

to make enable the NFC capabilities of the BenQ;

2.- the name of the following method:

package javax.microedition.contactless.ndef;
class NDEFRecord {
...
public NDEFMessage getNestedNDEFMessage(int offset);
...
}

package javax.microedition.contactless.ndef;
class NDEFRecord {
...
public NDEFMessage getNestedMessage(int offset);
...
}

;

3.- and the strings of the PushRegistry:

* for Text tags
MIDlet-Push-X: ndef:rtd?name=T, MIDletClassName, filter

* for URL tags
MIDlet-Push-X: ndef:rtd?name=U, MIDletClassName, filter

* for SmartPosters tags
MIDlet-Push-X: ndef:rtd?name=Sp, MIDletClassName, filter

----------------------------------------

Check if this works and advice us if there is any kind of problem.

Best regards,

Jose

Re: Unable to compile ... (Preverfiying Error!)

by josergc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am going to recommend to you to put the function

Hardware.NFCRequestEnabledADD(false);

instead of the

Hardware.NFCPauseADD();

This manual is still a draft and it looks like there is some mistakes yet.

We are going to forward this issue to BenQ to ask for updated SDK+documentation.

Re: Unable to compile ... (Preverfiying Error!)

by geri-m :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

okay, reading a Tag with a J2ME application works now. (I'M using the Nokia 6131 NFC SDK to compile the JAR).

I came across another thing: The call 'System.getProperty("microedition.smartcardslots")' is not implemented (correctly) -- It returns 'null' but it should return something like "0H" ... for hot-switch.

I do have also another question: I'd like to show a smartposter usecase with the Benq-Phone. I do have a Tag with a NDEF-URL stored. But when I touch the tag with the phone (no J2ME applcation running) nothing is happening. Is this feature implemented or not? [or what else could it be?]

Cheers, Gerald

Re: Unable to compile ... (Preverfiying Error!)

by Zec54 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey geri-m,

in regards of NDEF-URL Record types. As much as I have seen, the Benq t80 doesn't have any support for NFC forum record types(url, vCard, ...) as Nokia 6131 NFC has. AFAIK you must have a midlet installed on phone that has a record in PushRegistry for this format. So it is simple midlet that starts when it reads the appropriate NDEF message and then it calls PlatformRequest method to call the phones web browser.
But i am no expert in this matters, so we must wait for Jose to answer Your question.

Samo

Re: Unable to compile ... (Preverfiying Error!)

by josergc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have forward the "microedition.smartcardslots" property issue to our contact in BenQ and waiting for his answer.

About the other, there is not default behavior in the BenQ, but it should work if you create your own MIDlet. Please clarify me if I am wrong if you are expecting for something already developed or the problem is that kind of RecordType is not work.

Best regards,

Jose

Re: Unable to compile ... (Preverfiying Error!)

by geri-m :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jose,

I just thought, that the basic NDEF-types for URL, SMS eg. are already implementated nativly into the operating system (like on the Nokia). But it looks like, it is not the case ...

Cheers, geri-m

Re: Unable to compile ... (Preverfiying Error!)

by josergc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In this BenQ there is not default behavior for the standard NFC-Forum tags, but this "missing" functionality allow us to develop our own. In the Nokia, cannot override the autolaunch on SmartPosters, can it? we must to open the MIDlet before to be able to read NFC-Forum SmartPosters. Small advantage

Re: Unable to compile ... (Preverfiying Error!)

by josergc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Gerald,

We have got answer from BenQ: "This property is not defined by the JSR257 specification BUT it is one of the “Security and Trust Services API (SATSA)” property of the JSR177."

Cheers,

Jose