summaryrefslogtreecommitdiffstats
path: root/src/device_link_service.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-03-15 18:13:00 +0100
committerGravatar Martin Szulecki2010-03-15 19:13:07 +0100
commit2bde7add91ea63f0c2f2e3f090cf872168b504f9 (patch)
treede70bf1a34ec58501c851394cd8c54ce999c102b /src/device_link_service.c
parentd74b7217c374198ae79c1690f6f3234ed023021d (diff)
downloadlibimobiledevice-2bde7add91ea63f0c2f2e3f090cf872168b504f9.tar.gz
libimobiledevice-2bde7add91ea63f0c2f2e3f090cf872168b504f9.tar.bz2
Add device_link_service_send_ping function.
Diffstat (limited to 'src/device_link_service.c')
-rw-r--r--src/device_link_service.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/device_link_service.c b/src/device_link_service.c
index 7baef02..430b1db 100644
--- a/src/device_link_service.c
+++ b/src/device_link_service.c
@@ -254,6 +254,34 @@ device_link_service_error_t device_link_service_disconnect(device_link_service_c
}
/**
+ * Sends a DLMessagePing plist.
+ *
+ * @param client The device link service client to use.
+ * @param message String to send as ping message.
+ *
+ * @return DEVICE_LINK_SERVICE_E_SUCCESS on success,
+ * DEVICE_LINK_SERVICE_E_INVALID_ARG if client or message is invalid,
+ * or DEVICE_LINK_SERVICE_E_MUX_ERROR if the DLMessagePing plist could
+ * not be sent.
+ */
+device_link_service_error_t device_link_service_send_ping(device_link_service_client_t client, const char *message)
+{
+ if (!client || !client->parent || !message)
+ return DEVICE_LINK_SERVICE_E_INVALID_ARG;
+
+ plist_t array = plist_new_array();
+ plist_array_append_item(array, plist_new_string("DLMessagePing"));
+ plist_array_append_item(array, plist_new_string(message));
+
+ 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) {
+ err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
+ }
+ plist_free(array);
+ return err;
+}
+
+/**
* Sends a DLMessageProcessMessage plist.
*
* @param client The device link service client to use.