diff options
Diffstat (limited to 'cython')
| -rw-r--r-- | cython/imobiledevice.pxd | 2 | ||||
| -rw-r--r-- | cython/imobiledevice.pyx | 17 | 
2 files changed, 19 insertions, 0 deletions
| diff --git a/cython/imobiledevice.pxd b/cython/imobiledevice.pxd index cd17061..a614124 100644 --- a/cython/imobiledevice.pxd +++ b/cython/imobiledevice.pxd @@ -51,8 +51,10 @@ cdef class BaseService(Base):  cdef class PropertyListService(BaseService):      cpdef send(self, plist.Node node)      cpdef object receive(self) +    cpdef object receive_with_timeout(self, int timeout_ms)      cdef int16_t _send(self, plist.plist_t node)      cdef int16_t _receive(self, plist.plist_t* c_node) +    cdef int16_t _receive_with_timeout(self, plist.plist_t* c_node, int timeout_ms)  cdef extern from "libimobiledevice/lockdown.h":      cdef struct lockdownd_client_private: diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx index 9d2e13d..cdb9978 100644 --- a/cython/imobiledevice.pyx +++ b/cython/imobiledevice.pyx @@ -210,12 +210,29 @@ cdef class PropertyListService(BaseService):                  plist.plist_free(c_node)              raise +    cpdef object receive_with_timeout(self, int timeout_ms): +        cdef: +            plist.plist_t c_node = NULL +            int16_t err +        err = self._receive_with_timeout(&c_node, timeout_ms) +        try: +            self.handle_error(err) + +            return plist.plist_t_to_node(c_node) +        except BaseError, e: +            if c_node != NULL: +                plist.plist_free(c_node) +            raise +      cdef int16_t _send(self, plist.plist_t node):          raise NotImplementedError("send is not implemented")      cdef int16_t _receive(self, plist.plist_t* c_node):          raise NotImplementedError("receive is not implemented") +    cdef int16_t _receive_with_timeout(self, plist.plist_t* c_node, int timeout_ms): +        raise NotImplementedError("receive_with_timeout is not implemented") +  cdef class DeviceLinkService(PropertyListService):      pass | 
