8 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
9 "org.moblin.connman.Manager")
12 print "Usage: %s <command>" % (sys.argv[0])
15 print " name <profile> [name]"
17 print " create <profile> [name]"
18 print " remove <profile>"
21 def print_profiles(profiles, active):
23 profile = dbus.Interface(bus.get_object("org.moblin.connman", path),
24 "org.moblin.connman.Profile")
26 properties = profile.GetProperties()
28 identifier = path[path.rfind("/") + 1:]
35 if "Name" in properties.keys():
36 name = properties["Name"]
40 print "%s %-12s %s" % (default, identifier, name)
42 if sys.argv[1] in ["list", "show"]:
43 properties = manager.GetProperties()
45 print_profiles(properties["Profiles"], properties["ActiveProfile"])
47 elif sys.argv[1] in ["name"]:
48 if (len(sys.argv) < 3):
49 print "Need at least profile parameter"
52 path = "/profile/" + sys.argv[2]
54 profile = dbus.Interface(bus.get_object("org.moblin.connman", path),
55 "org.moblin.connman.Profile")
57 if (len(sys.argv) > 3):
60 profile.SetProperty("Name", name);
62 print "Name \"%s\" set for %s" % (name, sys.argv[2])
64 properties = profile.GetProperties()
66 if "Name" in properties.keys():
67 name = "\"" + properties["Name"] + "\""
71 print "Name for %s is %s" % (sys.argv[2], name)
73 elif sys.argv[1] in ["create", "add"]:
74 if (len(sys.argv) < 3):
75 print "Profile parameter required"
78 path = manager.CreateProfile(sys.argv[2])
80 print "New profile created at %s" % (path)
82 profile = dbus.Interface(bus.get_object("org.moblin.connman", path),
83 "org.moblin.connman.Profile")
85 if (len(sys.argv) > 3):
88 profile.SetProperty("Name", name);
90 print "Name \"%s\" set for %s" % (name, sys.argv[2])
92 elif sys.argv[1] in ["remove", "delete", "del"]:
93 if (len(sys.argv) < 3):
94 print "Profile parameter required"
97 path = "/profile/" + sys.argv[2]
99 manager.RemoveProfile(path)
102 print "Unknown command"