575 @return converted text |
575 @return converted text |
576 @rtype bytearray |
576 @rtype bytearray |
577 @exception ValueError raised to indicate an invalid dataFormat |
577 @exception ValueError raised to indicate an invalid dataFormat |
578 parameter |
578 parameter |
579 """ |
579 """ |
580 if dataFormat not in self.__formatAndValidators.keys(): |
580 if dataFormat not in self.__formatAndValidators: |
581 raise ValueError("Bad value for 'dataFormat' parameter.") |
581 raise ValueError("Bad value for 'dataFormat' parameter.") |
582 |
582 |
583 if dataFormat == "hex": # hex format |
583 if dataFormat == "hex": # hex format |
584 ba = bytearray(QByteArray.fromHex(bytes(txt, encoding="ascii"))) |
584 ba = bytearray(QByteArray.fromHex(bytes(txt, encoding="ascii"))) |
585 elif dataFormat == "dec": # decimal format |
585 elif dataFormat == "dec": # decimal format |
606 @return formatted text |
606 @return formatted text |
607 @rtype str |
607 @rtype str |
608 @exception ValueError raised to indicate an invalid dataFormat |
608 @exception ValueError raised to indicate an invalid dataFormat |
609 parameter |
609 parameter |
610 """ |
610 """ |
611 if dataFormat not in self.__formatAndValidators.keys(): |
611 if dataFormat not in self.__formatAndValidators: |
612 raise ValueError("Bad value for 'dataFormat' parameter.") |
612 raise ValueError("Bad value for 'dataFormat' parameter.") |
613 |
613 |
614 if dataFormat == "hex": # hex format |
614 if dataFormat == "hex": # hex format |
615 txt = "{0:x}".format(self.__bytearray2int(array)) |
615 txt = "{0:x}".format(self.__bytearray2int(array)) |
616 elif dataFormat == "dec": # decimal format |
616 elif dataFormat == "dec": # decimal format |