Add return value for RemoteProvisioning
This commit is contained in:
parent
faa0900c9e
commit
7e05701abe
1 changed files with 8 additions and 3 deletions
|
@ -19,6 +19,7 @@ public class RemoteProvisioning {
|
||||||
String mRPAddress;
|
String mRPAddress;
|
||||||
String mSchema;
|
String mSchema;
|
||||||
String mLocalLP;
|
String mLocalLP;
|
||||||
|
boolean value;
|
||||||
|
|
||||||
public RemoteProvisioningThread(final String RPAddress, final String LocalLP, final String schema) {
|
public RemoteProvisioningThread(final String RPAddress, final String LocalLP, final String schema) {
|
||||||
this.mRPAddress = RPAddress;
|
this.mRPAddress = RPAddress;
|
||||||
|
@ -28,6 +29,7 @@ public class RemoteProvisioning {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
value = false;
|
||||||
Log.i("Download remote provisioning file from " + mRPAddress);
|
Log.i("Download remote provisioning file from " + mRPAddress);
|
||||||
URL url = new URL(mRPAddress);
|
URL url = new URL(mRPAddress);
|
||||||
URLConnection ucon = url.openConnection();
|
URLConnection ucon = url.openConnection();
|
||||||
|
@ -68,6 +70,7 @@ public class RemoteProvisioning {
|
||||||
} else {
|
} else {
|
||||||
lp.sync();
|
lp.sync();
|
||||||
}
|
}
|
||||||
|
value = true;
|
||||||
Log.i("Remote provisioning ok");
|
Log.i("Remote provisioning ok");
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
Log.e("Invalid remote provisioning url: " + e.getLocalizedMessage());
|
Log.e("Invalid remote provisioning url: " + e.getLocalizedMessage());
|
||||||
|
@ -81,7 +84,7 @@ public class RemoteProvisioning {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void download(String address, String lpfile, boolean check) {
|
static boolean download(String address, String lpfile, boolean check) {
|
||||||
try {
|
try {
|
||||||
String schema = null;
|
String schema = null;
|
||||||
if(check) {
|
if(check) {
|
||||||
|
@ -92,13 +95,15 @@ public class RemoteProvisioning {
|
||||||
thread.start();
|
thread.start();
|
||||||
thread.wait();
|
thread.wait();
|
||||||
}
|
}
|
||||||
|
return thread.value;
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void download(String address, String lpfile) {
|
static boolean download(String address, String lpfile) {
|
||||||
download(address, lpfile, true);
|
return download(address, lpfile, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isAvailable() {
|
static boolean isAvailable() {
|
||||||
|
|
Loading…
Reference in a new issue