dbus linux system_bus_socket arm,DBUS发送接收数据(下)

1、编译后,由于没有进行配置,默认是无法运行的。

为了可以正常运行,增加或修改下面的配置文件即可。

/etc/dbus-1.0/system-local.conf

/p>

"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

system

messagebus

/usr/lib/dbus-1.0/dbus-daemon-launch-helper

/var/run/dbus/pid

EXTERNAL

unix:path=/var/run/dbus/system_bus_socket

send_interface="org.freedesktop.DBus"

send_member="UpdateActivationEnvironment"/>

send_interface="org.freedesktop.systemd1.Activator"/>

send_interface="org.freedesktop.systemd1.Activator"/>

system.d

contexts/dbus_contexts

2、测试消息发送

服务端:

$./testdbus_s.bin receive

Listening for signals

Match rule sent

Got Signal with value: Hello

Got Signal with value: Hi

Bye......

客户端:

$./testdbus_s.bin send Hello

Sending signal with value: Hello

Signal Sent

$./testdbus_s.bin send Hi

Sending signal with value: Hi

Signal Sent

$./testdbus_s.bin send Bye

Sending signal with value: Bye

Signal Sent

3、测试方法调用

服务端:

$./testdbus_s.bin listen

Listening for method calls

Method Invoked with value: Hello

Method Invoked with value: Hi

Bye......

客户端:

$./testdbus_s.bin query Hello

Calling remote method with Hello

Request Sent

Got Reply: 1, 21614

$./testdbus_s.bin query Hi

Calling remote method with Hi

Request Sent

Got Reply: 1, 21614

$./testdbus_s.bin query Bye

Calling remote method with Bye

Request Sent

Got Reply: 1, 21614

Share the post "DBUS发送接收数据(下)"