Class: RubyConnman::Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_connman/manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeManager

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_interfaceObject

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

#scanObject



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_servicesObject



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