• M
    mjung85

    Hi,

    sorry, maybe it was a little bit misleading. I'm not a commiter nor a contributer.

    I tried it also with the "native" .jar libraries and I think it should work with them also.

    There is also one problem remaining if you use this approach:

    I/dalvikvm(20033): Could not find method java.lang.String.<init>, referenced from method com.serotonin.util.queue.ByteQueue.popString
    W/dalvikvm(20033): VFY: unable to resolve direct method 5449: Ljava/lang/String;.<init> ([BLjava/nio/charset/Charset;)V
    D/dalvikvm(20033): VFY: replacing opcode 0x70 at 0x0007
    D/dalvikvm(20033): VFY: dead code 0x000a-000a in Lcom/serotonin/util/queue/ByteQueue;.popString (ILjava/nio/charset/Charset;)Ljava/lang/String;

    There is a String created using a Charset as argument and in Android this signature is not available, instead the Charset ISO name has to be passed as String instead as a Charset instead. So the change is really trivial, if you have the source code.

    Although it worked with the native libs, but I'm not sure if there aren't any side effects.

    What was your problem with the bind address?

    I just use something like this:

    private LocalDevice device = new LocalDevice(3456, "0.0.0.0");

    device.getEventHandler().addListener(this);
    Log.i(TAG,"Device created");
    try {
    device.initialize();
    } catch (IOException e) {
    e.printStackTrace();
    return;
    }

    ...

    device.setBroadcastAddress(ipstr);
    try {

    Log.i(TAG, "Sending broadcast.");
    device.sendBroadcast(whoHasRequest);
    // d.sendBroadcast(whois);
    

    } catch (BACnetException e) {
    System.out.println("Exception at " + ipstr);
    e.printStackTrace();
    }

    Seems to work without problems.

    If you like to I can send you my ported code in a zip file by E-mail. It includes the complete Bacnet4J stack and the reverse engineered seroUtils part, but since it is closed I don't want to make it public.

    BR

    posted in BACnet4J general discussion read more
  • M
    mjung85

    Hi,

    i just ported BACnet4J to Android. Just take the source code and include it in your Android project.

    There are nearly no changes required (remove apache logging, some minimal changes due to different method signatures of some classes, ...).

    A nasty thing is the dependency to the seroUtils.jar. I was able to reconstruct the src by using a older src zip found in this forum and a Java decompiler. Throwing away the not required parts of the lib for
    BACnet4J you get a working version on Android.

    I use it for a client application accessing a field device using the open-source BACnet C stack, so far it works well.

    Maybe I provide it as open-source project too, but first I need to check if this allowed by the license (seroUtils dependency ...).

    BR
    Markus

    posted in BACnet4J general discussion read more