From 3604756139b1a2dde383122745d37fe9d1c95f88 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Mon, 5 Aug 2013 20:07:04 +0200 Subject: Implement *_start_service() helper to simplify creation of service clients --- src/mobile_image_mounter.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/mobile_image_mounter.c') diff --git a/src/mobile_image_mounter.c b/src/mobile_image_mounter.c index f2e423a..bc439f9 100644 --- a/src/mobile_image_mounter.c +++ b/src/mobile_image_mounter.c @@ -105,6 +105,26 @@ mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdown return MOBILE_IMAGE_MOUNTER_E_SUCCESS; } +/** + * Starts a new mobile_image_mounter service on the specified device and connects to it. + * + * @param device The device to connect to. + * @param client Pointer that will point to a newly allocated + * mobile_image_mounter_t upon successful return. Must be freed using + * mobile_image_mounter_free() after use. + * @param label The label to use for communication. Usually the program name. + * Pass NULL to disable sending the label in requests to lockdownd. + * + * @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on success, or an MOBILE_IMAGE_MOUNTER_E_* error + * code otherwise. + */ +mobile_image_mounter_error_t mobile_image_mounter_start_service(idevice_t device, mobile_image_mounter_client_t * client, const char* label) +{ + mobile_image_mounter_error_t err = MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR; + service_client_factory_start_service(device, MOBILE_IMAGE_MOUNTER_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(mobile_image_mounter_new), &err); + return err; +} + /** * Disconnects a mobile_image_mounter client from the device and frees up the * mobile_image_mounter client data. -- cgit v1.1-32-gdbae