How to get the system signals like "hibernate" by dbus-java?
Luna Luan
luanying at huawei.com
Tue Aug 25 17:33:13 PDT 2009
can anyone help me?
here's a simple test,my question is just How to define the TestSignal to
make sure that when the system get hibernate (or resume,or device
inserted),the TestSignal handler,"handle" will be executed?
====================================================
package org.freedesktop.dbus;
import org.freedesktop.dbus.exceptions.DBusException;
import org.freedesktop.dbus.test.TestSignalInterface;
public class Test implements DBusSigHandler{
public void handle(DBusSignal t){
System.out.println("device inserted!!");
}
public static void main(String[] args){
try{
System.out.println("Create DBus connection!");
DBusConnection conn = null;
conn = DBusConnection.getConnection(DBusConnection.SYSTEM);
try{
System.out.println("add Signal Handler!");
conn.addSigHandler(TestSignalInterface.TestSignal.class,new Test());
}catch(DBusException DBe){
System.err.println("failed to add signal handler!"+DBe.getMessage());
}
}catch(DBusException DBe){
System.err.println("failed to create dbus connection"+DBe.getMessage());
}
return;
}
}
=======================================================================================
--
View this message in context: http://www.nabble.com/How-to-get-the-system-signals-like-%22hibernate%22-by-dbus-java--tp25109143p25144707.html
Sent from the Free Desktop - dbus mailing list archive at Nabble.com.
More information about the dbus
mailing list