8faf31c86f
The simulator fakes up some libraries so that the main door controller script can be tested without needing a Raspberry Pi. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
19 lines
380 B
Python
19 lines
380 B
Python
print("Using fake serial driver.")
|
|
|
|
import random
|
|
import string
|
|
|
|
class Serial:
|
|
def __init__(self, path, baudrate, timeout):
|
|
self.path = path
|
|
self.baudrate = baudrate
|
|
self.timeout = timeout
|
|
|
|
def read(self, count):
|
|
lst = [random.choice(string.hexdigits) for n in range(count - 2)]
|
|
ret = "A" + "".join(lst) + "D"
|
|
return ret.encode()
|
|
|
|
def flushInput(self):
|
|
pass
|