def search_connected_cards(cls,channel_number): try : print channel_number serial_port = Serial(int(channel_number)) except Exception, e: d_e = DomoticaException(e) d_e.log(cls.logger_instance) return "No se pudo habrir el puerto serial %s" % serial_port.port
def write_cards(self): cards_numbers = self.cards.keys() for card_number in cards_numbers : card = self.cards[card_number] if not 'w' in card.card_mode() : continue try : self.write_card(card) except DomoticaException, e : e.log(self.logger_instance) except Exception, e: d_e = DomoticaException("Excepcion no esperada en write card\ con card_id = %s (%s) "(card.get_id(),e.message)) d_e.log(self.logger_instance)
def test_cards_speeds(self,card_id=None): if card_id : cards_numbers = [card_id] else: self.reset() cards_numbers = self.cards.keys() # print "card_id " # print cards_numbers for c_id in cards_numbers : for i in range(5): if 'r' in self.cards[c_id].card_mode(): try : self.test_card_speed(c_id,'read') except DomoticaException, e: e.log(self.logger_instance) except Exception, e: d_e = DomoticaException(e) d_e.log(self.logger_instance) else: self.logger_instance.info("Test %d card %s OK" %(i,c_id)) if 'w' in self.cards[c_id].card_mode(): try : self.test_card_speed(c_id,'write') except DomoticaException, e: e.log(self.logger_instance) except Exception,e: d_e = DomoticaException(e) d_e.log(self.logger_instance)