Sha256: 82f032fd2ad9c4d9a5111b6da42ab534ae45918c03357bb982f9f1be6606bdb9

Contents?: true

Size: 477 Bytes

Versions: 6

Compression:

Stored size: 477 Bytes

Contents

#! /usr/bin/env ruby
require "dbus"

bus = DBus::SystemBus.instance
nm_service = bus["org.freedesktop.NetworkManager"]
network_manager_object = nm_service["/org/freedesktop/NetworkManager"]
nm_iface = network_manager_object["org.freedesktop.NetworkManager"]

# read a property
enabled = nm_iface["WirelessEnabled"]
if enabled
  puts "Wireless is enabled"
else
  puts "Wireless is disabled"
end
puts "Toggling wireless"
# write a property
nm_iface["WirelessEnabled"] = !enabled

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-dbus-0.17.0 examples/simple/properties.rb
ruby-dbus-0.16.0 examples/simple/properties.rb
ruby-dbus-0.15.0 examples/simple/properties.rb
ruby-dbus-0.14.1 examples/simple/properties.rb
ruby-dbus-0.14.0 examples/simple/properties.rb
ruby-dbus-0.13.0 examples/simple/properties.rb