From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Clifton Newsgroups: comp.lang.ada Subject: Re: Empty arrays & libdbusada Date: Thu, 30 Jun 2016 21:54:53 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net kRrNjqqjfQQ7JxP6xs1kTg20yssp0goTQUijlp9/DB5sLhKkG7 Cancel-Lock: sha1:7KBWn44yONQ0xgJQhKgZJXmIr3s= X-Face: UBC;x(*[G|MjJprNEe46g'_ohKo&_1j)xyO.Vp{Aqs]utmX:;onqsta@HWuZ/XLcnUl8:Tw ftqJ]_NiENI}83q%~[/2C!f[!&@p*N9'-weU1%|76wuw7,u$vB:Q2/rT:Xt7/vlATc]_'O$o +$BJ~I+H|df*r>lC?,P?s4W"HC]fP0FT+Ay5.0R{rc0)JICp(z:[gx9k'/JC|hnzbW@#"[t;'I0` Content-Language: en-GB User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Xref: news.eternal-september.org comp.lang.ada:30984 Date: 2016-06-30T21:54:53+01:00 List-Id: Reto Buerki writes: > On 2016-06-29, Ian Clifton wrote: >> Reto Buerki writes: >> >>> On 2016-06-28, Ian Clifton wrote: >>>> I’m trying to learn a bit about controlling programs through D-bus. I >>>> can make things happen with the “D-feet” tool, calling methods in >>>> ork.gtk.Actions and org.gtk.Application, supplying empty arrays (notated >>>> as “[]”) for un‐needed parameters. But when I try to do the equivalent >>>> in Ada code using libdbusada, I hit a snag—libdbusada doesn’t seem to be >>>> able to handle empty arrays. Does anyone know of a way round this? >>>> Thanks, >>> >>> Can you please provide a concrete example of what you are trying to do? >>> What happens if you just remove the empty array arguments? >>> >> Thanks for replying. At the moment I’m trying to control the play‐back >> of a CD using the “Sound Juicer” application on Debian Linux. The >> application exposes the “org.gtk.Actions” interface through D-Bus. Using >> D-feet, I can toggle playback by calling the “Activate” method with >> three arguments: >> >> 'play', [], [] >> >> i.e. the string 'play' followed by two empty arrays to mark the places >> of un‐needed parameters. >> >> If I omit these placeholders in my Ada code I get: >> >> raised D_BUS.D_BUS_ERROR : Type of message, '(s)', does not match >> expected type '(sava{sv})' >> >> If I supply empty arrays (uninitialised >> D_Bus.Arguments.Containers.Array_Type variables) I get: >> >> raised D_BUS.D_BUS_ERROR : Serialization error: Array is empty >> >> and if I put either empty strings or nonsense strings into containers of >> the expected type, my method calls seem to be passed without error but >> are ignored by the application. > > Thanks for the detailed description. > > Creating an array containing only an empty string should work in this > case. See the D_Bus/Ada notify.adb example where the same is done for > the Notify method of the org.freedesktop.Notifications interface. Thanks, I’ll investigate when I get a bit more time tomorrow night. -- Ian ◎