;;; dbus-properties-test.el --- Test program for complex :dict-entry. -*- lexical-binding: t; -*- ;; Copyright (C) 2020 Hugh Daschbach ;; Author: Hugh Daschbach ;; Keywords: tools ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; This program demonstrates an error in handling D-Bus properties ;; interface. ;; ;; `dbus-property-handler' provides an org.freedesktop.DBus.Properties ;; interface to respond to requests for registered properties. But, ;; unlike methods and signals, properties are not stored per interface ;; per object. They are merely stored per interface. ;; ;; So the current implementation cannot support properties on the same ;; interface with a different object path. ;;; Code: (require 'dbus) (defun main () (interactive) (setq dbus-debug t) (setq debug-on-error t) (dbus-register-property :system "org.gnu.Emacs" "/node0" "org.bluez.GattService1" "Device" :readwrite "-node0-") (start-process "node0-get" "*node0*" "dbus-send" "--system" "--print-reply" (concat "--dest=" (dbus-get-unique-name :system)) "/node0" "org.freedesktop.DBus.Properties.Get" "string:org.bluez.GattService1" "string:Device") (sit-for 1) (dbus-register-property :system "org.gnu.Emacs" "/node1" "org.bluez.GattService1" "Device" :readwrite "-node1-") (start-process "node0-get" "*node0*" "dbus-send" "--system" "--print-reply" (concat "--dest=" (dbus-get-unique-name :system)) "/node0" "org.freedesktop.DBus.Properties.Get" "string:org.bluez.GattService1" "string:Device") (start-process "node1-get" "*node1*" "dbus-send" "--system" "--print-reply" (concat "--dest=" (dbus-get-unique-name :system)) "/node1" "org.freedesktop.DBus.Properties.Get" "string:org.bluez.GattService1" "string:Device") (start-process "node1-set" "*node1*" "dbus-send" "--system" "--print-reply" (concat "--dest=" (dbus-get-unique-name :system)) "/node1" "org.freedesktop.DBus.Properties.Set" "string:org.bluez.GattService1" "string:Device" "variant:string:-replaced-") (sit-for 1) (start-process "node0-get" "*node0*" "dbus-send" "--system" "--print-reply" (concat "--dest=" (dbus-get-unique-name :system)) "/node0" "org.freedesktop.DBus.Properties.Get" "string:org.bluez.GattService1" "string:Device") (start-process "node1-get" "*node1*" "dbus-send" "--system" "--print-reply" (concat "--dest=" (dbus-get-unique-name :system)) "/node1" "org.freedesktop.DBus.Properties.Get" "string:org.bluez.GattService1" "string:Device") (start-process "node0-get" "*node0*" "dbus-send" "--system" "--print-reply" (concat "--dest=" (dbus-get-unique-name :system)) "/node0" "org.freedesktop.DBus.Properties.GetAll" "string:org.bluez.GattService1" "string:Device") (sit-for 1) (split-window-below) (switch-to-buffer "*node0*") (goto-char (point-min)) (other-window 1) (switch-to-buffer "*node1*") (goto-char (point-min))) (provide 'dbus-properties-test) ;;; dbus-properties-test.el ends here