6 DBusSigHandler

To handle incoming signals from other programs on the Bus you must register a signal handler. This must implement DBusSigHandler13 and provide an implementation for the handle method. An example Signal Handler is in figure 9. Signal handlers should be parameterised with the signal they are handling. If you want a signal handler to handle multiple signals you can leave out the parameterisation and use instanceof to check the type of signal you are handling. Signal handlers will be run in their own thread.


import org.freedesktop.dbus.DBusSignal;  
import org.freedesktop.dbus.DBusSigHandler;  
 
public class Handler extends DBusSigHandler<DBus.NameAcquired>  
{  
   public void handle(DBus.NameAcquired sig)  
   {  
         ...  
   }  
}


Figure 9: A Signal Handler