diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-08-01 18:33:44 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-08-01 18:33:44 -0500 |
commit | 5bc8ff5460d1b596649de5de71790aec952430b4 (patch) | |
tree | d2eb47a50316fb06766b33dbd1eaf3f193477a36 /src/killswitch.vala | |
parent | cf894302767d5ec483b5f8002bb796a284895bbf (diff) | |
download | ayatana-indicator-bluetooth-5bc8ff5460d1b596649de5de71790aec952430b4.tar.gz ayatana-indicator-bluetooth-5bc8ff5460d1b596649de5de71790aec952430b4.tar.bz2 ayatana-indicator-bluetooth-5bc8ff5460d1b596649de5de71790aec952430b4.zip |
improve documentation on Killswitch, Bluetooth, and Bluez
Diffstat (limited to 'src/killswitch.vala')
-rw-r--r-- | src/killswitch.vala | 23 |
1 files changed, 15 insertions, 8 deletions
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<uint32,Entry>(direct_hash, direct_equal); |