diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/build.gradle b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/build.gradle
index 1fd0aa818..dc2ec083c 100755
--- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/build.gradle
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/build.gradle
@@ -9,6 +9,7 @@ android {
targetSdkVersion 22
versionCode 1
versionName "1.0"
+
}
buildTypes {
release {
@@ -31,10 +32,14 @@ android {
}
productFlavors {
}
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
@@ -42,5 +47,5 @@ dependencies {
compile 'commons-codec:commons-codec:1.4'
compile 'com.netflix.feign:feign-jaxrs:8.16.0'
compile 'com.netflix.feign:feign-jackson:8.16.0'
-
+ compile 'org.altbeacon:android-beacon-library:2.8.1'
}
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml
index b7996fbd5..d1857e436 100755
--- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml
@@ -13,6 +13,10 @@
+
+
+
+
+
+
+
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconDetactorService.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconDetactorService.java
new file mode 100755
index 000000000..727559ac7
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconDetactorService.java
@@ -0,0 +1,105 @@
+package org.wso2.carbon.iot.android.sense.beacon;
+
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.support.v4.app.NotificationCompat;
+import android.util.Log;
+import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R;
+
+import org.altbeacon.beacon.BeaconConsumer;
+import org.altbeacon.beacon.BeaconManager;
+import org.altbeacon.beacon.MonitorNotifier;
+import org.altbeacon.beacon.Region;
+
+public class BeaconDetactorService extends Service implements BeaconConsumer {
+
+ private BeaconManager iBeaconManager = BeaconManager.getInstanceForApplication(this);
+
+ @Override
+ public IBinder onBind(Intent arg0) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ return START_STICKY;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ iBeaconManager.bind(this);
+
+ final Handler handler = new Handler();
+ final Runnable runnable = new Runnable() {
+
+ @Override
+ public void run() {
+ stopSelf();
+ }
+ };
+ handler.postDelayed(runnable, 10000);
+ }
+
+ @Override
+ public void onDestroy() {
+ iBeaconManager.unbind(this);
+ super.onDestroy();
+ }
+
+ @Override
+ public void onBeaconServiceConnect() {
+ iBeaconManager.setMonitorNotifier(new MonitorNotifier() {
+ @Override
+ public void didEnterRegion(Region region) {
+ Log.e("BeaconDetactorService", "didEnterRegion");
+ generateNotification(BeaconDetactorService.this, region.getUniqueId()
+ + ": just saw this iBeacon for the first time");
+ }
+
+ @Override
+ public void didExitRegion(Region region) {
+ Log.e("BeaconDetactorService", "didExitRegion");
+ generateNotification(BeaconDetactorService.this, region.getUniqueId() + ": is no longer visible");
+ }
+
+ @Override
+ public void didDetermineStateForRegion(int state, Region region) {
+ Log.e("BeaconDetactorService", "didDetermineStateForRegion:" + state);
+ }
+
+ });
+
+ try {
+ iBeaconManager.startMonitoringBeaconsInRegion(new Region("myMonitoringUniqueId", null, null, null));
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * Issues a notification to inform the user that server has sent a message.
+ */
+ private static void generateNotification(Context context, String message) {
+
+ Intent launchIntent = new Intent(context, MonitoringActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
+ | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+
+ ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)).notify(
+ 0,
+ new NotificationCompat.Builder(context).setWhen(System.currentTimeMillis())
+ .setSmallIcon(R.drawable.beacon).setTicker(message)
+ .setContentTitle(context.getString(R.string.app_name)).setContentText(message)
+ .setContentIntent(PendingIntent.getActivity(context, 0, launchIntent, 0)).setAutoCancel(true)
+ .build());
+
+ }
+
+}
\ No newline at end of file
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconServiceUtility.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconServiceUtility.java
new file mode 100755
index 000000000..7c0c82887
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconServiceUtility.java
@@ -0,0 +1,55 @@
+package org.wso2.carbon.iot.android.sense.beacon;
+
+import java.util.Calendar;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import org.altbeacon.beacon.BeaconConsumer;
+import org.altbeacon.beacon.BeaconManager;
+
+public class BeaconServiceUtility {
+
+ private Context context;
+ private PendingIntent pintent;
+ private AlarmManager alarm;
+ private Intent iService;
+
+ public BeaconServiceUtility(Context context) {
+ super();
+ this.context = context;
+ iService = new Intent(context, BeaconDetactorService.class);
+ alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+ pintent = PendingIntent.getService(context, 0, iService, 0);
+ }
+
+ public void onStart(BeaconManager iBeaconManager, BeaconConsumer consumer) {
+
+ stopBackgroundScan();
+ iBeaconManager.bind(consumer);
+
+ }
+
+ public void onStop(BeaconManager iBeaconManager, BeaconConsumer consumer) {
+
+ iBeaconManager.unbind(consumer);
+ startBackgroundScan();
+
+ }
+
+ private void stopBackgroundScan() {
+
+ alarm.cancel(pintent);
+ context.stopService(iService);
+ }
+
+ private void startBackgroundScan() {
+
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.SECOND, 2);
+ alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 360000, pintent); // 6*60 * 1000
+ context.startService(iService);
+ }
+
+}
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/MonitoringActivity.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/MonitoringActivity.java
new file mode 100644
index 000000000..89ffcd3a9
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/MonitoringActivity.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and limitations under the License.
+ *
+ */
+
+package org.wso2.carbon.iot.android.sense.beacon;
+
+
+import android.Manifest;
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+import android.view.LayoutInflater;
+import android.widget.BaseAdapter;
+import org.altbeacon.beacon.BeaconConsumer;
+import org.altbeacon.beacon.BeaconManager;
+import org.altbeacon.beacon.Beacon;
+import org.altbeacon.beacon.RangeNotifier;
+import android.widget.ListView;
+import android.widget.TextView;
+import org.altbeacon.beacon.BeaconParser;
+import org.altbeacon.beacon.MonitorNotifier;
+import org.altbeacon.beacon.Region;
+import java.util.ArrayList;
+import java.util.Collection;
+import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R;
+
+public class MonitoringActivity extends Activity implements BeaconConsumer {
+ protected static final String TAG = MonitoringActivity.class.getName();
+ private static final int PERMISSION_REQUEST_COARSE_LOCATION = 1;
+ private ListView list = null;
+ private BeaconAdapter adapter = null;
+ private ArrayList arrayL = new ArrayList<>();
+ private LayoutInflater inflater;
+
+ private BeaconServiceUtility beaconUtill = null;
+ private BeaconManager iBeaconManager = BeaconManager.getInstanceForApplication(this);
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_monitor);
+ beaconUtill = new BeaconServiceUtility(this);
+ list = (ListView) findViewById(R.id.list);
+ adapter = new BeaconAdapter();
+ list.setAdapter(adapter);
+ inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ beaconUtill.onStart(iBeaconManager, this);
+ }
+
+ @Override
+ protected void onStop() {
+ beaconUtill.onStop(iBeaconManager, this);
+ super.onStop();
+ }
+
+ @Override
+ public void onBeaconServiceConnect() {
+
+ iBeaconManager.setRangeNotifier(new RangeNotifier() {
+ @Override
+ public void didRangeBeaconsInRegion(Collection iBeacons, Region region) {
+
+ arrayL.clear();
+ arrayL.addAll((ArrayList) iBeacons);
+ // adapter.notifyDataSetChanged();
+ }
+
+ });
+
+ iBeaconManager.setMonitorNotifier(new MonitorNotifier() {
+ @Override
+ public void didEnterRegion(Region region) {
+ Log.e("BeaconDetactorService", "didEnterRegion");
+ // logStatus("I just saw an iBeacon for the first time!");
+ }
+
+ @Override
+ public void didExitRegion(Region region) {
+ Log.e("BeaconDetactorService", "didExitRegion");
+ // logStatus("I no longer see an iBeacon");
+ }
+
+ @Override
+ public void didDetermineStateForRegion(int state, Region region) {
+ Log.e("BeaconDetactorService", "didDetermineStateForRegion");
+ // logStatus("I have just switched from seeing/not seeing iBeacons: " + state);
+ }
+
+ });
+
+ try {
+ iBeaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ iBeaconManager.startMonitoringBeaconsInRegion(new Region("myMonitoringUniqueId", null, null, null));
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private class BeaconAdapter extends BaseAdapter {
+
+ @Override
+ public int getCount() {
+ if (arrayL != null && arrayL.size() > 0)
+ return arrayL.size();
+ else
+ return 0;
+ }
+
+ @Override
+ public Beacon getItem(int arg0) {
+ return arrayL.get(arg0);
+ }
+
+ @Override
+ public long getItemId(int arg0) {
+ return arg0;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ try {
+ ViewHolder holder;
+
+ if (convertView != null) {
+ holder = (ViewHolder) convertView.getTag();
+ } else {
+ holder = new ViewHolder(convertView = inflater.inflate(R.layout.tupple_monitoring, null));
+ }
+ if (arrayL.get(position).getId1() != null)
+ holder.beacon_uuid.setText("UUID: " + arrayL.get(position).getServiceUuid());
+
+ holder.beacon_major.setText("Major: " + arrayL.get(position).getId1());
+
+ holder.beacon_minor.setText(", Minor: " + arrayL.get(position).getId2());
+
+ holder.beacon_proximity.setText("Proximity: " + arrayL.get(position).getId3());
+
+ holder.beacon_rssi.setText(", Rssi: " + arrayL.get(position).getRssi());
+
+ holder.beacon_txpower.setText(", TxPower: " + arrayL.get(position).getTxPower());
+
+ holder.beacon_range.setText("" + arrayL.get(position).getDistance());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return convertView;
+ }
+
+ private class ViewHolder {
+ private TextView beacon_uuid;
+ private TextView beacon_major;
+ private TextView beacon_minor;
+ private TextView beacon_proximity;
+ private TextView beacon_rssi;
+ private TextView beacon_txpower;
+ private TextView beacon_range;
+
+ public ViewHolder(View view) {
+ beacon_uuid = (TextView) view.findViewById(R.id.BEACON_uuid);
+ beacon_major = (TextView) view.findViewById(R.id.BEACON_major);
+ beacon_minor = (TextView) view.findViewById(R.id.BEACON_minor);
+ beacon_proximity = (TextView) view.findViewById(R.id.BEACON_proximity);
+ beacon_rssi = (TextView) view.findViewById(R.id.BEACON_rssi);
+ beacon_txpower = (TextView) view.findViewById(R.id.BEACON_txpower);
+ beacon_range = (TextView) view.findViewById(R.id.BEACON_range);
+
+ view.setTag(this);
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/components/iot-plugins/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/iot-plugins/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 c1c4a93b9..055bf13e1 100755
--- a/components/iot-plugins/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/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java
@@ -140,8 +140,9 @@ public class DataPublisherService extends Service {
for (SpeedData speedData : speedDataMap) {
Event event = new Event();
event.setTimestamp(speedData.getTimeStamp());
- event.setSpeed(speedData.getSpeed());
event.setTurns(speedData.getTurns());
+ event.setSpeed(speedData.getSpeed());
+
events.add(event);
}
}
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java
index d5ec057ac..562bafc55 100755
--- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/Event.java
@@ -174,9 +174,7 @@ public class Event {
}
public float getSpeed() {
-
this.type = "speed";
-
return speed;
}
@@ -209,14 +207,13 @@ public class Event {
double gpsEvents[] = getGps();
jsonPayloadData.put("gps_lat", gpsEvents[0]);
jsonPayloadData.put("gps_long", gpsEvents[1]);
- //acceleromter
+ //accelerometer
float events[] = getAccelerometer();
jsonPayloadData.put("accelerometer_x", events[0]);
jsonPayloadData.put("accelerometer_y", events[1]);
jsonPayloadData.put("accelerometer_z", events[2]);
//speed
-
//if (getSpeed()>SPEED_LIMIT) {
jsonPayloadData.put("speed_limit", getSpeed());
//}
diff --git a/components/iot-plugins/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/iot-plugins/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 97eb6a918..9935f2dd4 100755
--- a/components/iot-plugins/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/iot-plugins/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
@@ -40,7 +40,6 @@ public class LocationDataReader extends DataReader implements LocationListener {
static final Double EARTH_RADIUS = 6371.00;
-
// flag for GPS status
private boolean isGPSEnabled = false;
@@ -176,8 +175,6 @@ public class LocationDataReader extends DataReader implements LocationListener {
time=c.get(Calendar.HOUR);
-
-
locationManager.removeUpdates(LocationDataReader.this);
//String Speed = "Device Speed: " +location.getSpeed();
latitude=location.getLongitude();
@@ -185,7 +182,6 @@ 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();
@@ -219,7 +215,6 @@ public class LocationDataReader extends DataReader implements LocationListener {
}
-
@Override
public void run() {
Log.d(TAG, "running -Location");
diff --git a/components/iot-plugins/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/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/ActivitySelectSensor.java
index d99889b88..fe6c4b093 100755
--- a/components/iot-plugins/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/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/realtimeviewer/ActivitySelectSensor.java
@@ -35,7 +35,8 @@ import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
-
+import android.app.AlertDialog;
+import android.content.DialogInterface;
import org.wso2.carbon.iot.android.sense.RegisterActivity;
import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherReceiver;
import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherService;
@@ -48,11 +49,13 @@ import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedS
import org.wso2.carbon.iot.android.sense.realtimeviewer.view.adaptor.SensorViewAdaptor;
import org.wso2.carbon.iot.android.sense.realtimeviewer.view.sensor.selector.SelectSensorDialog;
import org.wso2.carbon.iot.android.sense.speech.detector.WordRecognitionActivity;
-import org.wso2.carbon.iot.android.sense.util.LocalRegistry;
+import org.wso2.carbon.iot.android.sense.beacon.MonitoringActivity;
+import org.wso2.carbon.iot.android.sense.util.LocalRegistry;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
+import org.altbeacon.beacon.BeaconManager;
import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R;
@@ -73,6 +76,8 @@ public class ActivitySelectSensor extends AppCompatActivity
private RealTimeSensorReader sensorReader = null;
private RealTimeSensorChangeReceiver realTimeSensorChangeReceiver = new RealTimeSensorChangeReceiver();
private SupportedSensors supportedSensors = SupportedSensors.getInstance();
+ protected static final String TAG = ActivitySelectSensor.class.getName();
+ private static final int PERMISSION_REQUEST_COARSE_LOCATION = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -85,6 +90,7 @@ public class ActivitySelectSensor extends AppCompatActivity
sessionIdText.setCursorVisible(false);
listView = (ListView) findViewById(R.id.senseListContainer);
+ verifyBluetooth();
registerReceiver(realTimeSensorChangeReceiver, new IntentFilter("sensorDataMap"));
@@ -136,6 +142,18 @@ public class ActivitySelectSensor extends AppCompatActivity
}
});
+ FloatingActionButton fbtnBeaconMonitor = (FloatingActionButton) findViewById(R.id.beacon);
+ fbtnBeaconMonitor.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(getApplicationContext(), MonitoringActivity.class);
+ startActivity(intent);
+
+
+ }
+ });
+
+
sharedPreferences = getSharedPreferences(SupportedSensors.SELECTED_SENSORS, 0);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
@@ -293,4 +311,44 @@ public class ActivitySelectSensor extends AppCompatActivity
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();
+
+ }
+
+ }
}
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java
index b5d0bea50..2d1cbce9d 100755
--- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClient.java
@@ -51,7 +51,7 @@ public class SenseClient {
String responseStatus = response.get("status");
RegisterInfo registerInfo = new RegisterInfo();
if (responseStatus.trim().contains(SenseConstants.Request.REQUEST_SUCCESSFUL)) {
- registerInfo.setMsg("Login Succesful");
+ registerInfo.setMsg("Login Successful");
registerInfo.setIsRegistered(true);
return registerInfo;
} else {
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon.png b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon.png
new file mode 100644
index 000000000..1ed9d05d7
Binary files /dev/null and b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon.png differ
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/round_button.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/round_button.xml
new file mode 100644
index 000000000..b18dede82
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/round_button.xml
@@ -0,0 +1,13 @@
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/wso2logo.png b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/wso2logo.png
new file mode 100755
index 000000000..b4114a6c1
Binary files /dev/null and b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/wso2logo.png differ
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_monitor.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_monitor.xml
new file mode 100755
index 000000000..52e1b4566
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_monitor.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/app_bar_activity_select_sensor.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/app_bar_activity_select_sensor.xml
index 6dc91c927..f8c44edeb 100755
--- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/app_bar_activity_select_sensor.xml
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/app_bar_activity_select_sensor.xml
@@ -6,7 +6,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
- tools:context="org.wso2.carbon.iot.android.sense.realtimeviewer.ActivitySelectSensor">
+ tools:context="org.wso2.carbon.iot.android.sense.realtimeviewer.ActivitySelectSensor"
+ android:touchscreenBlocksFocus="false">
-
-
-
+
-
+
+
+
+
+
+
+
+
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/beacon_activity_list.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/beacon_activity_list.xml
new file mode 100644
index 000000000..0c3c6b1dc
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/beacon_activity_list.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/tupple_monitoring.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/tupple_monitoring.xml
new file mode 100644
index 000000000..a120207f5
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/tupple_monitoring.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/web_view_activity.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/web_view_activity.xml
new file mode 100644
index 000000000..bc421e322
--- /dev/null
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/web_view_activity.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/dimens.xml b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/dimens.xml
index 2626ab6a6..ea9d9f550 100755
--- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/dimens.xml
+++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/dimens.xml
@@ -5,5 +5,5 @@
16dp
160dp
- 16dp
+ 40dp
diff --git a/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/speed_sensor/speed_publisher/speed_publisher.xml b/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/speed_sensor/speed_publisher/speed_publisher.xml
index a2b18b5db..5e4d07ad3 100644
--- a/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/speed_sensor/speed_publisher/speed_publisher.xml
+++ b/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/speed_sensor/speed_publisher/speed_publisher.xml
@@ -21,7 +21,7 @@
Email Alerts Speed
-
+ pacificcontrolsapps@gmail.com
text/html
diff --git a/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/turn_sensor/turn_publisher/turn_publisher.xml b/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/turn_sensor/turn_publisher/turn_publisher.xml
index ffca74c42..d04a6f041 100644
--- a/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/turn_sensor/turn_publisher/turn_publisher.xml
+++ b/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/turn_sensor/turn_publisher/turn_publisher.xml
@@ -21,7 +21,7 @@
Email Alerts Turn
-
+ pacificcontrolsapps@gmail.com
text/html