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