DbusExecutionException when calling a Method on an RemotObject

hannehomuth hannehomuth1 at gmx.de
Thu Jul 10 08:00:10 PDT 2008


Hi again,

I've have another question that I can't resolve bymyself. I've connected my
own Dbus Service on the "SYSTEM_BUS" and now I've written a little Client
which calls some Methods on my remoteObject. The Interface for the
RemoteObject looks like this.

package de.sourcepark.PicoLcd;

import org.freedesktop.dbus.DBusInterface;

/**
 * This is the Interface for the de.sourcepark.PicoLcd Service which
 * provides you all Methods you can call 
 * @author jhomuth
 */
public interface Services extends DBusInterface
{
  public void sayHello();
  public boolean isRemote();
  public void turnBackGroundLightOff();
  public void turnBackGroundLightOn();
  public void clearDisplay();
  public void setContrast(int level);
  public void setTextInOneLine(String text,int whichline, boolean
putInCenter);
  public void setTextInTwoLines(String zeile1, String zeile2);
}

All Methods except the "sayHello" Method call an native Method which was
wrapped with jni from me.
Here the code of my RemoteObject

@DBusInterfaceName("de.sourcepark.PicoLcd.Services")
public class Service implements DBusInterface{


    public boolean isRemote() {
        return true;
    }
    
    /**
     * Prints the Word Hello on the Console. Only for testing
     */
    public void sayHello()
    {
        System.out.println("Hello");
        System.out.println("sayHello aufgerufen über den Dbus");
    }
    
    /**
     * This Method turns the backlight of the PicoLcd to off
     */
    public void turnBackGroundLightOff()
    {
        System.out.println("Mache Licht aus");
        PicoLCDWrappedMethods picoLcdMethods = new PicoLCDWrappedMethods();
        picoLcdMethods.turnLightOff();
    }
    
    /**
     * This Method turns the backlight of the PicoLcd to on
     */
    public void turnBackGroundLightOn()
    {
        System.out.println("Mache Licht an");
        PicoLCDWrappedMethods picoLcdMethods = new PicoLCDWrappedMethods();
        picoLcdMethods.turnLightOn();
    }
    
    /**
     * This Methods clears all Text on the Display
     */
    public void clearDisplay()
    {
        System.out.println("Lösche das Display");
        PicoLCDWrappedMethods picoLcdMethods = new PicoLCDWrappedMethods();
        picoLcdMethods.clearDisplay();
    }
}

There are more methods in here (as you can see in the Interface above) but I
let them out here in this posting.

And here the Wrapper If you wanna know

/**
 * This class wraps the C calls to Java Methods.
 * Here all nesseary methods will be wrapped so that we could
 * call them trough our java code
 * @author jhomuth
 */
public class PicoLCDWrappedMethods {

    public PicoLCDWrappedMethods() {
       System.out.println("Load the Library");      
Runtime.getRuntime().load(System.getProperty("user.home")+"/lib/PicoLCDServerWrappedMethods.dll");
       System.out.println("Library was loaded");
  }
   public native void turnLightOn();
    public native void turnLightOff();
    public native void clearDisplay();
    public native void setContrast(int level);
    public native void setLed(int whichLed, int status);
    private native void setText(int row, int colum, String text);
}

And here is a snippet outa the C "Class" which was written for the wrapper

//This Method clears the Display 
JNIEXPORT void JNICALL Java_picolcdserver_PicoLCDWrappedMethods_clearDisplay
(JNIEnv *env, jobject jobj)
{
    printf("ClearDisplay in der Native Methode");
     usblcd_operations *mylcd;
    /* init hid device and usblcd_operations structure */
    mylcd = new_usblcd_operations();
     /* init the USB LCD */
    mylcd->init(mylcd);
    mylcd->clear(mylcd);
    mylcd->close(mylcd);
}

As I sad in the Mail before, if I uses the same wrapper classes in my own
written socket server everything worked fine, But if I call this native
methods on my dbus RemoteObject I always get an DbusExecutionException. But
I have to say the sayHello Method, which has nothing todo with the wrapper
works.!?! I could think the wrapper is wrong but as I already sad it worked
with the socket server. So does anyone know why this damm exception comes,
and how to fix that? 

Thx for reading this long post in bad english and your answers

-- 
View this message in context: http://www.nabble.com/DbusExecutionException-when-calling-a-Method-on-an-RemotObject-tp18384769p18384769.html
Sent from the Free Desktop - dbus mailing list archive at Nabble.com.



More information about the dbus mailing list