[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-dbus
Subject:    Re: How to get the system signals like "hibernate" by dbus-java?
From:       Luna Luan <luanying () huawei ! com>
Date:       2009-08-26 0:33:13
Message-ID: 25144707.post () talk ! nabble ! com
[Download RAW message or body]


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.

_______________________________________________
dbus mailing list
dbus@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dbus


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic