From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hugh Daschbach Newsgroups: gmane.emacs.bugs Subject: bug#43252: 27.1; DBus properties lack type hints or overrides Date: Thu, 10 Sep 2020 15:53:29 -0700 Message-ID: <87pn6t9rbq.fsf@ccss.com> References: <87v9gqquct.fsf@ccss.com> <87imcqdo38.fsf@gmx.de> <87sgbtqylc.fsf@ccss.com> <87sgbtcvqs.fsf@gmx.de> <87pn6xqtsz.fsf@ccss.com> <87363sl4hs.fsf@gmx.de> <877dt3bnfl.fsf@ccss.com> <878sdj84kn.fsf@gmx.de> <871rjbaq05.fsf@ccss.com> <874ko6979w.fsf@gmx.de> <87v9gm9x9i.fsf@ccss.com> <871rj9k78r.fsf@gmx.de> <87imclwow5.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40458"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.5; emacs 27.1 Cc: 43252@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 11 00:54:25 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kGVSS-000APY-FQ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Sep 2020 00:54:24 +0200 Original-Received: from localhost ([::1]:53992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGVSR-0004cK-Hd for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Sep 2020 18:54:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGVS6-0004Lx-Io for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 18:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58346) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kGVS6-0006pN-8P for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 18:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kGVS6-0004zJ-6u for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 18:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Hugh Daschbach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Sep 2020 22:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43252 X-GNU-PR-Package: emacs Original-Received: via spool by 43252-submit@debbugs.gnu.org id=B43252.159977842519151 (code B ref 43252); Thu, 10 Sep 2020 22:54:02 +0000 Original-Received: (at 43252) by debbugs.gnu.org; 10 Sep 2020 22:53:45 +0000 Original-Received: from localhost ([127.0.0.1]:41659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGVRp-0004yo-5t for submit@debbugs.gnu.org; Thu, 10 Sep 2020 18:53:45 -0400 Original-Received: from mail1.ccss.com ([159.203.255.73]:44108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGVRm-0004yb-Tl for 43252@debbugs.gnu.org; Thu, 10 Sep 2020 18:53:43 -0400 Original-Received: by mail1.ccss.com (Postfix, from userid 114) id 27879BF89B; Thu, 10 Sep 2020 15:53:37 -0700 (PDT) Original-Received: from ccss.com (unknown [192.168.76.11]) by mail1.ccss.com (Postfix) with ESMTP id A637CBF820; Thu, 10 Sep 2020 15:53:36 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by ccss.com (Postfix) with ESMTP id 815E517606B7; Thu, 10 Sep 2020 15:53:36 -0700 (PDT) Original-Received: from ccss.com ([127.0.0.1]) by localhost (ccss.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q-2m-a0v9f2z; Thu, 10 Sep 2020 15:53:30 -0700 (PDT) Original-Received: from klaatu (klaatu.lan [192.168.42.3]) (Authenticated sender: hugh) by ccss.com (Postfix) with ESMTPSA id 1F2161760583; Thu, 10 Sep 2020 15:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ccss.com; s=mail; t=1599778410; bh=/rBCWqLNqnBLZWAHzy2ZuUIQCXfqfmpQvzJ/1cyhpWg=; h=References:From:To:Cc:Subject:In-reply-to:Date:From; b=RN3Kb9QWo0hv8YR5YNCyGOHXGFyJVoXCP0Cv/s/Nhpau1fCMJRLgXQE6XpGPEdYXr LVAGZBc3FrEeeCedCVdSniPUJOZRxrk+raUTepizhK3ZFG7PTM6+4K88IXD81oQ5T8 iJYbkhKIO/bp/v1Yl1oQpI+pk+Xh2HdR/pdc+Fr8H8ayoPxMiYZIYj35ouI/bVmVcO wq9jknTkk+dep/o9eWu5k4TTWv7Og13NKikY+gE79+re6EVKcO6GGl69P67l64k5iU noJFWQvlTMfgS6hKGWMFDvE+aGZJXZr3pSLLw8m/qiI5VvtoP1pUQoikks21ugnagQ lwk70p2E8R+5A== In-reply-to: <87imclwow5.fsf@gmx.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187782 Archived-At: --=-=-= Content-Type: text/plain; format=flowed Michael Albinus writes: > Michael Albinus writes: > > Hi Hugh, > >> Reading the BlueZ D-Bus GATT API description, you seem to need >> only >> basic types and arrays of basic types as properties. So I will >> start >> adding arrays of basic types. Other, more complex compound >> types will >> follow later. That's mostly true. There is another BlueZ interface (advertising) that take a byte keyed dictionary. It isn't obvious from the documentation https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt. But the Manufacturer ID described mentioned in the ManufacturerData dictionary description is a byte value. The property table in the BlueZ source code looks like: { "ManufacturerData", "a{qv}", get_manufacturer_data, NULL, manufacturer_data_exists }, (https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/client/advertising.c#n465) It isn't clear that there's a commitment to support such a data structure. The DBus info page says "Every dictionary entry has a string as a key". > I have pushed my recent work to master. dbus-register-property, > dbus-get-property, dbus-get-all-properties and > dbus-get-all-managed-objects shall work now for your byte > array. dbus-set-property will follow tomorrow, as well as other > compound > types but array. > With your latest work, I have successful tests for byte arrays, string arrays, object arrays, boolean arrays, and string keyed dictionaries. I haven't been able to verify property signatures programatically. I have turned on dbus-debug and verified signatures reported by the message formatter. I assume introspection is in the queue. With introspection, we could extend the tests. I assume I shouldn't care about tests that fail with debug turned on. WRT byte keyed dictionaries, I've attached a failing test. I don't know if you want to look at it or not. Still waiting for a response from assign@gnu.org. I assume a delay of a few days is to be expected. Thanks again, Hugh --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=dbus-tests-dictionary.patch Content-Transfer-Encoding: 8bit Content-Description: Test DBus byte keyed dictionary property. diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index a8e052efbef..c0e85449a37 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -521,6 +521,56 @@ dbus-test05-register-property-several-paths ;; Cleanup. (dbus-unregister-service :session dbus--test-service)))  +(ert-deftest dbus-test05-register-property-types () + "Check property type preservation for an own service." + (skip-unless dbus--test-enabled-session-bus) + (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service)) + + (unwind-protect + (let ((object-array "ByteDictionary") + (expected '((8 + ("byte eight")) + (16 + ("byte sixteen")) + (48 + ((8 9 10)))))) + (should + (equal + (dbus-register-property + :session dbus--test-service dbus--test-path + dbus--test-interface object-array :read + '(:array + :dict-entry (:byte 8 (:variant :string "byte-eight")) + :dict-entry (:byte 16 (:variant :object-path "/byte sixteen")) + :dict-entry (:byte 48 (:variant (:array :byte 8 :byte 9 :byte 10))))) + `((:property :session ,dbus--test-interface ,object-array) + (,dbus--test-service ,dbus--test-path)))) + (should + (equal + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface object-array) + expected)) + + + ;; A test for `dbus-get-property' shall be added. + + (let ((result + (dbus-get-all-properties + :session dbus--test-service dbus--test-path + dbus--test-interface))) + (should (equal (cdr (assoc object-array result)) expected))) + + (let ((result + (dbus-get-all-managed-objects :session dbus--test-service "/")) + result) + (should (setq result1 (cadr (assoc dbus--test-path result)))) + (should (setq result1 (cadr (assoc dbus--test-interface result1)))) + (should (equal (cdr (assoc object-array result1)) expected)))) + + ;; Cleanup. + (dbus-unregister-service :session dbus--test-service))) + (defun dbus-test-all (&optional interactive) "Run all tests for \\[dbus]." (interactive "p") --=-=-=--