...
The dbus-send application provides a convenient way to issue calls on DBus:
# Get a list of available condition types and their prototypes:
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.get_conditions
# Add a rule that prints a message when a laptop is unplugged:
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.add_rule \
string:’unplug_alert’ \
string:’whileUsingBatt()’ \
...
string:’logString(“Disconnected from AC power!”)’ \
string:’’
# Add a variable named battery_critical whose value is 7
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.add_var \
string:’battery_critical’ \
string:’7’
# Add a variable named critical_message whose value is “battery critical!”
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.add_var \
string:’critical_message’ \
string:’”battery critical!”’
# Print out all variables currently loaded--the two we added should be there
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.get_vars
# Add a rule using the two variables we added
...
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.add_rule \
string:’warn_critical’ \
string:’whileBattLessThan(0, $battery_critical)’ \
string:’logString($critical_message)’ \
string:’’
# Delete the rules we added
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.remove_rule \
string:’warn_critical’
dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.remove_rule \
string:’unplug_
...
alert’
# Delete the variables we added dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.remove_var \ string:’battery_critical’ dbus-send --system --print-reply --dest=com.citrix.xenclient.xcpmd /
...
com.citrix.xenclient.xcpmd.remove_var \
...
string:’critical_message’
More information on dbus-send is available at http://dbus.freedesktop.org/doc/dbus-send.1.html.
...