summaryrefslogtreecommitdiffstats
path: root/cython/mobilesync.pxi
diff options
context:
space:
mode:
Diffstat (limited to 'cython/mobilesync.pxi')
-rw-r--r--cython/mobilesync.pxi34
1 files changed, 19 insertions, 15 deletions
diff --git a/cython/mobilesync.pxi b/cython/mobilesync.pxi
index beafe10..0ec4710 100644
--- a/cython/mobilesync.pxi
+++ b/cython/mobilesync.pxi
@@ -29,9 +29,9 @@ cdef extern from "libimobiledevice/mobilesync.h":
29 mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist.plist_t *plist) 29 mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist.plist_t *plist)
30 mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist.plist_t plist) 30 mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist.plist_t plist)
31 31
32 mobilesync_error_t mobilesync_session_start(mobilesync_client_t client, char *data_class, mobilesync_anchors_t anchors, mobilesync_sync_type_t *sync_type, uint64_t *data_class_version) 32 mobilesync_error_t mobilesync_start(mobilesync_client_t client, char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version)
33 mobilesync_error_t mobilesync_session_cancel(mobilesync_client_t client, char* reason) 33 mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, char* reason)
34 mobilesync_error_t mobilesync_session_finish(mobilesync_client_t client) 34 mobilesync_error_t mobilesync_finish(mobilesync_client_t client)
35 35
36 mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client) 36 mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client)
37 mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client) 37 mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client)
@@ -40,12 +40,15 @@ cdef extern from "libimobiledevice/mobilesync.h":
40 40
41 mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client) 41 mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client)
42 mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist.plist_t changes, uint8_t is_last_record, plist.plist_t actions) 42 mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist.plist_t changes, uint8_t is_last_record, plist.plist_t actions)
43 mobilesync_error_t mobilesync_receive_remapping(mobilesync_client_t client, plist.plist_t *remapping) 43 mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plist.plist_t *mapping)
44
45 44
46 mobilesync_anchors_t mobilesync_anchors_new(char *device_anchor, char *computer_anchor) 45 mobilesync_anchors_t mobilesync_anchors_new(char *device_anchor, char *computer_anchor)
47 void mobilesync_anchors_free(mobilesync_anchors_t anchors) 46 void mobilesync_anchors_free(mobilesync_anchors_t anchors)
48 47
48 plist.plist_t mobilesync_actions_new()
49 void mobilesync_actions_add(plist.plist_t actions, ...)
50 void mobilesync_actions_free(plist.plist_t actions)
51
49SYNC_TYPE_FAST = MOBILESYNC_SYNC_TYPE_FAST 52SYNC_TYPE_FAST = MOBILESYNC_SYNC_TYPE_FAST
50SYNC_TYPE_SLOW = MOBILESYNC_SYNC_TYPE_SLOW 53SYNC_TYPE_SLOW = MOBILESYNC_SYNC_TYPE_SLOW
51SYNC_TYPE_RESET = MOBILESYNC_SYNC_TYPE_RESET 54SYNC_TYPE_RESET = MOBILESYNC_SYNC_TYPE_RESET
@@ -79,11 +82,12 @@ cdef class MobileSyncClient(DeviceLinkService):
79 err = mobilesync_client_free(self._c_client) 82 err = mobilesync_client_free(self._c_client)
80 self.handle_error(err) 83 self.handle_error(err)
81 84
82 cpdef tuple session_start(self, bytes data_class, bytes device_anchor, bytes host_anchor): 85 cpdef tuple start(self, bytes data_class, bytes device_anchor, bytes host_anchor):
83 cdef: 86 cdef:
84 mobilesync_anchors_t anchors = NULL 87 mobilesync_anchors_t anchors = NULL
85 mobilesync_sync_type_t sync_type 88 mobilesync_sync_type_t sync_type
86 uint64_t data_class_version 89 uint64_t computer_data_class_version = 1
90 uint64_t device_data_class_version
87 91
88 if device_anchor is None: 92 if device_anchor is None:
89 anchors = mobilesync_anchors_new(NULL, host_anchor) 93 anchors = mobilesync_anchors_new(NULL, host_anchor)
@@ -91,18 +95,18 @@ cdef class MobileSyncClient(DeviceLinkService):
91 anchors = mobilesync_anchors_new(device_anchor, host_anchor) 95 anchors = mobilesync_anchors_new(device_anchor, host_anchor)
92 96
93 try: 97 try:
94 self.handle_error(mobilesync_session_start(self._c_client, data_class, anchors, &sync_type, &data_class_version)) 98 self.handle_error(mobilesync_start(self._c_client, data_class, anchors, computer_data_class_version, &sync_type, &device_data_class_version))
95 return (sync_type, <bint>data_class_version) 99 return (sync_type, <bint>computer_data_class_version, <bint>device_data_class_version)
96 except Exception, e: 100 except Exception, e:
97 raise 101 raise
98 finally: 102 finally:
99 mobilesync_anchors_free(anchors) 103 mobilesync_anchors_free(anchors)
100 104
101 cpdef session_finish(self): 105 cpdef finish(self):
102 self.handle_error(mobilesync_session_finish(self._c_client)) 106 self.handle_error(mobilesync_finish(self._c_client))
103 107
104 cpdef session_cancel(self, bytes reason): 108 cpdef cancel(self, bytes reason):
105 self.handle_error(mobilesync_session_cancel(self._c_client, reason)) 109 self.handle_error(mobilesync_cancel(self._c_client, reason))
106 110
107 cpdef get_all_records_from_device(self): 111 cpdef get_all_records_from_device(self):
108 self.handle_error(mobilesync_get_all_records_from_device(self._c_client)) 112 self.handle_error(mobilesync_get_all_records_from_device(self._c_client))
@@ -134,11 +138,11 @@ cdef class MobileSyncClient(DeviceLinkService):
134 cpdef send_changes(self, plist.Node changes, bint is_last_record, plist.Node actions): 138 cpdef send_changes(self, plist.Node changes, bint is_last_record, plist.Node actions):
135 self.handle_error(mobilesync_send_changes(self._c_client, changes._c_node, is_last_record, actions._c_node)) 139 self.handle_error(mobilesync_send_changes(self._c_client, changes._c_node, is_last_record, actions._c_node))
136 140
137 cpdef receive_remapping(self): 141 cpdef remap_identifiers(self):
138 cdef plist.plist_t remapping = NULL 142 cdef plist.plist_t remapping = NULL
139 143
140 try: 144 try:
141 self.handle_error(mobilesync_receive_remapping(self._c_client, &remapping)) 145 self.handle_error(mobilesync_remap_identifiers(self._c_client, &remapping))
142 return plist.plist_t_to_node(remapping) 146 return plist.plist_t_to_node(remapping)
143 except Exception, e: 147 except Exception, e:
144 if remapping != NULL: 148 if remapping != NULL: