def task(): while True: isCardP = [-1, -1] run = 1 count = 0 InitShowText("Insert Card Please") ser_Init() while run: time.sleep(1) ts = time.time() for i in range(0, 2): x = isCardPresent(i) # if -1, then it failed to read (maybe reset). if (x < 0): count += 1 #if 5 failed reads in a row, the system may have reset. if count > 5: print("Wait 60 seconds, maybe rebooted") time.sleep(60) run = 0 else: #Get Transition Change count = 0 if isCardP[i] != x: isCardP[i] = x st = datetime.datetime.fromtimestamp(ts).strftime( '%Y-%m-%d %H:%M:%S') if isCardP[i] == True: print "%s Card %d Present" % (st, i) log.info("%s Card %d Present" % (st, i)) emv_data = getEnvData(i) print emv_data log.info(emv_data) else: print "%s Card %d Removed" % (st, i) log.info("%s Card %d Removed" % (st, i)) root.after(2000, task) root.mainloop()
def task(): while True: isCardP=[-1, -1] run = 1 count = 0 InitShowText("Insert Card Please") ser_Init() while run: time.sleep(1) ts = time.time() for i in range(0,2): x = isCardPresent(i) # if -1, then it failed to read (maybe reset). if(x < 0): count+=1 #if 5 failed reads in a row, the system may have reset. if count > 5: print ("Wait 60 seconds, maybe rebooted") time.sleep(60) run = 0 else: #Get Transition Change count = 0 if isCardP[i] != x: isCardP[i] = x st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') if isCardP[i] == True: print "%s Card %d Present" % (st, i) log.info("%s Card %d Present" % (st, i)) emv_data = getEnvData(i) print emv_data log.info(emv_data) else: print "%s Card %d Removed" % (st, i) log.info("%s Card %d Removed" % (st, i)) root.after(2000, task) root.mainloop()
my_name = 'solendoid_test' test_count = 10 ##############USER DEFINED################################################################################## ##One time setup while True: test_count = 0 ########Passing Counters######## total_count = 0 run = 1 ################################ ##############INIT ################# set_log_info(my_path, my_name, 1) ser_Init() #card_bay_init() ##############INIT END############## get_log_cm().info('Start %s Test', my_name) get_log_cm().info('Test :\n Solenoid') card_bay_init() while run: #Total Test Cycles #get_log_cm().info( "\n") total_count+=1 pull_off() get_log_cm().debug( "Total Test Cycles = %d", total_count) time.sleep(5) pull_on() get_log_cm().debug( "Total Test Cycles = %d", total_count)
if __name__ == '__main__': ##############USER DEFINED################################################################################## ##Overwrite Log location my_path = '..\\solenoid_log\\' my_name = 'solendoid_test' test_count = 10 ##############USER DEFINED################################################################################## ##One time setup while True: test_count = 0 ########Passing Counters######## total_count = 0 run = 1 ################################ ##############INIT ################# set_log_info(my_path, my_name) ser_Init() #card_bay_init() ##############INIT END############## get_log_cm().info('Start %s Test', my_name) get_log_cm().info('Test :\n Solenoid') while run: #Total Test Cycles #get_log_cm().info( "\n") total_count += 1 get_log_cm().debug("Total Test Cycles = %d", total_count) time.sleep(1)
#Main Code Here ################################################## if __name__=='__main__': while True: isCardP=[-1, -1] run = 1 count = 0 ##############USER DEFINED############## ##Overwrite Log location my_path = 'C:\MagTek\HCR-4\\fcc_log\\' my_name = 'fcc_test' ##############USER DEFINED############## log = ser_Init(my_path, my_name) #log = set_log_info(my_path, my_name) card_bay_init() while run: for i in range(0,2): x = isCardPresent(i) # if -1, then it failed to read (maybe reset). if(x < 0): count+=1 #if 5 failed reads in a row, the system may have reset. if count > 5: print ("Reading stopped, Reboot suspected") get_ser().close() run = 0
#Main Code Here ################################################## if __name__ == '__main__': while True: isCardP = [-1, -1] run = 1 count = 0 ##############USER DEFINED############## ##Overwrite Log location my_path = 'C:\MagTek\HCR-4\\fcc_log\\' my_name = 'fcc_test' ##############USER DEFINED############## log = ser_Init(my_path, my_name) #log = set_log_info(my_path, my_name) card_bay_init() while run: for i in range(0, 2): x = isCardPresent(i) # if -1, then it failed to read (maybe reset). if (x < 0): count += 1 #if 5 failed reads in a row, the system may have reset. if count > 5: print("Reading stopped, Reboot suspected") get_ser().close() run = 0 break