Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created April 28, 2015 01:07
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/a77188563af257497e6c to your computer and use it in GitHub Desktop.
Save kuc-arc-f/a77188563af257497e6c to your computer and use it in GitHub Desktop.
agri-blog2-2a-python
if __name__ == "__main__":
ser=serial.Serial(mDevice ,9600)
clsConst = com_appConst.appConstClass()
clsParam = com_getparam.getparamClass()
clsCom = com_func.funcClass()
clsParse =com_putParse.putParseClass()
clsLog = com_logging2.loggingClass()
clsPush =com_parsePush.parsePushClass()
from datetime import datetime
tmBef = datetime.now()
tmBefPush = 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()
if is_validTime(tmBefPush, tmNow, clsConst.mTimePush):
tmBefPush = datetime.now()
try:
clsPush.send_push(dic)
except:
print "--------------------------------------------"
print traceback.format_exc(sys.exc_info()[2])
print "--------------------------------------------"
clsLog.debug( traceback.format_exc(sys.exc_info()[2]) )
if is_validTime(tmBef, tmNow, clsConst.mTimeSensor):
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