diff options
Diffstat (limited to 'cython/mobilesync.pxi')
-rw-r--r-- | cython/mobilesync.pxi | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/cython/mobilesync.pxi b/cython/mobilesync.pxi index b9cf951..abd56b4 100644 --- a/cython/mobilesync.pxi +++ b/cython/mobilesync.pxi @@ -28,27 +28,33 @@ cdef class MobileSyncError(BaseError): } BaseError.__init__(self, *args, **kwargs) -cdef class MobileSyncClient(PropertyListService): +cdef class MobileSyncClient(PropertyListClient): cdef mobilesync_client_t _c_client def __cinit__(self, iDevice device not None, LockdownClient lockdown=None, *args, **kwargs): - cdef iDevice dev = device - cdef LockdownClient lckd + cdef: + iDevice dev = device + LockdownClient lckd + mobilesync_error_t err if lockdown is None: lckd = LockdownClient(dev) else: lckd = lockdown port = lckd.start_service("com.apple.mobilesync") - err = MobileSyncError(mobilesync_client_new(dev._c_dev, port, &(self._c_client))) - if err: raise err + err = mobilesync_client_new(dev._c_dev, port, &(self._c_client)) + self.handle_error(err) def __dealloc__(self): + cdef mobilesync_error_t err if self._c_client is not NULL: - err = MobileSyncError(mobilesync_client_free(self._c_client)) - if err: raise err + err = mobilesync_client_free(self._c_client) + self.handle_error(err) - cdef _send(self, plist.plist_t node): - return MobileSyncError(mobilesync_send(self._c_client, node)) + cdef inline int16_t _send(self, plist.plist_t node): + return mobilesync_send(self._c_client, node) - cdef _receive(self, plist.plist_t* node): - return MobileSyncError(mobilesync_receive(self._c_client, node)) + cdef inline int16_t _receive(self, plist.plist_t* node): + return mobilesync_receive(self._c_client, node) + + cdef inline BaseError _error(self, int16_t ret): + return MobileSyncError(ret) |