0. ready
dbusaddr=`ls /tmp |grep dbus`
export DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/${dbusaddr}"
启动dbus(根据conf来区别system session)
dbus-launch --auto-syntax --config-file=/usr/share/dbus-1/session.conf
dbus-launch --auto-syntax --config-file=/usr/share/dbus-1/session.conf > /tmp/dbusenv.sh
cat /tmp/dbusenv.sh | grep 'DBUS_SESSION_BUS_ADDRESS=' | awk -F ';' '{print $1}' > /tmp/dbusname
使用env.sh
dbusaddr=`cat /tmp/dbusname | cut -d "'" -f2`
export DBUS_SESSION_BUS_ADDRESS="${dbusaddr}"
或者
export DBUS_SESSION_BUS_ADDRESS=`cat /tmp/dbusname | cut -d "'" -f2`
1. dbus监控
dbus-monitor
2. 查看dbus注册信息
dbus-send --session --print-reply --dest=org.freedesktop.DBus /com/routon org.freedesktop.DBus.ListNames
dbus-send --system --print-reply --dest=org.freedesktop.DBus /com/routon org.freedesktop.DBus.ListNames
3. 命令形式发送数据
dbus-send --session --type=signal --dest=com.routon.ble.s1701 /com/routon com.routon.Method.TnMessage string:'com.routon.VNET' uint32:'129' string:':1.27'