diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-04-24 22:01:24 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-04-24 22:01:24 +0000 |
commit | f85f711a31fb3489580dc66b23c566cec12b1467 (patch) | |
tree | 02bef418c041e3c84236e392fd58d6cc591e0f98 /hcid/Bluetooth.cs | |
parent | add2ef92778b7b1faaac70f43f2bef28dde4b4b0 (diff) |
Use the default adapter path provided by the Manager interface
Diffstat (limited to 'hcid/Bluetooth.cs')
-rw-r--r-- | hcid/Bluetooth.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/hcid/Bluetooth.cs b/hcid/Bluetooth.cs index 0b27f7d6..36b17e50 100644 --- a/hcid/Bluetooth.cs +++ b/hcid/Bluetooth.cs @@ -26,6 +26,12 @@ namespace Bluetooth using System; using DBus; + [Interface("org.bluez.Manager")] + internal abstract class ManagerProxy + { + [Method] public abstract string DefaultAdapter(); + } + public delegate void RemoteDeviceFoundHandler(string address, Int16 rssi, string major, string minor, string[] services); public delegate void RemoteNameUpdatedHandler(string address, string name); @@ -60,6 +66,7 @@ namespace Bluetooth { private Service service; private Connection connection; + private ManagerProxy manager; private AdapterProxy adapter; private string path; @@ -68,7 +75,7 @@ namespace Bluetooth public event RemoteNameUpdatedHandler RemoteNameUpdated; #pragma warning restore 0067 - public Adapter() : this("/org/bluez/hci0") + public Adapter() : this("") { } @@ -77,6 +84,11 @@ namespace Bluetooth connection = Bus.GetSystemBus(); service = Service.Get(connection, "org.bluez"); + manager = (ManagerProxy) service.GetObject(typeof(ManagerProxy), "/org/bluez"); + + if (path == "") + path = manager.DefaultAdapter(); + this.path = path; adapter = (AdapterProxy) service.GetObject(typeof(AdapterProxy), path); @@ -90,6 +102,7 @@ namespace Bluetooth public void Dispose() { GC.SuppressFinalize(adapter); + GC.SuppressFinalize(manager); } private void OnSignalCalled(Signal signal) |