diff options
Diffstat (limited to 'cython/lockdown.pxi')
| -rw-r--r-- | cython/lockdown.pxi | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi index a904d12..8463738 100644 --- a/cython/lockdown.pxi +++ b/cython/lockdown.pxi | |||
| @@ -41,6 +41,8 @@ cdef extern from "libimobiledevice/lockdown.h": | |||
| 41 | lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client) | 41 | lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client) |
| 42 | lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) | 42 | lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) |
| 43 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) | 43 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) |
| 44 | lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count) | ||
| 45 | lockdownd_error_t lockdownd_data_classes_free(char **classes) | ||
| 44 | 46 | ||
| 45 | cdef class LockdownError(BaseError): | 47 | cdef class LockdownError(BaseError): |
| 46 | def __init__(self, *args, **kwargs): | 48 | def __init__(self, *args, **kwargs): |
| @@ -245,6 +247,27 @@ cdef class LockdownClient(PropertyListService): | |||
| 245 | cpdef goodbye(self): | 247 | cpdef goodbye(self): |
| 246 | self.handle_error(lockdownd_goodbye(self._c_client)) | 248 | self.handle_error(lockdownd_goodbye(self._c_client)) |
| 247 | 249 | ||
| 250 | cpdef list get_sync_data_classes(self): | ||
| 251 | cdef: | ||
| 252 | char **classes = NULL | ||
| 253 | int count = 0 | ||
| 254 | list result = [] | ||
| 255 | bytes data_class | ||
| 256 | |||
| 257 | try: | ||
| 258 | self.handle_error(lockdownd_get_sync_data_classes(self._c_client, &classes, &count)) | ||
| 259 | |||
| 260 | for i from 0 <= i < count: | ||
| 261 | data_class = classes[i] | ||
| 262 | result.append(data_class) | ||
| 263 | |||
| 264 | return result | ||
| 265 | except Exception, e: | ||
| 266 | raise | ||
| 267 | finally: | ||
| 268 | if classes != NULL: | ||
| 269 | lockdownd_data_classes_free(classes) | ||
| 270 | |||
| 248 | cdef inline int16_t _send(self, plist.plist_t node): | 271 | cdef inline int16_t _send(self, plist.plist_t node): |
| 249 | return lockdownd_send(self._c_client, node) | 272 | return lockdownd_send(self._c_client, node) |
| 250 | 273 | ||
