blob: 23cfc827bc97ccf44f98dee0549e7a04c564a8c6 [file] [log] [blame]
csmartdaltond7a9db62016-09-22 05:10:02 -07001# 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
6import time
7
8class HardwareException(Exception):
9 def __init__(self, message, sleeptime=60):
10 Exception.__init__(self, message)
11 self.sleeptime = sleeptime
12
13class 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)