Go to the documentation of this file.00001 package ros.zeroconf.android.jmdns.master_browser;
00002
00003 import android.content.Context;
00004 import ros.zeroconf.jmdns.Zeroconf;
00005 import android.app.ProgressDialog;
00006 import android.os.AsyncTask;
00007
00011 public class DiscoverySetup extends AsyncTask<Zeroconf, String, Void> {
00012
00013 private ProgressDialog commencing_dialog;
00014 private final Context context;
00015
00016 public DiscoverySetup(Context context) {
00017 this.context = context;
00018 }
00019
00020 protected Void doInBackground(Zeroconf... zeroconfs) {
00021 if ( zeroconfs.length == 1 ) {
00022 Zeroconf zconf = zeroconfs[0];
00023 android.util.Log.i("zeroconf", "*********** Discovery Commencing **************");
00024
00025
00026
00027
00028
00029 zconf.addListener("_ros-master._tcp","local");
00030 zconf.addListener("_ros-master._udp","local");
00031 zconf.addListener("_concert-master._tcp","local");
00032 zconf.addListener("_concert-master._udp","local");
00033 zconf.addListener("_app-manager._tcp","local");
00034 zconf.addListener("_app-manager._udp","local");
00035 } else {
00036 android.util.Log.i("zeroconf", "Error - DiscoveryTask::doInBackground received #zeroconfs != 1");
00037 }
00038 return null;
00039 }
00040
00041 protected void onPreExecute() {
00042 commencing_dialog = ProgressDialog.show(context,
00043 "Zeroconf Discovery", "Adding listeners...", true);
00044 }
00045 protected void onPostExecute(Void result) {
00046 commencing_dialog.dismiss();
00047 }
00048 }