Re: 答复: For dbus-send, how to send a s truct param?
Felipe Gasper <felipe-c4PQK5fb7feI/[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <[email protected]> |
It sounds like you can’t use dbus-send to do that. If you absolutely need to use that specific tool, then you’re SOL. But if you’re able to use any CLI tool, you have options. -F > On Sep 17, 2019, at 19:57, 刘铁罡 <[email protected]> wrote: > > Dear Felipe, > > Thanks a lot, but we are not using perl.😊 > > I want to use dbus-send to send "(qqay)" not "qqay". > > Any suggestion will be appreciated. > > Thanks > >> On Sep 17, 2019, at 7:08 AM, 刘铁罡 <[email protected]> wrote: >> >> Dear DBus Support List, >> >> Now I want to method-call via dbus-send, my command is : >> dbus-send --session --type=method_call --print-reply >> --dest=carservice.McuAdapterService.v1_0_McuAdapterService /McuAdapterService carservice.McuAdapterService.v1_0.request uint16:1015 uint16:1016 array:byte:1,2,3 But I got error: >> Error org.freedesktop.DBus.Error.UnknownMethod: Method "request" with >> signature "qqay" on interface "carservice.McuAdapterService.v1_0" >> doesn't exist >> >> In fact, I want to send "(qqay)" via dbus-send. >> I can’t find a struct sample of dbus-send. >> >> Would you please help me on it. > > If you have access to Perl, you could use Protocol::DBus to construct a similar command. It’ll be wordier, but it’ll do what you want. Something like (untested): > > perl -MData::Dumper -MProtocol::DBus::Client -e'my $dbus = Protocol::DBus::Client::login_session(); $dbus->initialize(); my $done_yn; $dbus->send_call( destination => "carservice.McuAdapterService.v1_0_McuAdapterService", path => "/McuAdapterService", interface => "carservice.McuAdapterService.v1_0", member => "request", signature => "(qqay)", body => [ [ 1015, 1016, [1, 2, 3] ] ] )->then( sub { print Dumper shift() } )->finally( sub { $done_yn = 1 } ); $dbus->get_message() while !$done_yn' > > -F > _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus