Class: NetworkManager::DBus::Root
- Inherits:
-
Object
- Object
- NetworkManager::DBus::Root
- Includes:
- DBusInterface::Object
- Defined in:
- lib/network_manager/dbus/root.rb
Constant Summary collapse
- NM_STATE_UNKNOWN =
Networking state is unknown.
0
- NM_STATE_ASLEEP =
Networking is inactive and all devices are disabled.
10
- NM_STATE_DISCONNECTED =
There is no active network connection.
20
- NM_STATE_DISCONNECTING =
Network connections are being cleaned up.
30
- NM_STATE_CONNECTING =
A network device is connecting to a network and there is no other available network connection.
40
- NM_STATE_CONNECTED_LOCAL =
A network device is connected, but there is only link-local connectivity.
50
- NM_STATE_CONNECTED_SITE =
A network device is connected, but there is only site-local connectivity.
60
- NM_STATE_CONNECTED_GLOBAL =
A network device is connected, with global network connectivity.
70
Class Method Summary collapse
- .activate_connection(con, dev, optional = NetworkManager::DBus::NULL_OBJECT) ⇒ Object
- .device_by_interface(interface) ⇒ Object
-
.devices ⇒ Array<NetworkManager::DBus::Device>
] devices.
- .internet_connection? ⇒ Boolean
Methods included from DBusInterface::Object
#[], #call, included, #initialize, #object_path, #object_path=, #properties, #to_s
Class Method Details
.activate_connection(con, dev, optional = NetworkManager::DBus::NULL_OBJECT) ⇒ Object
32 33 34 |
# File 'lib/network_manager/dbus/root.rb', line 32 def self.activate_connection(con, dev, optional = NetworkManager::DBus::NULL_OBJECT) instance.call('ActivateConnection', con.object_path, dev.object_path, optional) end |
.device_by_interface(interface) ⇒ Object
36 37 38 39 |
# File 'lib/network_manager/dbus/root.rb', line 36 def self.device_by_interface(interface) paths = instance.call('GetDeviceByIpIface', interface) paths.empty? ? nil : new_device(paths.first) end |
.devices ⇒ Array<NetworkManager::DBus::Device>
Returns ] devices.
24 25 26 27 28 29 30 |
# File 'lib/network_manager/dbus/root.rb', line 24 def self.devices instance.call('GetDevices').map do |list| list.map do |object_path| new_device(object_path) end end.flatten end |
.internet_connection? ⇒ Boolean
41 42 43 |
# File 'lib/network_manager/dbus/root.rb', line 41 def self.internet_connection? instance.call('state').first == NM_STATE_CONNECTED_GLOBAL end |