# DKNotificationCenter class documentation

niels.grewe@halbordnung.de
2010 Free Software Foundation, Inc.
Software documentation for the DKNotificationCenter class
DBusKit/DKNotificationCenter.h
The DKNotificationCenter class allows Objective-C objects to watch for notifications from other D-Bus objects ('signals' in the D-Bus dialect) or to post notifications to D-Bus themselves. You can use this class just as you would use an NSNotificationCenter. Notification names will be mapped to signals as follows: If the introspection data for theD-Bus signal carries an `org.gnustep.openstep.notification` annotation,the value of this annotation will be used as the name of the notification. Otherwise, the notification name will be `DKSignal_<InterfaceName>_<SignalName>` . Additionally, D-Bus provides a rather sophisticated matching mechanism to catch only signal emissions with a specific signature. This mechanism is available to applications through the -addObserver:selector:signal:interface:sender:destination: method and its more specific variants. Unfortunately, at this time, you need to specify identical match rules when removing the observer again. Every notification from D-Bus carries a reference to a proxy for the object emitting the signal and also guarantees that the following keys are present in the dictionary:
member
The name of the signal being emitted (e.g. "NameOwnerChanged"
interface
The name of the interface to which the signal belongs. (e.g. "org.freedesktop.DBus").
sender
The service emitting the signal (e.g. "org.freedesktop.DBus"). This will always be the unique name of the service, even if you registered the signal for another name.
path
The path to the object emitting the signal (e.g "/org/freedesktop/DBus").
destination
The intended receiver of the signal, might be empty if the signal was broadcast, which is usually the case. Additionally the userInfo dictionary will contain keys for every argument specified in the signal, named "arg N ". The dictionary might also contain further keys if `org.gnustep.openstep.notification.key` annotations were available.
centerForBusType:
type
Returns a notification center for the specified bus type.
sessionBusCenter
Returns a notification center for the session message bus.
systemBusCenter
Returns a notification center for the system message bus.
addObserver:
observer
selector:
notifySelector
name:
notificationName
object:
sender
Watches the bus for signals matching notificationName from sender. If one of them is `nil`, the value will not be used to restrict the notifications delivered to the observer. Notifications are delivered by calling notifySelector on observer as a receiver. Neither can be `nil` and notifySelector takes exactly one argument (the notification).
addObserver:
observer
selector:
notifySelector
name:
notificationName
sender:
sender
destination:
destination
Similar to -addObserver:selector:name:object: but allows to specify both sender and destination of the notification.
addObserver:
observer
selector:
notifySelector
signal:
signalName
interface:
interfaceName
sender:
sender
destination:
destination
Similar to -addObserver:selector:name:sender:destination: but allows finer grained control over what signals to match. (E.g. it would be possible to request all notifications matching a particular interface only.).
addObserver:
observer
selector:
notifySelector
signal:
signalName
interface:
interfaceName
sender:
sender
destination:
destination
filter:
filter
atIndex:
index
Similar to -addObserver:selector:signal:interface:sender:destination: but additionally allows matching a single argument. Due to D-Bus constraints, index must be less than 64. The signal will only be matched if the value of the argument at index is equal to the value of filter. Additionally, this matching is limited to string arguments.
addObserver:
observer
selector:
notifySelector
signal:
signalName
interface:
interfaceName
sender:
sender
destination:
destination
filtersAndIndices:
firstFilter
Similar to -addObserver:selector:signal:interface:sender:destination:filter:atIndex: but allows matching more than one signal. The argument list needs to be terminated by `nil`. If you want to match the first argument, specify that particular match as the first one and set firstIndex to `0`.
postNotification:
notification
NOTE: Not yet implemented.
postNotificationName:
name
object:
sender
NOTE: Not yet implemented.
postNotificationName:
name
object:
sender
userInfo:
info
NOTE: Not yet implemented.
postSignalName:
signalName
interface:
interfaceName
object:
sender
NOTE: Not yet implemented.
postSignalName:
signalName
interface:
interfaceName
object:
sender
userInfo:
info
NOTE: Not yet implemented.
registerNotificationName:
notificationName
asSignal:
signalName
inInterface:
interface
This method allows notification names to be registered for specific signals. E.g.: [[DKNotificationCenter sessionBusCenter] registerNotificationName: @"DKNameChanged" asSignal: @"NameOwnerChanged" inInterface: @"org.freedesktop.DBus"]; would deliver all " `NameOwnerChanged` " emissions as notifications named " `DKNameChanged` ". The method returns `NO` if the notification name has already been registered.
removeObserver:
observer
Removes all observation activities involving the observer.
removeObserver:
observer
name:
notificationName
object:
sender
Removes all observation activities matching the arguments specified. The match is inclusive. Every observation for a more specific rule will also be removed.
removeObserver:
observer
name:
notificationName
sender:
sender
destination:
destination
Removes all observation activities matching the arguments specified. The match is inclusive. Every observation for a more specific rule will also be removed.
removeObserver:
observer
signal:
signalName
interface:
interfaceName
object:
sender
Removes all observation activities matching the arguments specified. The match is inclusive. Every observation for a more specific rule will also be removed.
removeObserver:
observer
signal:
signalName
interface:
interfaceName
sender:
sender
destination:
destination
Removes all observation activities matching the arguments specified. The match is inclusive. Every observation for a more specific rule will also be removed.
removeObserver:
observer
signal:
signalName
interface:
interfaceName
sender:
sender
destination:
destination
filter:
filter
atIndex:
index
Removes all observation activities matching the arguments specified. The match is inclusive. Every observation for a more specific rule will also be removed.
removeObserver:
observer
signal:
signalName
interface:
interfaceName
sender:
sender
destination:
destination
filtersAndIndices:
firstFilter
Removes all observation activities matching the arguments specified. The match is inclusive. Every observation for a more specific rule will also be removed.