Re: 答复: For dbus-send, how to send a struct param?

Felipe Gasper felipe at felipegasper.com
Wed Sep 18 02:23:57 UTC 2019


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, 刘铁罡 <liutiegang at bdstar.com> 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, 刘铁罡 <liutiegang at bdstar.com> 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
> 



More information about the dbus mailing list