let's do ugly versioning in my playground
This commit is contained in:
50
notify-with-listen.lisp
Normal file
50
notify-with-listen.lisp
Normal file
@@ -0,0 +1,50 @@
|
||||
;;;; +----------------------------------------------------------------+
|
||||
;;;; | DBUS |
|
||||
;;;; +----------------------------------------------------------------+
|
||||
(load (sb-ext:posix-getenv "ASDF"))
|
||||
(asdf:load-system 'dbus)
|
||||
(defpackage #:publish-example
|
||||
(:use #:cl #:dbus)
|
||||
(:export #:publish-example))
|
||||
|
||||
(in-package #:publish-example)
|
||||
|
||||
(define-dbus-object root
|
||||
(:path "/"))
|
||||
|
||||
(define-dbus-object my-service
|
||||
(:path "/org/adeht/MyService")
|
||||
(:parent root))
|
||||
|
||||
(define-dbus-method (my-service my-method) ((s1 :string) (s2 :string)) (:string)
|
||||
(:interface "org.adeht.MyService")
|
||||
(format t "will process call for ~S and ~S~%" s1 s2)
|
||||
(force-output)
|
||||
(concatenate 'string "updated" s1 s2))
|
||||
|
||||
(define-dbus-signal-handler (my-service on-signal) ()
|
||||
(:interface "org.adeht.MyService")
|
||||
(format t "Got signal with arg ~S~%" "hoh")
|
||||
(force-output))
|
||||
|
||||
(define-dbus-signal-handler (root on-signal) ((s :string))
|
||||
(:interface "org.adeht.MyService")
|
||||
(format t "Got signal on root with arg ~S~%" s)
|
||||
(force-output))
|
||||
|
||||
(defun publish-example ()
|
||||
(handler-case
|
||||
(with-open-bus (bus (session-server-addresses))
|
||||
(format t "Bus connection name: ~A~%" (bus-name bus))
|
||||
(dbus:add-match bus :type :signal :interface "org.adeht.MyService")
|
||||
(publish-objects bus))
|
||||
(end-of-file ()
|
||||
:disconnected-by-bus)))
|
||||
|
||||
;; was missing the 'add-match
|
||||
;; and now let's try to catch the NotificationClosed tihngy
|
||||
;; enefedov@LLF33A87M:~$ dbus-send --session --type=signal /org/adeht/MyService org.adeht.MyService.OnSignal string:"Hello yayyaline"
|
||||
|
||||
;; and when i do signal-handler on 'root
|
||||
;; $ dbus-send --session --type=signal /org/adeht/MyService org.adeht.MyService.OnSignal ;; this is how to send it
|
||||
;; so! i need to create it on the object path, ok
|
||||
Reference in New Issue
Block a user