Author | SHA1 | Message | Date |
---|---|---|---|
Maciek Borzecki | 01b298b0e9 | mconnectctl: realign command description in --help output | 7 years ago |
Maciek Borzecki | ad905bf40b | mconnectctl: update send SMS help description | 7 years ago |
Maciek Borzecki | 517a27d518 | mconnectctl: find-my-phone command | 7 years ago |
Maciek Borzecki | fe1cded886 | find-my-phone: support for 'find my phone' | 7 years ago |
Maciek Borzecki | d3b6534bc2 | packet: allow empty body | 7 years ago |
@ -0,0 +1,44 @@ | |||
/** | |||
* 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> | |||
*/ | |||
[DBus (name = "org.mconnect.Device.FindMyPhone")] | |||
class FindMyPhoneHandlerProxy : Object, PacketHandlerInterfaceProxy { | |||
private Device device = null; | |||
private FindMyPhoneHandler find_my_phone_handler = null; | |||
public FindMyPhoneHandlerProxy.for_device_handler (Device dev, | |||
PacketHandlerInterface iface) { | |||
this.device = dev; | |||
this.find_my_phone_handler = (FindMyPhoneHandler) iface; | |||
} | |||
[DBus (visible = false)] | |||
public void bus_register (DBusConnection conn, string path) throws IOError { | |||
conn.register_object (path, this); | |||
} | |||
[DBus (visible = false)] | |||
public void bus_unregister (DBusConnection conn) throws IOError { | |||
// conn.unregister_object(this); | |||
} | |||
public void ring () { | |||
this.find_my_phone_handler.ring (this.device); | |||
} | |||
} |
@ -0,0 +1,56 @@ | |||
/** | |||
* 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> | |||
*/ | |||
class FindMyPhoneHandler : Object, PacketHandlerInterface { | |||
public const string FIND_MY_PHONE = "kdeconnect.findmyphone.request"; | |||
public string get_pkt_type () { | |||
return FIND_MY_PHONE; | |||
} | |||
private FindMyPhoneHandler () { | |||
} | |||
public static FindMyPhoneHandler instance () { | |||
return new FindMyPhoneHandler (); | |||
} | |||
public void use_device (Device dev) { | |||
debug ("use device %s for ping", dev.to_string ()); | |||
dev.message.connect (this.message); | |||
} | |||
public void release_device (Device dev) { | |||
debug ("release device %s", dev.to_string ()); | |||
dev.message.disconnect (this.message); | |||
} | |||
public void message (Device dev, Packet pkt) { | |||
return; | |||
} | |||
private Packet make_find_my_phone_packet () { | |||
var pkt = new Packet (FIND_MY_PHONE, null); | |||
return pkt; | |||
} | |||
public void ring (Device dev) { | |||
dev.send (make_find_my_phone_packet ()); | |||
} | |||
} |
@ -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; | |||
} | |||
} |