def __init__(self, parent=None, ShaMem_comm = manage_comm.DEFAULT_COMM_SHARED_MEMORY): import libs.comm.serial_utils as serial_utils #GUI QtGui.QWidget.__init__(self, parent) self.ui = Ui_App.Ui_MainWindow() self.ui.setupUi(self) #nastaveni prvniho dostupneho portu self.ui.aSetPort.setText(serial_utils.enumerate_serial_ports().next()) #======================================================================= # DATABASE #======================================================================= try: self.db = sqlite.sqlite_db("db/test_db.sqlite") self.db.connect() except: print "E: GUI: Database" #======================================================================= # TABLES #======================================================================= self.GuiData = GuiData.GuiData() self.U = UsersModel.Users( UsersModel.UsersParameters(self)) self.T = TimesModel.Times( TimesModel.TimesParameters(self)) self.R = RunsModel.Runs( RunsModel.RunsParameters(self)) #doplneni self.T.params.tabRuns = self.R self.U.update() self.T.update() self.R.update() '''status bar''' self.showMessage("mode", self.GuiData.getMesureModeString() + " ["+self.GuiData.getRaceName()+"]", dialog=False) #======================================================================= # SIGNALS #======================================================================= QtCore.QObject.connect(self.ui.RunsProxyView.selectionModel(), QtCore.SIGNAL("selectionChanged(QItemSelection, QItemSelection)"), self.sRunsProxyView_SelectionChanged) QtCore.QObject.connect(self.ui.aSetPort, QtCore.SIGNAL("activated()"), self.sPortSet) QtCore.QObject.connect(self.ui.aRefresh, QtCore.SIGNAL("activated()"), self.sRefresh) QtCore.QObject.connect(self.ui.aConnectPort, QtCore.SIGNAL("activated()"), self.sPortConnect) QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL("activated()"), self.sAbout) QtCore.QObject.connect(self.ui.aRefreshMode, QtCore.SIGNAL("activated()"), self.sRefreshMode) QtCore.QObject.connect(self.ui.aLockMode, QtCore.SIGNAL("activated()"), self.sLockMode) QtCore.QObject.connect(self.ui.aEditMode, QtCore.SIGNAL("activated()"), self.sEditMode) QtCore.QObject.connect(self.ui.tabWidget, QtCore.SIGNAL("currentChanged (int)"), self.sTabChanged) QtCore.QObject.connect(self.ui.TimesShowAll, QtCore.SIGNAL("stateChanged (int)"), self.sTimesShowAllChanged) QtCore.QObject.connect(self.ui.timesShowZero, QtCore.SIGNAL("stateChanged (int)"), self.sTimesShowZeroChanged) #COMM self.ShaMem_comm = ShaMem_comm self.myManageComm = manage_comm.ManageComm(ShaMem_comm = self.ShaMem_comm) #COMM instance self.myManageComm.start() #start thread, 'run' flag should be 0, so this thread ends immediatelly
def run(self): print "COMM: zakladam vlakno.." dstore.Set("com_init", 2) ''' CONNECT TO EWITIS ''' try: self.protokol.open_port() except serial.SerialException: print "E: Cant open port" dstore.SetItem("port", ["opened"], False) return """ DATABASE """ try: self.db = sqlite.sqlite_db("db/test_db.sqlite") '''connect to db''' self.db.connect() except: #dstore.Set("port_enable", False) dstore.SetItem("port", ["opened"], False) print "E: Database" """communication established""" #dstore.Set("port_enable", True) dstore.SetItem("port", ["opened"], True) self.cell_nr = 0 """slot tasking""" idx = idx_a = idx_b = idx_c = 0 SLOT_A = [self.runGetCellOverview, self.runGetDeviceOverview, self.runGetTime, self.runGetTabSpecific, None] SLOT_B = [self.runGetRun, self.runGetCellInfo, None] SLOT_C = [self.runGetDeviceInfo, self.runGetRaceInfo, self.runGetDiagnostic] LeastCommonMultiple = len(SLOT_A) * len(SLOT_B) * len(SLOT_C) print "LCM:", LeastCommonMultiple while(1): #wait X millisecond, test if thread should be terminated ztime_first = time.clock() #wait #for i in range(10): for i in range(2): #wait time.sleep(0.01) #terminate thread? if dstore.Get("port")["opened"] == False: self.stop() return #print "I: Comm: waiting:",time.clock() - ztime_first,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] #ztime = time.clock() #communication enabled? if(dstore.Get("port")["enabled"] == False): continue """ GET HW-SW-VERSION only once (after start sw,hw = none) """ if(dstore.Get("versions")["hw"] == None) or (dstore.Get("versions")["fw"] == None): aux_version = self.send_receive_frame("GET_HW_SW_VERSION") print "version:", aux_version if ('error' in aux_version): print "E: Comm: no Hw and Fw versions on device" continue #no other commands as long as no version dstore.SetItem("versions", ["hw"], aux_version["hw"]) dstore.SetItem("versions", ["fw"], aux_version["fw"]) dstore.SetItem("versions", ["device"], aux_version["device"]) #print "I: Comm: versions:",time.clock() - ztime,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] #ztime = time.clock() """ end of hw-sw-version """ #print "I: Comm: each cycle: Actions: ",time.clock() - ztime,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] #ztime = time.clock() """calling run functions""" '''each cycle''' self.runDeviceActions() self.runCellActions() self.runActions() self.runDiagnosticSendCommand() '''slot A''' #print "-",idx,"-" idx_a = idx % len(SLOT_A) if idx_a != len(SLOT_A)-1: SLOT_A[idx_a]() else: '''slot B''' idx_b = (idx / len(SLOT_A)) % len(SLOT_B) if idx_b != len(SLOT_B)-1: SLOT_B[idx_b]() else: '''slot C''' idx_c = (idx / len(SLOT_A) / len(SLOT_B)) % len(SLOT_C) SLOT_C[idx_c]() idx = idx + 1 if(idx == LeastCommonMultiple): idx = 0 # print "I: Comm:", # if idx_a != len(SLOT_A)-1: # print "slot A", idx_a, # elif idx_b != len(SLOT_B)-1: # print "slot B", idx_b, # else: # print "slot C", idx_c, # print "-", idx, time.clock() - ztime_first,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] # #ztime = time.clock() """ """ if dstore.Get("com_init") != 0: dstore.Set("com_init", dstore.Get("com_init") - 1) dstore.SetItem("systemcheck", ["wdg_comm"], dstore.GetItem("systemcheck", ["wdg_comm"])+1)
def run(self): print "COMM: zakladam vlakno.." dstore.Set("com_init", 2) ''' CONNECT TO EWITIS ''' try: self.protokol.open_port() except serial.SerialException: print "E: Cant open port" dstore.SetItem("port", ["opened"], False) return """ DATABASE """ try: self.db = sqlite.sqlite_db("db/test_db.sqlite") '''connect to db''' self.db.connect() except: #dstore.Set("port_enable", False) dstore.SetItem("port", ["opened"], False) print "E: Database" """communication established""" #dstore.Set("port_enable", True) dstore.SetItem("port", ["opened"], True) while(1): #wait X millisecond, test if thread should be terminated ztime = time.clock() for i in range(10): #wait time.sleep(0.01) #terminate thread? if dstore.Get("port")["opened"] == False: self.stop() return #print "I: Comm: waiting:",time.clock() - ztime,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] #print "I: Comm: waiting:",time.clock() #communication enabled? if(dstore.Get("port")["enabled"] == False): continue #add diagnostic? diagnostic = False if(dstore.Get("diagnostic")["log_cyclic"] == 2): diagnostic = True """ GET HW-SW-VERSION only once (after start sw,hw = none) """ if(dstore.Get("versions")["hw"] == None) or (dstore.Get("versions")["fw"] == None): aux_version = self.send_receive_frame("GET_HW_SW_VERSION") print "version:", aux_version if ('error' in aux_version): print "E: Comm: no Hw and Fw versions on device" continue #no other commands as long as no version dstore.SetItem("versions", ["hw"], aux_version["hw"]) dstore.SetItem("versions", ["fw"], aux_version["fw"]) dstore.SetItem("versions", ["device"], aux_version["device"]) """ end of hw-sw-version """ """ SEND COMMAND diagnostic purpose """ if(dstore.Get("diagnostic")["sendcommandkey"] != None): #send command aux_response = self.send_receive_frame(dstore.Get("diagnostic")["sendcommandkey"], (dstore.Get("diagnostic")["senddata"]).decode('hex')) if ('error' in aux_response): print "COMM: sendcommand response: ERROR" #smazat request dstore.SetItem("diagnostic", ["sendcommandkey"], None) #set response (text to label) dstore.SetItem("diagnostic", ["sendresponse"], json.dumps(aux_response, indent = 4)) """ RUNS & TIMES & DATABASE PART - get new time - get new run - store new time to the databasae - store new run to the databasae """ """ GET NEW TIME """ aux_time = self.send_receive_frame("GET_TIME_PAR_INDEX", self.index_times, diagnostic = diagnostic) """ GET NEW RUN """ aux_run = self.send_receive_frame("GET_RUN_PAR_INDEX", self.index_runs, diagnostic = diagnostic) if(aux_time['error'] == 0 or aux_run['error'] == 0): print"=================" """ GET NEW RUN """ aux_diagnostic = dstore.Get("diagnostic") if(aux_time['error'] != 0): dstore.SetItem("diagnostic", ["no_new_time_cnt"], aux_diagnostic["no_new_time_cnt"]+1) if(aux_run['error'] != 0): dstore.SetItem("diagnostic", ["no_new_run_cnt"], aux_diagnostic["no_new_run_cnt"]+1) #dstore.SetItem("diagnostic", ["communication"], aux_diagnostic["communication"]+"<font color='red'>no new times (100)</font><br>") #dstore.SetItem("diagnostic", ["communication"], aux_diagnostic["communication"]+"<font color='green'>no new times (100)</font><br>") #dstore.SetItem("diagnostic", ["communication"], aux_diagnostic["communication"]+"<font color='blue'>no new times (100)</font><br>") """ STORE NEW TIME TO THE DATABASE """ if(aux_time['error'] == 0): self.AddTimeToDb(aux_time) self.index_times += 1 # done, take next eventCalcNow.set() else: pass # no new time """ STORE NEW RUN TO THE DATABASE """ if(aux_run['error'] == 0): self.AddRunToDb(aux_run) self.index_runs += 1 # done, take next else: pass # no new run """ end of Run & Times & Database """ """ GET RACE TIME """ aux_racetime = self.send_receive_frame("GET_ACTUAL_RACE_TIME", diagnostic = diagnostic) dstore.Set("race_time", aux_racetime['time']) """ barCellActions - enable/disable startcell - enable/disable finishcell - generate starttime - generate finishtime - quit timing - clear database - enable/disable tags reading """ '''CELL ADDRESS ACTIONS, toolbar''' """ set cell diag info""" set_cell_diagnostic = dstore.Get("set_cell_diag_info", "SET") if(set_cell_diagnostic['address'] != 0): ret = self.send_receive_frame("SET_CELL_DIAG_INFO", set_cell_diagnostic) dstore.SetItem("set_cell_diag_info", ['address'],0, "SET") """ ping cell """ address = dstore.Get("ping_cell", "SET") if(address != 0): ret = self.send_receive_frame("PING_CELL", address) dstore.Set("ping_cell", 0, "SET") """ run cell diagnostic""" address = dstore.Get("run_cell_diagnostic", "SET") if(address != 0): ret = self.send_receive_frame("RUN_CELL_DIAGNOSTIC", address) dstore.Set("run_cell_diagnostic", 0, "SET") '''CELL TASK ACTIONS, tab cells''' """ get cell last times """ task = dstore.Get("get_cell_last_times", "SET") if(task != 0): ret = self.send_receive_frame("GET_CELL_LAST_TIME", task) dstore.Set("get_cell_last_times", 0, "SET") """ enable cell """ task = dstore.Get("enable_cell", "SET") if(task != 0): ret = self.send_receive_frame("ENABLE_CELL", task) dstore.Set("enable_cell", 0, "SET") """ disable cell """ task = dstore.Get("disable_cell", "SET") if(task != 0): ret = self.send_receive_frame("DISABLE_CELL", task) dstore.Set("disable_cell", 0, "SET") """ generate celltime """ generate_celltime = dstore.Get("generate_celltime", "SET") if(generate_celltime['task'] != 0): ret = self.send_receive_frame("GENERATE_CELLTIME", generate_celltime) dstore.Set("generate_celltime", {'task':0, 'user_id':0}, "SET") """ quit timing """ if(dstore.IsChanged("quit_timing")): ret = self.send_receive_frame("QUIT_TIMING") dstore.ResetChangedFlag("quit_timing") """ clear database """ if(dstore.IsChanged("clear_database")): ret = self.send_receive_frame("CLEAR_DATABASE") print "I: Comm: clearing database, please wait.. " time.sleep(21) dstore.ResetChangedFlag("clear_database") print "I: Comm: database should be empty now" """ enable/disable tags reading """ if(dstore.IsChanged("tags_reading")): on_off = dstore.Get("tags_reading", "SET") ret = self.send_receive_frame("SET_TAGS_READING", on_off) dstore.ResetChangedFlag("tags_reading") if(on_off): print "I: Comm: Enable tags reading" else: print "I: Comm: Disable tags reading" """ end of ACTIONS """ """ tab RACE SETTINGS & tab DEVICE - set speaker - get terminal info - set timing settings """ if(dstore.GetItem("gui", ["active_tab"]) == TAB.race_settings)\ or (dstore.GetItem("gui", ["active_tab"]) == TAB.device): """ synchronize system """ if(dstore.IsChanged("synchronize_system")): ret = self.send_receive_frame("SYNCHRONIZE_SYSTEM") print "I: Comm: synchronize system.. " dstore.ResetChangedFlag("synchronize_system") """ set speaker """ if(dstore.IsChanged("speaker")): aux_speaker = dstore.Get("speaker", "SET") ret = self.send_receive_frame("SET_SPEAKER", aux_speaker) dstore.ResetChangedFlag("speaker") """ get terminal-info """ aux_terminal_info = self.send_receive_frame("GET_TERMINAL_INFO") """ store terminal-info to the datastore """ if not('error' in aux_terminal_info): if(dstore.IsReadyForRefresh("terminal_info")): dstore.Set("terminal_info", aux_terminal_info, "GET") else: print "I: COMM: terminal info: not ready for refresh", aux_terminal_info """ set timing settings """ if(dstore.IsChanged("timing_settings")): aux_timing_settings = dstore.Get("timing_settings", "SET") #print "TS", aux_timing_settings ret = self.send_receive_frame("SET_TIMING_SETTINGS", aux_timing_settings) dstore.ResetChangedFlag("timing_settings") """ tab CELLs - clear diag, run diag, buttons ping, """ if(dstore.GetItem("gui", ["active_tab"]) == TAB.cells): pass """ tab DIAGNOSTIC - get diagnostic """ if(dstore.GetItem("gui", ["active_tab"]) == TAB.diagnostic): """ get diagnostic """ #for cmd_group in DEF_COMMANDS.DEF_COMMAND_GROUP['diagnostic']: cmd_group = DEF_COMMANDS.DEF_COMMAND_GROUP['diagnostic']['development'] aux_diagnostic = self.send_receive_frame("GET_DIAGNOSTIC", cmd_group) #print "aux_diagnostic", aux_diagnostic """ store terminal-states to the datastore """ #if(dstore.IsReadyForRefresh("timing_settings")): # dstore.Set("timing_settings", aux_timing_setting, "GET") #else: # print "not ready for refresh", aux_timing_setting """ ALL TABs - get timing settings """ """ get timing-settings """ aux_timing_setting = self.send_receive_frame("GET_TIMING_SETTINGS", diagnostic = diagnostic) #aux_timing_setting["name_id"] = 4 """ store terminal-states to the datastore """ if not('error' in aux_timing_setting): if(dstore.IsReadyForRefresh("timing_settings")): dstore.Set("timing_settings", aux_timing_setting, "GET") #else: # print "I: COMM: aux_timing_setting: not ready for refresh",aux_timing_setting """ get cell info """ if OPTIKA_V2: #SET CELL INFO nr_changed_cells = dstore.IsChanged("cells_info") if(nr_changed_cells): print nr_changed_cells for nr_changed_cell in nr_changed_cells: aux_cell_info = dstore.GetItem("cells_info", [nr_changed_cell], "SET") #print "COMM: set cell info", nr_changed_cell, aux_cell_info ret = self.send_receive_frame("SET_CELL_INFO", aux_cell_info) dstore.ResetChangedFlag("cells_info") #GET CELL INFO aux_cells_info = [None] * NUMBER_OF.CELLS for i in range(0, NUMBER_OF.CELLS): aux_cells_info[i] = self.send_receive_frame("GET_CELL_INFO", i+1, diagnostic = diagnostic) """ store terminal-states to the datastore """ if not('error' in aux_cells_info[i]): if(dstore.IsReadyForRefresh("cells_info")): dstore.SetItem("cells_info", [i], aux_cells_info[i], "GET", permanent = False) if dstore.Get("com_init"): #synchro get a set, tzn. comboboxu s lineedit - po navazani komunikace #print "nastavuju", aux_cells_info[i]["task"] dstore.SetItem("cells_info", [i, "task"], aux_cells_info[i]["task"], "SET", permanent = False, changed = False) """ ALL SETs - potom bude parametr refreh v datastore zbytecny """ """ """ if dstore.Get("com_init") != 0: dstore.Set("com_init", dstore.Get("com_init") - 1) dstore.SetItem("systemcheck", ["wdg_comm"], dstore.GetItem("systemcheck", ["wdg_comm"])+1)
""" Created on 8.12.2013 @author: Meloun """ import libs.sqlite.sqlite as sqlite # ======================================================================= # DATABASE # ======================================================================= print "I: Database init" try: db = sqlite.sqlite_db("db/test_db.sqlite") db.connect() except: print "E: Database"
def run(self): print "COMM: zakladam vlakno..", time.clock() dstore.Set("com_init", 30) ##Reset all HW settings #projit def_data a co neni permanent tak dat do default? #BB version print "COMM: Reset: versions" dstore.SetItem("versions", ["hw"], None) dstore.SetItem("versions", ["sw"], None) #cell versions print "COMM: Reset: cells_info" #dstore.ResetToDefault("cells_info", "GET") #timing settings #cell info #device info ''' CONNECT TO EWITIS ''' try: self.protokol.open_port() except serial.SerialException: print "E: Cant open port" dstore.SetItem("port", ["opened"], False) return """ DATABASE """ try: self.db = sqlite.sqlite_db("db/test_db.sqlite") '''connect to db''' self.db.connect() except: #dstore.Set("port_enable", False) dstore.SetItem("port", ["opened"], False) print "E: Database" """communication established""" #dstore.Set("port_enable", True) dstore.SetItem("port", ["opened"], True) self.CellIdx_ForCellInfo = 0 self.CellIdx_ForVersions = 0 """slot tasking""" idx = idx_a = idx_b = idx_c = 0 SLOT_A = [self.runGetCellOverview, self.runGetDeviceOverview, self.runGetTime, None] SLOT_B = [self.runGetCellInfo, self.runGetTabSpecific, None] SLOT_C = [self.runGetDeviceInfo, self.runGetRaceInfo, self.runGetDiagnostic] LeastCommonMultiple = len(SLOT_A) * len(SLOT_B) * len(SLOT_C) print "LCM:", LeastCommonMultiple while(1): #wait X millisecond, test if thread should be terminated ztime_first = time.clock() #wait #for i in range(10): for i in range(2): #wait time.sleep(0.01) #terminate thread? if dstore.Get("port")["opened"] == False: try: aux_diagnostics = self.runGetDiagnostic() myjson = json.dumps(aux_diagnostics) filename = 'log/'+time.strftime("%Y_%m_%d__%H_%M_", time.localtime())+'00_diagnostics.txt' json.dump(aux_diagnostics, codecs.open(filename, 'w', 'utf-8'), ensure_ascii = False, indent = 4, sort_keys=True) #f = open("Diagnostics.log","w") #f.write( str(aux_diagnostics) ) #f.close() except: print "E: Comm: Diagnostics.log" self.stop() return #print "I: Comm: waiting:",time.clock() - ztime_first,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] #ztime = time.clock() #communication enabled? if(dstore.Get("port")["enabled"] == False): continue """ GET HW-SW-VERSION only once (after start sw,hw = none) """ if(dstore.Get("versions")["hw"] == None) or (dstore.Get("versions")["fw"] == None): aux_version = self.send_receive_frame("GET_HW_SW_VERSION") print "version:", aux_version if ('error' in aux_version): print "E: Comm: no Hw and Fw versions on device" continue #no other commands as long as no version dstore.SetItem("versions", ["hw"], aux_version["hw"]) dstore.SetItem("versions", ["fw"], aux_version["fw"]) dstore.SetItem("versions", ["device"], aux_version["device"]) #print "I: Comm: versions:",time.clock() - ztime,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] #ztime = time.clock() """ end of hw-sw-version """ #print "I: Comm: each cycle: Actions: ",time.clock() - ztime,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] #ztime = time.clock() """calling run functions""" '''each cycle''' self.runDeviceActions() self.runCellActions() self.runActions() self.runDiagnosticSendCommand() '''slot A''' if dstore.Get("development")["disabled_cyclic_commands"] == False: #print "-",idx,"-" idx_a = idx % len(SLOT_A) if idx_a != len(SLOT_A)-1: SLOT_A[idx_a]() else: '''slot B''' idx_b = (idx / len(SLOT_A)) % len(SLOT_B) if idx_b != len(SLOT_B)-1: SLOT_B[idx_b]() else: '''slot C''' idx_c = (idx / len(SLOT_A) / len(SLOT_B)) % len(SLOT_C) SLOT_C[idx_c]() idx = idx + 1 if(idx == LeastCommonMultiple): idx = 0 # print "I: Comm:", # if idx_a != len(SLOT_A)-1: # print "slot A", idx_a, # elif idx_b != len(SLOT_B)-1: # print "slot B", idx_b, # else: # print "slot C", idx_c, # print "-", idx, time.clock() - ztime_first,"s", datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3] # #ztime = time.clock() """ """ if dstore.Get("com_init") != 0: dstore.Set("com_init", dstore.Get("com_init") - 1) if(dstore.Get("com_init") == 0): """ Init Event """ # print "init: nastavuju" dstore.SetItem("gui", ["update_requests", "tableCells_sync"], True) print "COMM: Initialized" dstore.SetItem("systemcheck", ["wdg_comm"], dstore.GetItem("systemcheck", ["wdg_comm"])+1)
def run(self): import sqlite3 print "COMM: zakladam vlakno.." if(self.ShaMem_comm["enable"] == False): print "COMM: okamzite koncim vlakno.." return #=========================================================================== # CONNECT TO EWITIS #=========================================================================== try: self.protokol.open_port() except serial.SerialException: print "E: Cant open port" raise serial.SerialException #======================================================================= # DATABASE #======================================================================= try: self.db = sqlite.sqlite_db("db/test_db.sqlite") #self.tableTimes = sqlite.sqlite_table(self.db, "times") #self.tableRuns = sqlite.sqlite_table(self.db, "runs") '''connect to db''' self.db.connect() except: print "E: Database" #query = sql_queries.get_query_times_par_id(152) #res = self.db.query(query) #for item in res: # print item while(1): #wait 1 second, test if thread should be terminated for i in range(100): # time.sleep(0.01) #terminate thread? if(self.ShaMem_comm["enable"] == False): self.stop() return #print "COMM: ",self.ShaMem_comm["enable"] #=================================================================== # GET NEW TIME #=================================================================== try: aux_time = self.protokol.send_receive_frame(ew_comm.CMD_GET_TIME_PAR_INDEX, struct.pack('h',self.index_times)) aux_time['order'] = self.order except (serialprotocol.SendReceiveError) as (errno, strerror): print "E:SendReceiveError - {1}({0})".format(errno, strerror) continue #=================================================================== # GET NEW RUN #=================================================================== try: aux_run = self.protokol.send_receive_frame(ew_comm.CMD_GET_RUN_PAR_INDEX, struct.pack('h',self.index_runs)) #aux_run['order'] = self.order #print aux_run except (serialprotocol.SendReceiveError) as (errno, strerror): print "E:SendReceiveError - {1}({0})".format(errno, strerror) continue