;; This is a test program for the lsp-dbus provided dbus API.
(load "lsp-dbus.lsp")
+;; Loading that module sets up core framework API and connects to
+;; dbus' system bus registering this application. This includes
+;; Dbus:ROOT for the "/org/freedektop/DBus" path, and Dbus:DBus for
+;; the interrface "org.freedektop.DBus".
+
+;; Register a handler for the NameAcquired signal, to replace the one
+;; installed by lsp-dbus.lsp
+
+;; Request a bus name "au.rrq" for this client
+(println "RequestName: "
+ (if (:invoke Dbus:ROOT (:m ObjectManager "RequestName(su)")
+ '("au.rrq" 0))
+ (!= ($it -1 -1 -1)) ; returns BOOLEAN
+ ))
-;; Connect to system bus and set up core framework API
+;; Set up a Match rule to see stuff
+(setf MATCH-RULE
+ (join (list "type='signal'"
+ ;;"sender='org.example.App2'"
+ ;;"path_namespace='/au/rrq'"
+ ;;"eavesdrop='true'"
+ )
+ ","))
+(println "AddMatch:\n" MATCH-RULE "\n"
+ (if (:invoke Dbus:ROOT (:m Dbus:DBus "AddMatch(s)")
+ (list MATCH-RULE))
+ ($it -1 -1 -1) ; returns OOM on error
+ ))
-;; Install my own framework object
-(die nil (setf au.rrq (Dbus "/au/rrq")))
+(reset)
-;; Request a bus name
-(println (if (:invoke Dbus:ROOT
- (print (:m ObjectManager "RequestName(su)"))
- (println (list (:%name au.rrq) 0)))
- (!= ($it -1 -1 -1)) ; returns BOOLEAN
- ))
-(Dbus:process-all-pending)
(println (if (:invoke Dbus:ROOT
(print "GetNameOwner(s)")