Class: NetworkManager

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-network-manager.rb,
lib/network_manager/modem.rb

Defined Under Namespace

Classes: Modem

Constant Summary collapse

MODEM_MANAGER_BUS_PATH =
'/org/freedesktop/ModemManager'
DBUS_PROPERTIES =
'freedesktop.DBus.Properties'
MM_DBUS_SERVICE =
'org.freedesktop.ModemManager'
MM_DBUS_INTERFACE_MODEM =
'org.freedesktop.ModemManager.Modem'
MM_DBUS_INTERFACE_MODEM_CDMA =
'org.freedesktop.ModemManager.Modem.Cdma'
MM_DBUS_INTERFACE_MODEM_GSM_CARD =
'org.freedesktop.ModemManager.Modem.Gsm.Card'
MM_DBUS_INTERFACE_MODEM_GSM_NETWORK =
'org.freedesktop.ModemManager.Modem.Gsm.Network'
MM_DBUS_INTERFACE_MODEM_SIMPLE =
'org.freedesktop.ModemManager.Modem.Simple'
MM_DBUS_INTERFACE_MODEM_GSM_USSD =
'org.freedesktop.ModemManager.Modem.Gsm.Ussd'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ NetworkManager

Returns a new instance of NetworkManager.



18
19
20
21
# File 'lib/ruby-network-manager.rb', line 18

def initialize(opts = {})
  set_options opts
  @bus        = DBus::SystemBus.instance
end

Instance Attribute Details

#modem_bus_pathObject (readonly)

Returns the value of attribute modem_bus_path.



6
7
8
# File 'lib/ruby-network-manager.rb', line 6

def modem_bus_path
  @modem_bus_path
end

#modem_serviceObject (readonly)

Returns the value of attribute modem_service.



6
7
8
# File 'lib/ruby-network-manager.rb', line 6

def modem_service
  @modem_service
end

Instance Method Details

#modems(opts = {}) ⇒ Object

Discover all enabled devices



24
25
26
27
28
29
# File 'lib/ruby-network-manager.rb', line 24

def modems(opts = {})
  @mm_service = @bus.service(@modem_service)
  @mm_object  = @mm_service.object(@modem_bus_path)
  @mm_object.introspect
  NetworkManager::Modem.fetch(@mm_object.EnumerateDevices()[0], service: @mm_service)
end