1# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import dbus 6import dbus.service 7 8import dbus_std_ifaces 9import pm_errors 10import utils 11 12from autotest_lib.client.cros.cellular import mm1_constants 13 14LOG_LEVELS = ['ERR', 'WARN', 'INFO', 'DEBUG'] 15 16class ModemManager(dbus_std_ifaces.DBusObjectManager): 17 """ Pseudomodem implementation of org.freedesktop.ModemManager1. """ 18 def __init__(self, bus): 19 dbus_std_ifaces.DBusObjectManager.__init__(self, bus, mm1_constants.MM1) 20 self.debug_level = 'INFO' 21 22 23 @utils.log_dbus_method() 24 @dbus.service.method(mm1_constants.I_MODEM_MANAGER) 25 def ScanDevices(self): 26 """ Starts a new scan for connected modem devices. """ 27 # TODO(armansito): For now this method is a noop. shill 28 # doesn't use this method afaik, but it doesn't make sense 29 # for a fake modem to do anything here anyway. Perhaps 30 # we can give the pseudo modem manager a list of fake 31 # modems upon initialization, and this method would add them? 32 pass 33 34 35 @utils.log_dbus_method() 36 @dbus.service.method(mm1_constants.I_MODEM_MANAGER, in_signature='s') 37 def SetLogging(self, level): 38 """ 39 Sets logging verbosity. 40 41 @param level: One of "ERR", "WARN", "INFO", "DEBUG" 42 43 """ 44 if level not in LOG_LEVELS: 45 raise pm_errors.MMCoreError(pm_errors.MMCoreError.INVALID_ARGS) 46