Ejemplo n.º 1
0
def check_command(command):
    """ Checks 9X and 55 commands to make sure they're correct.
    :param command []String 9X or 55 command
    :return Boolean True if it's a correct command and False if not.
    """
    if len(command) < 5:
        return False
    if command[0][0] == "9":
        calculated_command = GwtSUtils.int_array_to_hex_str(GwtSUtils.encode9x(" ".join(command[1:-1])))
    elif command[0][0] == "5":
        calculated_command = GwtSUtils.int_array_to_hex_str(GwtSUtils.encode55(" ".join(command[2:-1])))
    else:
        return False
    if calculated_command == " ".join(command):
        return True
    return False