summaryrefslogtreecommitdiffstats
path: root/swig/iphone.i
diff options
context:
space:
mode:
Diffstat (limited to 'swig/iphone.i')
-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 @@
16 } Lockdownd; 16 } Lockdownd;
17 17
18 typedef struct { 18 typedef struct {
19 Lockdownd* lckd; 19 iPhone* dev;
20 iphone_msync_client_t client; 20 iphone_msync_client_t client;
21 } MobileSync; 21 } MobileSync;
22 22
@@ -29,6 +29,7 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd);
29 %} 29 %}
30/* Parse the header file to generate wrappers */ 30/* Parse the header file to generate wrappers */
31%include "stdint.i" 31%include "stdint.i"
32%include "cstring.i"
32%include "plist/swig/plist.i" 33%include "plist/swig/plist.i"
33 34
34#define DBGMASK_ALL 0xFFFF 35#define DBGMASK_ALL 0xFFFF
@@ -47,7 +48,7 @@ typedef struct {
47} Lockdownd; 48} Lockdownd;
48 49
49typedef struct { 50typedef struct {
50 Lockdownd* lckd; 51 iPhone* dev;
51 iphone_msync_client_t client; 52 iphone_msync_client_t client;
52} MobileSync; 53} MobileSync;
53 54
@@ -78,7 +79,6 @@ Lockdownd* my_new_Lockdownd(iPhone* phone) {
78 79
79void my_delete_Lockdownd(Lockdownd* lckd) { 80void my_delete_Lockdownd(Lockdownd* lckd) {
80 if (lckd) { 81 if (lckd) {
81 my_delete_iPhone(lckd->dev);
82 iphone_lckd_free_client ( lckd->client ); 82 iphone_lckd_free_client ( lckd->client );
83 free(lckd); 83 free(lckd);
84 } 84 }
@@ -90,7 +90,7 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
90 int port = 0; 90 int port = 0;
91 if (IPHONE_E_SUCCESS == iphone_lckd_start_service ( lckd->client, "com.apple.mobilesync", &port )) { 91 if (IPHONE_E_SUCCESS == iphone_lckd_start_service ( lckd->client, "com.apple.mobilesync", &port )) {
92 client = (MobileSync*) malloc(sizeof(MobileSync)); 92 client = (MobileSync*) malloc(sizeof(MobileSync));
93 client->lckd = lckd; 93 client->dev = lckd->dev;
94 client->client = NULL; 94 client->client = NULL;
95 iphone_msync_new_client ( lckd->dev->dev, port, &(client->client)); 95 iphone_msync_new_client ( lckd->dev->dev, port, &(client->client));
96 } 96 }
@@ -115,15 +115,28 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
115 iphone_set_debug_mask(mask); 115 iphone_set_debug_mask(mask);
116 } 116 }
117 117
118 void set_debug_level(int level) {
119 iphone_set_debug(level);
120 }
121
122 int init_device_by_uuid(char* uuid) {
123 if (IPHONE_E_SUCCESS == iphone_get_device_by_uuid ( &($self->dev), uuid))
124 return 1;
125 return 0;
126 }
127
118 int init_device() { 128 int init_device() {
119 if (IPHONE_E_SUCCESS == iphone_get_device ( &($self->dev))) 129 if (IPHONE_E_SUCCESS == iphone_get_device ( &($self->dev)))
120 return 1; 130 return 1;
121 return 0; 131 return 0;
122 } 132 }
123 133
124 char* serial_number(){ 134 %newobject get_uuid;
125 return iphone_get_uuid($self->dev); 135 char* get_uuid(){
126 } 136 char* uuid = NULL;
137 uuid = (char *)iphone_get_uuid($self->dev);
138 return uuid;
139 }
127 140
128 Lockdownd* get_lockdown_client() { 141 Lockdownd* get_lockdown_client() {
129 return my_new_Lockdownd($self); 142 return my_new_Lockdownd($self);
@@ -162,7 +175,6 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) {
162 } 175 }
163 176
164 ~MobileSync() { 177 ~MobileSync() {
165 my_delete_Lockdownd($self->lckd);
166 iphone_msync_free_client ( $self->client ); 178 iphone_msync_free_client ( $self->client );
167 free($self); 179 free($self);
168 } 180 }