SensorModelDataCollector/src/com/clarkson/sensormodeldatacollector/WiFiScanActivity.java
/**
	 * Called when the activity is first created
	 * 
	 * This method is basically the "constructor" for the activity.
	 * @param savedInstanceState - top level android application instance
	 */
Called when the activity is first created

This method is basically the "constructor" for the activity.
@param savedInstanceState - top level android application instance
Called when the activity is first created This method is basically the " constructor " for the activity . @param savedInstanceState - top level android application instance
@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.wifi_scan_layout);
		Log.d(getLocalClassName(), "Step 3");
		mStartStopScanButton = (Button) findViewById(R.id.start_scan_button);
		mStartStopScanButton.setOnClickListener(this);
		mScanResultsListView = (ListView)findViewById(R.id.AP_list);
		mMainMenuExtras = getIntent().getExtras();
		mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
		mMagnetometerSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
		if(mMagnetometerSensor == null)
		{
			Toast.makeText(getApplicationContext(), "Magnetometer unavailable", Toast.LENGTH_LONG).show();
		}
        setupSketchView();
        magnetometerAnalyzer = new Orientation(sketchView);
        mSensorManager.registerListener(magnetometerAnalyzer, mMagnetometerSensor, SensorManager.SENSOR_DELAY_FASTEST);
        storage = new Storage(magnetometerAnalyzer, this);
        storage.loadCalibrationData();
        movement = new Movement(magnetometerAnalyzer);
        sketchView.setMovementObject(movement);
        programState = new ProgramState(sketchView, magnetometerAnalyzer, storage, movement);
        menuManager = new MenuManager(programState);
        menuManager.setBitmapMenuArrow(getBitmapResource(2));
        menuManager.setBitmapMenuButton(getBitmapResource(3));
        sketchView.setMenuManager(menuManager);
        programState.setMenuManager(menuManager);
        programState.setProgramState(ProgramState.State.STATE_PAUSE_WITH_MENU);
        setupUiInteraction();
        sketchView.invalidate();
        beginCalibrationStateMonitoring();
        beginMovementStateMonitoring();
        beginExportPathBitmapMonitoring();
		if(mMainMenuExtras != null)
		{
			mConnectToServer = mMainMenuExtras.getBoolean("mConnectToServer");
            int wifi_scan_interval_seconds = Integer.parseInt(mMainMenuExtras.getString("mWifiScanIntervalSeconds"));
			mWifiScanIntervalMilliseconds = 1000*wifi_scan_interval_seconds;
            this.mSSIDFilter = mMainMenuExtras.getString("mSSIDFilter");
            this.mSSIDFilterEnabled = mMainMenuExtras.getBoolean("mSSIDFilterEnabled");
		}
		Resources application_resources =getResources();
		mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
		if (mWifiManager.isWifiEnabled() == false)
		{
			Toast.makeText(getApplicationContext(), "wifi is disabled..making it enabled", Toast.LENGTH_LONG).show();
			mWifiManager.setWifiEnabled(true);
		}
		setWiFiScanListData();
		mWifiScanResultAdapter = new WiFiScanResultAdapter(this, mScanResultsArrayList, application_resources);
		mScanResultsListView.setAdapter(mWifiScanResultAdapter);
        mMillisecondsSinceBoot = SystemClock.uptimeMillis();
        buildAlertDialogs();
		checkServerConnection();
	}
@ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . wifi_scan_layout ) ; Log . d ( getLocalClassName ( ) , "Step 3" ) ; mStartStopScanButton = ( Button ) findViewById ( R . id . start_scan_button ) ; mStartStopScanButton . setOnClickListener ( this ) ; mScanResultsListView = ( ListView ) findViewById ( R . id . AP_list ) ; mMainMenuExtras = getIntent ( ) . getExtras ( ) ; mSensorManager = ( SensorManager ) getSystemService ( SENSOR_SERVICE ) ; mMagnetometerSensor = mSensorManager . getDefaultSensor ( Sensor . TYPE_MAGNETIC_FIELD ) ; if ( mMagnetometerSensor == null ) { Toast . makeText ( getApplicationContext ( ) , "Magnetometer unavailable" , Toast . LENGTH_LONG ) . show ( ) ; } setupSketchView ( ) ; magnetometerAnalyzer = new Orientation ( sketchView ) ; mSensorManager . registerListener ( magnetometerAnalyzer , mMagnetometerSensor , SensorManager . SENSOR_DELAY_FASTEST ) ; storage = new Storage ( magnetometerAnalyzer , this ) ; storage . loadCalibrationData ( ) ; movement = new Movement ( magnetometerAnalyzer ) ; sketchView . setMovementObject ( movement ) ; programState = new ProgramState ( sketchView , magnetometerAnalyzer , storage , movement ) ; menuManager = new MenuManager ( programState ) ; menuManager . setBitmapMenuArrow ( getBitmapResource ( 2 ) ) ; menuManager . setBitmapMenuButton ( getBitmapResource ( 3 ) ) ; sketchView . setMenuManager ( menuManager ) ; programState . setMenuManager ( menuManager ) ; programState . setProgramState ( ProgramState . State . STATE_PAUSE_WITH_MENU ) ; setupUiInteraction ( ) ; sketchView . invalidate ( ) ; beginCalibrationStateMonitoring ( ) ; beginMovementStateMonitoring ( ) ; beginExportPathBitmapMonitoring ( ) ; if ( mMainMenuExtras != null ) { mConnectToServer = mMainMenuExtras . getBoolean ( "mConnectToServer" ) ; int wifi_scan_interval_seconds = Integer . parseInt ( mMainMenuExtras . getString ( "mWifiScanIntervalSeconds" ) ) ; mWifiScanIntervalMilliseconds = 1000 * wifi_scan_interval_seconds ; this . mSSIDFilter = mMainMenuExtras . getString ( "mSSIDFilter" ) ; this . mSSIDFilterEnabled = mMainMenuExtras . getBoolean ( "mSSIDFilterEnabled" ) ; } Resources application_resources = getResources ( ) ; mWifiManager = ( WifiManager ) getSystemService ( Context . WIFI_SERVICE ) ; if ( mWifiManager . isWifiEnabled ( ) == false ) { Toast . makeText ( getApplicationContext ( ) , "wifi is disabled..making it enabled" , Toast . LENGTH_LONG ) . show ( ) ; mWifiManager . setWifiEnabled ( true ) ; } setWiFiScanListData ( ) ; mWifiScanResultAdapter = new WiFiScanResultAdapter ( this , mScanResultsArrayList , application_resources ) ; mScanResultsListView . setAdapter ( mWifiScanResultAdapter ) ; mMillisecondsSinceBoot = SystemClock . uptimeMillis ( ) ; buildAlertDialogs ( ) ; checkServerConnection ( ) ; }
Called when the activity is first created
Called when the activity is first created
//mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
 //mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
 //if
 //if
 //if  
 //Initialize the list view with default data
 //Start service
 //mAccelerometerIntent = new Intent(this, com.clarkson.sensormodeldatacollector.AccelerometerService.class);
 //mDbHelper = new AccelerometerDataReaderDbHelper(this);
 //Log.d( getLocalClassName(), "onCreate/startService" );
