From 2f1e0660ef0a3dcfa35c8003b0806bae3acd411d Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 11 Feb 2020 14:45:46 -0500 Subject: Add timeout and interrupt handling to debugserver. Fix debugserver_client_handle_response --- include/libimobiledevice/debugserver.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libimobiledevice/debugserver.h b/include/libimobiledevice/debugserver.h index ce8176c..03f97a4 100644 --- a/include/libimobiledevice/debugserver.h +++ b/include/libimobiledevice/debugserver.h @@ -119,7 +119,8 @@ debugserver_error_t debugserver_client_send(debugserver_client_t client, const c * @return DEBUGSERVER_E_SUCCESS on success, * DEBUGSERVER_E_INVALID_ARG when one or more parameters are * invalid, DEBUGSERVER_E_MUX_ERROR when a communication error - * occurs, or DEBUGSERVER_E_UNKNOWN_ERROR when an unspecified + * occurs, DEBUGSERVER_E_TIMEOUT when the timeout is reached, + * or DEBUGSERVER_E_UNKNOWN_ERROR when an unspecified * error occurs. */ debugserver_error_t debugserver_client_receive_with_timeout(debugserver_client_t client, char *data, uint32_t size, uint32_t *received, unsigned int timeout); @@ -177,6 +178,20 @@ debugserver_error_t debugserver_client_receive_response(debugserver_client_t cli */ debugserver_error_t debugserver_client_set_ack_mode(debugserver_client_t client, int enabled); +/** + * Sets behavior when awaiting a response from the server. + * + * @see debugserver_client_send_command, debugserver_client_receive_response, debugserver_client_receive + * + * @param client The debugserver client + * @param cancel_receive A function pointer that will be called approximately every receive_loop_timeout milliseconds; the function should return a boolean flag specifying whether to stop waiting for a response. If NULL, behaves as if it always returns true. + * @param receive_loop_timeout Time in milliseconds between calls to cancel_receive. + * + * @return DEBUGSERVER_E_SUCCESS on success, or an DEBUGSERVER_E_* error + * code otherwise. + */ +debugserver_error_t debugserver_client_set_receive_params(debugserver_client_t client, int (*cancel_receive)(), int receive_loop_timeout); + /** * Sets the argv which launches an app. * -- cgit v1.1-32-gdbae