summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2009-06-22 00:36:35 +0200
committerGravatar Matt Colyer2009-06-29 19:28:20 -0700
commitb0100c6a97b94bf24609ec2ddb52d6bd7d0a5e70 (patch)
tree28ab8d963cefcad348ef6d08178beef9b9e25324
parent853c1e699f070dafd6fe44b7cc3770a1e58c214c (diff)
downloadlibimobiledevice-b0100c6a97b94bf24609ec2ddb52d6bd7d0a5e70.tar.gz
libimobiledevice-b0100c6a97b94bf24609ec2ddb52d6bd7d0a5e70.tar.bz2
Update python bindings to use allow targeting device by uuid
[#47 state:resolved] Signed-off-by: Matt Colyer <matt@colyer.name>
-rw-r--r--swig/iphone.i28
1 files changed, 20 insertions, 8 deletions
diff --git a/swig/iphone.i b/swig/iphone.i
index 7a003d4..0a337ad 100644
--- a/swig/iphone.i
+++ b/swig/iphone.i
@@ -16,7 +16,7 @@
} Lockdownd;
typedef struct {
- Lockdownd* lckd;
+ iPhone* dev;
iphone_msync_client_t client;
} MobileSync;
@@ -29,6 +29,7 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd);
%}
/* Parse the header file to generate wrappers */
%include "stdint.i"
+%include "cstring.i"
%include "plist/swig/plist.i"
#define DBGMASK_ALL 0xFFFF
@@ -47,7 +48,7 @@ typedef struct {
} Lockdownd;
typedef struct {
- Lockdownd* lckd;
+ iPhone* dev;
iphone_msync_client_t client;
} MobileSync;
@@ -78,7 +79,6 @@ Lockdownd* my_new_Lockdownd(iPhone* phone) {
void my_delete_Lockdownd(Lockdownd* lckd) {
if (lckd) {
- my_delete_iPhone(lckd->dev);
iphone_lckd_free_client ( lckd->client );
free(lckd);
}
@@ -90,7 +90,7 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
int port = 0;
if (IPHONE_E_SUCCESS == iphone_lckd_start_service ( lckd->client, "com.apple.mobilesync", &port )) {
client = (MobileSync*) malloc(sizeof(MobileSync));
- client->lckd = lckd;
+ client->dev = lckd->dev;
client->client = NULL;
iphone_msync_new_client ( lckd->dev->dev, port, &(client->client));
}
@@ -115,15 +115,28 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
iphone_set_debug_mask(mask);
}
+ void set_debug_level(int level) {
+ iphone_set_debug(level);
+ }
+
+ int init_device_by_uuid(char* uuid) {
+ if (IPHONE_E_SUCCESS == iphone_get_device_by_uuid ( &($self->dev), uuid))
+ return 1;
+ return 0;
+ }
+
int init_device() {
if (IPHONE_E_SUCCESS == iphone_get_device ( &($self->dev)))
return 1;
return 0;
}
- char* serial_number(){
- return iphone_get_uuid($self->dev);
- }
+ %newobject get_uuid;
+ char* get_uuid(){
+ char* uuid = NULL;
+ uuid = (char *)iphone_get_uuid($self->dev);
+ return uuid;
+ }
Lockdownd* get_lockdown_client() {
return my_new_Lockdownd($self);
@@ -162,7 +175,6 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
}
~MobileSync() {
- my_delete_Lockdownd($self->lckd);
iphone_msync_free_client ( $self->client );
free($self);
}