| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging, os, re, string, threading, time | 5 import logging, os, re, string, threading, time |
| 6 | 6 |
| 7 import dbus | 7 import dbus |
| 8 | 8 |
| 9 def make_dbus_boolean(value): | 9 def make_dbus_boolean(value): |
| 10 value = value.upper() | 10 value = value.upper() |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 def GetObjectList(self, kind, properties=None): | 237 def GetObjectList(self, kind, properties=None): |
| 238 if properties is None: | 238 if properties is None: |
| 239 properties = self.manager.GetProperties() | 239 properties = self.manager.GetProperties() |
| 240 return [self.GetObjectInterface(kind, path) | 240 return [self.GetObjectInterface(kind, path) |
| 241 for path in properties[self._GetContainerName(kind)]] | 241 for path in properties[self._GetContainerName(kind)]] |
| 242 | 242 |
| 243 def GetActiveProfile(self): | 243 def GetActiveProfile(self): |
| 244 properties = self.manager.GetProperties() | 244 properties = self.manager.GetProperties() |
| 245 return self.GetObjectInterface("Profile", properties["ActiveProfile"]) | 245 return self.GetObjectInterface("Profile", properties["ActiveProfile"]) |
| 246 | 246 |
| 247 def CreateProfile(self, ident): |
| 248 path = self.manager.CreateProfile(ident) |
| 249 return self.GetObjectInterface("Profile", path) |
| 250 |
| 251 def RemoveProfile(self, ident): |
| 252 self.manager.RemoveProfile(ident) |
| 253 |
| 254 def PushProfile(self, ident): |
| 255 path = self.manager.PushProfile(ident) |
| 256 return self.GetObjectInterface("Profile", path) |
| 257 |
| 258 def PopProfile(self, ident): |
| 259 self.manager.PopProfile(ident) |
| 260 |
| 261 def PopAnyProfile(self): |
| 262 self.manager.PopAnyProfile() |
| 263 |
| 247 def GetSystemState(self): | 264 def GetSystemState(self): |
| 248 properties = self.manager.GetProperties() | 265 properties = self.manager.GetProperties() |
| 249 return properties["State"] | 266 return properties["State"] |
| 250 | 267 |
| 251 def WaitForServiceState(self, service, expected_states, timeout, | 268 def WaitForServiceState(self, service, expected_states, timeout, |
| 252 ignore_failure=False, property_name="State"): | 269 ignore_failure=False, property_name="State"): |
| 253 """Wait until service enters a state in expected_states or times out. | 270 """Wait until service enters a state in expected_states or times out. |
| 254 Args: | 271 Args: |
| 255 service: service to watch | 272 service: service to watch |
| 256 expected_states: list of exit states | 273 expected_states: list of exit states |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 try: | 372 try: |
| 356 logging.info("Attempting to power on device %s", device_path) | 373 logging.info("Attempting to power on device %s", device_path) |
| 357 device = self.flim_.GetObjectInterface("Device", device_path) | 374 device = self.flim_.GetObjectInterface("Device", device_path) |
| 358 device.SetProperty("Powered", True) | 375 device.SetProperty("Powered", True) |
| 359 except Exception, e: | 376 except Exception, e: |
| 360 # We want to keep on trying to power things on, so save an | 377 # We want to keep on trying to power things on, so save an |
| 361 # exception and continue | 378 # exception and continue |
| 362 to_raise = e | 379 to_raise = e |
| 363 if to_raise: | 380 if to_raise: |
| 364 raise to_raise | 381 raise to_raise |
| OLD | NEW |