doors/simulator/serial.py
Anna Schumaker 8faf31c86f Create a door controller simulator
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>
2015-04-22 20:47:11 -04:00

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