Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created April 27, 2015 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuc-arc-f/7417e967ba1379799b7a to your computer and use it in GitHub Desktop.
Save kuc-arc-f/7417e967ba1379799b7a to your computer and use it in GitHub Desktop.
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