diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java index 0ef131041e..5354cc1ae6 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/RegisterActivity.java @@ -54,6 +54,7 @@ public class RegisterActivity extends Activity { private EditText mHostView; private View mProgressView; private View mLoginFormView; + private Button deviceRegisterButton; private Handler mUiHandler = new Handler(); @Override @@ -73,7 +74,7 @@ public class RegisterActivity extends Activity { AvailableSensorsInDevice availableSensorsInDevice = new AvailableSensorsInDevice(getApplicationContext()); availableSensorsInDevice.setContent(); - Button deviceRegisterButton = (Button) findViewById(R.id.device_register_button); + deviceRegisterButton = (Button) findViewById(R.id.device_register_button); deviceRegisterButton.setOnClickListener(new OnClickListener() { @@ -204,6 +205,7 @@ public class RegisterActivity extends Activity { // and hide the relevant UI components. mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); + deviceRegisterButton.setVisibility(show? View.VISIBLE : View.GONE); } } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java index 0335ffe50b..ecff96371b 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java @@ -52,11 +52,8 @@ import java.util.List; * This is an android service which publishes the data to the server. */ public class DataPublisherService extends Service { - private static final String TAG = DataPublisherService.class.getName(); - private static String KEY_TAG = "key"; - private static String TIME_TAG = "time"; - private static String VALUE_TAG = "value"; - public static Context context; + private final String TAG = DataPublisherService.class.getName(); + private Context context; @Nullable @Override @@ -68,9 +65,9 @@ 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() { +// Runnable runnable = new Runnable() { +// @Override +// public void run() { try { List events = new ArrayList<>(); //retrieve sensor data. @@ -315,10 +312,10 @@ public class DataPublisherService extends Service { } catch (TransportHandlerException e) { Log.e(TAG, "Data Publish Failed", e); } - } - }; - Thread dataUploaderThread = new Thread(runnable); - dataUploaderThread.start(); +// } +// }; +// Thread dataUploaderThread = new Thread(runnable); +// dataUploaderThread.start(); return Service.START_NOT_STICKY; } } \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/location/LocationDataReader.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/location/LocationDataReader.java index 976e6d0bdc..f79cc64f52 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/location/LocationDataReader.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/location/LocationDataReader.java @@ -183,8 +183,8 @@ public class LocationDataReader extends DataReader implements LocationListener { double distance =CalculationByDistance(latitude, longitude, lat_old, lon_old)/1000; speed = (float)distance/(float)time; - Toast.makeText(mContext, longitude+"\n"+latitude+"\nDistance is: " - +distance+"\nSpeed is: "+speed , Toast.LENGTH_SHORT).show(); +// Toast.makeText(mContext, longitude+"\n"+latitude+"\nDistance is: " +// +distance+"\nSpeed is: "+speed , Toast.LENGTH_SHORT).show(); Intent intent = new Intent("speedUpdate"); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/ActivitySelectSensor.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/ActivitySelectSensor.java index f8d658f69d..fd7bf2ae9e 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/ActivitySelectSensor.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/ActivitySelectSensor.java @@ -73,7 +73,7 @@ public class ActivitySelectSensor extends AppCompatActivity private ListView listView; private SensorManager sensorManager; private ArrayList sensors = new ArrayList<>(); - private EditText sessionIdText; +// private EditText sessionIdText; private RealTimeSensorReader sensorReader = null; private RealTimeSensorChangeReceiver realTimeSensorChangeReceiver = new RealTimeSensorChangeReceiver(); private SupportedSensors supportedSensors = SupportedSensors.getInstance(); @@ -87,21 +87,21 @@ 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); + //sessionIdText = (EditText) findViewById(R.id.sessionId); +// sessionIdText.setCursorVisible(false); listView = (ListView) findViewById(R.id.senseListContainer); - verifyBluetooth(); + //verifyBluetooth(); registerReceiver(realTimeSensorChangeReceiver, new IntentFilter("sensorDataMap")); - sessionIdText.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - sessionIdText.setCursorVisible(true); - - } - }); +// sessionIdText.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// sessionIdText.setCursorVisible(true); +// +// } +// }); //Publish data FloatingActionButton fbtnPublishData = (FloatingActionButton) findViewById(R.id.publish); @@ -126,33 +126,33 @@ 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); - - - } - }); + //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); @@ -313,43 +313,43 @@ public class ActivitySelectSensor extends AppCompatActivity 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(); - - } - - } +// 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(); +// +// } +// +// } } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java index 9289a29a80..6b1591ce93 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java @@ -57,6 +57,7 @@ public class SenseClientAsyncExecutor extends AsyncTask - - + android:layout_height="100dp" + android:layout_margin="20dp" + android:orientation="horizontal"> - + + + + + + + + + + + + - + + + + + + + + + + + + + + + - + + + - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/content_activity_select_sensor.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/content_activity_select_sensor.xml index e431b902a2..d3d332de3d 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/content_activity_select_sensor.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/content_activity_select_sensor.xml @@ -11,18 +11,18 @@ tools:context="org.wso2.carbon.iot.android.sense.realtimeviewer.ActivitySelectSensor" android:id="@+id/parentContainer"> - + + + + + + + > diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/activity_activity_select_sensor_drawer.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/activity_activity_select_sensor_drawer.xml index 861bf44cda..cdcb375809 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/activity_activity_select_sensor_drawer.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/activity_activity_select_sensor_drawer.xml @@ -3,8 +3,8 @@ - + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/build.gradle b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/build.gradle index 83876c80ad..b3722d0822 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/build.gradle +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/build.gradle @@ -6,7 +6,7 @@ buildscript { maven { url 'https://repo.eclipse.org/content/repositories/paho-releases/' } } dependencies { - classpath 'com.android.tools.build:gradle:2.1.0' + classpath 'com.android.tools.build:gradle:2.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradle/wrapper/gradle-wrapper.properties b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradle/wrapper/gradle-wrapper.properties index e7ff442f33..f88c58d1a7 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradle/wrapper/gradle-wrapper.properties +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed May 11 14:40:10 IST 2016 +#Mon Jan 09 12:13:26 IST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml index d06d6ccce4..e01a8a4a7c 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml @@ -22,29 +22,29 @@ Add Keywords Send keywords to the device - - - keywords - - + + + + + Add Threshold Send Threshold to the device - - - threshold - - + + + + + Remove words Remove Threshold from the device - - - words - - + + + + +