|
|
@ -66,6 +66,7 @@ namespace Mconnect { |
|
|
|
list-devices List devices |
|
|
|
allow-device <path> Allow device |
|
|
|
show-device <path> Show device details |
|
|
|
show-battery <path> Show device battery & charging |
|
|
|
|
|
|
|
share-url <path> <url> Share URL with device |
|
|
|
share-text <path> <text> Share text with device |
|
|
@ -94,6 +95,7 @@ namespace Mconnect { |
|
|
|
Command ("list-devices", 0, cl.cmd_list_devices), |
|
|
|
Command ("allow-device", 1, cl.cmd_allow_device), |
|
|
|
Command ("show-device", 1, cl.cmd_show_device), |
|
|
|
Command ("show-battery", 1, cl.cmd_show_battery), |
|
|
|
Command ("share-url", 2, cl.cmd_share_url), |
|
|
|
Command ("share-text", 2, cl.cmd_share_text), |
|
|
|
Command ("share-file", 2, cl.cmd_share_file), |
|
|
@ -136,6 +138,7 @@ namespace Mconnect { |
|
|
|
} |
|
|
|
|
|
|
|
debug ("running callback"); |
|
|
|
debug("TEST"); |
|
|
|
return cmden.clbk (command_args); |
|
|
|
} |
|
|
|
} |
|
|
@ -254,6 +257,18 @@ namespace Mconnect { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private int cmd_show_battery(string[] args) { |
|
|
|
debug("DEBUG_0"); |
|
|
|
return checked_dbus_call (() => { |
|
|
|
var bt = get_battery (new ObjectPath (args[0])); |
|
|
|
|
|
|
|
stdout.printf ("Level: %u\n" + |
|
|
|
"Charging: %d\n", |
|
|
|
bt.level, |
|
|
|
bt.charging); |
|
|
|
return 0; |
|
|
|
}); |
|
|
|
} |
|
|
|
private delegate int CheckDBusCallFunc () throws Error; |
|
|
|
|
|
|
|
/** |
|
|
@ -323,6 +338,18 @@ namespace Mconnect { |
|
|
|
return get_mconnect_obj_proxy (path); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* get_device: |
|
|
|
* @path device object path |
|
|
|
* |
|
|
|
* Obtain DBus interface to Device.Battery |
|
|
|
* |
|
|
|
* @return interface or null |
|
|
|
*/ |
|
|
|
private BatteryIface ? get_battery (ObjectPath path) throws IOError { |
|
|
|
return get_mconnect_obj_proxy (path); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* get_share: |
|
|
|
* |
|
|
@ -378,4 +405,4 @@ namespace Mconnect { |
|
|
|
|
|
|
|
private delegate string GetDescFunc (ObjectPath obj_path); |
|
|
|
} |
|
|
|
} |
|
|
|
} |