def Listen(self, event): fox_number = self.combobox_fox.GetValue() if fox_number == settings.DEMO_FOX_STRING: fox_number = 0 elif fox_number == settings.NO_FOX_MESSAGE: utils.MessageBox("No Fox Detected! Connect fox and press Refresh-button in Fox-tab") return False else: fox_number = int(fox_number) com = self.panel_fox.GetCom() if len(com) > fox_number: if com[fox_number] == "": self.panel_fox.TestFoxes(None) com = self.panel_fox.GetCom() else: self.panel_fox.TestFoxes(None) com = self.panel_fox.GetCom() if com[fox_number] == "": utils.MessageBox("Selected Fox does not seem to be connected") return self.con_listen_tag = fox_serial.Open(com[fox_number]) if self.con_listen_tag == None: return self.thread_listen_tag = self.ListenThread(self, self.con_listen_tag) self.thread_listen_tag.start() self.Bind(self.EVT_TAG_FOUND, self.TagFound) self.button_stop_listen_tag.Enable() self.button_listen_tag.Disable()
def SyncTime(con, with_error=True): try: # write time current_time = datetime.datetime.now() current_time = current_time.replace(microsecond=0) con.write(settings.COMMAND_SET_TIME + current_time.time().isoformat()) con.write("\r\n".encode('utf-8')) except serial.SerialException: utils.MessageBox("Could not write to Serial Port") allstr = fox_serial.ReadToPrompt(con) if (allstr[len(allstr) - 2].find(settings.FOX_PROMPT) < 0 or allstr[len(allstr) - 3].find(settings.OK_PROMPT) < 0) and \ (allstr[len(allstr) - 1].find(settings.FOX_PROMPT) < 0 or allstr[len(allstr) - 2].find(settings.OK_PROMPT) < 0): if with_error: utils.MessageBox("Fox does not respond correctly") return False try: # write date current_time = datetime.datetime.now() con.write(settings.COMMAND_SET_DATE + current_time.date().isoformat()) con.write("\r\n".encode('utf-8')) except serial.SerialException: utils.MessageBox("Could not write to Serial Port") allstr = fox_serial.ReadToPrompt(con) if (allstr[len(allstr) - 2].find(settings.FOX_PROMPT) < 0 or allstr[len(allstr) - 3].find(settings.OK_PROMPT) < 0) and \ (allstr[len(allstr) - 1].find(settings.FOX_PROMPT) < 0 or allstr[len(allstr) - 2].find(settings.OK_PROMPT) < 0): if with_error: utils.MessageBox("Fox does not respond correctly") return False return True
def ReadXml(self, root): user = root.find("user") if user == None: utils.MessageBox("File is not valid, no user-tag as direct child of root tag") return False self.list_ctrl.DeleteAllItems() for child in user: if child.tag == "user_item": try: name = child.attrib['name'] except KeyError: utils.MessageBox("File is not valid, tag \"user_item\" does not have a name-attribute") return False try: tag_id = child.attrib['tag_id'] except KeyError: utils.MessageBox("File is not valid, tag \"user_item\" does not have a tag_id-attribute") return False try: created = child.attrib['created'] except KeyError: utils.MessageBox("File is not valid, tag \"user_item\" does not have a created-attribute") return False if created == settings.STRING_TRUE: created = True elif created == settings.STRING_FALSE: created = False else: utils.MessageBox("File is not valid, attribute \"created\" in tag \"user_item\" must be either True or False") return False self.AddElement(name, tag_id, created) return True
def Program(self, event): index = -1 for i in range(0, len(self.buttons_program)): if self.buttons_program[i] == event.GetEventObject(): index = i if index == -1: # no index of button found, should not occur return self.tag_id_set_id = self.list_ctrl.GetItem(index, 1).GetText() self.index_set_id = index fox_number = self.combobox_fox.GetValue() if fox_number == settings.DEMO_FOX_STRING: fox_number = 0 elif fox_number == settings.NO_FOX_MESSAGE: utils.MessageBox("No Fox Detected! Connect fox and press Refresh-button in Fox-tab") return False else: fox_number = int(fox_number) com = self.panel_fox.GetCom() if len(com) > fox_number: if com[fox_number] == "": self.panel_fox.TestFoxes(None) com = self.panel_fox.GetCom() else: self.panel_fox.TestFoxes(None) com = self.panel_fox.GetCom() if com[fox_number] == "": utils.MessageBox("Selected Fox does not seem to be connected") return self.progress_dialog_set_id = wx.ProgressDialog("Set Transponder ID", "Take the transponder near the rfid module", 2, parent=self, style=wx.PD_APP_MODAL|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT) self.progress_dialog_set_id.SetInitialSize() self.progress_dialog_set_id.Update(0) self.con_set_id = fox_serial.Open(com[fox_number]) if self.con_set_id == None: self.progress_dialog_set_id.Destroy() return fox.SendCommand(self.con_set_id, settings.COMMAND_SET_ID, str(self.tag_id_set_id)) self.timer_set_id = wx.Timer(self) self.timer_set_id.Start(1000) self.Bind(wx.EVT_TIMER, self.SetIdTimer, self.timer_set_id)
def TestResponse(allstr, with_error): if CheckRespond(allstr, with_error) != True: return [False, 0] fox_number = allstr[0] try: if int(fox_number) < settings.FOX_NUMBER_MIN or int(fox_number) > settings.FOX_NUMBER_MAX: if with_error: utils.MessageBox("Fox returned wrong number: \"" + fox_number + "\". Number must be between " + settings.FOX_NUMBER_MIN + " and " + settings.FOX_NUMBER_MAX + ".") return [False, 0] except ValueError: if with_error: utils.MessageBox("Fox returned wrong number: \"" + str(fox_number) + "\". Number must be between " + str(settings.FOX_NUMBER_MIN) + " and " + str(settings.FOX_NUMBER_MAX) + ".") return [False, 0] int_fox_num = int(fox_number) return [True, int_fox_num]
def ReadTag(self, tag_string): for i in range(0, len(tag_string)): if tag_string[i].find(settings.MESSAGE_ERROR_TAG) >= 0: utils.MessageBox("Error reading tag") return False ret = self.TestString(tag_string[1], settings.TAG_TAG_ID) if ret[0] != False and ret[1] != False: tag_id = ret[2] else: return False secret = [] for i in range(0, 5): ret = self.TestString(tag_string[2 + i], settings.TAG_FOX[i]) if ret[0] != False and ret[1] != False: secret.append(ret[2]) else: return False history_tag_id = [] history_timestamp = [] for j in range(0, 5): history_tag_id.append([]) history_timestamp.append([]) for i in range(0, settings.TAG_HISTORY_ENTRIES_PER_FOX): ret = self.TestString(tag_string[9 + j * (settings.TAG_HISTORY_ENTRIES_PER_FOX * 2 + 2) + 2 * i], settings.TAG_TAG_ID) # + 2 because of one line with "" and one line with "Fox x:" if ret[0] != False and ret[1] != False: history_tag_id[j].append(ret[2]) else: return False ret = self.TestString(tag_string[9 + j * (settings.TAG_HISTORY_ENTRIES_PER_FOX * 2 + 2) + 2 * i + 1], settings.TAG_TIMESTAMP) # + 2 because of one line with "" and one line with "Fox x:" if ret[0] != False and ret[1] != False: history_timestamp[j].append(ret[2]) else: return False # check secret: correct_secret = [True, True, True, True, True] all_secrets_correct = True secret_msg = "" for i in range(0, 5): if self.panel_fox.GetSecret()[i] != secret[i]: correct_secret[i] = False secret_msg += "n" all_secrets_correct = False else: secret_msg += "y" time = [] for i in range(0, 5): tim = self.panel_fox.GetStartTime() tim.AddTS(wx.TimeSpan(0, 0, history_timestamp[i][0], 0)) time.append(tim.FormatISOTime()) self.AddElement(tag_id, time, secret_msg)
def CheckRespond(allstr, with_error=True): try: if (allstr[len(allstr) - 2].find(settings.FOX_PROMPT) >= 0 and allstr[len(allstr) - 3].find(settings.OK_PROMPT) >= 0) or\ (allstr[len(allstr) - 1].find(settings.FOX_PROMPT) >= 0 and allstr[len(allstr) - 2].find(settings.OK_PROMPT) >= 0): pass else: if with_error: utils.MessageBox("Fox not reachable, maybe there is not transmitter connected to selected COM-port?") return False return True except IndexError: return False
def ReadNumber(port, with_error=True): def TestResponse(allstr, with_error): if CheckRespond(allstr, with_error) != True: return [False, 0] fox_number = allstr[0] try: if int(fox_number) < settings.FOX_NUMBER_MIN or int(fox_number) > settings.FOX_NUMBER_MAX: if with_error: utils.MessageBox("Fox returned wrong number: \"" + fox_number + "\". Number must be between " + settings.FOX_NUMBER_MIN + " and " + settings.FOX_NUMBER_MAX + ".") return [False, 0] except ValueError: if with_error: utils.MessageBox("Fox returned wrong number: \"" + str(fox_number) + "\". Number must be between " + str(settings.FOX_NUMBER_MIN) + " and " + str(settings.FOX_NUMBER_MAX) + ".") return [False, 0] int_fox_num = int(fox_number) return [True, int_fox_num] con = fox_serial.Open(port, with_error=False) if con == None: if with_error: utils.MessageBox("Cannot open COM-port " + str(port)) return [False, 0] # this is necessary to clear the uart buffer if the welcome message is sent # -> sent one command and receive the answer # first time uart will receive binary zeros, second command is then correct fox_serial.ClearBuffer(con) fox_serial.Writeln(con, settings.COMMAND_GET_FOX_NUMBER) allstr = fox_serial.ReadToPrompt(con, False) ret = TestResponse(allstr, False) if ret[0] != True: fox_serial.ClearBuffer(con) fox_serial.ReadAll(con) fox_serial.Writeln(con, "exit") allstr3 = fox_serial.ReadToPrompt(con, False) #fox_serial.Writeln(con, "exit") #allstr3 = fox_serial.ReadToPrompt(con, False) fox_serial.Writeln(con, settings.COMMAND_GET_FOX_NUMBER) allstr = fox_serial.ReadToPrompt(con, False) ret = TestResponse(allstr, with_error) fox_serial.Close(con) return ret
def Open(self, event): openFileDialog = wx.FileDialog(self, "Open File", "", "", "ARDF-Transmitter Files (*.ardf)|*.ardf|All Files (*)|*", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) ret = openFileDialog.ShowModal() fn = openFileDialog.GetPath() openFileDialog.Destroy() if ret == wx.ID_CANCEL: return try: tree = ET.parse(fn) except ET.XMLSyntaxError: utils.MessageBox("File does not seem to be a valid XML-File") return root = tree.getroot() if root.tag != "transmitter": utils.MessageBox("File is not valid, root-tag name must be \"transmitter\"") return version = root.find("software_version") if version.text != settings.VERSION: msg = wx.MessageDialog(None, "File seems to be created with another software version, read it anyway?", style=wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION) ret = msg.ShowModal() msg.Destroy() if ret != wx.ID_YES: return success = True for key, i in self.nb.panels.iteritems(): if i.ReadXml(root) == False: success = False if success == True: self.filename = fn self.last_save_string = self.Saving(with_saving_to_file=False) self.nb.NbChanging(None) else: self.last_save_string = self.Saving(with_saving_to_file=False) self.nb.NbChanging(None) self.New(None)
def ReadCrystalFrequency(port, with_error=True): con = fox_serial.Open(port, with_error=False) if con == None: return [False, 0] fox_serial.Writeln(con, settings.COMMAND_GET_CRYSTAL_FREQUENCY) allstr = fox_serial.ReadToPrompt(con) fox_serial.Close(con) if CheckRespond(allstr, with_error) != True: return [False, 0] crystal_frequency = allstr[0] try: int_crystal_frequency = int(crystal_frequency) except ValueError: if with_error: utils.MessageBox("Fox returned wrong crystal frequency: \"" + crystal_frequency) return [False, 0] return [True, int_crystal_frequency]
def ReadXml(self, root): result = root.find("result") if result == None: utils.MessageBox("File is not valid, no result-tag as direct child of root tag") return False self.list_ctrl_tag.DeleteAllItems() for child in result: if child.tag == "result_item": try: name = child.attrib['name'] except KeyError: utils.MessageBox("File is not valid, tag \"result_item\" does not have a name-attribute") return False try: tag_id = child.attrib['tag_id'] except KeyError: utils.MessageBox("File is not valid, tag \"result_item\" does not have a tag_id-attribute") return False fox = [] try: for i in range(0, 5): fox.append(child.attrib['fox' + str(i + 1)]) except KeyError: utils.MessageBox("File is not valid, tag \"result_item\" does not have all fox-attributes (1 to 5)") return False try: finish = child.attrib['finish'] except KeyError: utils.MessageBox("File is not valid, tag \"result_item\" does not have a finish-attribute") return False try: secret = child.attrib['secret'] except KeyError: utils.MessageBox("File is not valid, tag \"result_item\" does not have a secret-attribute") return False self.AddElement(tag_id, fox, secret, finish, name, True) return True
def ReadXml(self, root): # fox tag fox = root.find("fox") if fox == None: utils.MessageBox( "File is not valid, no \"fox\"-tag found as direct child of root-tag" ) return False for i in range(0, 6): fox_name = "fox_" + str(i + 1) if i == 5: fox_name = "fox_demo" fox_x = fox.find(fox_name) if fox_x == None: utils.MessageBox("File is not valid, no \"" + fox_name + "\"-tag found as direct child of \"fox\"-tag") return False try: temp = fox_x.attrib['call'] self.combobox_call[i].SetValue(temp) except KeyError: utils.MessageBox("File is not valid, \"" + fox_name + "\"-tag does not have a \"call\"-attribute") return False try: temp = fox_x.attrib['checked'] if temp == settings.STRING_TRUE: self.checkbox_fox[i].SetValue(True) elif temp == settings.STRING_FALSE: self.checkbox_fox[i].SetValue(False) else: utils.MessageBox( "File is not valid, \"checked\"-attribute in \"" + fox_name + "\"-tag must be either \"" + settings.TRING_TRUE + "\" or \"" + settings.STRING_FALSE + "\"") return False except KeyError: utils.MessageBox( "File is not valid, \"" + fox_name + "\"-tag does not have a \"checked\"-attribute") return False if i != 5: # not for demo-fox because there is no transmit_minute-attribute try: temp = fox_x.attrib['transmit_minute'] self.combobox_minute[i].SetValue(temp) except KeyError: utils.MessageBox( "File is not valid, \"" + fox_name + "\"-tag does not have a \"transmit_minute\"-attribute") return False try: temp = fox_x.attrib['secret'] self.fox_secret[i] = int(temp) except KeyError: utils.MessageBox( "File is not valid, \"" + fox_name + "\"-tag does not have a \"secret\"-attribute") return False except ValueError: utils.MessageBox( "File is not valid, \"" + fox_name + "\"-tag does not have an integer number as \"secret\"-attribute" ) return False repetition_interval = fox.find("repetition_interval") if repetition_interval == None: utils.MessageBox( "File is not valid, \"fox\"-tag does not have a \"repetition_interval\"-tag as direct child" ) return False self.combobox_repetition.SetValue(repetition_interval.text) self.CheckboxFoxChanged(None) # frequency tag frequency = root.find("frequency") if frequency == None: utils.MessageBox( "File is not valid, no \"frequency\"-tag found as direct child of root-tag" ) return False amplitude_modulation = frequency.find("amplitude_modulation") if amplitude_modulation == None: utils.MessageBox( "File is not valid, \"frequency\"-tag does not have \"amplitude_modulation\"-tag as direct child" ) return False if amplitude_modulation.text == settings.STRING_TRUE: self.checkbox_modulation.SetValue(True) elif amplitude_modulation.text == settings.STRING_FALSE: self.checkbox_modulation.SetValue(False) else: utils.MessageBox( "File is not valid, text of \"amplitude_modulation\"-tag must be either \"" + settings.STRING_TRUE + "\" or \"" + settings.STRING_FALSE + "\"") return False freq = frequency.find("frequency") if freq == None: utils.MessageBox( "File is not valid, child tag of root-tag \"frequency\" does not have a \"frequency\"-tag" ) return False self.text_frequency.SetValue(freq.text) demo_freq = frequency.find("demo_fox_frequency") if demo_freq == None: utils.MessageBox( "File is not valid, \"frequency\"-tag does not have a \"demo_fox_frequency\"-tag as direct child" ) return False self.text_demo_frequency_freq.SetValue(demo_freq.text) amplitude = frequency.find("amplitude") if amplitude == None: utils.MessageBox( "File is not valid, \"frequency\"-tag does not have a \"amplitude\"-tag as direct child" ) return False self.text_amplitude.SetValue(amplitude.text) # timing tag timing = root.find("timing") if timing == None: utils.MessageBox( "File is not valid, no \"timing\"-tag found as direct child of root-tag" ) return False start_time = timing.find("start_time") if start_time == None: utils.MessageBox( "File is not valid, \"timing\"-tag does not have a \"start_time\"-tag as direct child" ) return False wxdt = wx.DateTime() if wxdt.ParseISOTime(start_time.text) == False: utils.MessageBox( "File is not valid, text of \"start_time\"-tag must be in iso8601-format (e.g 23:59:59)" ) return False self.start_time_picker.SetValue(wxdt) stop_time = timing.find("stop_time") if stop_time == None: utils.MessageBox( "File is not valid, \"timing\"-tag does not have a \"stop_time\"-tag as direct child" ) return False wxdt = wx.DateTime() if wxdt.ParseISOTime(stop_time.text) == False: utils.MessageBox( "File is not valid, text of \"stop_time\"-tag must be in iso8601-format (e.g. 23:59:59)" ) return False self.stop_time_picker.SetValue(wxdt) start_date = timing.find("start_date") if start_date == None: utils.MessageBox( "File is not valid, \"timing\"-tag does not have a \"start_date\"-tag as direct child" ) return False wxdt = wx.DateTime() if wxdt.ParseISODate(start_date.text) == False: utils.MessageBox( "File is not valid, text of \"start_date\"-tag must be in iso8601-format (e.g. 2016-04-08)" ) return False self.start_date_picker.SetValue(wxdt) stop_date = timing.find("stop_date") if stop_date == None: utils.MessageBox( "File is not valid, \"timing\"-tag does not have a \"stop_date\"-tag as direct child" ) return False wxdt = wx.DateTime() if wxdt.ParseISODate(stop_date.text) == False: utils.MessageBox( "File is not valid, text of \"stop_date\"-tag must be in iso8601-format (e.g. 2016-04-08)" ) return False self.stop_date_picker.SetValue(wxdt) # morsing tag morsing = root.find("morsing") if morsing == None: utils.MessageBox( "File is not valid, \"morsing\"-tag found as direct child of root-tag" ) return False try: self.text_morse_speed.SetValue(morsing.attrib['speed']) except KeyError: utils.MessageBox( "File is not valid, \"morsing\"-tag does not have a \"speed\"-attribute" ) return False return True
def ProgramFoxNumber(self, number): # number is from ARRAY_FOX_NUMBER! j = -1 # just a value that is not between FOX_NUMBER_MIN and FOX_NUMBER_MAX if number == settings.ARRAY_FOX_NUMBER_DEMO: transmit_minute = "0" secret = "1" repetition = "1" try: frequency = str( int( float(self.text_demo_frequency_freq.GetValue()) * 1000000)) except ValueError: utils.MessageBox( "Frequency does not seem to be a float-number (e.g. 3.5)") return False try: amplitude_int = int(self.text_amplitude.GetValue()) amplitude = str(amplitude_int) if amplitude_int < 0 or amplitude_int > 100: utils.MessageBox("Amplitude must be between 0 and 100") except ValueError: utils.MessageBox("Amplitude does not seem to be an integer") return False try: morse_int = int(self.text_morse_speed.GetValue()) morse = str(morse_int) except ValueError: utils.MessageBox("Morse-speed does not seem to be an integer") return False else: transmit_minute = self.combobox_minute[number].GetValue() secret = str(self.fox_secret[number]) repetition = self.combobox_repetition.GetValue() try: frequency = str( int(float(self.text_frequency.GetValue()) * 1000000)) except ValueError: utils.MessageBox( "Frequency does not seem to be a float-number (e.g. 3.5)") return False if number == settings.ARRAY_FOX_NUMBER_DEMO: number = settings.FOX_NUMBER_DEMO else: number = number + 1 fox_name = str(number) if number == settings.FOX_NUMBER_DEMO: fox_name = "Demo" if self.com[number] != "": ret = fox.ReadNumber(self.com[number]) if ret[0] == True: j = ret[1] progress_dialog = wx.ProgressDialog("Program Fox", "Check fox number", maximum=31, parent=None, style=wx.PD_APP_MODAL) progress_dialog.SetInitialSize() self.frame.Status("Program Fox " + str(number) + ": Check fox number") progress_dialog.Update( 0, "Program Fox " + str(number) + ": Check fox number") if j != number: self.TestFoxes(None) if self.com[number] != "": temp = fox.ReadNumber(self.com[number]) if temp[0] == True: j = temp[1] if j != number or self.com[number] == "": progress_dialog.Destroy() self.frame.Status("Program Fox " + str(number) + ": Failed") if number != settings.FOX_NUMBER_DEMO: utils.MessageBox("Fox " + str(number) + " is not connected") else: utils.MessageBox("Demo-Fox is not connected") return False con = fox_serial.Open(self.com[number]) if con == None: progress_dialog.Destroy() return False if self.checkbox_modulation.GetValue(): modulation_string = settings.STRING_ON else: modulation_string = settings.STRING_OFF commands = [ settings.COMMAND_SET_RELOAD, settings.COMMAND_SET_CALL_SIGN, settings.COMMAND_SET_FOX_MAX, settings.COMMAND_SET_TRANSMIT_MINUTE, settings.COMMAND_SET_FREQUENCY, settings.COMMAND_SET_START_DATE, settings.COMMAND_SET_START_TIME, settings.COMMAND_SET_STOP_DATE, settings.COMMAND_SET_STOP_TIME, settings.COMMAND_SET_WPM, settings.COMMAND_SET_MODULATION, settings.COMMAND_SET_MORSING, settings.COMMAND_SET_AMPLITUDE, settings.COMMAND_RESET_HISTORY, settings.COMMAND_SET_SECRET ] parameters = [ settings.STRING_OFF, self.combobox_call[number].GetValue() [:self.combobox_call[number].GetValue().find(" " )], # SET_CALL_SIGN repetition, # SET_FOX_MAX transmit_minute, # SET_TRANSMIT_MINUTE frequency, # SET_FREQUENCY self.start_date_picker.GetValue().FormatISODate( ), # SET_START_DATE self.start_time_picker.GetValue( as_wxDateTime=True).FormatISOTime(), # SET_START_TIME self.stop_date_picker.GetValue().FormatISODate(), # SET_STOP_DATE self.stop_time_picker.GetValue( as_wxDateTime=True).FormatISOTime(), # SET_STOP_TIME self.text_morse_speed.GetValue(), # SET_WPM modulation_string, # SET_MODULATION settings.STRING_ON, # SET_MORSING self.text_amplitude.GetValue(), # SET_AMPLITUDE "", # RESET HISTORY secret ] self.frame.Status("Program Fox " + str(number) + ": Write commands") progress_dialog.Update( 10, "Program Fox " + str(number) + ": Write commands") fox_serial.ReadAll(con) # continue here -> others with commands and parameters, oscillator frequency in fox-panel for i in range(0, len(commands)): fox.SendCommand(con, commands[i], parameters[i], with_error=False) suc = True for i in range(0, len(commands)): allstr = fox_serial.ReadToPrompt(con) if fox.CheckRespond(allstr, False) == False: utils.MessageBox(i) suc = False break if suc == False: progress_dialog.Destroy() utils.MessageBox("Fox does not respond correctly") self.frame.Status("Program Fox " + str(number) + ": Failed") fox_serial.Close(con) return False self.frame.Status("Program Fox " + str(number) + ": Synchronise time") progress_dialog.Update( 20, "Program Fox " + str(number) + ": Synchronise time") if fox.SyncTime(con, with_error=False) == False: utils.MessageBox("Fox " + str(number) + " does not respond correctly") self.frame.Status("Program Fox " + str(number) + ": Failed") progress_dialog.Destroy() fox_serial.Writeln( con, settings.COMMAND_SET_RELOAD + settings.STRING_ON) fox_serial.ReadToPrompt() fox_serial.Close(con) return False progress_dialog.Update(30) fox_serial.Writeln(con, settings.COMMAND_SET_RELOAD + settings.STRING_ON) allstr = fox_serial.ReadToPrompt(con) if fox.CheckRespond(allstr, False) == False: utils.MessageBox("Fox does not respond correctly") self.frame.Status("Program Fox " + str(number) + ": Failed") fox_serial.Close(con) return False self.frame.Status("Fox " + str(number) + " programmed successfully") fox_serial.Close(con) progress_dialog.Destroy() return True
def TagFound(self, event): tag_string = self.thread_listen_tag.GetTag() if self.ReadTag(tag_string) == False: utils.MessageBox("Error reading tag")