| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 def GetObjectList(self, kind, properties=None): | 243 def GetObjectList(self, kind, properties=None): |
| 244 if properties is None: | 244 if properties is None: |
| 245 properties = self.manager.GetProperties() | 245 properties = self.manager.GetProperties() |
| 246 return [self.GetObjectInterface(kind, path) | 246 return [self.GetObjectInterface(kind, path) |
| 247 for path in properties[self._GetContainerName(kind)]] | 247 for path in properties[self._GetContainerName(kind)]] |
| 248 | 248 |
| 249 def GetActiveProfile(self): | 249 def GetActiveProfile(self): |
| 250 properties = self.manager.GetProperties() | 250 properties = self.manager.GetProperties() |
| 251 return self.GetObjectInterface("Profile", properties["ActiveProfile"]) | 251 return self.GetObjectInterface("Profile", properties["ActiveProfile"]) |
| 252 | 252 |
| 253 def CreateProfile(self, ident): |
| 254 path = self.manager.CreateProfile(ident) |
| 255 return self.GetObjectInterface("Profile", path) |
| 256 |
| 257 def RemoveProfile(self, ident): |
| 258 self.manager.RemoveProfile(ident) |
| 259 |
| 260 def PushProfile(self, ident): |
| 261 path = self.manager.PushProfile(ident) |
| 262 return self.GetObjectInterface("Profile", path) |
| 263 |
| 264 def PopProfile(self, ident): |
| 265 self.manager.PopProfile(ident) |
| 266 |
| 267 def PopAnyProfile(self): |
| 268 self.manager.PopAnyProfile() |
| 269 |
| 253 def GetSystemState(self): | 270 def GetSystemState(self): |
| 254 properties = self.manager.GetProperties() | 271 properties = self.manager.GetProperties() |
| 255 return properties["State"] | 272 return properties["State"] |
| 256 | 273 |
| 257 def WaitForServiceState(self, service, expected_states, timeout, | 274 def WaitForServiceState(self, service, expected_states, timeout, |
| 258 ignore_failure=False, property_name="State"): | 275 ignore_failure=False, property_name="State"): |
| 259 """Wait until service enters a state in expected_states or times out. | 276 """Wait until service enters a state in expected_states or times out. |
| 260 Args: | 277 Args: |
| 261 service: service to watch | 278 service: service to watch |
| 262 expected_states: list of exit states | 279 expected_states: list of exit states |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 try: | 378 try: |
| 362 logging.info("Attempting to power on device %s", device_path) | 379 logging.info("Attempting to power on device %s", device_path) |
| 363 device = self.flim_.GetObjectInterface("Device", device_path) | 380 device = self.flim_.GetObjectInterface("Device", device_path) |
| 364 device.SetProperty("Powered", True) | 381 device.SetProperty("Powered", True) |
| 365 except Exception, e: | 382 except Exception, e: |
| 366 # We want to keep on trying to power things on, so save an | 383 # We want to keep on trying to power things on, so save an |
| 367 # exception and continue | 384 # exception and continue |
| 368 to_raise = e | 385 to_raise = e |
| 369 if to_raise: | 386 if to_raise: |
| 370 raise to_raise | 387 raise to_raise |
| OLD | NEW |