summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2011-04-28 21:01:27 +0200
committerGravatar Martin Szulecki2011-04-28 21:01:27 +0200
commitfa40b4ad59bce6b9d8c3a0763b09530e8cf2a006 (patch)
treeb3c3409dac86c2d0ee90e1b620763bb37ac3b527
parentd81887cf6a0d067d8b345d8077027ccd634c1c17 (diff)
downloadlibimobiledevice-fa40b4ad59bce6b9d8c3a0763b09530e8cf2a006.tar.gz
libimobiledevice-fa40b4ad59bce6b9d8c3a0763b09530e8cf2a006.tar.bz2
device_link_service: Allow passing a reason message upon disconnecting
-rw-r--r--src/device_link_service.c8
-rw-r--r--src/device_link_service.h2
-rw-r--r--src/mobilebackup.c2
-rw-r--r--src/mobilebackup2.c1
-rw-r--r--src/mobilesync.c2
-rw-r--r--src/screenshotr.c2
6 files changed, 11 insertions, 6 deletions
diff --git a/src/device_link_service.c b/src/device_link_service.c
index 6083d80..5825f0c 100644
--- a/src/device_link_service.c
+++ b/src/device_link_service.c
@@ -235,20 +235,24 @@ leave:
* Performs a disconnect with the connected device link service client.
*
* @param client The device link service client to disconnect.
+ * @param message Optional message to send send to the device or NULL.
*
* @return DEVICE_LINK_SERVICE_E_SUCCESS on success,
* DEVICE_LINK_SERVICE_E_INVALID_ARG if client is NULL,
* or DEVICE_LINK_SERVICE_E_MUX_ERROR when there's an error when sending
* the the disconnect message.
*/
-device_link_service_error_t device_link_service_disconnect(device_link_service_client_t client)
+device_link_service_error_t device_link_service_disconnect(device_link_service_client_t client, const char *message)
{
if (!client)
return DEVICE_LINK_SERVICE_E_INVALID_ARG;
plist_t array = plist_new_array();
plist_array_append_item(array, plist_new_string("DLMessageDisconnect"));
- plist_array_append_item(array, plist_new_string("All done, thanks for the memories"));
+ if (message)
+ plist_array_append_item(array, plist_new_string(message));
+ else
+ plist_array_append_item(array, plist_new_string("___EmptyParameterString___"));
device_link_service_error_t err = DEVICE_LINK_SERVICE_E_SUCCESS;
if (property_list_service_send_binary_plist(client->parent, array) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
diff --git a/src/device_link_service.h b/src/device_link_service.h
index 9953f77..8589428 100644
--- a/src/device_link_service.h
+++ b/src/device_link_service.h
@@ -48,7 +48,7 @@ device_link_service_error_t device_link_service_send_ping(device_link_service_cl
device_link_service_error_t device_link_service_receive_message(device_link_service_client_t client, plist_t *msg_plist, char **dlmessage);
device_link_service_error_t device_link_service_send_process_message(device_link_service_client_t client, plist_t message);
device_link_service_error_t device_link_service_receive_process_message(device_link_service_client_t client, plist_t *message);
-device_link_service_error_t device_link_service_disconnect(device_link_service_client_t client);
+device_link_service_error_t device_link_service_disconnect(device_link_service_client_t client, const char *message);
device_link_service_error_t device_link_service_send(device_link_service_client_t client, plist_t plist);
device_link_service_error_t device_link_service_receive(device_link_service_client_t client, plist_t *plist);
diff --git a/src/mobilebackup.c b/src/mobilebackup.c
index fcff60d..78f9a5c 100644
--- a/src/mobilebackup.c
+++ b/src/mobilebackup.c
@@ -115,7 +115,7 @@ mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client)
return MOBILEBACKUP_E_INVALID_ARG;
mobilebackup_error_t err = MOBILEBACKUP_E_SUCCESS;
if (client->parent) {
- device_link_service_disconnect(client->parent);
+ device_link_service_disconnect(client->parent, NULL);
err = mobilebackup_error(device_link_service_client_free(client->parent));
}
free(client);
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c
index c72823e..c16da9a 100644
--- a/src/mobilebackup2.c
+++ b/src/mobilebackup2.c
@@ -116,6 +116,7 @@ mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client)
return MOBILEBACKUP2_E_INVALID_ARG;
mobilebackup2_error_t err = MOBILEBACKUP2_E_SUCCESS;
if (client->parent) {
+ device_link_service_disconnect(client->parent, NULL);
err = mobilebackup2_error(device_link_service_client_free(client->parent));
}
free(client);
diff --git a/src/mobilesync.c b/src/mobilesync.c
index ee9af5f..e600452 100644
--- a/src/mobilesync.c
+++ b/src/mobilesync.c
@@ -122,7 +122,7 @@ mobilesync_error_t mobilesync_client_free(mobilesync_client_t client)
{
if (!client)
return MOBILESYNC_E_INVALID_ARG;
- device_link_service_disconnect(client->parent);
+ device_link_service_disconnect(client->parent, "All done, thanks for the memories");
mobilesync_error_t err = mobilesync_error(device_link_service_client_free(client->parent));
free(client);
return err;
diff --git a/src/screenshotr.c b/src/screenshotr.c
index 0c4c9b2..e9301a9 100644
--- a/src/screenshotr.c
+++ b/src/screenshotr.c
@@ -114,7 +114,7 @@ screenshotr_error_t screenshotr_client_free(screenshotr_client_t client)
{
if (!client)
return SCREENSHOTR_E_INVALID_ARG;
- device_link_service_disconnect(client->parent);
+ device_link_service_disconnect(client->parent, NULL);
screenshotr_error_t err = screenshotr_error(device_link_service_client_free(client->parent));
free(client);
return err;