Class: RubyConnman::Manager
- Inherits:
-
Object
- Object
- RubyConnman::Manager
- Defined in:
- lib/ruby_connman/manager.rb
Instance Attribute Summary collapse
-
#service_interface ⇒ Object
Returns the value of attribute service_interface.
Instance Method Summary collapse
- #get_interface(network_interface) ⇒ Object
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
- #scan ⇒ Object
- #wifi_services ⇒ Object
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
5 6 7 8 9 |
# File 'lib/ruby_connman/manager.rb', line 5 def initialize @service_interface = DBus::SystemBus.instance.service('net.connman').object('/') @service_interface.introspect @service_interface = @service_interface['net.connman.Manager'] end |
Instance Attribute Details
#service_interface ⇒ Object
Returns the value of attribute service_interface.
3 4 5 |
# File 'lib/ruby_connman/manager.rb', line 3 def service_interface @service_interface end |
Instance Method Details
#get_interface(network_interface) ⇒ Object
28 29 30 31 |
# File 'lib/ruby_connman/manager.rb', line 28 def get_interface(network_interface) interface = @service_interface.GetServices.first.select { |a| a[1]['Ethernet']['Interface'] == network_interface } (interface.empty?) ? nil : interface.first end |
#scan ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ruby_connman/manager.rb', line 11 def scan interfaces = @service_interface.GetTechnologies.first.select { |a| a[1]['Type'] == 'wifi' } interfaces.each do |interface| RubyConnman::Technology.new(interface[0]).service_interface.Scan end end |
#wifi_services ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby_connman/manager.rb', line 18 def wifi_services temp = [] interfaces = @service_interface.GetServices.first.select { |a| a[1]['Type'] == 'wifi' } interfaces.each do |interface| #RubyConnman::Service.new(interface[0]) temp.push([interface[0], interface[1]]) end temp end |