Go to the documentation of this file.00001 package com.ros.turtlebot.apps.rocon;
00002
00003 import java.net.URI;
00004 import java.net.URISyntaxException;
00005
00006 import android.annotation.SuppressLint;
00007 import android.content.Context;
00008 import android.content.Intent;
00009 import android.os.AsyncTask;
00010 import android.os.Bundle;
00011 import android.os.PowerManager;
00012 import android.os.PowerManager.WakeLock;
00013 import android.widget.TextView;
00014 import android.widget.Toast;
00015
00016 public class RoconMainActivity extends RosBaseActivity {
00017
00018 PowerManager.WakeLock wakeLock = null ;
00019
00021 @Override
00022 public void onCreate(Bundle savedInstanceState) {
00023 super.onCreate(savedInstanceState);
00024 setContentView(R.layout.nfc_reader);
00025
00026
00027 PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
00028 wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "ROCON");
00029 wakeLock.acquire();
00030
00031 txtInformation = (TextView) findViewById(R.id.INFORMATION);
00032
00033 Intent intent = getIntent();
00034 nfc_table = intent.getStringExtra("table");
00035 nfc_weblink = intent.getStringExtra("weblink");
00036 nfc_masteruri = intent.getStringExtra("masteruri");
00037 }
00038
00039 @SuppressLint("NewApi")
00040 public void startMasterChooser() {
00041 URI uri;
00042 try {
00043 uri = new URI(nfc_masteruri);
00044 } catch (URISyntaxException e) {
00045
00046 Toast.makeText(this, "Invalid MasterURI - " + nfc_masteruri, Toast.LENGTH_SHORT).show() ;
00047 return ;
00048 }
00049
00050 nodeMainExecutorService.setMasterUri(uri);
00051
00052
00053
00054 new AsyncTask<Void, Void, Void>() {
00055 @Override
00056 protected Void doInBackground(Void... params) {
00057 init(nodeMainExecutorService);
00058 return null;
00059 }
00060 }.execute();
00061 }
00062
00063 @Override
00064 protected void onDestroy() {
00065
00066 wakeLock.release();
00067 super.onDestroy();
00068 }
00069
00070 }