Code formatting for android sense agent.

revert-dabc3590
Menaka Jayawardena 7 years ago
parent 8271728c10
commit 19ad2093f5

@ -43,7 +43,6 @@ import org.wso2.carbon.iot.android.sense.util.dto.RegisterInfo;
import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R;
/**
* A login screen that offers to register the device.
*/
@ -159,7 +158,6 @@ public class RegisterActivity extends Activity {
startActivity(intent);
}
});
}
mUiHandler.post(new Runnable() {
@Override
@ -167,11 +165,9 @@ public class RegisterActivity extends Activity {
showProgress(false);
}
});
}
});
myThread.start();
}
}
@ -208,6 +204,4 @@ public class RegisterActivity extends Activity {
deviceRegisterButton.setVisibility(show? View.VISIBLE : View.GONE);
}
}
}

@ -34,5 +34,4 @@ public class DataPublisherReceiver extends BroadcastReceiver {
PendingIntent pending = PendingIntent.getService(context, 0, i, 0);
service.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), ALARM_INTERVAL, pending);
}
}

@ -20,7 +20,6 @@ import android.hardware.Sensor;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -29,17 +28,17 @@ import org.wso2.carbon.iot.android.sense.constants.SenseConstants;
import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.AndroidSenseMQTTHandler;
import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.transport.MQTTTransportHandler;
import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.transport.TransportHandlerException;
import org.wso2.carbon.iot.android.sense.event.streams.location.LocationData;
import org.wso2.carbon.iot.android.sense.event.streams.sensor.SensorData;
import org.wso2.carbon.iot.android.sense.event.streams.speed.SpeedData;
import org.wso2.carbon.iot.android.sense.event.streams.activity.ActivityData;
import org.wso2.carbon.iot.android.sense.event.streams.application.ApplicationData;
import org.wso2.carbon.iot.android.sense.event.streams.audio.AudioData;
import org.wso2.carbon.iot.android.sense.event.streams.battery.BatteryData;
import org.wso2.carbon.iot.android.sense.event.streams.call.CallData;
import org.wso2.carbon.iot.android.sense.event.streams.data.NetworkData;
import org.wso2.carbon.iot.android.sense.event.streams.location.LocationData;
import org.wso2.carbon.iot.android.sense.event.streams.screen.ScreenData;
import org.wso2.carbon.iot.android.sense.event.streams.sensor.SensorData;
import org.wso2.carbon.iot.android.sense.event.streams.sms.SmsData;
import org.wso2.carbon.iot.android.sense.event.streams.speed.SpeedData;
import org.wso2.carbon.iot.android.sense.speech.detector.util.ProcessWords;
import org.wso2.carbon.iot.android.sense.speech.detector.util.WordData;
import org.wso2.carbon.iot.android.sense.util.LocalRegistry;
@ -65,9 +64,6 @@ public class DataPublisherService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
context = this;
Log.d(TAG, "service started");
// Runnable runnable = new Runnable() {
// @Override
// public void run() {
try {
List<Event> events = new ArrayList<>();
//retrieve sensor data.
@ -312,10 +308,6 @@ public class DataPublisherService extends Service {
} catch (TransportHandlerException e) {
Log.e(TAG, "Data Publish Failed", e);
}
// }
// };
// Thread dataUploaderThread = new Thread(runnable);
// dataUploaderThread.start();
return Service.START_NOT_STICKY;
}
}

@ -236,6 +236,5 @@ public class AndroidSenseMQTTHandler extends MQTTTransportHandler {
public void processIncomingMessage(MqttMessage message) throws TransportHandlerException {
}
}

@ -38,5 +38,4 @@ public class SenseScheduleReceiver extends BroadcastReceiver {
cal.add(Calendar.SECOND, 10);
service.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), ALARM_INTERVAL, pending);
}
}

@ -59,7 +59,6 @@ public class SenseService extends Service {
SenseDataReceiverManager.registerNetworkDataReader(this);
//service will not be stopped until we manually stop the service
return Service.START_NOT_STICKY;
}
@Override

@ -25,7 +25,6 @@ import android.net.TrafficStats;
import android.os.AsyncTask;
import android.os.Handler;
import android.util.Log;
import org.wso2.carbon.iot.android.sense.util.SenseDataHolder;
import java.util.Date;

@ -56,7 +56,6 @@ public class SensorDataReader extends DataReader implements SensorEventListener
for (Sensor sensor : sensorList) {
mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL);
}
}
private void collectSensorData() {
@ -112,5 +111,4 @@ public class SensorDataReader extends DataReader implements SensorEventListener
}
}
}
}

