Browse Source

mconnectctl: find-my-phone command

bboozzoo/find-my-phone
Maciek Borzecki 7 years ago
parent
commit
517a27d518
3 changed files with 50 additions and 0 deletions
  1. +1
    -0
      meson.build
  2. +26
    -0
      src/mconnectctl/find-my-phone-iface.vala
  3. +23
    -0
      src/mconnectctl/main.vala

+ 1
- 0
meson.build View File

@ -77,6 +77,7 @@ mconnectctl_src = [
'src/mconnectctl/device-iface.vala', 'src/mconnectctl/device-iface.vala',
'src/mconnectctl/share-iface.vala', 'src/mconnectctl/share-iface.vala',
'src/mconnectctl/telephony-iface.vala', 'src/mconnectctl/telephony-iface.vala',
'src/mconnectctl/find-my-phone-iface.vala',
] ]
executable('mconnectctl', mconnectctl_src, executable('mconnectctl', mconnectctl_src,
dependencies : [glib_dep, gobject_dep, dependencies : [glib_dep, gobject_dep,


+ 26
- 0
src/mconnectctl/find-my-phone-iface.vala View File

@ -0,0 +1,26 @@
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* AUTHORS
* Maciek Borzecki <maciek.borzecki (at] gmail.com>
*/
namespace Mconnect {
[DBus (name = "org.mconnect.Device.FindMyPhone")]
public interface FindMyPhoneIface : Object {
public abstract void ring () throws IOError;
}
}

+ 23
- 0
src/mconnectctl/main.vala View File

@ -72,6 +72,8 @@ namespace Mconnect {
share-file <path> <file> Share file with device share-file <path> <file> Share file with device
send-sms <number> <message> Send SMS send-sms <number> <message> Send SMS
find-my-phone <path> Find my phone
""" """
); );
opt_context.set_help_enabled (true); opt_context.set_help_enabled (true);
@ -98,6 +100,7 @@ namespace Mconnect {
Command ("share-text", 2, cl.cmd_share_text), Command ("share-text", 2, cl.cmd_share_text),
Command ("share-file", 2, cl.cmd_share_file), Command ("share-file", 2, cl.cmd_share_file),
Command ("send-sms", 3, cl.cmd_send_sms), Command ("send-sms", 3, cl.cmd_send_sms),
Command ("find-my-phone", 1, cl.cmd_find_my_phone),
}; };
handle_command (remaining, commands); handle_command (remaining, commands);
@ -214,6 +217,15 @@ namespace Mconnect {
}); });
} }
private int cmd_find_my_phone (string[] args) {
return checked_dbus_call (() => {
var dp = args[0];
var fmp = get_find_my_phone (new ObjectPath (dp));
fmp.ring ();
return 0;
});
}
private void print_sorted_caps (string[] caps, string format) { private void print_sorted_caps (string[] caps, string format) {
qsort_with_data<string>(caps, sizeof (string), qsort_with_data<string>(caps, sizeof (string),
(a, b) => GLib.strcmp (a, b)); (a, b) => GLib.strcmp (a, b));
@ -345,6 +357,17 @@ namespace Mconnect {
return get_mconnect_obj_proxy (path); return get_mconnect_obj_proxy (path);
} }
/**
* get_find_my_phone:
*
* Obtain DBus interface to FindMyPhone of given device
*
* @return interface or null
*/
private FindMyPhoneIface ? get_find_my_phone (ObjectPath path) throws IOError {
return get_mconnect_obj_proxy (path);
}
/** /**
* print_paths: * print_paths:
* @objs: object paths * @objs: object paths


Loading…
Cancel
Save