aboutsummaryrefslogtreecommitdiff
path: root/src/bluetooth.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth.vala')
-rw-r--r--src/bluetooth.vala49
1 files changed, 8 insertions, 41 deletions
diff --git a/src/bluetooth.vala b/src/bluetooth.vala
index 100bdf2..b268701 100644
--- a/src/bluetooth.vala
+++ b/src/bluetooth.vala
@@ -27,22 +27,19 @@ public interface Bluetooth: Object
This work as a proxy for "does this hardware support bluetooth?" */
public abstract bool supported { get; protected set; }
- /* True if there are any bluetooth adapters powered up on the system.
- In short, whether or not this system's bluetooth is "on". */
- public abstract bool powered { get; protected set; }
+ /* True if bluetooth's enabled on this system.
+ Bluetooth can be soft-blocked by software and hard-blocked physically,
+ eg by a laptop's network killswitch */
+ public abstract bool enabled { get; protected set; }
+
+ /* Try to enable/disable bluetooth. This can fail if it's overridden
+ by the system, eg by a laptop's network killswitch */
+ public abstract void try_set_enabled (bool b);
/* True if our system can be seen by other bluetooth devices */
public abstract bool discoverable { get; protected set; }
public abstract void try_set_discoverable (bool discoverable);
- /* True if bluetooth's blocked. This can be soft-blocked by software and
- * hard-blocked physically, eg by a laptop's network killswitch */
- public abstract bool blocked { get; protected set; }
-
- /* Try to block/unblock bluetooth. This can fail if it's overridden
- by the system, eg by a laptop's network killswitch */
- public abstract void try_set_blocked (bool b);
-
/* Get a list of the Device structs that we know about */
public abstract List<unowned Device> get_devices ();
@@ -53,33 +50,3 @@ public interface Bluetooth: Object
The device_key argument comes from the Device struct */
public abstract void set_device_connected (uint device_key, bool connected);
}
-
-
-
-/**
- * Base class for Bluetooth objects that use a killswitch to implement
- * the 'discoverable' property.
- */
-public abstract class KillswitchBluetooth: Object, Bluetooth
-{
- private KillSwitch killswitch;
-
- public KillswitchBluetooth (KillSwitch killswitch)
- {
- // always sync our 'blocked' property with the one in killswitch
- this.killswitch = killswitch;
- blocked = killswitch.blocked;
- killswitch.notify["blocked"].connect (() => blocked = killswitch.blocked );
- }
-
- public bool supported { get; protected set; default = false; }
- public bool powered { get; protected set; default = false; }
- public bool discoverable { get; protected set; default = false; }
- public bool blocked { get; protected set; default = true; }
- public void try_set_blocked (bool b) { killswitch.try_set_blocked (b); }
-
- // empty implementations
- public abstract void try_set_discoverable (bool b);
- public abstract List<unowned Device> get_devices ();
- public abstract void set_device_connected (uint device_key, bool connected);
-}