csmartdalton | d7a9db6 | 2016-09-22 05:10:02 -0700 | [diff] [blame^] | 1 | # Copyright 2016 Google Inc. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | import time |
| 7 | |
| 8 | class HardwareException(Exception): |
| 9 | def __init__(self, message, sleeptime=60): |
| 10 | Exception.__init__(self, message) |
| 11 | self.sleeptime = sleeptime |
| 12 | |
| 13 | class Hardware: |
| 14 | def __init__(self): |
| 15 | self.kick_in_time = 0 |
| 16 | |
| 17 | def __enter__(self): |
| 18 | return self |
| 19 | |
| 20 | def __exit__(self, exception_type, exception_value, traceback): |
| 21 | pass |
| 22 | |
| 23 | def sanity_check(self): |
| 24 | '''Raises a HardwareException if any hardware state is not as expected.''' |
| 25 | pass |
| 26 | |
| 27 | def sleep(self, sleeptime): |
| 28 | '''Puts the hardware into a resting state for a fixed amount of time.''' |
| 29 | time.sleep(sleeptime) |