@ -73,7 +73,6 @@ public class ActivitySelectSensor extends AppCompatActivity
private ListView listView;
private SensorManager sensorManager;
private ArrayList<Sensor> sensors = new ArrayList<>();
// private EditText sessionIdText;
private RealTimeSensorReader sensorReader = null;
private RealTimeSensorChangeReceiver realTimeSensorChangeReceiver = new RealTimeSensorChangeReceiver();
private SupportedSensors supportedSensors = SupportedSensors.getInstance();
@ -87,22 +86,10 @@ public class ActivitySelectSensor extends AppCompatActivity
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
//sessionIdText = (EditText) findViewById(R.id.sessionId);
// sessionIdText.setCursorVisible(false);
listView = (ListView) findViewById(R.id.senseListContainer);
//verifyBluetooth();
registerReceiver(realTimeSensorChangeReceiver, new IntentFilter("sensorDataMap"));
// sessionIdText.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// sessionIdText.setCursorVisible(true);
//
// }
// });
//Publish data
FloatingActionButton fbtnPublishData = (FloatingActionButton) findViewById(R.id.publish);
@ -126,35 +113,6 @@ public class ActivitySelectSensor extends AppCompatActivity
}
});
//FloatingActionButton fbtnSpeechRecongnizer = (FloatingActionButton) findViewById(R.id.speech);
// fbtnSpeechRecongnizer.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// String sessionId = sessionIdText.getText().toString();
// if (!sessionId.isEmpty()) {
// Intent intent = new Intent(getApplicationContext(), WordRecognitionActivity.class);
// intent.putExtra("sessionId", sessionId);
// startActivity(intent);
// } else {
// Toast.makeText(ActivitySelectSensor.this, "Please type a session id value", Toast.LENGTH_SHORT)
// .show();
// }
//
// }
// });
// FloatingActionButton fbtnBeaconMonitor = (FloatingActionButton) findViewById(R.id.beacon);
// fbtnBeaconMonitor.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(getApplicationContext(), BeaconMonitoringActivity.class);
// startActivity(intent);
//
//
// }
// });
sharedPreferences = getSharedPreferences(SupportedSensors.SELECTED_SENSORS, 0);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
@ -223,7 +181,6 @@ public class ActivitySelectSensor extends AppCompatActivity
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@ -272,7 +229,6 @@ public class ActivitySelectSensor extends AppCompatActivity
realTimeSensorChangeReceiver.updateOnChange(adaptor1);
listView.setAdapter(adaptor1);
}
public void update() {
@ -305,51 +261,10 @@ public class ActivitySelectSensor extends AppCompatActivity
}
}
/**
* This method unregisters the real-time broadcast receiver.
*/
public void unregisterReceivers() {
unregisterReceiver(realTimeSensorChangeReceiver);
}
// private void verifyBluetooth() {
//
// try {
// if (!BeaconManager.getInstanceForApplication(this).checkAvailability()) {
// final AlertDialog.Builder builder = new AlertDialog.Builder(this);
// builder.setTitle("Bluetooth not enabled");
// builder.setMessage("Please enable bluetooth in settings and restart this application.");
// builder.setPositiveButton(android.R.string.ok, null);
// builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
//
// @Override
// public void onDismiss(DialogInterface dialog) {
// finish();
// System.exit(0);
// }
//
// });
// builder.show();
//
// }
// } catch (RuntimeException e) {
// final AlertDialog.Builder builder = new AlertDialog.Builder(this);
// builder.setTitle("Bluetooth LE not available");
// builder.setMessage("Sorry, this device does not support Bluetooth LE.");
// builder.setPositiveButton(android.R.string.ok, null);
// builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
//
// @Override
// public void onDismiss(DialogInterface dialog) {
// finish();
// System.exit(0);
// }
//
// });
// builder.show();
//
// }
//
// }
}

@ -33,5 +33,4 @@ public class TempStore {
* Array List which is used to populate the List view.
*/
public static ArrayList<RealTimeSensor> sensorArrayList = new ArrayList<>();
}

@ -37,5 +37,4 @@ public class RealTimeSensorChangeReceiver extends BroadcastReceiver {
TempStore.sensorArrayList.clear();
TempStore.sensorArrayList.addAll(TempStore.sensorDataMap.values());
}
}

@ -58,5 +58,4 @@ public class RealTimeSensorReader implements SensorEventListener {
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
}

@ -60,6 +60,4 @@ public class AvailableSensorsInDevice {
editor.putStringSet(SupportedSensors.GET_AVAILABLE_SENSORS, sensorSet);
editor.apply();
}
}

@ -83,7 +83,6 @@ public class SensorViewAdaptor extends BaseAdapter {
holder.valuesZ.setText(data.getValueZ());
return view;
}
private class ViewHolder {

@ -36,7 +36,6 @@ import java.util.Set;
* Get the user selections
* Put them in to shared preferences
*/
public class SelectSensorDialog extends DialogFragment {
protected boolean[] selections = new boolean[SupportedSensors.SUPPORTED_SENSOR_COUNT];
@ -79,7 +78,6 @@ public class SelectSensorDialog extends DialogFragment {
Log.d("Click", "Ok");
//call sensorDataMap reading class
sensorListListener.onDialogPositiveClick(SelectSensorDialog.this);
}
});
@ -96,7 +94,6 @@ public class SelectSensorDialog extends DialogFragment {
}
}
});
return builder.create();
}
@ -143,5 +140,4 @@ public class SelectSensorDialog extends DialogFragment {
public interface SensorListListener {
void onDialogPositiveClick(SelectSensorDialog dialog);
}
}

Loading…
Cancel
Save