diff options
Diffstat (limited to 'src/device_link_service.c')
-rw-r--r-- | src/device_link_service.c | 28 |
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. |