Module: CMusBt::Device::Bluetooth
- Defined in:
- lib/cmus-bt/device/bluetooth.rb
Class Method Summary collapse
Class Method Details
.list ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cmus-bt/device/bluetooth.rb', line 41 def list ret = [] dir = objman.GetManagedObjects() dir.each { |path, hash| next if not hash.keys.include?("org.bluez.Device1") iface = hash["org.bluez.Device1"] next if iface["UUIDs"].none? {|id| /^0000110e-/ =~ id} next if not iface["Connected"] next if not iface["ServicesResolved"] ret << {:address => iface["Address"], :name => iface["Name"]} } return ret end |
.objman ⇒ Object
36 37 38 |
# File 'lib/cmus-bt/device/bluetooth.rb', line 36 def objman return @objman ||= root["org.freedesktop.DBus.ObjectManager"] end |
.root ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/cmus-bt/device/bluetooth.rb', line 26 def root if not @root @root = service["/"] @root.introspect end return @root end |
.service ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/cmus-bt/device/bluetooth.rb', line 16 def service if not @service @service = DBus.system_bus.service("org.bluez") @service.introspect end return @service end |