diff options
author | Martin Szulecki | 2015-01-26 23:37:08 +0100 |
---|---|---|
committer | Martin Szulecki | 2015-01-27 22:01:23 +0100 |
commit | 9d7667a1ace1da60f508fa075793bba87e98af4a (patch) | |
tree | 498ca6fb596f0b32f65f3607275adb977be09d07 /include | |
parent | 9aa2fdef1c2b6d2292562d926f8482424c3b65fb (diff) | |
download | libimobiledevice-9d7667a1ace1da60f508fa075793bba87e98af4a.tar.gz libimobiledevice-9d7667a1ace1da60f508fa075793bba87e98af4a.tar.bz2 |
installation_proxy: Refactor implementation, add new commands and helpers
Diffstat (limited to 'include')
-rw-r--r-- | include/libimobiledevice/installation_proxy.h | 117 |
1 files changed, 113 insertions, 4 deletions
diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h index 82af71b..6810978 100644 --- a/include/libimobiledevice/installation_proxy.h +++ b/include/libimobiledevice/installation_proxy.h @@ -3,7 +3,8 @@ * @brief Manage applications on a device. * \internal * - * Copyright (c) 2009 Nikias Bassen All Rights Reserved. + * Copyright (c) 2010-2015 Martin Szulecki All Rights Reserved. + * Copyright (c) 2010-2013 Nikias Bassen All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -107,8 +108,8 @@ typedef enum { typedef struct instproxy_client_private instproxy_client_private; typedef instproxy_client_private *instproxy_client_t; /**< The client handle. */ -/** Reports the status of the given operation */ -typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status, void *user_data); +/** Reports the status response of the given command */ +typedef void (*instproxy_status_cb_t) (plist_t command, plist_t status, void *user_data); /* Interface */ @@ -170,6 +171,41 @@ instproxy_error_t instproxy_client_free(instproxy_client_t client); instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result); /** + * List pages of installed applications in a callback. + * + * @param client The connected installation_proxy client + * @param client_options The client options to use, as PLIST_DICT, or NULL. + * Valid client options include: + * "ApplicationType" -> "System" + * "ApplicationType" -> "User" + * "ApplicationType" -> "Internal" + * "ApplicationType" -> "Any" + * @param status_cb Callback function to process each page of application + * information. Passing a callback is required. + * @param user_data Callback data passed to status_cb. + * + * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if + * an error occured. + */ +instproxy_error_t instproxy_browse_with_callback(instproxy_client_t client, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); + +/** + * Lookup information about specific applications from the device. + * + * @param client The connected installation_proxy client + * @param appids A PLIST_ARRAY with PLIST_STRINGs of bundle identifiers, a + * single PLIST_STRING for one bundle identifier or NULL to lookup all. + * @param client_options The client options to use, as PLIST_DICT, or NULL. + * Currently there are no known client options, so pass NULL here. + * @param result Pointer that will be set to a plist containing a PLIST_DICT + * holding requested information about the application or NULL on errors. + * + * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if + * an error occured. + */ +instproxy_error_t instproxy_lookup(instproxy_client_t client, plist_t appids, plist_t client_options, plist_t *result); + +/** * Install an application on the device. * * @param client The connected installation_proxy client @@ -333,10 +369,83 @@ instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid */ instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); +/** + * Checks a device for certain capabilities. + * + * @param client The connected installation_proxy client + * @param capabilities A PLIST_ARRAY with PLIST_STRINGs of capability names. + * The capabilities are passed through and queried from MobileGestalt. + * @param client_options The client options to use, as PLIST_DICT, or NULL. + * Currently there are no known client options, so pass NULL here. + * @param result Pointer that will be set to a plist containing a PLIST_DICT + * holding information if the capabilities matched or NULL on errors. + * + * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if + * an error occured. + */ +instproxy_error_t instproxy_check_capabilities_match(instproxy_client_t client, plist_t capabilities, plist_t client_options, plist_t *result); + /* Helper */ /** - * Create a new client_options plist. + * Gets the name from a command dictionary. + * + * @param command The dictionary describing the command. + * @param name Pointer to store the name of the command. + */ +void instproxy_command_get_name(plist_t command, char** name); + +/** + * Gets the name of a status. + * + * @param status The dictionary status response to use. + * @param name Pointer to store the name of the status. + */ +void instproxy_status_get_name(plist_t status, char **name); + +/** + * Gets error name, code and description from a response if available. + * + * @param status The dictionary status response to use. + * @param name Pointer to store the name of an error. + * @param description Pointer to store error description text if available. + * The caller is reponsible for freeing the allocated buffer after use. + * If NULL is passed no description will be returned. + * @param code Pointer to store the returned error code if available. + * If NULL is passed no error code will be returned. + * + * @return INSTPROXY_E_SUCCESS if no error is found or an INSTPROXY_E_* error + * value matching the error that ẃas found in the status. + */ +instproxy_error_t instproxy_status_get_error(plist_t status, char **name, char** description, uint64_t* code); + +/** + * Gets total and current item information from a browse response if available. + * + * @param status The dictionary status response to use. + * @param total Pointer to store the total number of items. + * @param current_index Pointer to store the current index of all browsed items. + * @param current_amount Pointer to store the amount of items in the + * current list. + * @param list Pointer to store a newly allocated plist with items. + * The caller is reponsible for freeing the list after use. + * If NULL is passed no list will be returned. If NULL is returned no + * list was found in the status. + */ +void instproxy_status_get_current_list(plist_t status, uint64_t* total, uint64_t* current_index, uint64_t* current_amount, plist_t* list); + + +/** + * Gets progress in percentage from a status if available. + * + * @param status The dictionary status response to use. + * @param name Pointer to store the progress in percent (0-100) or -1 if not + * progress was found in the status. + */ +void instproxy_status_get_percent_complete(plist_t status, int *percent); + +/** + * Creates a new client_options plist. * * @return A new plist_t of type PLIST_DICT. */ |