public void stopLogging() { started = false; locationManager.removeUpdates(locationListener); context.unregisterReceiver(wr01); if (accOpen) { fwRawAccel.closeFileOnCard(); } if (compOpen) { fwRawCompass.closeFileOnCard(); } }
private void writeTofwObject(FWriter fw, String data) { boolean retry = true; int tries = 0; while (retry && tries < 3) { try { fw.openFileOnCard(); fw.appendLineToFile(data); fw.closeFileOnCard(); retry = false; } catch (FileNotFoundException e) { // e.printStackTrace(); tries++; } } }
@Override public void onLocationChanged(Location location) { try { fwGPS.openFileOnCard(); fwGPS.appendLineToFile( "" + System.currentTimeMillis() + "," + location.getLatitude() + "," + location.getLongitude()); fwGPS.closeFileOnCard(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
public void logRawAcc(long timestamp, double x, double y, double z) { if (!accOpen) { boolean retry = true; int tries = 0; while (retry && tries < 3) { try { fwRawAccel.openFileOnCard(); retry = false; accOpen = true; } catch (FileNotFoundException e) { tries++; } } } if (accOpen) { fwRawAccel.appendLineToFile("" + timestamp + ", " + x + ", " + y + ", " + z); } }
public void startLogging() { Log.i("FOOTPATH", "Starting Logging"); routeID = System.currentTimeMillis(); createFileObjects(); try { fwRawAccel.openFileOnCard(); accOpen = true; fwRawCompass.openFileOnCard(); compOpen = true; } catch (FileNotFoundException e) { e.printStackTrace(); } locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); wm01 = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); wr01 = new WifiReceiver(wm01); context.registerReceiver(wr01, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); Log.i("FOOTPATH", "Registered WifiReceiver"); wm01.startScan(); Log.i("FOOTPATH", "Started WiFi Scan"); started = true; }