static void display_totp() { int ret; char totp[7]; ret = oath_totp_generate(key, keylen, time(NULL), 30, 0, 6, totp); if (ret != 0) { fprintf(stderr, "Error generating totp value\n"); exit(-1); } ply_boot_client_tell_daemon_to_display_message (ply_client, totp, NULL, (ply_boot_client_response_handler_t) on_failure, NULL); }
Plymouth::answer_t Plymouth::displayMessage(const std::string & message){ ply_boot_client_attach_to_event_loop(_ply_client, _ply_event_loop); auto response_helper = [this] (int exit_status) -> void { ply_event_loop_exit(_ply_event_loop, exit_status); }; typedef decltype(response_helper) answer_helper_t; auto response_hdl = [] (void * data, ply_boot_client_t *) -> void{ (*reinterpret_cast<answer_helper_t*>(data))(OK); }; auto fail_hdl = [] (void *data, ply_boot_client_t*) -> void{ (*reinterpret_cast<answer_helper_t*>(data))(FAILED); }; ply_boot_client_tell_daemon_to_display_message(_ply_client, message.c_str(), response_hdl, fail_hdl, &response_helper); return static_cast<answer_t>(ply_event_loop_run(_ply_event_loop)); }
static void on_message_request (state_t *state, const char *command) { char *text; text = NULL; ply_command_parser_get_command_options (state->command_parser, command, "text", &text, NULL); if (text != NULL) { ply_boot_client_tell_daemon_to_display_message (state->client, text, (ply_boot_client_response_handler_t) on_success, (ply_boot_client_response_handler_t) on_failure, state); free (text); } }