summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-07-09 02:50:48 +0200
committerGravatar Nikias Bassen2010-07-09 02:50:48 +0200
commit31ec3f32bb828a5851f920c51c8e8e6b8f1f682b (patch)
tree7bfd2ebdbe069878d224aca612d2b0d7b4ef7676 /src
parentccb63b0cc6335d2e186a9223b14f50542feeb982 (diff)
downloadlibimobiledevice-31ec3f32bb828a5851f920c51c8e8e6b8f1f682b.tar.gz
libimobiledevice-31ec3f32bb828a5851f920c51c8e8e6b8f1f682b.tar.bz2
sbservices: add support for fetching the home screen wallpaper
Diffstat (limited to 'src')
-rw-r--r--src/sbservices.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/sbservices.c b/src/sbservices.c
index 2678e24..e6342d1 100644
--- a/src/sbservices.c
+++ b/src/sbservices.c
@@ -269,3 +269,52 @@ leave_unlock:
}
+/**
+ * Get the home screen wallpaper as PNG data.
+ *
+ * @param client The connected sbservices client to use.
+ * @param pngdata Pointer that will point to a newly allocated buffer
+ * containing the PNG data upon successful return. It is up to the caller
+ * to free the memory.
+ * @param pngsize Pointer to a uint64_t that will be set to the size of the
+ * buffer pngdata points to upon successful return.
+ *
+ * @return SBSERVICES_E_SUCCESS on success, SBSERVICES_E_INVALID_ARG when
+ * client or pngdata are invalid, or an SBSERVICES_E_* error
+ * code otherwise.
+ */
+sbservices_error_t sbservices_get_home_screen_wallpaper_pngdata(sbservices_client_t client, char **pngdata, uint64_t *pngsize)
+{
+ if (!client || !client->parent || !pngdata)
+ return SBSERVICES_E_INVALID_ARG;
+
+ sbservices_error_t res = SBSERVICES_E_UNKNOWN_ERROR;
+
+ plist_t dict = plist_new_dict();
+ plist_dict_insert_item(dict, "command", plist_new_string("getHomeScreenWallpaperPNGData"));
+
+ sbs_lock(client);
+
+ res = sbservices_error(property_list_service_send_binary_plist(client->parent, dict));
+ if (res != SBSERVICES_E_SUCCESS) {
+ debug_info("could not send plist, error %d", res);
+ goto leave_unlock;
+ }
+ plist_free(dict);
+
+ dict = NULL;
+ res = sbservices_error(property_list_service_receive_plist(client->parent, &dict));
+ if (res == SBSERVICES_E_SUCCESS) {
+ plist_t node = plist_dict_get_item(dict, "pngData");
+ if (node) {
+ plist_get_data_val(node, pngdata, pngsize);
+ }
+ }
+
+leave_unlock:
+ if (dict) {
+ plist_free(dict);
+ }
+ sbs_unlock(client);
+ return res;
+}