* Empty arrays & libdbusada @ 2016-06-28 11:19 Ian Clifton 2016-06-29 9:35 ` Reto Buerki 0 siblings, 1 reply; 6+ messages in thread From: Ian Clifton @ 2016-06-28 11:19 UTC (permalink / raw) 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, -- Ian ◎ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Empty arrays & libdbusada 2016-06-28 11:19 Empty arrays & libdbusada Ian Clifton @ 2016-06-29 9:35 ` Reto Buerki 2016-06-29 21:49 ` Ian Clifton 0 siblings, 1 reply; 6+ messages in thread From: Reto Buerki @ 2016-06-29 9:35 UTC (permalink / raw) Hi Ian, On 2016-06-28, Ian Clifton <ian.clifton@chem.ox.ac.uk> 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! - reto ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Empty arrays & libdbusada 2016-06-29 9:35 ` Reto Buerki @ 2016-06-29 21:49 ` Ian Clifton 2016-06-30 7:04 ` Reto Buerki 0 siblings, 1 reply; 6+ messages in thread From: Ian Clifton @ 2016-06-29 21:49 UTC (permalink / raw) Reto Buerki <reet@codelabs.ch> writes: > On 2016-06-28, Ian Clifton <ian.clifton@chem.ox.ac.uk> 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. -- Ian ◎ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Empty arrays & libdbusada 2016-06-29 21:49 ` Ian Clifton @ 2016-06-30 7:04 ` Reto Buerki 2016-06-30 20:54 ` Ian Clifton 0 siblings, 1 reply; 6+ messages in thread From: Reto Buerki @ 2016-06-30 7:04 UTC (permalink / raw) On 2016-06-29, Ian Clifton <ian.clifton@chem.ox.ac.uk> wrote: > Reto Buerki <reet@codelabs.ch> writes: > >> On 2016-06-28, Ian Clifton <ian.clifton@chem.ox.ac.uk> 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. Regards, - reto ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Empty arrays & libdbusada 2016-06-30 7:04 ` Reto Buerki @ 2016-06-30 20:54 ` Ian Clifton 2016-07-05 15:33 ` Ian Clifton 0 siblings, 1 reply; 6+ messages in thread From: Ian Clifton @ 2016-06-30 20:54 UTC (permalink / raw) Reto Buerki <reet@codelabs.ch> writes: > On 2016-06-29, Ian Clifton <ian.clifton@chem.ox.ac.uk> wrote: >> Reto Buerki <reet@codelabs.ch> writes: >> >>> On 2016-06-28, Ian Clifton <ian.clifton@chem.ox.ac.uk> 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 ◎ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Empty arrays & libdbusada 2016-06-30 20:54 ` Ian Clifton @ 2016-07-05 15:33 ` Ian Clifton 0 siblings, 0 replies; 6+ messages in thread From: Ian Clifton @ 2016-07-05 15:33 UTC (permalink / raw) Ian Clifton <ian.clifton@chem.ox.ac.uk> writes: > Reto Buerki <reet@codelabs.ch> writes: > >> On 2016-06-29, Ian Clifton <ian.clifton@chem.ox.ac.uk> wrote: >>> Reto Buerki <reet@codelabs.ch> writes: >>> >>>> On 2016-06-28, Ian Clifton <ian.clifton@chem.ox.ac.uk> 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. I believe I might have solved this problem now. Firstly, I found out how to generate “variant” values in the D-feet tool (you use an expression like GLib.Variant('b', False) to create the Boolean value false in a variant container), this was a great help as it allowed me to learn a lot more about D-Bus just through experimentation. Then I decided I ought to be using the SetState method instead of Activate. Finally it turns out that using the value 0 (i.e., not even an array!) as a placeholder for the “platform_data” parameter seems to work fine. I haven’t tried this in my Ada code yet (it’s on a different machine), but I’ve a feeling I can get it to work now—thanks for your help! -- Ian ◎ ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-05 15:33 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-06-28 11:19 Empty arrays & libdbusada Ian Clifton 2016-06-29 9:35 ` Reto Buerki 2016-06-29 21:49 ` Ian Clifton 2016-06-30 7:04 ` Reto Buerki 2016-06-30 20:54 ` Ian Clifton 2016-07-05 15:33 ` Ian Clifton
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox