2016-12-20 21:09:01 +00:00
|
|
|
'''
|
|
|
|
Created on Dec 19, 2016
|
2016-12-19 15:38:30 +00:00
|
|
|
|
2016-12-20 21:09:01 +00:00
|
|
|
@author: klaehn
|
|
|
|
'''
|
2016-12-19 15:38:30 +00:00
|
|
|
import time
|
2017-03-30 14:41:54 +00:00
|
|
|
import sys
|
2017-04-09 06:24:40 +00:00
|
|
|
import logging
|
2017-04-10 08:38:37 +00:00
|
|
|
import gate_guard.gate
|
2016-12-19 15:38:30 +00:00
|
|
|
|
2016-12-20 21:09:01 +00:00
|
|
|
def main():
|
2017-04-11 07:13:33 +00:00
|
|
|
logging.basicConfig(filename='/var/log/gate_guard.log', level=logging.DEBUG, format='%(asctime)s %(message)s')
|
2017-04-10 08:38:37 +00:00
|
|
|
gate_state = gate_guard.gate.Gate()
|
2016-12-20 21:09:01 +00:00
|
|
|
try:
|
|
|
|
while True:
|
|
|
|
gate_state.poll()
|
2017-03-30 09:58:55 +00:00
|
|
|
time.sleep(0.1)
|
2016-12-19 15:38:30 +00:00
|
|
|
|
2016-12-20 21:09:01 +00:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
print "key exit"
|
|
|
|
return None
|
2016-12-19 15:38:30 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2016-12-20 21:09:01 +00:00
|
|
|
sys.exit(main())
|