1# Copyright (c) 2013 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 5# Setup wardmodem package root and other autotest paths. 6import common 7 8import state_machine 9 10class CallMachine(state_machine.StateMachine): 11 """ 12 This state machine simulates an active call over a registered network. 13 14 """ 15 # ########################################################################## 16 # Functions overriden from base class. 17 def get_well_known_name(self): 18 """ Returns the well known name for this machine. """ 19 return 'call_machine' 20 21 22 # ########################################################################## 23 # State machine API functions. 24 def connect_call(self): 25 """ Connect a call on a reigstered network. """ 26 power_level = self._state['power_level'] 27 if power_level == 'FULL': 28 self._update_state({'call_status': 'CONNECTED'}, 3000) 29 # Update level indicators 30 self._update_state({'level_call': 1}, 3000) 31 else: 32 self._logger.info(self._tag_with_name( 33 "Attempted to connect a call at power level: %s. Ignored." % 34 power_level)) 35 self._respond_ok() 36 37 38 def disconnect_call(self): 39 """ Disconnect an active call on a registered network. """ 40 self._update_state({'call_status': 'DISCONNECTED'}, 3000) 41 # Update level indicators 42 self._update_state({'level_call': 0}, 3000) 43 self._respond_ok() 44