Created
April 27, 2015 22:42
-
-
Save kuc-arc-f/7417e967ba1379799b7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
ser=serial.Serial(mDevice ,9600) | |
clsParam = com_getparam.getparamClass() | |
clsCom = com_func.funcClass() | |
clsParse =com_putParse.putParseClass() | |
clsLog = com_logging2.loggingClass() | |
from datetime import datetime | |
tmBef = datetime.now() | |
while True: | |
val=ser.readline() | |
bFrom = clsParam.Is_fromMC(val) | |
if bFrom==True: | |
dic= clsParam.getDict(val) | |
sTime = datetime.now().strftime("%Y%m%d%H%M%S") | |
tmNow = datetime.now() | |
tmSpan = tmNow - tmBef | |
iSpan = tmSpan.total_seconds() | |
print "iSpan="+ str(iSpan) | |
if iSpan > mTimeMax: | |
tmBef = datetime.now() | |
try: | |
clsParse.send_parse(dic, sTime) | |
except: | |
print "--------------------------------------------" | |
print traceback.format_exc(sys.exc_info()[2]) | |
print "--------------------------------------------" | |
clsLog.debug( traceback.format_exc(sys.exc_info()[2]) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment