From 5bc8ff5460d1b596649de5de71790aec952430b4 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 1 Aug 2013 18:33:44 -0500 Subject: improve documentation on Killswitch, Bluetooth, and Bluez --- src/killswitch.vala | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/killswitch.vala') diff --git a/src/killswitch.vala b/src/killswitch.vala index 92b1a3c..cf5c6c8 100644 --- a/src/killswitch.vala +++ b/src/killswitch.vala @@ -20,13 +20,24 @@ /** * Monitors whether or not bluetooth is blocked, * either by software (e.g., a session configuration setting) - * or by hardware (e.g., user disabled it via a physical switch on her laptop) + * or by hardware (e.g., user disabled it via a physical switch on her laptop). + * + * The Bluetooth class uses this as a backend for its 'blocked' property. + * Other code can't even see this, so use Bluetooth.blocked instead. :) */ public class KillSwitch: Object { public bool blocked { get; protected set; default = false; } - public void try_set_blocked (bool blocked) + public virtual void try_set_blocked (bool blocked) {} +} + +/** + * On Linux systems, monitors /dev/rfkill to watch for bluetooth blockage + */ +public class RfKillSwitch: KillSwitch +{ + public override void try_set_blocked (bool blocked) { return_if_fail (this.blocked != blocked); @@ -42,10 +53,6 @@ public class KillSwitch: Object warning ("Could not write rfkill event: %s", strerror(errno)); } - /*** - **** Past this point, it's all RfKill implementation details... - ***/ - private class Entry { public uint32 idx; @@ -68,13 +75,13 @@ public class KillSwitch: Object return false; } - ~KillSwitch () + ~RfKillSwitch () { Source.remove (watch); Posix.close (fd); } - public KillSwitch () + public RfKillSwitch () { entries = new HashTable(direct_hash, direct_equal); -- cgit v1.2.3