def wait_for_power_and_battery(args): global VERDICT, OUTPUT if wait_for_event("power status", ["Charging", "Full"]) and wait_for_event("battery presence", '1'): menu(validation_menu, initial_menu_items) else: OUTPUT = "FAILURE: Did not find power status 'Charging' or 'Full' and battery connected" print_to_console_and_logcat(OUTPUT) VERDICT = FAILURE menu(validation_menu[1:], initial_menu_items)
def wait_for_battery_disconnect(args): global VERDICT, OUTPUT if wait_for_event("battery presence", '0'): OUTPUT = "SUCCESS" print_to_console_and_logcat(OUTPUT) VERDICT = SUCCESS else: OUTPUT = "FAILURE: Did not find battery disconnected" print_to_console_and_logcat(OUTPUT) VERDICT = FAILURE
def wait_for_battery_full(args): global VERDICT, OUTPUT if wait_for_event("power status", 'Full', wait_time_sec): OUTPUT = "SUCCESS" print_to_console_and_logcat(OUTPUT) VERDICT = SUCCESS else: OUTPUT = "FAILURE: Did not find battery full status after waiting {} hours".format(wait_time_hours) print_to_console_and_logcat(OUTPUT) VERDICT = FAILURE
def pre_check_verification(args): global VERDICT, OUTPUT if wait_for_event("power status", pre_check_status): menu(validation_menu, initial_menu_items) else: OUTPUT = "FAILURE: Did not find power status '{}'".format( pre_check_status) print_to_console_and_logcat(OUTPUT) VERDICT = FAILURE menu(validation_menu[1:], initial_menu_items)
def wait_for_status(args): global VERDICT, OUTPUT if wait_for_event("power status", check_status): message = "SUCCESS" print_to_console_and_logcat(message) VERDICT = SUCCESS else: message = "FAILURE: Did not find power status '{}', instead found status '{}'" message = message.format(check_status, get_charging_status()) print_to_console_and_logcat(message) VERDICT = FAILURE OUTPUT = message
def wait_for_status(): global VERDICT, OUTPUT global current_iteration tmp_status = check_status if check_status == "Charging": tmp_status = [check_status, "Full"] if wait_for_event("power status", tmp_status): return True else: OUTPUT = "FAILURE: Did not find power status '{}'".format(check_status) print_to_console_and_logcat(OUTPUT) VERDICT = FAILURE print "Do you want to repeat the test ? (y/n)" while True: input_line = raw_input("") if input_line == "y": current_iteration = 0 return True elif input_line == "n": return False