From: Ralph Ronnquist Date: Sat, 22 Apr 2023 09:21:09 +0000 (+1000) Subject: Modified test. X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=11efae9fa44a07a065859a69b3ed77f403dcbed7;p=rrq%2Flsp-utils.git Modified test. --- diff --git a/lsp-dbus-test.lsp b/lsp-dbus-test.lsp index 94981b5..af8af95 100644 --- a/lsp-dbus-test.lsp +++ b/lsp-dbus-test.lsp @@ -1,19 +1,37 @@ ;; 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)")