diff options
| author | 2010-05-13 22:13:30 +0200 | |
|---|---|---|
| committer | 2010-05-13 22:13:30 +0200 | |
| commit | 8a776e490d689174cb91d89f43972300d37d4091 (patch) | |
| tree | 6028d98e39900a8a07144aa9378cfcedc7df4d5b /include/libimobiledevice/mobilesync.h | |
| parent | 6a1f93a003bb93c33687f2e8f6fcd68ab733527d (diff) | |
| download | libimobiledevice-8a776e490d689174cb91d89f43972300d37d4091.tar.gz libimobiledevice-8a776e490d689174cb91d89f43972300d37d4091.tar.bz2 | |
Implement mobilesync API
Diffstat (limited to 'include/libimobiledevice/mobilesync.h')
| -rw-r--r-- | include/libimobiledevice/mobilesync.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h index 7af3aef..4943f66 100644 --- a/include/libimobiledevice/mobilesync.h +++ b/include/libimobiledevice/mobilesync.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * @brief MobileSync Implementation | 3 | * @brief MobileSync Implementation |
| 4 | * \internal | 4 | * \internal |
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2010 Bryan Forbes All Rights Reserved. | ||
| 6 | * Copyright (c) 2009 Jonathan Beck All Rights Reserved. | 7 | * Copyright (c) 2009 Jonathan Beck All Rights Reserved. |
| 7 | * | 8 | * |
| 8 | * This library is free software; you can redistribute it and/or | 9 | * This library is free software; you can redistribute it and/or |
| @@ -28,6 +29,7 @@ extern "C" { | |||
| 28 | #endif | 29 | #endif |
| 29 | 30 | ||
| 30 | #include <libimobiledevice/libimobiledevice.h> | 31 | #include <libimobiledevice/libimobiledevice.h> |
| 32 | #include <glib.h> | ||
| 31 | 33 | ||
| 32 | /** @name Error Codes */ | 34 | /** @name Error Codes */ |
| 33 | /*@{*/ | 35 | /*@{*/ |
| @@ -36,21 +38,62 @@ extern "C" { | |||
| 36 | #define MOBILESYNC_E_PLIST_ERROR -2 | 38 | #define MOBILESYNC_E_PLIST_ERROR -2 |
| 37 | #define MOBILESYNC_E_MUX_ERROR -3 | 39 | #define MOBILESYNC_E_MUX_ERROR -3 |
| 38 | #define MOBILESYNC_E_BAD_VERSION -4 | 40 | #define MOBILESYNC_E_BAD_VERSION -4 |
| 41 | #define MOBILESYNC_E_SYNC_REFUSED -5 | ||
| 42 | #define MOBILESYNC_E_CANCELLED -6 | ||
| 43 | #define MOBILESYNC_E_WRONG_DIRECTION -7 | ||
| 44 | #define MOBILESYNC_E_NOT_READY -8 | ||
| 39 | 45 | ||
| 40 | #define MOBILESYNC_E_UNKNOWN_ERROR -256 | 46 | #define MOBILESYNC_E_UNKNOWN_ERROR -256 |
| 41 | /*@}*/ | 47 | /*@}*/ |
| 42 | 48 | ||
| 49 | typedef enum { | ||
| 50 | MOBILESYNC_SYNC_TYPE_FAST, | ||
| 51 | MOBILESYNC_SYNC_TYPE_SLOW, | ||
| 52 | MOBILESYNC_SYNC_TYPE_RESET | ||
| 53 | } mobilesync_sync_type_t; | ||
| 54 | |||
| 43 | /** Represents an error code. */ | 55 | /** Represents an error code. */ |
| 44 | typedef int16_t mobilesync_error_t; | 56 | typedef int16_t mobilesync_error_t; |
| 45 | 57 | ||
| 46 | typedef struct mobilesync_client_private mobilesync_client_private; | 58 | typedef struct mobilesync_client_private mobilesync_client_private; |
| 47 | typedef mobilesync_client_private *mobilesync_client_t; /**< The client handle */ | 59 | typedef mobilesync_client_private *mobilesync_client_t; /**< The client handle */ |
| 48 | 60 | ||
| 61 | typedef struct { | ||
| 62 | char *device_anchor; | ||
| 63 | char *computer_anchor; | ||
| 64 | } mobilesync_anchors; | ||
| 65 | typedef mobilesync_anchors *mobilesync_anchors_t; | ||
| 66 | |||
| 67 | /* Interface */ | ||
| 49 | mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client); | 68 | mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client); |
| 50 | mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); | 69 | mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); |
| 70 | |||
| 51 | mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist); | 71 | mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist); |
| 52 | mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); | 72 | mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); |
| 53 | 73 | ||
| 74 | mobilesync_error_t mobilesync_start(mobilesync_client_t client, const char *data_class, mobilesync_anchors_t anchors, mobilesync_sync_type_t *sync_type, uint64_t *data_class_version); | ||
| 75 | mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, const char* reason); | ||
| 76 | mobilesync_error_t mobilesync_finish(mobilesync_client_t client); | ||
| 77 | |||
| 78 | mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client); | ||
| 79 | mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client); | ||
| 80 | |||
| 81 | mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_t *entities, uint8_t *is_last_record, plist_t *actions); | ||
| 82 | mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_t client); | ||
| 83 | |||
| 84 | mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client); | ||
| 85 | |||
| 86 | mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist_t entities, uint8_t is_last_record, plist_t actions); | ||
| 87 | mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plist_t *mapping); | ||
| 88 | |||
| 89 | /* Helper */ | ||
| 90 | mobilesync_anchors_t mobilesync_anchors_new(const char *device_anchor, const char *computer_anchor); | ||
| 91 | void mobilesync_anchors_free(mobilesync_anchors_t anchors); | ||
| 92 | |||
| 93 | plist_t mobilesync_actions_new(); | ||
| 94 | void mobilesync_actions_add(plist_t actions, ...) G_GNUC_NULL_TERMINATED; | ||
| 95 | void mobilesync_actions_free(plist_t actions); | ||
| 96 | |||
| 54 | #ifdef __cplusplus | 97 | #ifdef __cplusplus |
| 55 | } | 98 | } |
| 56 | #endif | 99 | #endif |
