Created
April 28, 2015 01:07
-
-
Save kuc-arc-f/a77188563af257497e6c to your computer and use it in GitHub Desktop.
agri-blog2-2a-python
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) | |
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