diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/build.gradle b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/build.gradle deleted file mode 100755 index 9f6b11adf..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 22 - buildToolsVersion '22.0.1' - defaultConfig { - applicationId "agent.sense.android.iot.carbon.wso2.org.wso2_senseagent" - minSdkVersion 19 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - - } - repositories { - maven { - url "https://dl.bintray.com/alt236/maven" - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - applicationVariants.all { variant -> - variant.outputs.each { output -> - def newName = output.outputFile.name - newName = newName.replace("app-", "androidsense") - newName = newName.replace("release", "") - //noinspection GroovyAssignabilityCheck - output.outputFile = new File(output.outputFile.parent, newName) - } - } - } - } - packagingOptions { - exclude 'META-INF/NOTICE' - exclude 'META-INF/LICENSE' - exclude 'META-INF/DEPENDENCIES' - exclude 'META-INF/NOTICE' - exclude 'META-INF/LICENSE' - exclude 'META-INF/LICENSE.txt' - exclude 'META-INF/NOTICE.txt' - } - productFlavors { - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } -} - -dependencies { - 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' - compile 'com.github.rholder:snowball-stemmer:1.3.0.581.1' - 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' - compile 'uk.co.alt236:easycursor-android:1.0.0' - compile 'uk.co.alt236:bluetooth-le-library-android:1.0.0' - compile 'com.google.android.gms:play-services-location:9.4.0' -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml deleted file mode 100755 index 9922eac4b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/BuildConfig.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/BuildConfig.java deleted file mode 100644 index 5032b19a1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/BuildConfig.java +++ /dev/null @@ -1,8 +0,0 @@ -/*___Generated_by_IDEA___*/ - -package agent.sense.android.iot.carbon.wso2.org.wso2_senseagent; - -/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */ -public final class BuildConfig { - public final static boolean DEBUG = Boolean.parseBoolean(null); -} \ 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/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/Manifest.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/Manifest.java deleted file mode 100644 index 6e03df3ca..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/Manifest.java +++ /dev/null @@ -1,7 +0,0 @@ -/*___Generated_by_IDEA___*/ - -package agent.sense.android.iot.carbon.wso2.org.wso2_senseagent; - -/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */ -public final class Manifest { -} \ 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/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/R.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/R.java deleted file mode 100644 index b047be4fc..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/gen/agent/sense/android/iot/carbon/wso2/org/wso2_senseagent/R.java +++ /dev/null @@ -1,7 +0,0 @@ -/*___Generated_by_IDEA___*/ - -package agent.sense.android.iot.carbon.wso2.org.wso2_senseagent; - -/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */ -public final class R { -} \ 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/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 deleted file mode 100755 index bf532d00b..000000000 --- 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 +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2015, 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; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.annotation.TargetApi; -import android.app.Activity; -import android.content.Intent; -import android.os.Build; -import android.os.Bundle; -import android.os.Handler; -import android.text.TextUtils; -import android.view.KeyEvent; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Toast; - -import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherReceiver; -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.event.SenseScheduleReceiver; -import org.wso2.carbon.iot.android.sense.realtimeviewer.ActivitySelectSensor; -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.AvailableSensorsInDevice; -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedSensors; -import org.wso2.carbon.iot.android.sense.util.LocalRegistry; -import org.wso2.carbon.iot.android.sense.util.SenseClient; -import org.wso2.carbon.iot.android.sense.util.SenseUtils; -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. - */ -public class RegisterActivity extends Activity { - - private EditText mUsernameView; - private EditText mPasswordView; - private EditText mHostView; - private View mProgressView; - private View mLoginFormView; - private Button deviceRegisterButton; - private Handler mUiHandler = new Handler(); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - getSharedPreferences(SupportedSensors.SELECTED_SENSORS, 0).edit().clear().apply(); - - if (LocalRegistry.isExist(getApplicationContext())) { - Intent intent = new Intent(getApplicationContext(), ActivitySelectSensor.class); - startActivity(intent); - } - setContentView(R.layout.activity_register); - mUsernameView = (EditText) findViewById(R.id.username); - mPasswordView = (EditText) findViewById(R.id.password); - mHostView = (EditText) findViewById(R.id.hostname); - AvailableSensorsInDevice availableSensorsInDevice = new AvailableSensorsInDevice(getApplicationContext()); - availableSensorsInDevice.setContent(); - - deviceRegisterButton = (Button) findViewById(R.id.device_register_button); - - - deviceRegisterButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - attemptLogin(); - } - }); - - mLoginFormView = findViewById(R.id.login_form); - mProgressView = findViewById(R.id.login_progress); - } - - public void attemptLogin() { - showProgress(true); - // Reset errors. - mUsernameView.setError(null); - mPasswordView.setError(null); - - // Store values at the time of the login attempt. - final String username = mUsernameView.getText().toString(); - final String password = mPasswordView.getText().toString(); - final String hostname = mHostView.getText().toString(); - boolean cancel = false; - View focusView = null; - - // Check for a valid password, if the user entered one. - if (!TextUtils.isEmpty(password)) { - // mPasswordView.setError(getString(R.string.error_invalid_password)); - focusView = mPasswordView; - //cancel = true; - } - // Check for a valid username . - if (TextUtils.isEmpty(username)) { - mUsernameView.setError(getString(R.string.error_field_required)); - focusView = mUsernameView; - cancel = true; - } - if (TextUtils.isEmpty(username)) { - mHostView.setError(getString(R.string.error_field_required)); - focusView = mHostView; - cancel = true; - } - - if (cancel) { - focusView.requestFocus(); - } else { - Thread myThread = new Thread(new Runnable() { - @Override - public void run() { - SenseClient client = new SenseClient(getApplicationContext()); - LocalRegistry.addServerURL(getBaseContext(), hostname); - String deviceId = SenseUtils.generateDeviceId(getBaseContext(), getContentResolver()); - final RegisterInfo registerStatus = client.register(username, password, deviceId, mUiHandler); - mUiHandler.post(new Runnable() { - @Override - public void run() { - Toast.makeText(getApplicationContext(), registerStatus.getMsg(), Toast.LENGTH_LONG).show(); - } - }); - - if (registerStatus.isRegistered()) { - LocalRegistry.setEnrolled(getApplicationContext(), true); - LocalRegistry.addUsername(getApplicationContext(), username); - LocalRegistry.addDeviceId(getApplicationContext(), deviceId); - MQTTTransportHandler mqttTransportHandler = AndroidSenseMQTTHandler.getInstance(getApplicationContext()); - if (!mqttTransportHandler.isConnected()) { - mqttTransportHandler.connect(); - } - SenseScheduleReceiver senseScheduleReceiver = new SenseScheduleReceiver(); - senseScheduleReceiver.clearAbortBroadcast(); - senseScheduleReceiver.onReceive(getApplicationContext(), null); - - DataPublisherReceiver dataUploaderReceiver = new DataPublisherReceiver(); - dataUploaderReceiver.clearAbortBroadcast(); - dataUploaderReceiver.onReceive(getApplicationContext(), null); - - mUiHandler.post(new Runnable() { - @Override - public void run() { - Intent intent = new Intent(getApplicationContext(), ActivitySelectSensor.class); - startActivity(intent); - } - }); - } - mUiHandler.post(new Runnable() { - @Override - public void run() { - showProgress(false); - } - }); - } - }); - myThread.start(); - } - } - - @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) - public void showProgress(final boolean show) { - // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow - // for very easy animations. If available, use these APIs to fade-in - // the progress spinner. - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { - int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); - - mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); - mLoginFormView.animate().setDuration(shortAnimTime).alpha( - show ? 0 : 1).setListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); - } - }); - - mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); - mProgressView.animate().setDuration(shortAnimTime).alpha( - show ? 1 : 0).setListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); - } - }); - } else { - // The ViewPropertyAnimator APIs are not available, so simply show - // 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/beacon/BeaconDetactorService.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/beacon/BeaconDetactorService.java deleted file mode 100755 index 61e84c680..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconDetactorService.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.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) { - - new Thread(){ - @Override - public void run() { - iBeaconManager.bind(BeaconDetactorService.this); - } - }.start(); - - - return START_STICKY; - } - - @Override - public void onCreate() { - super.onCreate(); - - - 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/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconScanedData.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/beacon/BeaconScanedData.java deleted file mode 100644 index e33e3f8e2..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconScanedData.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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 java.util.Date; - - -public class BeaconScanedData { - - - private int beaconMajor;// Major - private int beaconMinor;//Minor - private String beaconProximity;// Proximity - private int beaconUuid;// Uuid - private long timestamp;// Timestamp - - BeaconScanedData(int beaconMajor, int beaconMinor,String beaconProximity,int beaconUuid) { - this.beaconMajor = beaconMajor; - this.beaconMinor = beaconMinor; - this.beaconProximity = beaconProximity; - this.beaconUuid = beaconUuid; - timestamp = new Date().getTime(); - - } - - public int getBeaconMajor() { - return beaconMajor; - } - - public void setBeaconMajor(int beaconMajor) { - this.beaconMajor = beaconMajor; - } - - public int getBeaconMinor() { - return beaconMinor; - } - - public void setBeaconMinor(int beaconMinor) { - this.beaconMinor = beaconMinor; - } - - public String getBeaconProximity() { - return beaconProximity; - } - - public void setBeaconProximity(String beaconProximity) { - this.beaconProximity = beaconProximity; - } - - public int getBeaconUuid() { - return beaconUuid; - } - - public void setBeaconUuid(int beaconUuid) { - this.beaconUuid = beaconUuid; - } - - public long getTimeStamp() { - return timestamp; - } - - public void setTimeStamp(long timeStamp) { - timestamp = timeStamp; - } -} 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/beacon/BeaconServiceUtility.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/beacon/BeaconServiceUtility.java deleted file mode 100755 index 1a4271b5e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/BeaconServiceUtility.java +++ /dev/null @@ -1,71 +0,0 @@ -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; -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ -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/device-types/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/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/MonitoringActivity.java deleted file mode 100644 index 5b24c3858..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/beacon/MonitoringActivity.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * 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 org.wso2.carbon.iot.android.sense.beacon.BeaconScanedData; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.logging.Handler; -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; - private ArrayList arrayL = new ArrayList<>(); - private LayoutInflater inflater; - - private BeaconServiceUtility beaconUtill = null; - private BeaconManager iBeaconManager = BeaconManager.getInstanceForApplication(this); - - BeaconScanedData beaconData; - - @Override - public void onBeaconServiceConnect() { - - iBeaconManager.setBackgroundMode(true); - - - iBeaconManager.setRangeNotifier(new RangeNotifier() { - @Override - public void didRangeBeaconsInRegion(Collection iBeacons, Region region) { - for (Beacon beacon: iBeacons) { - Log.i(TAG, "This beacon has identifiers:"+beacon.getId1()+", "+beacon.getId2()+", "+beacon.getId3()); - - - } - - arrayL.clear(); - arrayL.addAll(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(); - } - } - - @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); - - //iBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25")); - iBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24")); - - iBeaconManager.bind(this); - - iBeaconManager.setRangeNotifier(new RangeNotifier() { - @Override - public void didRangeBeaconsInRegion(Collection beacons, Region region) { - for(Beacon beacon : beacons) { - Log.d(TAG, "UUID:" + beacon.getId1() + ", major:" + beacon.getId2() + ", minor:" + beacon.getId3() + ", Distance:" + beacon.getDistance() + ",RSSI" + beacon.getRssi() + ", TxPower" + beacon.getTxPower()); - } - arrayL.clear(); - arrayL.addAll(beacons); - } - }); - - } - - @Override - protected void onDestroy() { - super.onDestroy(); - } - - @Override - protected void onStart() { - super.onStart(); - beaconUtill.onStart(iBeaconManager, this); - beaconUtill = new BeaconServiceUtility(this); - } - - @Override - protected void onStop() { - beaconUtill.onStop(iBeaconManager, this); - super.onStop(); - } - - - 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)); - } - holder.beacon_uuid.setText("UUID: " + arrayL.get(position).getId1().toString().toUpperCase()); - - holder.beacon_major.setText("Major: " + arrayL.get(position).getId2()); - - holder.beacon_minor.setText(" Minor: " + arrayL.get(position).getId3()); - - double proximity = arrayL.get(position).getDistance(); - holder.beacon_proximity.setText("Proximity: " + (new BigDecimal(proximity).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue())); - - 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()); - - beaconData = new BeaconScanedData(arrayL.get(position).getId2().toInt(), arrayL.get(position).getId3().toInt(),holder.beacon_uuid.toString(),arrayL.get(position).getRssi()); - SenseDataHolder.getBeaconScanedDataHolder().add(beaconData); - - - - } 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/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/BeaconMonitoringActivity.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/bmonitor/BeaconMonitoringActivity.java deleted file mode 100644 index 23785db26..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/BeaconMonitoringActivity.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * 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.bmonitor; - -import android.annotation.TargetApi; -import android.app.Activity; -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.os.AsyncTask; -import android.os.Build; -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.widget.ListView; - -import java.util.HashMap; -import java.util.Map; - -import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; -import uk.co.alt236.bluetoothlelib.device.BluetoothLeDevice; -import uk.co.alt236.easycursor.objectcursor.EasyObjectCursor; - -public class BeaconMonitoringActivity extends AppCompatActivity { - - private BluetoothLeScanner mScanner; - private BluetoothUtils mBluetoothUtils; - private LeDeviceListAdapter mLeDeviceListAdapter; - private BluetoothLeDeviceStore mDeviceStore; - - protected ListView mList; - - public static final int MINIMUM_DISTANCE = -70; - - public static Map itemMap; - - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_beacon_monitoring); - - itemMap = new HashMap(); - itemMap.put("DC:5F:BD:68:88:D5", "Noodles"); - itemMap.put("EF:0F:50:D5:BA:A1", "Vegetables"); - itemMap.put("FA:F2:CF:84:C2:F7", "Oil"); - - mList = (ListView) this.findViewById(android.R.id.list); - - mDeviceStore = new BluetoothLeDeviceStore(); - mBluetoothUtils = new BluetoothUtils(this); - mScanner = new BluetoothLeScanner(mLeScanCallback, mBluetoothUtils); - startScan(); - } - - private final BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { - @Override - public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) { - final BluetoothLeDevice deviceLe = new BluetoothLeDevice(device, rssi, scanRecord, System.currentTimeMillis()); - if(deviceLe!= null && deviceLe.getName()!= null && !deviceLe.getName().equals("Unknown Device")){ - mDeviceStore.addDevice(deviceLe); - - if(deviceLe.getRssi() > MINIMUM_DISTANCE){ - Object[] objects = new Object[4]; - objects[0] = deviceLe.getName(); - objects[1] = deviceLe.getAddress(); - objects[2] = deviceLe.getRssi(); - objects[3] = itemMap.get(device.getAddress()); - - new SendToSiddi().execute(objects); - } - - - final EasyObjectCursor c = mDeviceStore.getDeviceCursor(); - runOnUiThread(new Runnable() { - @Override - public void run() { - mLeDeviceListAdapter.swapCursor(c); - } - }); - } - } - }; - - private void startScan() { - - mLeDeviceListAdapter = new LeDeviceListAdapter(this, mDeviceStore.getDeviceCursor()); - mList.setAdapter(mLeDeviceListAdapter); - - final boolean mIsBluetoothOn = mBluetoothUtils.isBluetoothOn(); - final boolean mIsBluetoothLePresent = mBluetoothUtils.isBluetoothLeSupported(); - mBluetoothUtils.askUserToEnableBluetoothIfNeeded(); - if (mIsBluetoothOn && mIsBluetoothLePresent) { - mScanner.scanLeDevice(-1, true); - invalidateOptionsMenu(); - } - } - - - public class SendToSiddi extends AsyncTask{ - - @Override - protected Void doInBackground(Object... objects) { - - return null; - } - } -} 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/bmonitor/BluetoothLeDeviceStore.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/bmonitor/BluetoothLeDeviceStore.java deleted file mode 100644 index 141157501..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/BluetoothLeDeviceStore.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * - * 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.bmonitor; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import uk.co.alt236.bluetoothlelib.device.BluetoothLeDevice; -import uk.co.alt236.bluetoothlelib.device.beacon.BeaconType; -import uk.co.alt236.bluetoothlelib.device.beacon.BeaconUtils; -import uk.co.alt236.bluetoothlelib.device.beacon.ibeacon.IBeaconDevice; -import uk.co.alt236.bluetoothlelib.util.ByteUtils; -import uk.co.alt236.easycursor.objectcursor.EasyObjectCursor; - -public class BluetoothLeDeviceStore { - private final Map mDeviceMap; - - - public BluetoothLeDeviceStore() { - mDeviceMap = new HashMap<>(); - } - - public void addDevice(final BluetoothLeDevice device) { - if (mDeviceMap.containsKey(device.getAddress())) { - mDeviceMap.get(device.getAddress()).updateRssiReading(device.getTimestamp(), device.getRssi()); - } else { - mDeviceMap.put(device.getAddress(), device); - } - } - - public void clear() { - mDeviceMap.clear(); - } - - public EasyObjectCursor getDeviceCursor() { - return new EasyObjectCursor<>( - BluetoothLeDevice.class, - getDeviceList(), - "address"); - } - - public List getDeviceList() { - final List methodResult = new ArrayList<>(mDeviceMap.values()); - - Collections.sort(methodResult, new Comparator() { - - @Override - public int compare(final BluetoothLeDevice arg0, final BluetoothLeDevice arg1) { - return arg0.getAddress().compareToIgnoreCase(arg1.getAddress()); - } - }); - - return methodResult; - } - - private String getListAsCsv() { - final List list = getDeviceList(); - final StringBuilder sb = new StringBuilder(); - sb.append(CsvWriterHelper.addStuff("mac")); - sb.append(CsvWriterHelper.addStuff("name")); - sb.append(CsvWriterHelper.addStuff("firstTimestamp")); - sb.append(CsvWriterHelper.addStuff("firstRssi")); - sb.append(CsvWriterHelper.addStuff("currentTimestamp")); - sb.append(CsvWriterHelper.addStuff("currentRssi")); - sb.append(CsvWriterHelper.addStuff("adRecord")); - sb.append(CsvWriterHelper.addStuff("iBeacon")); - sb.append(CsvWriterHelper.addStuff("uuid")); - sb.append(CsvWriterHelper.addStuff("major")); - sb.append(CsvWriterHelper.addStuff("minor")); - sb.append(CsvWriterHelper.addStuff("txPower")); - sb.append(CsvWriterHelper.addStuff("distance")); - sb.append(CsvWriterHelper.addStuff("accuracy")); - sb.append('\n'); - - for (final BluetoothLeDevice device : list) { - sb.append(CsvWriterHelper.addStuff(device.getAddress())); - sb.append(CsvWriterHelper.addStuff(device.getName())); - sb.append(CsvWriterHelper.addStuff(TimeFormatter.getIsoDateTime(device.getFirstTimestamp()))); - sb.append(CsvWriterHelper.addStuff(device.getFirstRssi())); - sb.append(CsvWriterHelper.addStuff(TimeFormatter.getIsoDateTime(device.getTimestamp()))); - sb.append(CsvWriterHelper.addStuff(device.getRssi())); - sb.append(CsvWriterHelper.addStuff(ByteUtils.byteArrayToHexString(device.getScanRecord()))); - final boolean isIBeacon = BeaconUtils.getBeaconType(device) == BeaconType.IBEACON; - final String uuid; - final String minor; - final String major; - final String txPower; - final String distance; - final String accuracy; - - if (isIBeacon) { - final IBeaconDevice beacon = new IBeaconDevice(device); - uuid = String.valueOf(beacon.getUUID()); - minor = String.valueOf(beacon.getMinor()); - major = String.valueOf(beacon.getMajor()); - txPower = String.valueOf(beacon.getCalibratedTxPower()); - distance = beacon.getDistanceDescriptor().toString().toLowerCase(Locale.US); - accuracy = String.valueOf(beacon.getAccuracy()); - } else { - uuid = ""; - minor = ""; - major = ""; - txPower = ""; - distance = ""; - accuracy = ""; - } - - sb.append(CsvWriterHelper.addStuff(isIBeacon)); - sb.append(CsvWriterHelper.addStuff(uuid)); - sb.append(CsvWriterHelper.addStuff(minor)); - sb.append(CsvWriterHelper.addStuff(major)); - sb.append(CsvWriterHelper.addStuff(txPower)); - sb.append(CsvWriterHelper.addStuff(distance)); - sb.append(CsvWriterHelper.addStuff(accuracy)); - - sb.append('\n'); - } - - return sb.toString(); - } - - public void shareDataAsEmail(final Context context) { - final long timeInMillis = System.currentTimeMillis(); - - final String to = null; - final String subject = ""; - - final String message = ""; - - final Intent i = new Intent(Intent.ACTION_SEND); - i.setType("plain/text"); - try { - final File outputDir = context.getCacheDir(); - final File outputFile = File.createTempFile("bluetooth_le_" + timeInMillis, ".csv", outputDir); - outputFile.setReadable(true, false); - generateFile(outputFile, getListAsCsv()); - i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(outputFile)); - i.putExtra(Intent.EXTRA_EMAIL, new String[]{to}); - i.putExtra(Intent.EXTRA_SUBJECT, subject); - i.putExtra(Intent.EXTRA_TEXT, message); - context.startActivity(Intent.createChooser(i, "Email Subject")); - - } catch (final IOException e) { - e.printStackTrace(); - } - } - - private static FileWriter generateFile(final File file, final String contents) { - FileWriter writer = null; - try { - writer = new FileWriter(file); - writer.append(contents); - writer.flush(); - - } catch (final IOException e) { - e.printStackTrace(); - } finally { - try { - writer.close(); - } catch (final IOException e) { - e.printStackTrace(); - } - } - return writer; - } -} \ 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/bmonitor/BluetoothLeScanner.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/bmonitor/BluetoothLeScanner.java deleted file mode 100644 index a132d53ee..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/BluetoothLeScanner.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * 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.bmonitor; - -import android.bluetooth.BluetoothAdapter; -import android.os.Handler; -import android.util.Log; - -public class BluetoothLeScanner { - private final Handler mHandler; - private final BluetoothAdapter.LeScanCallback mLeScanCallback; - private final BluetoothUtils mBluetoothUtils; - private boolean mScanning; - - public BluetoothLeScanner(final BluetoothAdapter.LeScanCallback leScanCallback, final BluetoothUtils bluetoothUtils) { - mHandler = new Handler(); - mLeScanCallback = leScanCallback; - mBluetoothUtils = bluetoothUtils; - } - - public boolean isScanning() { - return mScanning; - } - - public void scanLeDevice(final int duration, final boolean enable) { - if (enable) { - if (mScanning) { - return; - } - Log.d("TAG", "~ Starting Scan"); - // Stops scanning after a pre-defined scan period. - if (duration > 0) { - mHandler.postDelayed(new Runnable() { - @Override - public void run() { - Log.d("TAG", "~ Stopping Scan (timeout)"); - mScanning = false; - mBluetoothUtils.getBluetoothAdapter().stopLeScan(mLeScanCallback); - } - }, duration); - } - mScanning = true; - mBluetoothUtils.getBluetoothAdapter().startLeScan(mLeScanCallback); - } else { - Log.d("TAG", "~ Stopping Scan"); - mScanning = false; - mBluetoothUtils.getBluetoothAdapter().stopLeScan(mLeScanCallback); - } - } -} 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/bmonitor/BluetoothUtils.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/bmonitor/BluetoothUtils.java deleted file mode 100644 index 5e664793c..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/BluetoothUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * 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.bmonitor; - -import android.app.Activity; -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothManager; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; - -public final class BluetoothUtils { - public final static int REQUEST_ENABLE_BT = 2001; - private final Activity mActivity; - private final BluetoothAdapter mBluetoothAdapter; - - public BluetoothUtils(final Activity activity) { - mActivity = activity; - final BluetoothManager btManager = (BluetoothManager) mActivity.getSystemService(Context.BLUETOOTH_SERVICE); - mBluetoothAdapter = btManager.getAdapter(); - } - - public void askUserToEnableBluetoothIfNeeded() { - if (isBluetoothLeSupported() && (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled())) { - final Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); - mActivity.startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); - } - } - - public BluetoothAdapter getBluetoothAdapter() { - return mBluetoothAdapter; - } - - public boolean isBluetoothLeSupported() { - return mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE); - } - - public boolean isBluetoothOn() { - if (mBluetoothAdapter == null) { - return false; - } else { - return mBluetoothAdapter.isEnabled(); - } - } -} 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/bmonitor/CsvWriterHelper.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/bmonitor/CsvWriterHelper.java deleted file mode 100644 index 6c10210a2..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/CsvWriterHelper.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * 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.bmonitor; - -public class CsvWriterHelper { - private static final String QUOTE = "\""; - - public static String addStuff(final Integer text) { - return QUOTE + text + QUOTE + ","; - } - - public static String addStuff(final Long text) { - return QUOTE + text + QUOTE + ","; - } - - public static String addStuff(final boolean value) { - return QUOTE + value + QUOTE + ","; - } - - public static String addStuff(String text) { - if (text == null) { - text = ""; - } - text = text.replace(QUOTE, "'"); - - return QUOTE + text.trim() + QUOTE + ","; - } -} \ 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/bmonitor/LeDeviceListAdapter.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/bmonitor/LeDeviceListAdapter.java deleted file mode 100644 index da4370b89..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/LeDeviceListAdapter.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * 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.bmonitor; - -import android.app.Activity; -import android.support.v4.widget.SimpleCursorAdapter; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import java.text.DecimalFormat; - -import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; -import uk.co.alt236.bluetoothlelib.device.BluetoothLeDevice; -import uk.co.alt236.bluetoothlelib.device.beacon.BeaconType; -import uk.co.alt236.bluetoothlelib.device.beacon.BeaconUtils; -import uk.co.alt236.bluetoothlelib.device.beacon.ibeacon.IBeaconDevice; -import uk.co.alt236.easycursor.objectcursor.EasyObjectCursor; - -public class LeDeviceListAdapter extends SimpleCursorAdapter { - private final LayoutInflater mInflator; - private final Activity mActivity; - - public static final DecimalFormat DOUBLE_TWO_DIGIT_ACCURACY = new DecimalFormat("#.##"); - public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - public LeDeviceListAdapter(final Activity activity, final EasyObjectCursor cursor) { - super(activity, R.layout.list_item_device, cursor, new String[0], new int[0], 0); - mInflator = activity.getLayoutInflater(); - mActivity = activity; - } - - @SuppressWarnings("unchecked") - @Override - public EasyObjectCursor getCursor() { - return ((EasyObjectCursor) super.getCursor()); - } - - @Override - public BluetoothLeDevice getItem(final int i) { - return getCursor().getItem(i); - } - - @Override - public long getItemId(final int i) { - return i; - } - - @Override - public View getView(final int i, View view, final ViewGroup viewGroup) { - final ViewHolder viewHolder; - // General ListView optimization code. - if (view == null) { - view = mInflator.inflate(R.layout.list_item_device, null); - viewHolder = new ViewHolder(); - viewHolder.deviceAddress = (TextView) view.findViewById(R.id.device_address); - viewHolder.deviceName = (TextView) view.findViewById(R.id.device_name); - viewHolder.deviceRssi = (TextView) view.findViewById(R.id.device_rssi); - viewHolder.deviceIcon = (ImageView) view.findViewById(R.id.device_icon); - viewHolder.deviceLastUpdated = (TextView) view.findViewById(R.id.device_last_update); - viewHolder.ibeaconMajor = (TextView) view.findViewById(R.id.ibeacon_major); - viewHolder.ibeaconMinor = (TextView) view.findViewById(R.id.ibeacon_minor); - viewHolder.ibeaconDistance = (TextView) view.findViewById(R.id.ibeacon_distance); - viewHolder.ibeaconUUID = (TextView) view.findViewById(R.id.ibeacon_uuid); - viewHolder.ibeaconTxPower = (TextView) view.findViewById(R.id.ibeacon_tx_power); - viewHolder.ibeaconSection = view.findViewById(R.id.ibeacon_section); - viewHolder.ibeaconDistanceDescriptor = (TextView) view.findViewById(R.id.ibeacon_distance_descriptor); - view.setTag(viewHolder); - } else { - viewHolder = (ViewHolder) view.getTag(); - } - - final BluetoothLeDevice device = getCursor().getItem(i); - final String deviceName = device.getName(); - - final double rssi = device.getRssi(); - - if (deviceName != null && deviceName.length() > 0) { - viewHolder.deviceName.setText(deviceName + " (" + BeaconMonitoringActivity.itemMap.get(device.getAddress()) + ")"); - } else { - viewHolder.deviceName.setText(R.string.unknown_device); - } - - - if (BeaconUtils.getBeaconType(device) == BeaconType.IBEACON) { - final IBeaconDevice iBeacon = new IBeaconDevice(device); - final String accuracy = DOUBLE_TWO_DIGIT_ACCURACY.format(iBeacon.getAccuracy()); - - viewHolder.deviceIcon.setImageResource(R.drawable.beacon); - viewHolder.ibeaconSection.setVisibility(View.VISIBLE); - viewHolder.ibeaconMajor.setText(String.valueOf(iBeacon.getMajor())); - viewHolder.ibeaconMinor.setText(String.valueOf(iBeacon.getMinor())); - viewHolder.ibeaconTxPower.setText(String.valueOf(iBeacon.getCalibratedTxPower())); - viewHolder.ibeaconUUID.setText(iBeacon.getUUID()); - viewHolder.ibeaconDistance.setText( - mActivity.getString(R.string.formatter_meters, accuracy)); - viewHolder.ibeaconDistanceDescriptor.setText(iBeacon.getDistanceDescriptor().toString()); - } else { - if(device.getRssi() > BeaconMonitoringActivity.MINIMUM_DISTANCE){ - viewHolder.deviceIcon.setImageResource(R.drawable.beacon_red); - }else{ - viewHolder.deviceIcon.setImageResource(R.drawable.beacon); - } - - viewHolder.ibeaconSection.setVisibility(View.GONE); - } - - - final String rssiString = - mActivity.getString(R.string.formatter_db, String.valueOf(rssi)); - final String runningAverageRssiString = - mActivity.getString(R.string.formatter_db, String.valueOf(device.getRunningAverageRssi())); - - viewHolder.deviceLastUpdated.setText( - android.text.format.DateFormat.format( - TIME_FORMAT, new java.util.Date(device.getTimestamp()))); - viewHolder.deviceAddress.setText(device.getAddress()); - viewHolder.deviceRssi.setText(rssiString + " / " + runningAverageRssiString); - return view; - } - - static class ViewHolder { - TextView deviceName; - TextView deviceAddress; - TextView deviceRssi; - TextView ibeaconUUID; - TextView ibeaconMajor; - TextView ibeaconMinor; - TextView ibeaconTxPower; - TextView ibeaconDistance; - TextView ibeaconDistanceDescriptor; - TextView deviceLastUpdated; - View ibeaconSection; - ImageView deviceIcon; - } - -} \ 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/bmonitor/TimeFormatter.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/bmonitor/TimeFormatter.java deleted file mode 100644 index 340a0211b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/TimeFormatter.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * 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.bmonitor; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -public class TimeFormatter { - private final static String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS zzz"; - private final static SimpleDateFormat ISO_FORMATTER = new UtcDateFormatter(ISO_FORMAT, Locale.US); - - public static String getIsoDateTime(final Date date) { - return ISO_FORMATTER.format(date); - } - - public static String getIsoDateTime(final long millis) { - return getIsoDateTime(new Date(millis)); - } -} \ 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/bmonitor/UtcDateFormatter.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/bmonitor/UtcDateFormatter.java deleted file mode 100644 index bb3f52759..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/bmonitor/UtcDateFormatter.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * **************************************************************************** - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * GenieConnect Ltd. ("COMPANY") CONFIDENTIAL - * Unpublished Copyright (c) 2010-2013 GenieConnect Ltd., All Rights Reserved. - * - * NOTICE: - * All information contained herein is, and remains the property of COMPANY. - * The intellectual and technical concepts contained herein are proprietary to - * COMPANY and may be covered by U.S. and Foreign Patents, patents in process, and - * are protected by trade secret or copyright law. Dissemination of this - * information or reproduction of this material is strictly forbidden unless prior - * written permission is obtained from COMPANY. Access to the source code - * contained herein is hereby forbidden to anyone except current COMPANY employees, - * managers or contractors who have executed Confidentiality and Non-disclosure - * agreements explicitly covering such access. - * - * The copyright notice above does not evidence any actual or intended publication - * or disclosure of this source code, which includes information that is - * confidential and/or proprietary, and is a trade secret, of COMPANY. - * - * ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE, OR PUBLIC - * DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN - * CONSENT OF COMPANY IS STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE LAWS - * AND INTERNATIONAL TREATIES. THE RECEIPT OR POSSESSION OF THIS SOURCE CODE - * AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, - * DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING - * THAT IT MAY DESCRIBE, IN WHOLE OR IN PART. - * **************************************************************************** - */ -package org.wso2.carbon.iot.android.sense.bmonitor; - -import android.annotation.SuppressLint; - -import java.text.DateFormatSymbols; -import java.util.Locale; -import java.util.TimeZone; - -public class UtcDateFormatter extends java.text.SimpleDateFormat { - private static final long serialVersionUID = 1L; - - private static final String TIME_ZONE_STRING = "UTC"; - private static final TimeZone TIME_ZONE_UTC = TimeZone.getTimeZone(TIME_ZONE_STRING); - - @SuppressLint("SimpleDateFormat") - public UtcDateFormatter(final String template) { - super(template); - super.setTimeZone(TIME_ZONE_UTC); - } - - @SuppressLint("SimpleDateFormat") - public UtcDateFormatter(final String template, final DateFormatSymbols symbols) { - super(template, symbols); - super.setTimeZone(TIME_ZONE_UTC); - } - - public UtcDateFormatter(final String template, final Locale locale) { - super(template, locale); - super.setTimeZone(TIME_ZONE_UTC); - } - - /* - * This function will throw an UnsupportedOperationException. - * You are not be able to change the TimeZone of this object - * - * (non-Javadoc) - * @see java.text.DateFormat#setTimeZone(java.util.TimeZone) - */ - @Override - public void setTimeZone(final TimeZone timezone) { - throw new UnsupportedOperationException("This SimpleDateFormat can only be in " + TIME_ZONE_STRING); - } -} \ 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/constants/SenseConstants.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/constants/SenseConstants.java deleted file mode 100755 index 6ef46a7d3..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/constants/SenseConstants.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.constants; - -/** - * This hold constants related to android_sense. - */ -public class SenseConstants { - public final static String DEVICE_TYPE = "android_sense"; - public final static String REGISTER_CONTEXT = "/android_sense"; - public final static String DCR_CONTEXT = "/dynamic-client-web"; - public final static String TOKEN_ISSUER_CONTEXT = "/oauth2"; - public final static String API_APPLICATION_REGISTRATION_CONTEXT = "/api-application-registration"; - - public static final String EVENT_LISTENER_STARTED = "xxStartedxx"; - public static final String EVENT_LISTENER_FINISHED = "xxFinishedxx"; - public static final String EVENT_LISTENER_ONGOING = "xxOngoingxx"; - - public final class Request { - public final static String REQUEST_SUCCESSFUL = "200"; - public final static int MAX_ATTEMPTS = 2; - } -} 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/DataPublisherReceiver.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/DataPublisherReceiver.java deleted file mode 100755 index de4c14b3c..000000000 --- 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/DataPublisherReceiver.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.data.publisher; - -import android.app.AlarmManager; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -/** - * This creates and AlarmManagerService that triggers the data uploader service with a 30 seconds interval. - */ -public class DataPublisherReceiver extends BroadcastReceiver { - private static int ALARM_INTERVAL = 1000; - - @Override - public void onReceive(Context context, Intent intent) { - AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - Log.i("Data Publisher", "triggered"); - Intent i = new Intent(context, DataPublisherService.class); - PendingIntent pending = PendingIntent.getService(context, 0, i, 0); - service.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), ALARM_INTERVAL, pending); - } -} \ 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/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 deleted file mode 100755 index 09f254ddb..000000000 --- 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 +++ /dev/null @@ -1,313 +0,0 @@ -/* - * 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.data.publisher; - -import android.app.Service; -import android.content.Context; -import android.content.Intent; -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; -import org.wso2.carbon.iot.android.sense.beacon.BeaconScanedData; -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.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; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * This is an android service which publishes the data to the server. - */ -public class DataPublisherService extends Service { - private final String TAG = DataPublisherService.class.getName(); - private Context context; - - @Nullable - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - context = this; - Log.d(TAG, "service started"); - try { - List events = new ArrayList<>(); - //retrieve sensor data. - List sensorDataMap = SenseDataHolder.getSensorDataHolder(); - if (!sensorDataMap.isEmpty()) { - for (SensorData sensorData : sensorDataMap) { - Event event = new Event(); - event.setTimestamp(sensorData.getTimestamp()); - switch (sensorData.getSensorType()) { - case Sensor.TYPE_ACCELEROMETER: - event.setAccelerometer(sensorData.getSensorValues()); - events.add(event); - break; - case Sensor.TYPE_MAGNETIC_FIELD: - event.setMagnetic(sensorData.getSensorValues()); - events.add(event); - break; - case Sensor.TYPE_GYROSCOPE: - event.setGyroscope(sensorData.getSensorValues()); - events.add(event); - break; - case Sensor.TYPE_LIGHT: - event.setLight(sensorData.getSensorValues()[0]); - break; - case Sensor.TYPE_PRESSURE: - event.setPressure(sensorData.getSensorValues()[0]); - events.add(event); - break; - case Sensor.TYPE_PROXIMITY: - event.setProximity(sensorData.getSensorValues()[0]); - events.add(event); - break; - case Sensor.TYPE_GRAVITY: - event.setGravity(sensorData.getSensorValues()); - events.add(event); - break; - case Sensor.TYPE_GAME_ROTATION_VECTOR: - event.setRotation(sensorData.getSensorValues()); - events.add(event); - break; - } - } - } - SenseDataHolder.resetSensorDataHolder(); - - //retrieve battery data. - List batteryDataMap = SenseDataHolder.getBatteryDataHolder(); - if (!batteryDataMap.isEmpty()) { - for (BatteryData batteryData : batteryDataMap) { - Event event = new Event(); - event.setTimestamp(batteryData.getTimestamp()); - event.setBattery(batteryData.getLevel()); - event.setBatteryTemperature(batteryData.getTemperature()); - event.setBatteryStatus(batteryData.getStatus()); - event.setBatteryState(batteryData.getState().toString()); - events.add(event); - } - } - SenseDataHolder.resetBatteryDataHolder(); - - //retrieve location data. - List locationDataMap = SenseDataHolder.getLocationDataHolder(); - - if (!locationDataMap.isEmpty()) { - for (LocationData locationData : locationDataMap) { - Event event = new Event(); - event.setTimestamp(locationData.getTimeStamp()); - event.setGps(new double[]{locationData.getLatitude(), locationData.getLongitude()}); - events.add(event); - } - } - SenseDataHolder.resetLocationDataHolder(); - - //retrieve speed data. - List speedDataMap = SenseDataHolder.getSpeedDataHolder(); - if (!speedDataMap.isEmpty()) { - for (SpeedData speedData : speedDataMap) { - Event event = new Event(); - event.setTimestamp(speedData.getTimeStamp()); - event.setTurns(speedData.getTurns()); - event.setSpeed(speedData.getSpeed()); - - events.add(event); - } - } - SenseDataHolder.resetSpeedDataHolder(); - - //retrieve speed data. - List beaconDataMap = SenseDataHolder.getBeaconScanedDataHolder(); - if (!speedDataMap.isEmpty()) { - for (BeaconScanedData beaconData : beaconDataMap) { - Event event = new Event(); - event.setBeaconMajor(beaconData.getBeaconMajor()); - event.setBeaconMinor(beaconData.getBeaconMinor()); - event.setBeaconProximity(beaconData.getBeaconProximity()); - event.setBeaconUuid(beaconData.getBeaconUuid()); - - events.add(event); - } - } - SenseDataHolder.resetSpeedDataHolder(); - - //retrieve words - ProcessWords.cleanAndPushToWordMap(); - List wordDatMap = SenseDataHolder.getWordDataHolder(); - for (WordData wordData : wordDatMap) { - if (wordData.getOccurences() == 0) { - continue; - } - for (int i = 0; i < wordData.getOccurences(); i++) { - Event event = new Event(); - event.setTimestamp(wordData.getTimestamp()); - event.setWord(wordData.getWord()); - String word = wordData.getWord(); - String status = word; - if ((!word.equals(SenseConstants.EVENT_LISTENER_STARTED)) && (!word.equals(SenseConstants - .EVENT_LISTENER_FINISHED))) { - status = SenseConstants.EVENT_LISTENER_ONGOING; - } - event.setWordStatus(status); - events.add(event); - } - } - SenseDataHolder.resetWordDataHolder(); - - // retrieve call data. - List callDataList = SenseDataHolder.getCallDataHolder(); - if (!callDataList.isEmpty()) { - for (CallData callData : callDataList) { - Event event = new Event(); - event.setCallNumber(callData.getPhoneNumber()); - event.setCallType(callData.getType().toString().toLowerCase()); - event.setCallStartTime(callData.getStartTime()); - event.setCallEndTime(callData.getEndTime()); - event.setTimestamp(callData.getStartTime()); - - events.add(event); - } - } - SenseDataHolder.resetCallDataHolder(); - - // retrieve screen data. - List screenDataList = SenseDataHolder.getScreenDataHolder(); - if (!screenDataList.isEmpty()) { - for (ScreenData screenData : screenDataList) { - Event event = new Event(); - event.setScreenState(screenData.getAction()); - event.setTimestamp(screenData.getTimestamp()); - - events.add(event); - } - } - SenseDataHolder.resetScreenDataHolder(); - - // retrieve audio data. - List audioDataList = SenseDataHolder.getAudioDataHolder(); - if (!audioDataList.isEmpty()) { - for (AudioData audioData : audioDataList) { - Event event = new Event(); - event.setTimestamp(audioData.getTimestamp()); - event.setAudioPlaying(audioData.isPlaying()); - event.setHeadsetOn(audioData.isHeadsetOn()); - event.setMusicVolume(audioData.getMusicVolume()); - events.add(event); - } - } - SenseDataHolder.resetAudioDataHolder(); - - // retrieve activity data. - List activityDataList = SenseDataHolder.getActivityDataHolder(); - if (!activityDataList.isEmpty()) { - for (ActivityData activityData : activityDataList) { - Event event = new Event(); - event.setTimestamp(activityData.getTimestamp()); - event.setActivityType(activityData.getActivity()); - event.setConfidence(activityData.getConfidence()); - events.add(event); - } - } - SenseDataHolder.resetActivityDataHolder(); - - // retrieve sms data. - List smsDataList = SenseDataHolder.getSmsDataHolder(); - if (!smsDataList.isEmpty()) { - for (SmsData smsData : smsDataList) { - Event event = new Event(); - event.setTimestamp(smsData.getTimestamp()); - event.setSmsNumber(smsData.getPhoneNumber()); - events.add(event); - } - } - SenseDataHolder.resetSmsDataHolder(); - - - // retrieve application data. - List appDataList = SenseDataHolder.getApplicationDataHolder(); - if (!appDataList.isEmpty()) { - for (ApplicationData appData : appDataList) { - Event event = new Event(); - event.setTimestamp(appData.getTimestamp()); - event.setPackageName(appData.getPackageName()); - event.setAction(appData.getAction().toString()); - events.add(event); - } - } - SenseDataHolder.resetApplicationDataHolder(); - - //Retrieve network data - List networkDataList = SenseDataHolder.getNetworkDataHolder(); - if (!networkDataList.isEmpty()) { - for (NetworkData networkData : networkDataList) { - Event event = new Event(); - event.setTimestamp(networkData.getTimeStamp()); - event.setDataType(networkData.getDataType()); - event.setDataReceived(networkData.getDataReceived()); - event.setDataSent(networkData.getDataSent()); - events.add(event); - } - } - SenseDataHolder.resetNetworkDataHolder(); - - //publish the data - if (events.size() > 0 && LocalRegistry.isEnrolled(context)) { - String user = LocalRegistry.getUsername(context); - String deviceId = LocalRegistry.getDeviceId(context); - JSONArray jsonArray = new JSONArray(); - for (Event event : events) { - event.setOwner(user); - event.setDeviceId(deviceId); - jsonArray.put(new JSONObject().put("event", event.getEvent())); - } - - MQTTTransportHandler mqttTransportHandler = AndroidSenseMQTTHandler.getInstance(context); - if (!mqttTransportHandler.isConnected()) { - mqttTransportHandler.connect(); - } - String topic = LocalRegistry.getTenantDomain(context) + "/" + SenseConstants.DEVICE_TYPE + "/" + deviceId + "/data"; - mqttTransportHandler.publishDeviceData(user, deviceId, jsonArray.toString(), topic); - } - } catch (JSONException e) { - Log.e(TAG, "Json Data Parsing Exception", e); - } catch (TransportHandlerException e) { - Log.e(TAG, "Data Publish Failed", e); - } - 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/data/publisher/Event.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/Event.java deleted file mode 100755 index cfce21dd9..000000000 --- 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/Event.java +++ /dev/null @@ -1,555 +0,0 @@ -package org.wso2.carbon.iot.android.sense.data.publisher; - -import org.json.JSONException; -import org.json.JSONObject; - -/** - * This hold the definition of the stream that android sense is publishing to. - */ -public class Event { - - private String owner; - private String deviceId; - private String type; - private int battery; - private double gps[] = new double[]{0, 0}; //lat,long - private float accelerometer[] = new float[]{0, 0, 0}; //x,y,z - private float magnetic[] = new float[]{0, 0, 0};; //x,y,z - private float gyroscope[] = new float[]{0, 0, 0};; //x,y,z - private int batteryTemperature; - private int batteryStatus; - /** - * LOW or OK - */ - private String batteryState; - private float light; - private float pressure; - private float proximity; - private float gravity[] = new float[]{0, 0, 0};; - private float rotation[] = new float[]{0, 0, 0};; - private String wordSessionId; - private String word; - private String wordStatus; - private long timestamp; - private static float speed; - private String turn; - public static final float SPEED_LIMIT = 60; - private int beaconMajor; - private int beaconMinor; - private int beaconUuid; - private String beaconProximity; - private String callNumber; - private String callType; - private long callStartTime; - private long callEndTime; - - /** - * State of the phone display. - * Possible values are: - * on - * off - * unknown - */ - private String screenState; - - private boolean audioPlaying; - private boolean headsetOn; - private int musicVolume; - private int activityType; - private int confidence; - private String smsNumber; - private String packageName; - private String action; - - /** - * Network data - * Time stamp - * Data type - * Data sent - * Data received. - * */ - private String dataType; - private long dataSent; - private long dataReceived; - - private int getBattery() { - return battery; - } - - public void setBattery(int battery) { - this.type = "battery"; - this.battery = battery; - } - - public int getBatteryTemperature() { - return batteryTemperature; - } - - public void setBatteryTemperature(int batteryTemperature) { - this.type = "battery"; // Type is battery - this.batteryTemperature = batteryTemperature; - } - - public int getBatteryStatus() { - return batteryStatus; - } - - public void setBatteryStatus(int batteryStatus) { - this.type = "battery"; // Type is battery - this.batteryStatus = batteryStatus; - } - - public String getBatteryState() { - return batteryState != null ? batteryState : ""; - } - - public void setBatteryState(String batteryState) { - this.type = "battery"; // Type is battery - this.batteryState = batteryState; - } - - private double[] getGps() { - return gps; - } - - public void setGps(double[] gps) { - this.type = "gps"; - this.gps = gps; - } - - private float[] getAccelerometer() { - return accelerometer; - } - - public void setAccelerometer(float[] accelerometer) { - this.type = "accelerometer"; - this.accelerometer = accelerometer; - } - - private float[] getMagnetic() { - return magnetic; - } - - public void setMagnetic(float[] magnetic) { - this.type = "magnetic"; - this.magnetic = magnetic; - } - - private float[] getGyroscope() { - return gyroscope; - } - - public void setGyroscope(float[] gyroscope) { - this.type = "gyroscope"; - this.gyroscope = gyroscope; - } - - public float getLight() { - return light; - } - - public void setLight(float light) { - this.type = "light"; - this.light = light; - } - - public float getPressure() { - return pressure; - } - - public void setPressure(float pressure) { - this.type = "pressure"; - this.pressure = pressure; - } - - public float getProximity() { - return proximity; - } - - public void setProximity(float proximity) { - this.type = "proximity"; - this.proximity = proximity; - } - - private float[] getGravity() { - return gravity; - } - - public void setGravity(float gravity[]) { - this.type = "gravity"; - this.gravity = gravity; - } - - private float[] getRotation() { - return rotation; - } - - public void setRotation(float rotation[]) { - this.type = "rotation"; - this.rotation = rotation; - } - - public void setSmsNumber(String smsNumber) { - this.type = "sms"; - this.smsNumber = smsNumber; - } - - public String getSmsNumber() { - return smsNumber; - } - - private String getWordSessionId() { - return wordSessionId != null ? wordSessionId : ""; - } - - public void setWordSessionId(String wordSessionId) { - this.wordSessionId = wordSessionId; - } - - private String getWord() { - return word != null ? word : ""; - } - - public void setWord(String word) { - this.type = "word"; - this.word = word; - } - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.type = "application"; - this.packageName = packageName; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.type = "application"; - this.action = action; - } - - private long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - private String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - private String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getWordStatus() { - return wordStatus != null ? wordStatus : ""; - } - - public void setWordStatus(String wordStatus) { - this.wordStatus = wordStatus; - } - - public void setSpeed(float speed) { - this.type = "speed"; - this.speed = speed; - } - - public float getSpeed() { - this.type = "speed"; - if (Float.isInfinite(speed) || Float.isNaN(speed)) { - return -1.0f; - } - return speed; - } - - public void setTurns(String turn) { - - this.type = "turn"; - this.turn = turn; - } - - public String getTurns() { - - if (turn == null || turn.isEmpty() || turn.equals("null")) { - turn = "No Turns"; - } - return turn; - } - - public void setBeaconMajor(int beaconMajor) { - this.type = "beaconMajor"; - this.beaconMajor = beaconMajor; - } - - public int getBeaconMajor() { - this.type = "beaconMajor"; - return beaconMajor; - } - - public void setBeaconMinor(int beaconMinor) { - this.type = "beaconMinor"; - this.beaconMinor = beaconMinor; - } - - public int getBeaconMinor() { - this.type = "beaconMinor"; - return beaconMinor; - } - - public void setBeaconUuid(int beaconUuid) { - this.type = "beaconUuid"; - this.beaconUuid = beaconUuid; - } - - public int getBeaconUuid() { - this.type = "beaconUuid"; - return beaconUuid; - } - - public void setBeaconProximity(String beaconProximity) { - this.type = "beaconProximity"; - this.beaconProximity = beaconProximity; - } - - public String getBeaconProximity() { - return beaconProximity != null ? beaconProximity : ""; - } - - public String getCallNumber() { - return callNumber != null ? callNumber : ""; - } - - public void setCallNumber(String callNumber) { - this.type = "call"; - this.callNumber = callNumber; - } - - public String getCallType() { - return callType != null ? callType : ""; - } - - public void setCallType(String callType) { - this.type = "call"; - this.callType = callType; - } - - public long getCallStartTime() { - return callStartTime; - } - - public void setCallStartTime(long callStartTime) { - this.type = "call"; - this.callStartTime = callStartTime; - } - - public long getCallEndTime() { - return callEndTime; - } - - public void setCallEndTime(long callEndTime) { - this.type = "call"; - this.callEndTime = callEndTime; - } - - public String getScreenState() { - return screenState != null ? screenState : ""; - } - - public void setScreenState(String screenState) { - this.type = "screen"; - this.screenState = screenState; - } - - public boolean isAudioPlaying() { - return audioPlaying; - } - - public void setAudioPlaying(boolean audioPlaying) { - this.type = "audio"; - this.audioPlaying = audioPlaying; - } - - public boolean isHeadsetOn() { - return headsetOn; - } - - public void setHeadsetOn(boolean headsetOn) { - this.type = "audio"; - this.headsetOn = headsetOn; - } - - public int getMusicVolume() { - return musicVolume; - } - - public void setMusicVolume(int musicVolume) { - this.type = "audio"; - this.musicVolume = musicVolume; - } - - public int getActivityType() { - return activityType; - } - - public void setActivityType(int activityType) { - this.type = "activity"; - this.activityType = activityType; - } - - public int getConfidence() { - return confidence; - } - - public void setConfidence(int confidence) { - // Do not set type here since it can be used for various types. - // However, now it is being used by activity only - this.confidence = confidence; - } - - public String getDataType() { - this.type = "data"; - return dataType; - } - - public void setDataType(String dataType) { - this.type = "data"; - this.dataType = dataType; - } - - public long getDataSent() { - this.type = "data"; - return dataSent; - } - - public void setDataSent(long dataSent) { - this.type = "data"; - this.dataSent = dataSent; - } - - public long getDataReceived() { - this.type = "data"; - return dataReceived; - } - - public void setDataReceived(long dataReceived) { - this.type = "data"; - this.dataReceived = dataReceived; - } - - public JSONObject getEvent() throws JSONException { - JSONObject jsonEvent = new JSONObject(); - JSONObject jsonMetaData = new JSONObject(); - jsonMetaData.put("owner", getOwner()); - jsonMetaData.put("deviceId", getDeviceId()); - jsonMetaData.put("type", type); - jsonMetaData.put("timestamp", getTimestamp()); - jsonEvent.put("metaData", jsonMetaData); - - JSONObject jsonPayloadData = new JSONObject(); - // battery - jsonPayloadData.put("battery", getBattery()); - jsonPayloadData.put("battery_state", getBatteryState()); - jsonPayloadData.put("battery_status", getBatteryStatus()); - jsonPayloadData.put("battery_temperature", getBatteryTemperature()); - - - //gps - double gpsEvents[] = getGps(); - jsonPayloadData.put("gps_lat", gpsEvents[0]); - jsonPayloadData.put("gps_long", gpsEvents[1]); - //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()); - //} - - //Beacon Data - jsonPayloadData.put("beacon_major", getBeaconMajor()); - jsonPayloadData.put("beacon_minor", getBeaconMinor()); - jsonPayloadData.put("beacon_proximity", getBeaconProximity()); - jsonPayloadData.put("beacon_uuid", getBeaconUuid()); - - //turn - jsonPayloadData.put("turn_way", getTurns()); - //magnetic - events = getMagnetic(); - jsonPayloadData.put("magnetic_x", events[0]); - jsonPayloadData.put("magnetic_y", events[1]); - jsonPayloadData.put("magnetic_z", events[2]); - //gyroscope - events = getGyroscope(); - jsonPayloadData.put("gyroscope_x", events[0]); - jsonPayloadData.put("gyroscope_y", events[1]); - jsonPayloadData.put("gyroscope_z", events[2]); - - jsonPayloadData.put("light", getLight()); - jsonPayloadData.put("pressure", getPressure()); - jsonPayloadData.put("proximity", getProximity()); - //gravity - events = getGravity(); - jsonPayloadData.put("gravity_x", events[0]); - jsonPayloadData.put("gravity_y", events[1]); - jsonPayloadData.put("gravity_z", events[2]); - //rotation - events = getRotation(); - jsonPayloadData.put("rotation_x", events[0]); - jsonPayloadData.put("rotation_y", events[1]); - jsonPayloadData.put("rotation_z", events[2]); - //word - jsonPayloadData.put("word", getWord()); - jsonPayloadData.put("word_sessionId", getWordSessionId()); - jsonPayloadData.put("word_status", getWordStatus()); - - // call - jsonPayloadData.put("call_number", getCallNumber()); - jsonPayloadData.put("call_type", getCallType()); - jsonPayloadData.put("call_start_time", getCallStartTime()); - jsonPayloadData.put("call_end_time", getCallEndTime()); - - // screen - jsonPayloadData.put("screen_state", getScreenState()); - - // headset - jsonPayloadData.put("audio_playing", isAudioPlaying()); - jsonPayloadData.put("headset_on", isHeadsetOn()); - jsonPayloadData.put("music_volume", getMusicVolume()); - - jsonPayloadData.put("activity_type", getActivityType()); - jsonPayloadData.put("confidence", getConfidence()); - - jsonPayloadData.put("sms_number", getSmsNumber()); - - jsonPayloadData.put("application_name", getPackageName()); - jsonPayloadData.put("action", getAction()); - - //Network data - jsonPayloadData.put("data_type", getDataType()); - jsonPayloadData.put("data_received", getDataReceived()); - jsonPayloadData.put("data_sent", getDataSent()); - - jsonEvent.put("payloadData", jsonPayloadData); - - return jsonEvent; - } -} \ 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/data/publisher/mqtt/AndroidSenseMQTTHandler.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/mqtt/AndroidSenseMQTTHandler.java deleted file mode 100755 index 10f32a8ad..000000000 --- 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/mqtt/AndroidSenseMQTTHandler.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.data.publisher.mqtt; - -import android.content.Context; -import android.util.Log; - -import org.eclipse.paho.client.mqttv3.MqttException; -import org.eclipse.paho.client.mqttv3.MqttMessage; -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.constants.SenseConstants; -import org.wso2.carbon.iot.android.sense.speech.detector.util.ProcessWords; -import org.wso2.carbon.iot.android.sense.util.LocalRegistry; - -import java.nio.charset.StandardCharsets; -import java.util.Arrays; - -/** - * This is an example for the use of the MQTT capabilities provided by the IoT-Server. This example depicts the use - * of MQTT Transport for the Android Sense device-type. This class extends the abstract class - * "MQTTTransportHandler". "MQTTTransportHandler" consists of the MQTT client specific functionality and implements - * the "TransportHandler" interface. The actual functionality related to the "TransportHandler" interface is - * implemented here, in this concrete class. Whilst the abstract class "MQTTTransportHandler" is intended to provide - * the common MQTT functionality, this class (which is its extension) provides the implementation specific to the - * MQTT communication of the Device-Type (Android Sense) in concern. - * - * Hence, the methods of this class are implementation of the "TransportHandler" interface which handles the device - * specific logic to connect-to, publish-to, process-incoming-messages-from and disconnect-from the MQTT broker - * listed in the configurations. - */ -public class AndroidSenseMQTTHandler extends MQTTTransportHandler { - private static final String TAG = "AndroidSenseMQTTHandler"; - private static volatile AndroidSenseMQTTHandler mInstance; - private Context context; - - /** - * return a sigleton Instance - * @param context is the android context object. - * @return AndroidSenseMQTTHandler. - */ - public static AndroidSenseMQTTHandler getInstance(Context context) { - context = context; - if (mInstance == null) { - Class clazz = AndroidSenseMQTTHandler.class; - synchronized (clazz) { - if (mInstance == null) { - mInstance = new AndroidSenseMQTTHandler(context); - } - } - } - return mInstance; - } - - /** - * Default constructor for the AndroidSenseMQTTHandler. - */ - private AndroidSenseMQTTHandler(Context context) { - super(context); - } - - /** - * {@inheritDoc} - * AndroidSense device-type specific implementation to connect to the MQTT broker and subscribe to a topic. - * This method is called to initiate a MQTT communication. - */ - @Override - public void connect() { - Runnable connector = new Runnable() { - public void run() { - while (!isConnected()) { - try { - connectToQueue(); - } catch (TransportHandlerException e) { - Log.e(TAG, "Connection to MQTT Broker at: " + mqttBrokerEndPoint + " failed", e); - try { - Thread.sleep(timeoutInterval); - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - Log.e(TAG, "MQTT-Connector: Thread Sleep Interrupt Exception.", ex); - } - } - - try { - subscribeToQueue(); - } catch (TransportHandlerException e) { - Log.w(TAG, "Subscription to MQTT Broker at: " + mqttBrokerEndPoint + " failed", e); - } - } - } - }; - - Thread connectorThread = new Thread(connector); - connectorThread.start(); - } - - /** - * {@inheritDoc} - * AndroidSense device-type specific implementation to process incoming messages. This is the specific - * method signature of the overloaded "processIncomingMessage" method that gets called from the messageArrived() - * callback of the "MQTTTransportHandler". - */ - @Override - public void processIncomingMessage(MqttMessage mqttMessage, String... messageParams) { - if (messageParams.length != 0) { - // owner and the deviceId are extracted from the MQTT topic to which the message was received. - // = [ServerName/Owner/DeviceType/DeviceId/#] - String topic = messageParams[0]; - String[] topicParams = topic.split("/"); - String owner = topicParams[1]; - String deviceId = topicParams[3]; - - Log.d(TAG, "Received MQTT message for: [OWNER-" + owner + "] & [DEVICE.ID-" + deviceId + "]"); - - String msg; - msg = mqttMessage.toString(); - Log.d(TAG, "MQTT: Received Message [" + msg + "] topic: [" + topic + "]"); - if (topic.contains("threshold")) { - try { - ProcessWords.setThreshold(Integer.parseInt(msg)); - } catch (NumberFormatException e) { - Log.e(TAG, "Invalid threshold value " + msg); - } - } else if (topic.contains("words")) { - String words[] = msg.split(" "); - ProcessWords.addWords(Arrays.asList(words)); - } else if (topic.contains("remove")) { - String words[] = msg.split(" "); - for (String word: words) { - ProcessWords.removeWord(word); - } - } - } else { - String errorMsg = - "MQTT message [" + mqttMessage.toString() + "] was received without the topic information."; - Log.w(TAG, errorMsg); - } - } - - /** - * {@inheritDoc} - * AndroidSense device-type specific implementation to publish data to the device. This method calls the - * {@link #publishToQueue(String, MqttMessage)} method of the "MQTTTransportHandler" class. - */ - @Override - public void publishDeviceData(String... publishData) throws TransportHandlerException { - if (publishData.length != 4) { - String errorMsg = "Incorrect number of arguments received to SEND-MQTT Message. " + - "Need to be [owner, deviceId, content]"; - Log.e(TAG, errorMsg); - throw new TransportHandlerException(errorMsg); - } - - String deviceOwner = publishData[0]; - String deviceId = publishData[1]; - String resource = publishData[2]; - - MqttMessage pushMessage = new MqttMessage(); - String publishTopic = publishData[3]; - String actualMessage = resource; - pushMessage.setPayload(actualMessage.getBytes(StandardCharsets.UTF_8)); - pushMessage.setQos(DEFAULT_MQTT_QUALITY_OF_SERVICE); - pushMessage.setRetained(false); - publishToQueue(publishTopic, pushMessage); - } - - - /** - * {@inheritDoc} - * Android Sense device-type specific implementation to disconnect from the MQTT broker. - */ - @Override - public void disconnect() { - Runnable stopConnection = new Runnable() { - public void run() { - while (isConnected()) { - try { - closeConnection(); - } catch (MqttException e) { - Log.w(TAG, "Unable to 'STOP' MQTT connection at broker at: " + mqttBrokerEndPoint - + " for device-type - " + SenseConstants.DEVICE_TYPE, e); - - try { - Thread.sleep(timeoutInterval); - } catch (InterruptedException e1) { - Thread.currentThread().interrupt(); - Log.e(TAG, "MQTT-Terminator: Thread Sleep Interrupt Exception at device-type - " + - SenseConstants.DEVICE_TYPE, e1); - } - } - } - } - }; - - Thread terminatorThread = new Thread(stopConnection); - terminatorThread.start(); - } - - - /** - * {@inheritDoc} - */ - @Override - public void publishDeviceData() { - // nothing to do - } - - @Override - public void publishDeviceData(MqttMessage publishData) throws TransportHandlerException { - } - - /** - * {@inheritDoc} - */ - @Override - public void processIncomingMessage() { - // nothing to do - } - - @Override - public void processIncomingMessage(MqttMessage message) throws TransportHandlerException { - - } -} - 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/mqtt/transport/MQTTTransportHandler.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/mqtt/transport/MQTTTransportHandler.java deleted file mode 100755 index 17884381c..000000000 --- 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/mqtt/transport/MQTTTransportHandler.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.data.publisher.mqtt.transport; -import android.content.Context; -import android.util.Log; -import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; -import org.eclipse.paho.client.mqttv3.MqttCallback; -import org.eclipse.paho.client.mqttv3.MqttClient; -import org.eclipse.paho.client.mqttv3.MqttConnectOptions; -import org.eclipse.paho.client.mqttv3.MqttException; -import org.eclipse.paho.client.mqttv3.MqttMessage; -import org.wso2.carbon.iot.android.sense.constants.SenseConstants; -import org.wso2.carbon.iot.android.sense.util.LocalRegistry; - -import java.nio.charset.StandardCharsets; - -/** - * This is an abstract class that implements the "TransportHandler" interface. The interface is an abstraction for - * the core functionality with regards to device-server communication regardless of the Transport protocol. This - * specific class contains the MQTT-Transport specific implementations. The class implements utility methods for the - * case of a MQTT communication. However, this "abstract class", even-though it implements the "TransportHandler" - * interface, does not contain the logic relevant to the interface methods. The specific functionality of the - * interface methods are intended to be implemented by the concrete class that extends this abstract class and - * utilizes the MQTT specific functionality (ideally a device API writer who would like to communicate to the device - * via MQTT Protocol). - * - * This class contains the Device-Management specific implementation for all the MQTT functionality. This includes - * connecting to a MQTT Broker & subscribing to the appropriate MQTT-topic, action plan upon losing connection or - * successfully delivering a message to the broker and upon receiving a MQTT message. Makes use of the 'Paho-MQTT' - * library provided by Eclipse Org. - */ -public abstract class MQTTTransportHandler implements MqttCallback, TransportHandler { - private static final String TAG = "MQTTTransportHandler"; - - private MqttClient client; - private String clientId; - private MqttConnectOptions options; // options to be set to the client-connection. - // topic to which a will-message is automatically published by the broker upon the device losing its connection. - private String clientWillTopic; - - protected String mqttBrokerEndPoint; - protected int timeoutInterval; // interval to use for reconnection attempts etc. - protected String subscribeTopic; - - // Quality of Service Levels for MQTT Subscription and Publishing. - public static final int QoS_0 = 0; // At-Most Once - @SuppressWarnings("unused") - public static final int QoS_1 = 1; // At-Least Once - public static final int QoS_2 = 2; // Exactly Once - - public static final int DEFAULT_MQTT_QUALITY_OF_SERVICE = QoS_0; - // Prefix to the Will-Topic to which a message is published if client loses its connection. - private static final String DISCONNECTION_WILL_TOPIC_PREFIX = "Disconnection/"; - // Will-Message of the client to be published if connection is lost. - private static final String DISCONNECTION_WILL_MSG = "Lost-Connection"; - /** - * Constructor for the MQTTTransportHandler which takes in the owner, type of the device and the MQTT Broker URL - * and the topic to subscribe. - * @param context activity context. - */ - protected MQTTTransportHandler(Context context) { - String username = LocalRegistry.getUsername(context); - String deviceId = LocalRegistry.getDeviceId(context); - this.clientId = deviceId + ":" + SenseConstants.DEVICE_TYPE; - this.subscribeTopic = LocalRegistry.getTenantDomain(context)+ "/" + SenseConstants.DEVICE_TYPE + "/" + - deviceId + "/command/#"; - this.clientWillTopic = DISCONNECTION_WILL_TOPIC_PREFIX + SenseConstants.DEVICE_TYPE; - this.mqttBrokerEndPoint = LocalRegistry.getMqttEndpoint(context); - this.timeoutInterval = DEFAULT_TIMEOUT_INTERVAL; - this.initMQTTClient(); - setUsernameAndPassword(LocalRegistry.getAccessToken(context), ""); - } - - /** - * Constructor for the MQTTTransportHandler which takes in the owner, type of the device and the MQTT Broker URL - * and the topic to subscribe. Additionally this constructor takes in the reconnection-time interval between - * successive attempts to connect to the broker. - * - * @param deviceOwner the owner of the device. - * @param deviceType the CDMF Device-Type of the device. - * @param mqttBrokerEndPoint the IP/URL of the MQTT broker endpoint. - * @param subscribeTopic the MQTT topic to which the client is to be subscribed - * @param intervalInMillis the time interval in MILLI-SECONDS between attempts to connect to the broker. - */ - protected MQTTTransportHandler(String deviceOwner, String deviceType, - String mqttBrokerEndPoint, String subscribeTopic, int intervalInMillis) { - this.clientId = deviceOwner + ":" + deviceType; - this.subscribeTopic = subscribeTopic; - this.clientWillTopic = DISCONNECTION_WILL_TOPIC_PREFIX + deviceType; - this.mqttBrokerEndPoint = mqttBrokerEndPoint; - this.timeoutInterval = intervalInMillis; - this.initMQTTClient(); - } - - - /** - * Initializes the MQTT-Client. Creates a client using the given MQTT-broker endpoint and the clientId (which is - * constructed by a concatenation of [deviceOwner]:[deviceType]). Also sets the client's options parameter with - * the clientWillTopic (in-case of connection failure) and other info. Also sets the callback to this current class. - */ - private void initMQTTClient() { - try { - client = new MqttClient(this.mqttBrokerEndPoint, clientId, null); - Log.i(TAG, "MQTT client was created with ClientID : " + clientId); - } catch (MqttException ex) { - String errorMsg = "Initializing the MQTT Client failed."; - Log.e(TAG, errorMsg, ex); - } - - options = new MqttConnectOptions(); - options.setKeepAliveInterval(120); // set the keep alive interval to 120 seconds by default. - options.setCleanSession(true); // sets clean session to true by default. - setDisconnectionWillForClient(QoS_2, true); // sets default will-topic & msg with QoS 2 and retained true. - client.setCallback(this); // callback for MQTT events are set to `this` object. - } - - /** - * @param qos the Quality of Service at which the last-will-message is to be published. - * @param isRetained indicate whether to retain the last-will-message. - * @see MQTTTransportHandler#setDisconnectionWillForClient(String, String, int, boolean). Uses the default values - * for Will-Topic and Will-Message. - */ - protected void setDisconnectionWillForClient(int qos, boolean isRetained) { - this.setDisconnectionWillForClient(clientWillTopic, DISCONNECTION_WILL_MSG, qos, isRetained); - } - - /** - * Sets the [Will] option in the default options-set of the MQTT Client. A will-topic, will-message is parsed - * along with the QoS and the retained flag. When the client loses its connection to the broker, the broker - * publishes the will-message to the will-topic, to itself. - * - * @param willTopic the topic to which the last will message is to be published when client exists ungracefully. - * @param willMsg the message to be published upon client's ungraceful exit from the broker. - * @param qos the Quality of Service at which the last-will-message is to be published. - * @param isRetained indicate whether to retain the last-will-message. - */ - protected void setDisconnectionWillForClient(String willTopic, String willMsg, int qos, boolean isRetained) { - this.options.setWill(willTopic, willMsg.getBytes(StandardCharsets.UTF_8), qos, isRetained); - } - - /** - * Sets the [Clean-Session] option in the default options-set of the MQTT Client. It is set to `true` by default. - * - * @param setCleanSession `true` indicates that the session details can be cleared/cleaned upon disconnection, - * `false` indicates that the session details are to be persisted if the client disconnects. - */ - @SuppressWarnings("unused") - protected void setClientCleanSession(boolean setCleanSession) { - this.options.setCleanSession(setCleanSession); - } - - /** - * Sets the [Username] & [Password] options in the default options-set of the MQTT Client. By default these - * values are not set. - * - * @param username the username to be used by the client to connect to the broker. - * @param password the password to be used by the client to connect to the broker. - */ - @SuppressWarnings("unused") - protected void setUsernameAndPassword(String username, String password) { - this.options.setUserName(username); - this.options.setPassword(password.toCharArray()); - } - - /** - * Connects to the MQTT-Broker at the endpoint specified in the constructor to this class using default the - * MQTT-options. - * - * @throws TransportHandlerException in the event of 'Connecting to' the MQTT broker fails. - */ - protected void connectToQueue() throws TransportHandlerException { - this.connectToQueue(options); - } - - /** - * Connects to the MQTT-Broker at the endpoint specified in the constructor to this class using the MQTT-Options - * passed. - * - * @param options options to be used by the client for this connection. (username, password, clean-session, etc) - * @throws TransportHandlerException in the event of 'Connecting to' the MQTT broker fails. - */ - protected void connectToQueue(MqttConnectOptions options) throws TransportHandlerException { - try { - client.connect(options); - Log.d(TAG, "MQTT Client connected to queue at: " + this.mqttBrokerEndPoint); - } catch (MqttException ex) { - String errorMsg = "MQTT Exception occured whilst connecting to queue at [" + this.mqttBrokerEndPoint + "]"; - Log.e(TAG, errorMsg); - throw new TransportHandlerException(errorMsg, ex); - } - } - - /** - * @throws TransportHandlerException in the event of 'Subscribing to' the MQTT broker fails. - * @see MQTTTransportHandler#subscribeToQueue(int). Uses default QoS of 1. - */ - protected void subscribeToQueue() throws TransportHandlerException { - this.subscribeToQueue(QoS_0); - } - - /** - * Subscribes to the MQTT-Topic specified in the constructor to this class. - * - * @throws TransportHandlerException in the event of 'Subscribing to' the MQTT broker fails. - */ - protected void subscribeToQueue(int qos) throws TransportHandlerException { - try { - client.subscribe(subscribeTopic, qos); - Log.d(TAG, "Client [" + clientId + "] subscribed to topic: " + subscribeTopic); - } catch (MqttException ex) { - String errorMsg = "MQTT Exception occurred whilst client [" + clientId + "] tried to subscribe to " + - "topic: [" + subscribeTopic + "]"; - Log.e(TAG, errorMsg); - throw new TransportHandlerException(errorMsg, ex); - } - } - - /** - * @param topic the topic to which the message is to be published. - * @param payLoad the message (payload) of the MQTT publish action. - * @see MQTTTransportHandler#publishToQueue(String, String, int, boolean) - */ - @SuppressWarnings("unused") - protected void publishToQueue(String topic, String payLoad) throws TransportHandlerException { - publishToQueue(topic, payLoad, DEFAULT_MQTT_QUALITY_OF_SERVICE, false); - } - - /** - * @param topic the topic to which the message is to be published. - * @param message the message (payload) of the MQTT publish action as a `MQTTMessage`. - * @throws TransportHandlerException if any error occurs whilst trying to publish to the MQTT Queue. - * @see MQTTTransportHandler#publishToQueue(String, String, int, boolean) - */ - protected void publishToQueue(String topic, MqttMessage message) throws TransportHandlerException { - try { - client.publish(topic, message); - Log.d(TAG, "Message: " + message.toString() + " to MQTT topic [" + topic + "] published successfully"); - } catch (MqttException ex) { - String errorMsg = "MQTT Client Error whilst client [" + clientId + "] tried to publish to queue at " + - "[" + mqttBrokerEndPoint + "] under topic [" + topic + "]"; - Log.e(TAG, errorMsg); - throw new TransportHandlerException(errorMsg, ex); - } - } - - /** - * This method is used to publish messages to the MQTT-Endpoint to which this client is connected to. It is via - * publishing to this broker that the messages are communicated to the device. This is an overloaded method with - * different parameter combinations. This method invokes the publish method provided by the MQTT-Client library. - * - * @param topic the topic to which the message is to be published. - * @param payLoad the message (payload) of the MQTT publish action. - * @param qos the Quality-of-Service of the current publish action. - * Could be 0(At-most once), 1(At-least once) or 2(Exactly once) - * @param retained indicate whether to retain the publish-message in the event of no subscribers. - * @throws TransportHandlerException if any error occurs whilst trying to publish to the MQTT Queue. - */ - protected void publishToQueue(String topic, String payLoad, int qos, boolean retained) - throws TransportHandlerException { - try { - client.publish(topic, payLoad.getBytes(StandardCharsets.UTF_8), qos, retained); - Log.d(TAG, "Message: " + payLoad + " to MQTT topic [" + topic + "] published successfully"); - - } catch (MqttException ex) { - String errorMsg = "MQTT Client Error whilst client [" + clientId + "] tried to publish to queue at " + - "[" + mqttBrokerEndPoint + "] under topic [" + topic + "]"; - Log.e(TAG, errorMsg); - throw new TransportHandlerException(errorMsg, ex); - } - } - - /** - * Checks whether the connection to the MQTT-Broker exists. - * - * @return `true` if the client is connected to the MQTT-Broker, else `false`. - */ - @Override - public boolean isConnected() { - return client.isConnected(); - } - - /** - * Callback method which is triggered once the MQTT client losers its connection to the broker. Spawns a new - * thread that executes necessary actions to try and reconnect to the endpoint. - * - * @param throwable a Throwable Object containing the details as to why the failure occurred. - */ - @Override - public void connectionLost(Throwable throwable) { - Log.w(TAG, "Connection for client: " + this.clientId + " to " + this.mqttBrokerEndPoint + " was lost." + - "\nThis was due to - " + throwable.getMessage()); - Thread reconnectThread = new Thread() { - public void run() { - connect(); - } - }; - reconnectThread.start(); - } - - /** - * Callback method which is triggered upon receiving a MQTT Message from the broker. Spawns a new thread that - * executes any actions to be taken with the received message. - * - * @param topic the MQTT-Topic to which the received message was published to and the client subscribed to. - * @param mqttMessage the actual MQTT-Message that was received from the broker. - */ - @Override - public void messageArrived(final String topic, final MqttMessage mqttMessage) { - Log.d(TAG, "Got an MQTT message '" + mqttMessage.toString() + "' for topic '" + topic + "'."); - - Thread messageProcessorThread = new Thread() { - public void run() { - try { - processIncomingMessage(mqttMessage, topic); - } catch (TransportHandlerException e) { - Log.e(TAG, "An error occurred when trying to process received MQTT message [" + mqttMessage + "] " + - "for topic [" + topic + "].", e); - } - } - }; - messageProcessorThread.start(); - } - - /** - * Callback method which gets triggered upon successful completion of a message delivery to the broker. - * - * @param iMqttDeliveryToken the MQTT-DeliveryToken which includes the details about the specific message delivery. - */ - @Override - public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { - String topic = iMqttDeliveryToken.getTopics()[0]; - String client = iMqttDeliveryToken.getClient().getClientId(); - - try { - if (iMqttDeliveryToken.isComplete()) { - if (iMqttDeliveryToken.getMessage() != null) { - String message = iMqttDeliveryToken.getMessage().toString(); - Log.d(TAG, "Message to client [" + client + "] under topic (" + topic + - ") was delivered successfully with the delivery message: '" + message + "'"); - } else { - Log.d(TAG, "Message to client [" + client + "] under topic (" + topic + - ") was delivered successfully."); - } - } else { - Log.w(TAG, "FAILED: Delivery of MQTT message to [" + client + "] under topic [" + topic + "] failed."); - } - } catch (MqttException e) { - Log.w(TAG, "Error occurred whilst trying to read the message from the MQTT delivery token."); - } - } - - /** - * Closes the connection to the MQTT Broker. - */ - public void closeConnection() throws MqttException { - if (client != null && isConnected()) { - client.disconnect(); - } - } - - /** - * Fetches the default options set for the MQTT Client - * - * @return the options that are currently set for the client. - */ - public MqttConnectOptions getOptions() { - return options; - } -} \ 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/data/publisher/mqtt/transport/TransportHandler.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/mqtt/transport/TransportHandler.java deleted file mode 100755 index 88efba9a4..000000000 --- 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/mqtt/transport/TransportHandler.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.data.publisher.mqtt.transport; - -/** - * This interface consists of the core functionality related to the transport between any device and the server. The - * interface is an abstraction, regardless of the underlying protocol used for the transport. Implementation of this - * interface by any class that caters a specific protocol (ex: HTTP, XMPP, MQTT, CoAP) would ideally have methods - * specific to the protocol used for communication and other methods that implement the logic related to the devices - * using the protocol. The methods of the interface are identified as generic ones for implementing transport - * protocols for device communication. The implementation can utilize the appropriate method signatures applicable for - * intended protocol. - * - * @param an object of the message type specific to the protocol implemented. To be set to 'String' if there - * isn't anything specific. - */ -public interface TransportHandler { - // a default timeout interval to be used for the protocol specific connections - int DEFAULT_TIMEOUT_INTERVAL = 5000; // millis ~ 5 sec - - /** - * Implements the underlying connect mechanism specific to the protocol enabled by the interface. An object of a - * class that implements this interface would call this method before any communication is started via the - * intended protocol. - */ - void connect(); - - /** - * Used to check whether a connection (via the implemented protocol) to the external-endpoint exists. Ideally - * used to verify that the connection persists and to spawn a reconnection attempt if not. - * - * @return 'true' if connection is already made & exists, else 'false'. - */ - boolean isConnected(); - - /** - * @throws TransportHandlerException in the event of any exceptions that occur whilst processing the message. - * @see TransportHandler#processIncomingMessage(Object, String...) - */ - void processIncomingMessage() throws TransportHandlerException; - - /** - * @param message the message (of the type specific to the protocol) received from the device. - * @throws TransportHandlerException - * @see TransportHandler#processIncomingMessage(Object, String...) - */ - void processIncomingMessage(T message) throws TransportHandlerException; - - /** - * This is an overloaded method with three different method-signatures. This method is used to process any - * incoming messages via the implemented protocol. It would ideally be invoked at a point where a message - * received event is activated (Ex: `MessageArrived` callback in Eclipse-Paho-MQTT Client & `PacketListener`(s) - * in XMPP). - * - * - * @param message the message (of the type specific to the protocol) received from the device. - * @param messageParams one or more other parameters received as part-of & relevant-to the message (Ex: MQTT Topic). - * @throws TransportHandlerException in the event of any exceptions that occur whilst processing the message. - */ - void processIncomingMessage(T message, String... messageParams) throws TransportHandlerException; - - /** - * @throws TransportHandlerException in the event of any exceptions that occur whilst sending the message. - * @see TransportHandler#publishDeviceData(String...) - */ - void publishDeviceData() throws TransportHandlerException; - - /** - * @param publishData the message (of the type specific to the protocol) to be sent to the device. - * @throws TransportHandlerException in the event of any exceptions that occur whilst sending the message. - * @see TransportHandler#publishDeviceData(String...) - */ - void publishDeviceData(T publishData) throws TransportHandlerException; - - /** - * This is an overloaded method with three different method-signatures. This method is used to publish messages - * to an external-endpoint/device via the implemented protocol. It could in itself call the (communicating) - * external-endpoint or invoke any method provided by the protocol specific library. - * - * - * @param publishData one or more parameters specific to the message and the data to be sent. - * @throws TransportHandlerException in the event of any exceptions that occur whilst sending the message. - */ - void publishDeviceData(String... publishData) throws TransportHandlerException; - - /** - * Implements the underlying disconnect mechanism specific to the protocol enabled by the interface. An object of a - * class that implements this interface would call this method upon completion of all communication. In the case of - * the IoT-Server invoking this would only be required if the server shuts-down. - */ - void disconnect(); -} 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/mqtt/transport/TransportHandlerException.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/mqtt/transport/TransportHandlerException.java deleted file mode 100755 index fe297b828..000000000 --- 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/mqtt/transport/TransportHandlerException.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.data.publisher.mqtt.transport; - -/** - * This exception will be thrown when the mqtt transport fails. - */ -public class TransportHandlerException extends Exception { - private static final long serialVersionUID = 2736466230451105440L; - - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public TransportHandlerException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public TransportHandlerException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public TransportHandlerException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public TransportHandlerException() { - super(); - } - - public TransportHandlerException(Throwable cause) { - super(cause); - } -} 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/SenseScheduleReceiver.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/SenseScheduleReceiver.java deleted file mode 100755 index 4e4134358..000000000 --- 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/SenseScheduleReceiver.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.event; - -import android.app.AlarmManager; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import java.util.Calendar; - -/** - * This is a service which triggers to collect - */ -public class SenseScheduleReceiver extends BroadcastReceiver { - private static final int ALARM_INTERVAL = 1000; - @Override - public void onReceive(Context context, Intent intent) { - - AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - Intent i = new Intent(context, SenseService.class); - PendingIntent pending = PendingIntent.getService(context, 0, i, 0); - - Calendar cal = Calendar.getInstance(); - - cal.add(Calendar.SECOND, 10); - service.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), ALARM_INTERVAL, pending); - } -} 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/SenseService.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/SenseService.java deleted file mode 100755 index 3ad384e75..000000000 --- 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/SenseService.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.event; - -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.os.IBinder; - -import org.wso2.carbon.iot.android.sense.event.streams.SenseDataCollector; -import org.wso2.carbon.iot.android.sense.util.LocalRegistry; -import org.wso2.carbon.iot.android.sense.util.SenseDataReceiverManager; -import org.wso2.carbon.iot.android.sense.util.SenseWakeLock; - -/** - * This service caters to initiate the data collection. - */ -public class SenseService extends Service { - - public static Context context; - - @Override - public void onCreate() { - super.onCreate(); - SenseWakeLock.acquireWakeLock(this); - } - - @Override - public IBinder onBind(Intent arg0) { - return null; - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - context = this; - if (!LocalRegistry.isExist(context)) return Service.START_NOT_STICKY; - //Below triggers the data collection for sensors,location and battery. - SenseDataCollector Sensor = new SenseDataCollector(this, SenseDataCollector.DataType.SENSOR); - SenseDataCollector Location = new SenseDataCollector(this, SenseDataCollector.DataType.LOCATION); - SenseDataCollector speed = new SenseDataCollector(this, SenseDataCollector.DataType.SPEED); - SenseDataCollector audio = new SenseDataCollector(this, SenseDataCollector.DataType.AUDIO); - SenseDataReceiverManager.registerBatteryDataReceiver(this); - SenseDataReceiverManager.registerScreenDataReceiver(this); - SenseDataReceiverManager.registerCallDataReceiver(this); - SenseDataReceiverManager.registerActivityDataReceiver(this); - SenseDataReceiverManager.registerSmsDataReceiver(this); - SenseDataReceiverManager.registerAppDataReceiver(this); - SenseDataReceiverManager.registerNetworkDataReader(this); - //service will not be stopped until we manually stop the service - return Service.START_NOT_STICKY; - } - - @Override - public void onDestroy() { - SenseDataReceiverManager.unregisterBatteryDataReceiver(this); - SenseDataReceiverManager.unregisterScreenDataReceiver(this); - SenseDataReceiverManager.unregisterCallDataReceiver(this); - SenseDataReceiverManager.unregisterActivityDataReceiver(this); - SenseDataReceiverManager.unregisterSmsDataReceiver(this); - SenseDataReceiverManager.unregisterAppDataReceiver(this); - SenseDataReceiverManager.unregisterNetworkDataReader(); - - SenseWakeLock.releaseCPUWakeLock(); - super.onDestroy(); - } -} 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/DataReader.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/DataReader.java deleted file mode 100755 index 1d8e42204..000000000 --- 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/DataReader.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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.event.streams; - -/** - * this class extended by each data reader implementation, where the data store logic is implemented in thread. - */ -public abstract class DataReader implements Runnable { -} 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/SenseDataCollector.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/SenseDataCollector.java deleted file mode 100755 index 086f7d40a..000000000 --- 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/SenseDataCollector.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.event.streams; - -import android.content.Context; -import org.wso2.carbon.iot.android.sense.event.streams.location.LocationDataReader; -import org.wso2.carbon.iot.android.sense.event.streams.sensor.SensorDataReader; -import org.wso2.carbon.iot.android.sense.event.streams.speed.SpeedDataReader; -import org.wso2.carbon.iot.android.sense.event.streams.audio.AudioDataReader; - -/** - * This class triggered by service to collect the sensor data. - */ -public class SenseDataCollector { - public enum DataType { - SENSOR, LOCATION,SPEED, AUDIO - } - - public SenseDataCollector(Context ctx, DataType dt) { - DataReader dr = null; - switch (dt) { - case SENSOR: - dr = new SensorDataReader(ctx); - break; - case LOCATION: - dr = new LocationDataReader(ctx); - break; - case SPEED: - dr = new SpeedDataReader(ctx); - break; - case AUDIO: - dr = new AudioDataReader(ctx); - break; - - } - if (dr != null) { - Thread DataCollector = new Thread(dr); - DataCollector.start(); - } - } -} 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/activity/ActivityData.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/activity/ActivityData.java deleted file mode 100644 index 772351c5b..000000000 --- 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/activity/ActivityData.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.activity; - -import java.util.Date; - -public class ActivityData { - /** - * 0 - In vehicle - * 1 - Bicycle - * 2 - Foot - * 3 - Still - * 4 - Unknown - * 5 - Tilting - * 7 - Walking - * 8 - Running - */ - private int activity; - private int confidence; - private long timestamp; - - ActivityData(int activity, int confidence) { - this.activity = activity; - this.confidence = confidence; - this.timestamp = new Date().getTime(); - } - - public int getActivity() { - return activity; - } - - public void setActivity(int activity) { - this.activity = activity; - } - - public int getConfidence() { - return confidence; - } - - public void setConfidence(int confidence) { - this.confidence = confidence; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } -} 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/activity/ActivityReceiver.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/activity/ActivityReceiver.java deleted file mode 100644 index 322049198..000000000 --- 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/activity/ActivityReceiver.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.activity; - -import android.app.IntentService; -import android.content.Intent; - -import com.google.android.gms.location.ActivityRecognitionResult; -import com.google.android.gms.location.DetectedActivity; - -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -public class ActivityReceiver extends IntentService { - public static final int MINIMUM_CONFIDENCE = 75; - - /** - * Retrieve the information for every 10 seconds. - */ - public static final long UPDATE_INTERVAL = 10000; - - public ActivityReceiver() { - super(ActivityReceiver.class.getName()); - } - - @Override - protected void onHandleIntent(Intent intent) { - if (ActivityRecognitionResult.hasResult(intent)) { - ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent); - - for (DetectedActivity activity : result.getProbableActivities()) { - if (activity.getConfidence() >= MINIMUM_CONFIDENCE) { - ActivityData data = new ActivityData(activity.getType(), activity.getConfidence()); - SenseDataHolder.getActivityDataHolder().add(data); - } - } - } - } -} 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/application/ApplicationData.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/application/ApplicationData.java deleted file mode 100644 index 1443e36b9..000000000 --- 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/application/ApplicationData.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.application; - -import java.util.Date; - -public class ApplicationData { - public enum Action { - INSTALL, REMOVE - } - - private long timestamp; - private String packageName; - private Action action; - - ApplicationData(String packageName, Action action) { - this.packageName = packageName; - this.action = action; - this.timestamp = new Date().getTime(); - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - public Action getAction() { - return action; - } - - public void setAction(Action action) { - this.action = action; - } -} 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/application/ApplicationDataReceiver.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/application/ApplicationDataReceiver.java deleted file mode 100644 index 8cb52550f..000000000 --- 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/application/ApplicationDataReceiver.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.application; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -/** - * Currently interested on package add and remove only. Can be extended for modification. - */ -public class ApplicationDataReceiver extends BroadcastReceiver { - - - @Override - public void onReceive(Context context, Intent intent) { - String packageName = intent.getData().toString().substring(8); - ApplicationData appData; - if (Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())) { - appData = new ApplicationData(packageName, ApplicationData.Action.INSTALL); - } else { - // Removed - appData = new ApplicationData(packageName, ApplicationData.Action.REMOVE); - } - SenseDataHolder.getApplicationDataHolder().add(appData); - } -} 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/audio/AudioData.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/audio/AudioData.java deleted file mode 100644 index 0449d3291..000000000 --- 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/audio/AudioData.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.audio; - -public class AudioData { - private long timestamp; - private boolean headsetOn; - private int musicVolume; - private boolean playing; - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public boolean isHeadsetOn() { - return headsetOn; - } - - public void setHeadsetOn(boolean headsetOn) { - this.headsetOn = headsetOn; - } - - public int getMusicVolume() { - return musicVolume; - } - - public void setMusicVolume(int musicVolume) { - this.musicVolume = musicVolume; - } - - public boolean isPlaying() { - return playing; - } - - public void setPlaying(boolean playing) { - this.playing = playing; - } -} 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/audio/AudioDataReader.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/audio/AudioDataReader.java deleted file mode 100644 index 1a5f85c09..000000000 --- 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/audio/AudioDataReader.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.audio; - -import android.content.Context; -import android.media.AudioManager; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.event.streams.DataReader; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -import java.util.Date; - -public class AudioDataReader extends DataReader { - - private static final String TAG = AudioDataReader.class.getName(); - private Context context; - - public AudioDataReader(Context context) { - this.context = context; - } - - @Override - public void run() { - Log.d(TAG, "Running AudioDataReader"); - AudioManager manager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - AudioData audioData = new AudioData(); - audioData.setTimestamp(new Date().getTime()); - audioData.setPlaying(manager.isMusicActive()); - audioData.setHeadsetOn(manager.isWiredHeadsetOn()); - audioData.setMusicVolume(manager.getStreamVolume(AudioManager.STREAM_MUSIC)); - SenseDataHolder.getAudioDataHolder().add(audioData); - } -} 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/battery/BatteryData.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/battery/BatteryData.java deleted file mode 100755 index 7a4d7413a..000000000 --- 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/battery/BatteryData.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.event.streams.battery; - -import android.content.Intent; -import android.os.BatteryManager; - -import java.util.Date; - -/** - * This defines the data structure of the battery data that is been collected. - * look at http://developer.android.com/reference/android/os/BatteryManager.html for field description. - */ -public class BatteryData { - - public enum State { - LOW, OK - } - - private int health; - private int level; - private int plugged; - private int present; - private int scale; - private int status; - private int temperature; - private int voltage; - private long timestamp; - private State state; - - BatteryData(Intent intent) { - timestamp = new Date().getTime(); - health = intent.getIntExtra(BatteryManager.EXTRA_HEALTH, 0); - level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); - plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0); - present = intent.getExtras().getBoolean(BatteryManager.EXTRA_PRESENT) ? 1 : 0; - scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0); - status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0); - String technology = intent.getExtras().getString(BatteryManager.EXTRA_TECHNOLOGY); - temperature = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0); - voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0); - state = State.OK; - } - - BatteryData(State state) { - this.timestamp = new Date().getTime(); - this.state = state; - } - - public int getHealth() { - return health; - } - - public void setHealth(int health) { - this.health = health; - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - this.level = level; - } - - public int getPlugged() { - return plugged; - } - - public void setPlugged(int plugged) { - this.plugged = plugged; - } - - public int getPresent() { - return present; - } - - public void setPresent(int present) { - this.present = present; - } - - public int getScale() { - return scale; - } - - public void setScale(int scale) { - this.scale = scale; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public int getTemperature() { - return temperature; - } - - public void setTemperature(int temperature) { - this.temperature = temperature; - } - - public int getVoltage() { - return voltage; - } - - public void setVoltage(int voltage) { - this.voltage = voltage; - } - - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public State getState() { - return state; - } - - public void setState(State state) { - this.state = state; - } -} 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/battery/BatteryDataReceiver.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/battery/BatteryDataReceiver.java deleted file mode 100755 index 0a971ab61..000000000 --- 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/battery/BatteryDataReceiver.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.event.streams.battery; - -import android.app.AlarmManager; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.BatteryManager; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherService; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -/** - * Whenever the battery level changes This receiver will be triggered. - */ -public class BatteryDataReceiver extends BroadcastReceiver { - - private final long ALARM_INTERVAL = 1000; - /** - * When the data is retrieved then its added to a in memory map. - * - * @param context of the receiver. - * @param intent of the receiver - */ - @Override - public void onReceive(Context context, Intent intent) { - AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - Log.i("Battery Data Receiver", "Triggered"); - Intent i = new Intent(context, BatteryReaderService.class); - PendingIntent pending = PendingIntent.getService(context, 0, i, 0); - service.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), ALARM_INTERVAL, pending); - } - -} 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/battery/BatteryReaderService.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/battery/BatteryReaderService.java deleted file mode 100644 index c2ea5db9f..000000000 --- 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/battery/BatteryReaderService.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.battery; - -import android.app.IntentService; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.BatteryManager; -import android.os.IBinder; -import android.support.annotation.Nullable; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -public class BatteryReaderService extends IntentService { - - private Context context; - - public BatteryReaderService() { - super("BatteryReaderService"); - } - - @Nullable - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - protected void onHandleIntent(Intent intent) { - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(Intent.ACTION_BATTERY_LOW); - intentFilter.addAction(Intent.ACTION_BATTERY_OKAY); - intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED); - Intent intent1 = registerReceiver(null, intentFilter); - - Log.i("Battery Data", String.valueOf(intent1.getIntExtra(BatteryManager.EXTRA_LEVEL, 0))); - if (Intent.ACTION_BATTERY_OKAY.equals(intent.getAction())) { - SenseDataHolder.getBatteryDataHolder().add(new BatteryData(BatteryData.State.OK)); - } else if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) { - SenseDataHolder.getBatteryDataHolder().add(new BatteryData(BatteryData.State.LOW)); - } else { - SenseDataHolder.getBatteryDataHolder().add(new BatteryData(intent1)); - } - } -} 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/call/CallData.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/call/CallData.java deleted file mode 100644 index 9f617cdb1..000000000 --- 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/call/CallData.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.call; - -public class CallData { - - public enum Type { - INCOMING, OUTGOING, MISSED; - } - - private Type type; - private String phoneNumber; - private long startTime; - private long endTime; - - public CallData(Type type, String phoneNumber, long startTime, long endTime) { - this.type = type; - this.phoneNumber = phoneNumber; - this.startTime = startTime; - this.endTime = endTime; - } - - public Type getType() { - return type; - } - - public void setType(Type type) { - this.type = type; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public long getStartTime() { - return startTime; - } - - public void setStartTime(long startTime) { - this.startTime = startTime; - } - - public long getEndTime() { - return endTime; - } - - public void setEndTime(long endTime) { - this.endTime = endTime; - } -} \ 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/call/CallDataReceiver.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/call/CallDataReceiver.java deleted file mode 100644 index 1988914e8..000000000 --- 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/call/CallDataReceiver.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.call; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.telephony.TelephonyManager; - -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -public class CallDataReceiver extends BroadcastReceiver { - private static int lastState = TelephonyManager.CALL_STATE_IDLE; - private static long startTime; - private static boolean isIncoming; - private static String lastNotifiedNumber; - - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) { - lastNotifiedNumber = intent.getExtras().getString(Intent.EXTRA_PHONE_NUMBER); - } else { - String extraState = intent.getExtras().getString(TelephonyManager.EXTRA_STATE); - int state = 0; - if (extraState.equals(TelephonyManager.EXTRA_STATE_IDLE)) { - state = TelephonyManager.CALL_STATE_IDLE; - } else if (extraState.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) { - state = TelephonyManager.CALL_STATE_OFFHOOK; - } else if (extraState.equals(TelephonyManager.EXTRA_STATE_RINGING)) { - state = TelephonyManager.CALL_STATE_RINGING; - } - - if (lastState == state) { - return; // Nothing has been changed - } - switch (state) { - case TelephonyManager.CALL_STATE_RINGING: - // Receiving a call - isIncoming = true; - startTime = System.currentTimeMillis(); - // If incoming call, get the incoming number - lastNotifiedNumber = intent.getExtras().getString(TelephonyManager.EXTRA_INCOMING_NUMBER); - break; - case TelephonyManager.CALL_STATE_OFFHOOK: - if (lastState == TelephonyManager.CALL_STATE_RINGING) { - // RINGING -> OFFHOOK = ANSWERED - isIncoming = true; - startTime = System.currentTimeMillis(); - } else { - // NOT RINGING -> OFFHOOK = OUTGOING - isIncoming = false; - startTime = System.currentTimeMillis(); - } - break; - case TelephonyManager.CALL_STATE_IDLE: - if (lastState == TelephonyManager.CALL_STATE_RINGING) { - // RINGING -> IDLE = MISSED - SenseDataHolder.getCallDataHolder().add(new CallData(CallData.Type.MISSED, lastNotifiedNumber, startTime, System.currentTimeMillis())); - } else if (isIncoming) { - // Incoming (OFFHOOK) -> IDLE = INCOMING CALL ENDED - SenseDataHolder.getCallDataHolder().add(new CallData(CallData.Type.INCOMING, lastNotifiedNumber, startTime, System.currentTimeMillis())); - } else { - // Not Incoming -> IDLE = OUTGOING CALL ENDED - SenseDataHolder.getCallDataHolder().add(new CallData(CallData.Type.OUTGOING, lastNotifiedNumber, startTime, System.currentTimeMillis())); - } - break; - } - lastState = state; - } - } -} 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/data/NetworkData.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/data/NetworkData.java deleted file mode 100644 index 52695a5e1..000000000 --- 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/data/NetworkData.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.data; - -public class NetworkData { - - //Mobile or Wifi - private String type; - private long dataReceived; - private long dataSent; - private long timeStamp; - - public NetworkData() { - } - - public String getDataType() { - return type; - } - - public long getDataReceived() { - return dataReceived; - } - - public void setDataReceived(long dataReceived) { - this.dataReceived = dataReceived; - } - - public long getDataSent() { - return dataSent; - } - - public void setDataSent(long dataSent) { - this.dataSent = dataSent; - } - - public long getTimeStamp() { - return timeStamp; - } - - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } -} 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/data/NetworkDataReader.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/data/NetworkDataReader.java deleted file mode 100644 index 885bd5c9b..000000000 --- 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/data/NetworkDataReader.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.data; - -import android.content.Context; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -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; - -/** - * Class to read data sent and received by the device. - */ -public class NetworkDataReader extends AsyncTask { - - private NetworkData networkData; - private Context context; - private Handler mHandler = new Handler(); - private long mStartRX = 0; - private long mStartTX = 0; - private final String WIFI = "WIFI"; - private final String MOBILE = "MOBILE"; - private String connectionType; - - public NetworkDataReader(Context context) { - this.context = context; - } - - @Override - protected Long doInBackground(Void... voids) { - - ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - networkData = new NetworkData(); - - if (getConnectionType(connectivityManager, ConnectivityManager.TYPE_WIFI)) { - connectionType = WIFI; - } else if (getConnectionType(connectivityManager, ConnectivityManager.TYPE_MOBILE)) { - connectionType = MOBILE; - } - - mStartRX = TrafficStats.getTotalRxBytes(); - mStartTX = TrafficStats.getTotalTxBytes(); - if (mStartRX == TrafficStats.UNSUPPORTED || mStartTX == TrafficStats.UNSUPPORTED) { - Log.e("ERROR", "Not connected."); - } else { - mHandler.postDelayed(mRunnable, 10000); - } - return null; - } - - /** - * Collect data sent and received with in 10 second time frames. - */ - private final Runnable mRunnable = new Runnable() { - public void run() { - long rxBytes = TrafficStats.getTotalRxBytes() - mStartRX; - long txBytes = TrafficStats.getTotalTxBytes() - mStartTX; - Log.i("Usage: ", String.valueOf(rxBytes) + " " + String.valueOf(txBytes) + " " + System.currentTimeMillis()); - networkData.setType(connectionType); - networkData.setTimeStamp(new Date().getTime()); - networkData.setDataSent(txBytes); - networkData.setDataReceived(rxBytes); - SenseDataHolder.getNetworkDataHolder().add(networkData); - mHandler.postDelayed(mRunnable, 10000); - } - }; - - /** - * Get the type of the connection currently have. - */ - private boolean getConnectionType(ConnectivityManager manager, Integer type) { - NetworkInfo networkInfo = manager.getNetworkInfo(type); - return networkInfo.isConnected(); - } -} 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/LocationData.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/LocationData.java deleted file mode 100755 index c53499060..000000000 --- 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/LocationData.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.event.streams.location; - -import java.util.Date; - -/** - * This defines the data structure of the location data that is been collected. - */ -public class LocationData { - private double latitude; // latitude - private double longitude; // longitude - private long timestamp; - - LocationData(double latitude, double longitude) { - this.latitude = latitude; - this.longitude = longitude; - timestamp = new Date().getTime(); - - } - - public double getLatitude() { - return latitude; - } - - public void setLatitude(double latitude) { - this.latitude = latitude; - } - - public double getLongitude() { - return longitude; - } - - public void setLongitude(double longitude) { - this.longitude = longitude; - } - - public long getTimeStamp() { - return timestamp; - } - - public void setTimeStamp(long timeStamp) { - timestamp = timeStamp; - } -} 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 deleted file mode 100755 index f79cc64f5..000000000 --- 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 +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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.event.streams.location; - -import android.content.Context; -import android.content.Intent; -import android.location.Location; -import android.location.LocationListener; -import android.location.LocationManager; -import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; -import android.util.Log; -import android.widget.Toast; - -import org.wso2.carbon.iot.android.sense.event.streams.DataReader; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -import java.util.Calendar; -import java.util.concurrent.TimeUnit; - -/** - * This is used to retrieve the location data using GPS and used Network connection to increase the accuracy. - */ -public class LocationDataReader extends DataReader implements LocationListener { - protected LocationManager locationManager; - private final Context mContext; - - LocationData gps; - - static final Double EARTH_RADIUS = 6371.00; - - // flag for GPS status - private boolean isGPSEnabled = false; - - // flag for network status - private boolean isNetworkEnabled = false; - - // flag for GPS status - private boolean canGetLocation = false; - //private boolean canGetLocation = false; - private static final String TAG = LocationDataReader.class.getName(); - - Location location; // location - double latitude; // latitude - double longitude; // longitude - - double lat_old=0.0; - double lon_old=0.0; - double time; - float speed = 0.0f; - private long lastUpdate; - - // The minimum distance to change Updates in meters - private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters - - // The minimum time between updates in milliseconds - private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute - - public LocationDataReader(Context context) { - this.mContext = context; - getLocation(); - } - - public Location getLocation() { - try { - - locationManager = (LocationManager) mContext - .getSystemService(mContext.LOCATION_SERVICE); - - // getting GPS status - isGPSEnabled = locationManager - .isProviderEnabled(LocationManager.GPS_PROVIDER); - - // getting network status - isNetworkEnabled = locationManager - .isProviderEnabled(LocationManager.NETWORK_PROVIDER); - - if (!isGPSEnabled && !isNetworkEnabled) { - // no network provider is enabled - } else { - this.canGetLocation = true; - if (isNetworkEnabled) { - locationManager.requestLocationUpdates( - LocationManager.NETWORK_PROVIDER, - MIN_TIME_BW_UPDATES, - MIN_DISTANCE_CHANGE_FOR_UPDATES, this); - Log.d("Network", "Network"); - if (locationManager != null) { - location = locationManager - .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); - if (location != null) { - latitude = location.getLatitude(); - longitude = location.getLongitude(); - } - } - } - // if GPS Enabled get lat/long using GPS Services - if (isGPSEnabled) { - if (location == null) { - locationManager.requestLocationUpdates( - LocationManager.GPS_PROVIDER, - MIN_TIME_BW_UPDATES, - MIN_DISTANCE_CHANGE_FOR_UPDATES, this); - Log.d("GPS Enabled", "GPS Enabled"); - if (locationManager != null) { - location = locationManager - .getLastKnownLocation(LocationManager.GPS_PROVIDER); - if (location != null) { - latitude = location.getLatitude(); - longitude = location.getLongitude(); - } - } - } - } - } - - } catch (Exception e) { - Log.e(TAG, "Failed to capture location data."); - } - - return location; - } - - public boolean canGetLocation() { - return this.canGetLocation; - } - - public void stopUsingGPS() { - if (locationManager != null) { - locationManager.removeUpdates(LocationDataReader.this); - } - } - - public double getLatitude() { - if (location != null) { - latitude = location.getLatitude(); - } - // return latitude - return latitude; - } - - /** - * Function to get longitude - */ - public double getLongitude() { - if (location != null) { - longitude = location.getLongitude(); - } - // return longitude - return longitude; - } - - @Override - public void onLocationChanged(Location arg0) { - // TODO Auto-generated method stub - Log.v("Debug", "in onLocation changed.."); - if(location!=null){ - long curTime = System.currentTimeMillis(); - - long diffTime = (curTime - lastUpdate); - lastUpdate = curTime; - Calendar c=Calendar.getInstance(); - c.setTimeInMillis(diffTime); - - time=c.get(Calendar.HOUR); - - locationManager.removeUpdates(LocationDataReader.this); - //String Speed = "Device Speed: " +location.getSpeed(); - latitude=location.getLongitude(); - longitude =location.getLatitude(); - - 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(); - - - Intent intent = new Intent("speedUpdate"); - intent.putExtra("speed", speed); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - - lat_old=latitude; - lon_old=longitude; - } - - } - - @Override - public void onProviderDisabled(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void onProviderEnabled(String arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void onStatusChanged(String arg0, int arg1, Bundle arg2) { - // TODO Auto-generated method stub - - } - - @Override - public void run() { - Log.d(TAG, "running -Location"); - try { - TimeUnit.MILLISECONDS.sleep(10000); - double lat = getLatitude(); - double longit = getLongitude(); - if (lat != 0 && longit != 0) { - Log.d(TAG, "YYY " + getLatitude() + ", XXX " + getLongitude()); - gps = new LocationData(getLatitude(), getLongitude()); - SenseDataHolder.getLocationDataHolder().add(gps); - - } - } catch (InterruptedException e) { - // Restore the interrupted status - Thread.currentThread().interrupt(); - Log.e(TAG, " Location Data Retrieval Failed", e); - } - } - - public double CalculationByDistance(double lat1, double lon1, double lat2, double lon2) { - double Radius = EARTH_RADIUS; - double dLat = Math.toRadians(lat2-lat1); - double dLon = Math.toRadians(lon2-lon1); - double a = Math.sin(dLat/2) * Math.sin(dLat/2) + - Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * - Math.sin(dLon/2) * Math.sin(dLon/2); - double c = 2 * Math.asin(Math.sqrt(a)); - return Radius * c; - } - - - -} 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/screen/ScreenData.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/screen/ScreenData.java deleted file mode 100644 index 0c124611f..000000000 --- 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/screen/ScreenData.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.screen; - -import android.content.Intent; - -import java.util.Date; - -public class ScreenData { - private String action; - private long timestamp; - - ScreenData(Intent intent) { - if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) { - this.action = "on"; - } else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { - this.action = "off"; - } else { - this.action = "unknown"; - } - this.timestamp = new Date().getTime(); - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } -} 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/screen/ScreenDataReceiver.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/screen/ScreenDataReceiver.java deleted file mode 100644 index ace9d98fa..000000000 --- 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/screen/ScreenDataReceiver.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.screen; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -public class ScreenDataReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - SenseDataHolder.getScreenDataHolder().add(new ScreenData(intent)); - } -} 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/sensor/SensorData.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/sensor/SensorData.java deleted file mode 100755 index a8c0d0364..000000000 --- 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/sensor/SensorData.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.event.streams.sensor; - -import android.hardware.SensorEvent; - -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedSensors; - -import java.util.Date; - -/** - * This defines the data structure of the sensor data that is been collected. - * look at http://developer.android.com/guide/topics/sensors/sensors_overview.html for field description. - */ -public class SensorData { - private int sensorType; - private String sensorName; - private String sensorVendor; - private float sensorValues[]; - private int accuracyStatus; - private long timestamp; - private String collectTimestamp; - private SupportedSensors supportedSensors = SupportedSensors.getInstance(); - - SensorData(SensorEvent event) { - sensorValues = event.values; - accuracyStatus = event.accuracy; - collectTimestamp = String.valueOf(event.timestamp); - timestamp = new Date().getTime(); - sensorName = supportedSensors.getType(event.sensor.getType()).toUpperCase(); - sensorVendor = event.sensor.getVendor(); - sensorType = event.sensor.getType(); - } - - public int getSensorType() { - return sensorType; - } - - public void setSensorType(int sensorType) { - this.sensorType = sensorType; - } - - public String getSensorName() { - return sensorName; - } - - public void setSensorName(String sensorName) { - this.sensorName = sensorName; - } - - public String getSensorVendor() { - return sensorVendor; - } - - public void setSensorVendor(String sensorVendor) { - this.sensorVendor = sensorVendor; - } - - public float[] getSensorValues() { - return sensorValues; - } - - public void setSensorValues(float sensorValues[]) { - this.sensorValues = sensorValues; - } - - public int getAccuracyStatus() { - return accuracyStatus; - } - - public void setAccuracyStatus(int accuracyStatus) { - this.accuracyStatus = accuracyStatus; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public String getCollectTimestamp() { - return collectTimestamp; - } - - public void setCollectTimestamp(String collectTimestamp) { - this.collectTimestamp = collectTimestamp; - } -} 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/sensor/SensorDataReader.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/sensor/SensorDataReader.java deleted file mode 100755 index b72754f44..000000000 --- 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/sensor/SensorDataReader.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.event.streams.sensor; - -import android.content.Context; -import android.content.SharedPreferences; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.event.streams.DataReader; -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedSensors; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import java.util.concurrent.TimeUnit; - -/** - * This is used to retrieve the sensor data. - */ -public class SensorDataReader extends DataReader implements SensorEventListener { - private SensorManager mSensorManager; - private Map senseDataStruct = new HashMap<>(); - private Vector sensorVector = new Vector<>(); - Context ctx; - private List sensorList = new ArrayList<>(); - private SupportedSensors supportedSensors = SupportedSensors.getInstance(); - private static final String TAG = SensorDataReader.class.getName(); - - public SensorDataReader(Context context) { - ctx = context; - SharedPreferences sharedPreferences = ctx.getSharedPreferences(SupportedSensors.SELECTED_SENSORS, Context - .MODE_MULTI_PROCESS); - Set selectedSet = sharedPreferences.getStringSet(SupportedSensors.SELECTED_SENSORS_BY_USER, null); - mSensorManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE); - selectedSensorList(selectedSet); - for (Sensor sensor : sensorList) { - mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL); - } - } - - private void collectSensorData() { - for (Sensor sensor : sensorList) { - try { - if (senseDataStruct.containsKey(sensor.getName())) { - SensorData sensorInfo = senseDataStruct.get(sensor.getName()); - sensorVector.add(sensorInfo); - Log.d(TAG, "Sensor Name " + sensor.getName() + ", Type " + sensor.getType() + " " + - ", sensorValue :" + Arrays.toString(sensorInfo.getSensorValues())); - } - } catch (Throwable e) { - Log.d(TAG, "error on sensors"); - } - } - mSensorManager.unregisterListener(this); - } - - public Vector getSensorData() { - try { - TimeUnit.MILLISECONDS.sleep(1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - Log.e(TAG, e.getMessage()); - } - collectSensorData(); - return sensorVector; - } - - @Override - public void onAccuracyChanged(Sensor sensor, int accuracy) { - } - - @Override - public void onSensorChanged(SensorEvent event) { - senseDataStruct.put(event.sensor.getName(), new SensorData(event)); - } - - @Override - public void run() { - Log.d(TAG, "running -sensorDataMap"); - Vector sensorDetails = getSensorData(); - for (SensorData data : sensorDetails) { - SenseDataHolder.getSensorDataHolder().add(data); - } - } - - public void selectedSensorList(Set set) { - if (set != null) { - String[] sensorsSet = set.toArray(new String[set.size()]); - for (String s : sensorsSet) { - sensorList.add(mSensorManager.getDefaultSensor(supportedSensors.getType(s.toLowerCase()))); - } - } - } -} 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/sms/SmsData.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/sms/SmsData.java deleted file mode 100644 index 607ca2a85..000000000 --- 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/sms/SmsData.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.sms; - -import java.util.Date; - -public class SmsData { - - private String phoneNumber; - private long timestamp; - private String message; - - SmsData(String phoneNumber, String message) { - this.phoneNumber = phoneNumber; - this.message = message; - this.timestamp = new Date().getTime(); - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} 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/sms/SmsDataReceiver.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/sms/SmsDataReceiver.java deleted file mode 100644 index d107ab0a9..000000000 --- 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/sms/SmsDataReceiver.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.event.streams.sms; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.telephony.SmsMessage; - -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -public class SmsDataReceiver extends BroadcastReceiver { - - @Override - public void onReceive(Context context, Intent intent) { - final Bundle bundle = intent.getExtras(); - - if (bundle != null) { - final Object[] pdusObj = (Object[]) bundle.get("pdus"); - - for (int i = 0; i < pdusObj.length; i++) { - SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[i]); - String phoneNumber = currentMessage.getDisplayOriginatingAddress(); - String message = currentMessage.getDisplayMessageBody(); - - SmsData smsData = new SmsData(phoneNumber, message); - SenseDataHolder.getSmsDataHolder().add(smsData); - } - } - } -} 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/speed/SpeedData.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/speed/SpeedData.java deleted file mode 100644 index 2093fcbd4..000000000 --- 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/speed/SpeedData.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.event.streams.speed; - -import java.util.Date; - -public class SpeedData { - private float speed; // speed - private String turnAxis; // turns - private long timestamp; - - SpeedData(float speed, String turnAxis) { - this.speed = speed; - this.turnAxis = turnAxis; - timestamp = new Date().getTime(); - - } - - public float getSpeed() { - return speed; - } - - public void setSpeed(float speed) { - this.speed = speed; - } - - public String getTurns() { - return turnAxis; - } - - public void setTurns(String turnAxis) { - this.turnAxis = turnAxis; - } - - public long getTimeStamp() { - return timestamp; - } - - public void setTimeStamp(long timeStamp) { - timestamp = timeStamp; - } - -} 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/speed/SpeedDataReader.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/speed/SpeedDataReader.java deleted file mode 100644 index f66739125..000000000 --- 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/speed/SpeedDataReader.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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.event.streams.speed; - -import org.wso2.carbon.iot.android.sense.event.streams.DataReader; -import org.wso2.carbon.iot.android.sense.event.streams.sensor.SensorData; -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedSensors; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; -import android.content.Context; -import android.content.IntentFilter; -import android.content.SharedPreferences; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; -import android.support.v4.content.LocalBroadcastManager; -import android.util.Log; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import java.util.concurrent.TimeUnit; -import android.content.BroadcastReceiver; - -import android.content.Intent; - - -public class SpeedDataReader extends DataReader implements SensorEventListener { - - SpeedData data; - private SensorManager mSensorManager; - private Map senseDataStruct = new HashMap<>(); - private Vector sensorVector = new Vector<>(); - private static final String TAG = SpeedDataReader.class.getName(); - private float last_x, last_y, last_z; - private long lastUpdate; - private String xTurnAxis; - float speed; - private float x,y,z; - Context ctx; - private List sensorList = new ArrayList<>(); - private SupportedSensors supportedSensors = SupportedSensors.getInstance(); - - @Override - public void onSensorChanged(SensorEvent event) { - - Sensor devSensor = event.sensor; - - if (devSensor.getType() == Sensor.TYPE_ACCELEROMETER) { - x = event.values[0]; - y = event.values[1]; - z = event.values[2]; - - } - } - - public SpeedDataReader(Context context) { - ctx = context; - SharedPreferences sharedPreferences = ctx.getSharedPreferences(SupportedSensors.SELECTED_SENSORS, Context - .MODE_MULTI_PROCESS); - Set selectedSet = sharedPreferences.getStringSet(SupportedSensors.SELECTED_SENSORS_BY_USER, null); - mSensorManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE); - selectedSensorList(selectedSet); - for (Sensor sensor : sensorList) { - mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL); - } - - LocalBroadcastManager.getInstance(ctx).registerReceiver(mMessageReceiver, - new IntentFilter("speedUpdate")); - - } - - private void collectSensorData() { - for (Sensor sensor : sensorList) { - try { - if (senseDataStruct.containsKey(sensor.getName())) { - SensorData sensorInfo = senseDataStruct.get(sensor.getName()); - sensorVector.add(sensorInfo); - Log.d(TAG, "Sensor Name " + sensor.getName() + ", Type " + sensor.getType() + " " + - ", sensorValue :" + sensorInfo.getSensorValues()); - } - } catch (Throwable e) { - Log.d(TAG, "error on sensors"); - } - } - mSensorManager.unregisterListener(this); - } - - - public String getTurns() { - - if(Round(x,4)>10.0000){ - Log.d("sensor", "X Right axis: " + x); - xTurnAxis = "Right"; - return xTurnAxis; - }else if(Round(x,4)<-10.0000){ - Log.d("sensor", "X Left axis: " + x); - xTurnAxis = "Left"; - return xTurnAxis; - }else { - xTurnAxis = "No Turns"; - - } - return xTurnAxis; - } - - public float getSpeed(){ - - return speed; - } - - @Override - public void onAccuracyChanged(Sensor sensor, int accuracy) { - // can be safely ignored for this demo - } - - public static float Round(float Rval, int Rpl) { - float p = (float)Math.pow(10,Rpl); - Rval = Rval * p; - float tmp = Math.round(Rval); - Log.d("round", "round: " + tmp/p); - - return tmp/p; - } - - @Override - public void run() { - Log.d(TAG, "running - Device Speed"); - try { - TimeUnit.MILLISECONDS.sleep(10000); - // String trn = getTurns(); - // double spd = getSpeed(); - //if (trn != 0 && spd != 0) { - data = new SpeedData(getSpeed(), getTurns()); - SenseDataHolder.getSpeedDataHolder().add(data); - collectSensorData(); - - //} - } catch (InterruptedException e) { - // Restore the interrupted status - Thread.currentThread().interrupt(); - Log.e(TAG, " Speed Data Retrieval Failed"); - } - } - - public void selectedSensorList(Set set) { - if (set != null) { - String[] sensorsSet = set.toArray(new String[set.size()]); - for (String s : sensorsSet) { - sensorList.add(mSensorManager.getDefaultSensor(supportedSensors.getType(s.toLowerCase()))); - } - } - } - - private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - // Get extra data included in the Intent - speed = intent.getFloatExtra("speed",speed); - - Log.d("receiver", "Got message: " + speed); - } - }; - - -} 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 deleted file mode 100755 index 41b661ec6..000000000 --- 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 +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer; - -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.SharedPreferences; -import android.hardware.Sensor; -import android.hardware.SensorManager; -import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.support.design.widget.NavigationView; -import android.support.design.widget.Snackbar; -import android.support.v4.view.GravityCompat; -import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarDrawerToggle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; -import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; -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.bmonitor.BeaconMonitoringActivity; -import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherReceiver; -import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherService; -import org.wso2.carbon.iot.android.sense.event.SenseScheduleReceiver; -import org.wso2.carbon.iot.android.sense.event.SenseService; -import org.wso2.carbon.iot.android.sense.realtimeviewer.datastore.TempStore; -import org.wso2.carbon.iot.android.sense.realtimeviewer.event.RealTimeSensorChangeReceiver; -import org.wso2.carbon.iot.android.sense.realtimeviewer.event.realtimesensor.RealTimeSensorReader; -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedSensors; -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.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; - -/** - * Activity for selecting sensors available in the device - */ - -public class ActivitySelectSensor extends AppCompatActivity - implements NavigationView.OnNavigationItemSelectedListener, SelectSensorDialog.SensorListListener { - - private SharedPreferences sharedPreferences; - private SelectSensorDialog sensorDialog = new SelectSensorDialog(); - private Set selectedSensorSet = new HashSet<>(); - private ListView listView; - private SensorManager sensorManager; - private ArrayList sensors = new ArrayList<>(); - 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) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_activity_select_sensor); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); - listView = (ListView) findViewById(R.id.senseListContainer); - - registerReceiver(realTimeSensorChangeReceiver, new IntentFilter("sensorDataMap")); - - //Publish data - FloatingActionButton fbtnPublishData = (FloatingActionButton) findViewById(R.id.publish); - - fbtnPublishData.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Snackbar.make(view, "Publishing data started", Snackbar.LENGTH_LONG) - .setAction("Action", null).show(); - - DataPublisherReceiver dataPublisherReceiver = new DataPublisherReceiver(); - dataPublisherReceiver.clearAbortBroadcast(); - dataPublisherReceiver.onReceive(getApplicationContext(), null); - } - }); - - FloatingActionButton fbtnAddSensors = (FloatingActionButton) findViewById(R.id.addSensors); - fbtnAddSensors.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - sensorDialog.show(getFragmentManager(), "Sensor List"); - } - }); - - sharedPreferences = getSharedPreferences(SupportedSensors.SELECTED_SENSORS, 0); - - DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); - ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( - this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); - drawer.setDrawerListener(toggle); - toggle.syncState(); - - NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); - navigationView.setNavigationItemSelectedListener(this); - } - - @Override - public void onBackPressed() { - DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); - if (drawer.isDrawerOpen(GravityCompat.START)) { - drawer.closeDrawer(GravityCompat.START); - } else { - super.onBackPressed(); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.activity_select_sensor, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. - int id = item.getItemId(); - - //noinspection SimplifiableIfStatement - if (id == R.id.action_deEnroll) { - - /** - * unregister the sensors and broadcast receivers. - * */ - unregisterSensors(); - unregisterReceivers(); - - if (!LocalRegistry.isExist(getApplicationContext())) { - Intent activity = new Intent(getApplicationContext(), RegisterActivity.class); - startActivity(activity); - } - LocalRegistry.setEnrolled(getApplicationContext(), false); - LocalRegistry.removeUsername(getApplicationContext()); - LocalRegistry.removeDeviceId(getApplicationContext()); - LocalRegistry.removeServerURL(getApplicationContext()); - LocalRegistry.removeAccessToken(getApplicationContext()); - LocalRegistry.removeRefreshToken(getApplicationContext()); - LocalRegistry.removeMqttEndpoint(getApplicationContext()); - LocalRegistry.removeTenantDomain(getApplicationContext()); - LocalRegistry.setExist(false); - //Stop the current running background services. - stopService(new Intent(this, SenseService.class)); //Stop sensor reading service - stopService(new Intent(this, DataPublisherService.class)); //Stop data uploader service - - Intent registerActivity = new Intent(getApplicationContext(), RegisterActivity.class); - registerActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(registerActivity); - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } - - @SuppressWarnings("StatementWithEmptyBody") - @Override - public boolean onNavigationItemSelected(MenuItem item) { - // Handle navigation view item clicks here. - int id = item.getItemId(); - - if (id == R.id.select) { - sensorDialog.show(getFragmentManager(), "Sensor List"); - } - - DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); - drawer.closeDrawer(GravityCompat.START); - return true; - } - - - - @Override - public void onDialogPositiveClick(SelectSensorDialog dialog) { - - Log.d("Selected sensors", dialog.getSet().toString()); - selectedSensorSet = dialog.getSet(); - update(); - unregisterSensors(); - - SenseScheduleReceiver senseScheduleReceiver = new SenseScheduleReceiver(); - senseScheduleReceiver.clearAbortBroadcast(); - senseScheduleReceiver.onReceive(this, null); - - /** - * Get the selected sensors - * Register them - * */ - SensorViewAdaptor adaptor1 = new SensorViewAdaptor(getApplicationContext(), TempStore.sensorArrayList); - adaptor1.notifyDataSetChanged(); - - sensorReader = new RealTimeSensorReader(this, adaptor1); - getSensors(); - - for (Sensor s : sensors) { - sensorManager.registerListener(sensorReader, s, SensorManager.SENSOR_DELAY_NORMAL); - } - - realTimeSensorChangeReceiver.updateOnChange(adaptor1); - listView.setAdapter(adaptor1); - } - - public void update() { - Log.d("Update", "Set the values to Shared Preferences"); - - TempStore.sensorArrayList.clear(); - TempStore.sensorDataMap.clear(); - - SharedPreferences.Editor editor = sharedPreferences.edit(); - editor.putStringSet(SupportedSensors.SELECTED_SENSORS_BY_USER, selectedSensorSet); - editor.apply(); - } - - public void getSensors() { - sensors.clear(); - for (String sensor : selectedSensorSet.toArray(new String[selectedSensorSet.size()])) { - sensors.add(sensorManager.getDefaultSensor(supportedSensors.getType(sensor.toLowerCase()))); - } - } - - /** - * This method will unregister all the registered sensors. - */ - public void unregisterSensors() { - if (sensors.size() > 0) { - for (Sensor s : sensors) { - System.out.println(s.getName() + " Unregistered!"); - sensorManager.unregisterListener(sensorReader, s); - } - } - } - - /** - * This method unregisters the real-time broadcast receiver. - */ - public void unregisterReceivers() { - unregisterReceiver(realTimeSensorChangeReceiver); - } -} 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/datastore/TempStore.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/datastore/TempStore.java deleted file mode 100755 index dd5a9f86a..000000000 --- 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/datastore/TempStore.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.datastore; - -import org.wso2.carbon.iot.android.sense.realtimeviewer.event.realtimesensor.RealTimeSensor; - -import java.util.ArrayList; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - * Class to store the real time sensor readings. - */ -public class TempStore { - - /** - * Hash map which is used to store sensor values with the sensor names. - */ - public static ConcurrentMap sensorDataMap = new ConcurrentHashMap<>(); - - /** - * Array List which is used to populate the List view. - */ - public static ArrayList sensorArrayList = new ArrayList<>(); -} 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/event/RealTimeSensorChangeReceiver.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/event/RealTimeSensorChangeReceiver.java deleted file mode 100755 index 3413f4e43..000000000 --- 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/event/RealTimeSensorChangeReceiver.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.event; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import org.wso2.carbon.iot.android.sense.realtimeviewer.datastore.TempStore; -import org.wso2.carbon.iot.android.sense.realtimeviewer.view.adaptor.SensorViewAdaptor; - -/** - * This class is to detect the sensor change event and update the sensor array list. - * And update the view adaptor which is used to show the sensors list in the Android List view. - */ -public class RealTimeSensorChangeReceiver extends BroadcastReceiver { - - SensorViewAdaptor adaptor; - - public void updateOnChange(SensorViewAdaptor adaptor) { - this.adaptor = adaptor; - } - - @Override - public void onReceive(Context context, Intent intent) { - TempStore.sensorArrayList.clear(); - TempStore.sensorArrayList.addAll(TempStore.sensorDataMap.values()); - } -} 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/event/realtimesensor/RealTimeSensor.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/event/realtimesensor/RealTimeSensor.java deleted file mode 100755 index 6a71739dc..000000000 --- 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/event/realtimesensor/RealTimeSensor.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.event.realtimesensor; - -import android.support.annotation.NonNull; - -/** - * The class to store the sensor data captured by the RealTimeSensorReader. - */ -public class RealTimeSensor implements Comparable { - - - /** - * Name of the sensor. - */ - private String name; - - /** - * The X value reading of the sensor. - */ - private String valueX; - - /** - * The Y value reading of the sensor. - */ - private String valueY; - - /** - * The Y value reading of the sensor. - */ - private String valueZ; - - public RealTimeSensor() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValueX() { - return valueX; - } - - public void setValueX(String valueX) { - this.valueX = valueX; - } - - public String getValueY() { - return valueY; - } - - public void setValueY(String valueY) { - this.valueY = valueY; - } - - public String getValueZ() { - return valueZ; - } - - public void setValueZ(String valueZ) { - this.valueZ = valueZ; - } - - @Override - public String toString() { - return this.valueX + ", " + valueY + ", " + valueZ; - } - - @Override - public int compareTo(@NonNull Object another) { - return this.toString().contains(another.toString()) ? 1 : 0; - } -} 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/event/realtimesensor/RealTimeSensorReader.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/event/realtimesensor/RealTimeSensorReader.java deleted file mode 100755 index 441b25195..000000000 --- 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/event/realtimesensor/RealTimeSensorReader.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.event.realtimesensor; - -import android.content.Context; -import android.content.Intent; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; - -import org.wso2.carbon.iot.android.sense.realtimeviewer.datastore.TempStore; -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedSensors; -import org.wso2.carbon.iot.android.sense.realtimeviewer.view.adaptor.SensorViewAdaptor; - -/** - * This class reads the sensor values in real time. - */ -public class RealTimeSensorReader implements SensorEventListener { - - private Context context; - private SensorViewAdaptor adaptor; - private SupportedSensors supportedSensors = SupportedSensors.getInstance(); - - public RealTimeSensorReader(Context context, SensorViewAdaptor adaptor) { - this.context = context; - this.adaptor = adaptor; - } - - @Override - public void onSensorChanged(SensorEvent event) { - RealTimeSensor realTimeSensor = new RealTimeSensor(); - realTimeSensor.setName(supportedSensors.getType(event.sensor.getType()).toUpperCase()); - - realTimeSensor.setValueX(event.values == null ? "" : event.values[0] + ""); - realTimeSensor.setValueY(event.values == null || event.values.length <= 1 ? "" : event.values[1] + ""); - realTimeSensor.setValueZ(event.values == null || event.values.length <= 1 ? "" : event.values[2] + ""); - - TempStore.sensorDataMap.put(supportedSensors.getType(event.sensor.getType()), realTimeSensor); - - Intent intent = new Intent(); - intent.setAction("sensorDataMap"); - context.sendBroadcast(intent); - - adaptor.notifyDataSetChanged(); - } - - @Override - public void onAccuracyChanged(Sensor sensor, int accuracy) { - } -} 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/sensorlisting/AvailableSensorsInDevice.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/sensorlisting/AvailableSensorsInDevice.java deleted file mode 100755 index e8cdfc808..000000000 --- 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/sensorlisting/AvailableSensorsInDevice.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.sensorlisting; - -import android.content.Context; -import android.content.SharedPreferences; -import android.hardware.Sensor; -import android.hardware.SensorManager; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Class to save the list of sensors that are available in the device, which are supported by the iot server. - * This list will be saved in Shared preferences so that app can use this data when needed. - */ -public class AvailableSensorsInDevice { - - private SharedPreferences sensorPreference; - - /** - * The Android sensor manager which is used to get the sensors available in device. - */ - private SensorManager mSensorManager; - - public AvailableSensorsInDevice(Context context) { - this.sensorPreference = context.getSharedPreferences(SupportedSensors.AVAILABLE_SENSORS, 0); - this.mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); - } - - /** - * This method filters the pre defined sensor types from sensors available in device and sets them in Shared - * preferences. - */ - public void setContent() { - SupportedSensors supportedSensors = SupportedSensors.getInstance(); - List sensor_List = supportedSensors.getSensorList(); - Set sensorSet = new HashSet<>(); - List sensors = mSensorManager.getSensorList(Sensor.TYPE_ALL); - - for (String sen : sensor_List) { - if (sensors.contains(mSensorManager.getDefaultSensor(supportedSensors.getType(sen.toLowerCase())))) { - sensorSet.add(sen); - } - } - - SharedPreferences.Editor editor = this.sensorPreference.edit(); - editor.putStringSet(SupportedSensors.GET_AVAILABLE_SENSORS, sensorSet); - editor.apply(); - } -} 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/sensorlisting/SupportedSensors.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/sensorlisting/SupportedSensors.java deleted file mode 100755 index d5113eb33..000000000 --- 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/sensorlisting/SupportedSensors.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.sensorlisting; - -import android.hardware.Sensor; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * Class to store the supported sensorDataMap types. - */ -public class SupportedSensors { - - //For set user selected sensors. Will be used by sensorDataMap reading and dialog - public static String SELECTED_SENSORS = "Selected"; - public static String SELECTED_SENSORS_BY_USER = "userSelection"; - - //For setting the available sensors in the device in dialog and AvailableSensorsInDevice - public static String AVAILABLE_SENSORS = "Sensors"; - public static String GET_AVAILABLE_SENSORS = "getAvailableSensors"; - - public static final int SUPPORTED_SENSOR_COUNT = 10; - private static List sensorList = new ArrayList<>(); - private static HashMap sensorTypeMap = new HashMap<>(); - private static HashMap typeSensorMap = new HashMap<>(); - private static SupportedSensors supportedSensors = new SupportedSensors(); - - private SupportedSensors() { - this.setList(); - this.setSensorTypeMap(); - this.setTypeSensorMap(); - } - - public static SupportedSensors getInstance() { - return supportedSensors; - } - - /** - * Set the supported sensor types by the IOT server. - */ - private void setList() { - sensorList.add("Accelerometer"); - sensorList.add("Magnetometer"); - sensorList.add("Gravity"); - sensorList.add("Rotation Vector"); - sensorList.add("Pressure"); - sensorList.add("Light"); - sensorList.add("Gyroscope"); - sensorList.add("Proximity"); - sensorList.add("Pedometer"); - } - - /** - * Populate the hash map which has Sensor name as the key and the sensor type as the value. - */ - private void setSensorTypeMap() { - sensorTypeMap.put("accelerometer", Sensor.TYPE_ACCELEROMETER); - sensorTypeMap.put("magnetometer", Sensor.TYPE_MAGNETIC_FIELD); - sensorTypeMap.put("gravity", Sensor.TYPE_GRAVITY); - sensorTypeMap.put("rotation vector", Sensor.TYPE_GAME_ROTATION_VECTOR); - sensorTypeMap.put("pressure", Sensor.TYPE_PRESSURE); - sensorTypeMap.put("gyroscope", Sensor.TYPE_GYROSCOPE); - sensorTypeMap.put("light", Sensor.TYPE_LIGHT); - sensorTypeMap.put("proximity", Sensor.TYPE_PROXIMITY); - sensorTypeMap.put("pedometer", Sensor.TYPE_STEP_COUNTER); - } - - /** - * Populates the hash map which has Sensor type as the key and sensor name as the value. - */ - private void setTypeSensorMap() { - typeSensorMap.put(Sensor.TYPE_ACCELEROMETER, "accelerometer"); - typeSensorMap.put(Sensor.TYPE_MAGNETIC_FIELD, "magnetometer"); - typeSensorMap.put(Sensor.TYPE_GRAVITY, "gravity"); - typeSensorMap.put(Sensor.TYPE_GAME_ROTATION_VECTOR, "rotation vector"); - typeSensorMap.put(Sensor.TYPE_PRESSURE, "pressure"); - typeSensorMap.put(Sensor.TYPE_GYROSCOPE, "gyroscope"); - typeSensorMap.put(Sensor.TYPE_LIGHT, "light"); - typeSensorMap.put(Sensor.TYPE_PROXIMITY, "proximity"); - typeSensorMap.put(Sensor.TYPE_STEP_COUNTER, "pedometer"); - } - - /** - * Method to get the supported sensor list. - * - * @return the list of sensors supported by the iot server. - */ - public List getSensorList() { - return sensorList; - } - - - /** - * @param sensor The name of the sensor. - * @return The integer representing the type of the sensor, - */ - public int getType(String sensor) { - return sensorTypeMap.get(sensor); - } - - - /** - * @param type The type of the sensor. - * @return The sensor name related to the given sensor type. - */ - public String getType(int type) { - return typeSensorMap.get(type); - } -} 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/view/adaptor/SensorViewAdaptor.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/view/adaptor/SensorViewAdaptor.java deleted file mode 100755 index c526ab36b..000000000 --- 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/view/adaptor/SensorViewAdaptor.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.view.adaptor; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.TextView; - -import org.wso2.carbon.iot.android.sense.realtimeviewer.event.realtimesensor.RealTimeSensor; - -import java.util.List; - -import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; - -/** - * Adaptor for populate the ListView. - * Takes list of Sensor readings - */ -public class SensorViewAdaptor extends BaseAdapter { - - private Context context; - private List data; - - public SensorViewAdaptor(Context context, List data) { - this.context = context; - this.data = data; - } - - @Override - public int getCount() { - return data.size(); - } - - @Override - public Object getItem(int position) { - return data.get(position); - } - - @Override - public long getItemId(int position) { - return 0; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder holder; - - LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View view; - - if (convertView == null) { - view = inflater.inflate(R.layout.display_sensor_values, parent, false); - holder = new ViewHolder(); - holder.name = (TextView) view.findViewById(R.id.name); - holder.valuesX = (TextView) view.findViewById(R.id.X); - holder.valuesY = (TextView) view.findViewById(R.id.Y); - holder.valuesZ = (TextView) view.findViewById(R.id.Z); - view.setTag(holder); - } else { - view = convertView; - holder = (ViewHolder) view.getTag(); - } - - RealTimeSensor data = this.data.get(position); - - holder.name.setText(data.getName()); - holder.valuesX.setText(data.getValueX()); - holder.valuesY.setText(data.getValueY()); - holder.valuesZ.setText(data.getValueZ()); - - return view; - } - - private class ViewHolder { - public TextView name; - public TextView valuesX; - public TextView valuesY; - public TextView valuesZ; - } -} 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/view/sensor/selector/SelectSensorDialog.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/view/sensor/selector/SelectSensorDialog.java deleted file mode 100755 index f04463353..000000000 --- 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/view/sensor/selector/SelectSensorDialog.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2015, 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.realtimeviewer.view.sensor.selector; - -import android.app.Activity; -import android.app.Dialog; -import android.app.DialogFragment; -import android.content.Context; -import android.content.DialogInterface; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.support.v7.app.AlertDialog; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.realtimeviewer.sensorlisting.SupportedSensors; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Functionality - * - * Show the list of available sensors in a list - * Get the user selections - * Put them in to shared preferences - */ -public class SelectSensorDialog extends DialogFragment { - - protected boolean[] selections = new boolean[SupportedSensors.SUPPORTED_SENSOR_COUNT]; - Activity activity; - SensorListListener sensorListListener; - private Set selectedSensorSet = new HashSet<>(); - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setTitle("Select Sensors"); - activity = getActivity(); - - SharedPreferences preferences = getActivity().getSharedPreferences(SupportedSensors.AVAILABLE_SENSORS, Context. - MODE_MULTI_PROCESS); - - Set set = preferences.getStringSet(SupportedSensors.GET_AVAILABLE_SENSORS, null); - final CharSequence[] sequence = getSequence(set); - - final boolean[] pos = new boolean[selections.length]; - final boolean[] neg = new boolean[selections.length]; - - builder.setMultiChoiceItems(sequence, selections, new DialogInterface.OnMultiChoiceClickListener() { - @Override - public void onClick(DialogInterface dialog, int which, boolean isChecked) { - if (isChecked) { - selectedSensorSet.add(sequence[which].toString()); - - pos[which] = true; - } else { - selectedSensorSet.remove(sequence[which].toString()); - neg[which] = true; - } - } - }); - - builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Log.d("Click", "Ok"); - //call sensorDataMap reading class - sensorListListener.onDialogPositiveClick(SelectSensorDialog.this); - } - }); - - builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Log.d("Click", "Cancel"); - for (int i = 0; i < SupportedSensors.SUPPORTED_SENSOR_COUNT; i++) { - - if (pos[i]) - selections[i] = false; - if (neg[i]) - selections[i] = true; - } - } - }); - return builder.create(); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - @Override - public void onDetach() { - super.onDetach(); - } - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - - try { - sensorListListener = (SensorListListener) getActivity(); - } catch (ClassCastException ex) { - throw new ClassCastException(activity.toString() + " must implement the SensorListener"); - } - } - - @Override - public void onStart() { - super.onStart(); - } - - /** - * Interface to be implemented by the parent - */ - public CharSequence[] getSequence(Set sensorset) { - CharSequence[] seq; - String[] seq2 = sensorset.toArray(new String[sensorset.size()]); - seq = Arrays.copyOf(seq2, seq2.length); - return seq; - } - - public Set getSet() { - return this.selectedSensorSet; - } - - public interface SensorListListener { - void onDialogPositiveClick(SelectSensorDialog dialog); - } -} 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/speech/detector/IVoiceControl.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/speech/detector/IVoiceControl.java deleted file mode 100755 index 83b702d45..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/IVoiceControl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.speech.detector; - -/** - * This interface is used to retrieve the voice commands and restart the listenting service - */ -public interface IVoiceControl { - /** - * This will be executed when a voice command was found - * @param voiceCommands - */ - public abstract void processVoiceCommands(String... voiceCommands); - - /** - * This will be executed after a voice command was processed to keep the recognition service activated - */ - public void restartListeningService(); - - public void finish(); -} 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/speech/detector/WordRecognitionActivity.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/speech/detector/WordRecognitionActivity.java deleted file mode 100755 index a3521f9ca..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/WordRecognitionActivity.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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.speech.detector; - -import android.content.Intent; -import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.WindowManager; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Toast; - -import org.wso2.carbon.iot.android.sense.constants.SenseConstants; -import org.wso2.carbon.iot.android.sense.realtimeviewer.ActivitySelectSensor; -import org.wso2.carbon.iot.android.sense.speech.detector.util.ListeningActivity; -import org.wso2.carbon.iot.android.sense.speech.detector.util.ProcessWords; -import org.wso2.carbon.iot.android.sense.speech.detector.util.VoiceRecognitionListener; -import org.wso2.carbon.iot.android.sense.speech.detector.util.WordData; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; - -/** - * This is main activity for word recognition. - */ -public class WordRecognitionActivity extends ListeningActivity { - Button setThreasholdButton; - Button addWordButton; - Button removeWordButton; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_speech_sense_main); - context = getApplicationContext(); // Needs to be set - - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - VoiceRecognitionListener.getInstance().setListener(this); // Here we set the current listener - addListenerOnSetThreasholdButton(); - addListenerOnAddWordButton(); - addListenerOnRemoveWordButton(); - String sessionId = getIntent().getStringExtra("sessionId"); - ProcessWords.setSessionId(sessionId); - FloatingActionButton fbtnSpeechRecongnizer = (FloatingActionButton) findViewById(R.id.sensorChange); - fbtnSpeechRecongnizer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - WordData wordData = new WordData(ProcessWords.getSessionId(), SenseConstants.EVENT_LISTENER_FINISHED, 1); - SenseDataHolder.getWordDataHolder().add(wordData); - stopListening(); - Intent intent = new Intent(getApplicationContext(), ActivitySelectSensor.class); - startActivity(intent); - } - }); - Long tsLong = System.currentTimeMillis() / 1000; - WordData wordData = new WordData(sessionId, SenseConstants.EVENT_LISTENER_STARTED, 1); - SenseDataHolder.getWordDataHolder().add(wordData); - startListening(); // starts listening - } - - @Override - public void onBackPressed() { - } - - @Override - public void processVoiceCommands(String... voiceCommands) { - if(voiceCommands==null || voiceCommands.length==0){ - return; - } - ProcessWords processWords = new ProcessWords(this); - processWords.execute(voiceCommands); - restartListeningService(); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - // getMenuInflater().inflate(R.menu.menu_main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. - int id = item.getItemId(); - - //noinspection SimplifiableIfStatement - if (id == R.id.action_deEnroll) { - return true; - } - return super.onOptionsItemSelected(item); - } - - public void addListenerOnSetThreasholdButton() { - setThreasholdButton = (Button) findViewById(R.id.setThreshold); - setThreasholdButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View arg0) { - String thresholdString = ((EditText) findViewById(R.id.editThreashold)).getText().toString(); - try{ - ProcessWords.setThreshold(Integer.parseInt(thresholdString)); - } catch (NumberFormatException e) { - Toast.makeText(WordRecognitionActivity.this, "Invalid Threshold - " + thresholdString, Toast.LENGTH_SHORT).show(); - } - } - }); - } - - public void addListenerOnAddWordButton() { - addWordButton = (Button) findViewById(R.id.addWord); - addWordButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View arg0) { - String word = ((EditText) findViewById(R.id.wordText)).getText().toString(); - ProcessWords.addWord(word); - Toast.makeText(WordRecognitionActivity.this, word + " is added to the list", Toast.LENGTH_SHORT).show(); - } - }); - } - - public void addListenerOnRemoveWordButton() { - removeWordButton = (Button) findViewById(R.id.removeWord); - removeWordButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View arg0) { - String word = ((EditText) findViewById(R.id.wordText)).getText().toString(); - Toast.makeText(WordRecognitionActivity.this, word + " is removed from the list", Toast.LENGTH_SHORT).show(); - ProcessWords.removeWord(word); - } - - }); - } -} 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/speech/detector/util/ListeningActivity.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/speech/detector/util/ListeningActivity.java deleted file mode 100755 index db37583b5..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/ListeningActivity.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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.speech.detector.util; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.speech.RecognizerIntent; -import android.speech.SpeechRecognizer; -import android.widget.Toast; - -import org.wso2.carbon.iot.android.sense.speech.detector.IVoiceControl; - -/** - * This Activity Contols the Speech Recognizer Activity. - */ -public abstract class ListeningActivity extends Activity implements IVoiceControl { - - protected SpeechRecognizer sr; - protected Context context; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - /** - * Starts the listening service. - */ - protected void startListening() { - initSpeech(); - Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); - intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); - sr.startListening(intent); - } - - /** - * Stop the listening service. - */ - protected void stopListening() { - if (sr != null) { - sr.stopListening(); - sr.cancel(); - sr.destroy(); - } - sr = null; - } - - /** - * Initialize the speech. - */ - protected void initSpeech() { - if (sr == null) { - sr = SpeechRecognizer.createSpeechRecognizer(this); - if (!SpeechRecognizer.isRecognitionAvailable(context)) { - Toast.makeText(context, "Speech Recognition is not available", - Toast.LENGTH_LONG).show(); - finish(); - } - sr.setRecognitionListener(VoiceRecognitionListener.getInstance()); - } - } - - @Override - public void finish() { - stopListening(); - super.finish(); - } - - @Override - protected void onStop() { - stopListening(); - super.onStop(); - } - - @Override - protected void onDestroy() { - if (sr != null) { - sr.stopListening(); - sr.cancel(); - sr.destroy(); - } - super.onDestroy(); - } - - @Override - protected void onPause() { - if(sr!=null){ - sr.stopListening(); - sr.cancel(); - sr.destroy(); - - } - sr = null; - - super.onPause(); - } - - /** - * Is abstract so the inheriting classes need to implement it. Here you put your code which should be executed once - * a command was found - */ - @Override - public abstract void processVoiceCommands(String ... voiceCommands); - - @Override - public void restartListeningService() { - stopListening(); - startListening(); - } -} - - 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/speech/detector/util/ProcessWords.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/speech/detector/util/ProcessWords.java deleted file mode 100755 index cbd1ed2b5..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/ProcessWords.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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.speech.detector.util; - -import android.app.Activity; -import android.os.AsyncTask; -import android.widget.EditText; - -import org.apache.commons.codec.language.Soundex; -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import org.tartarus.snowball.ext.englishStemmer; - -import agent.sense.android.iot.carbon.wso2.org.wso2_senseagent.R; - -/** - * This class process the words form required words with the recongnized words to check whether it matches with the - * certain threshold. - */ -public class ProcessWords extends AsyncTask { - private static volatile double threshold = 80; - private static volatile Map wordDataMap = new ConcurrentHashMap<>(); - private static String sessionId = "default"; - private static Soundex soundex = new Soundex(); - Activity activity; - - public ProcessWords(Activity activity) { - this.activity = activity; - } - - /** - * Add the list of words which are used for reference. - * @param wordlist that needs to be looked upon in the speech - */ - public static void addWords(List wordlist) { - for (String word : wordlist) { - if (!wordDataMap.keySet().contains(word) && !word.isEmpty()) { - wordDataMap.put(word, new WordData(sessionId, word, 0)); - } - } - } - - /** - * Process the recognized word list. - * @param voiceCommands word lists. - */ - private void processTexts(String... voiceCommands) { - for (String requiredWord : wordDataMap.keySet()) { - int maxOccurunce = 0; - for (String command : voiceCommands) { - int occurence = 0; - for (String word : command.split(" ")) { - if (StringSimilarity.similarity(requiredWord, word) > threshold) { - occurence++; - continue; - } - if (soundex.encode(requiredWord).equals(soundex.encode(word))) { - occurence++; - continue; - } - if (StringSimilarity.similarity(requiredWord, stem(word)) > threshold) { - occurence++; - continue; - } - } - if (maxOccurunce < occurence) { - maxOccurunce = occurence; - } - } - if (maxOccurunce > 0) { - WordData wordData = wordDataMap.get(requiredWord); - wordData.addOccurences(maxOccurunce); - wordDataMap.put(requiredWord, wordData); - } - } - } - - /** - * Check for distance between the referenced and recognized words. - * @param params - * @return - */ - @Override - protected String doInBackground(String... params) { - processTexts(params); - publishProgress(); - return ""; - } - - /** - * update it in the UI. - * @param values words list. - */ - @Override - protected void onProgressUpdate(Void... values) { - super.onProgressUpdate(values); - EditText content = (EditText) activity.findViewById(R.id.command); - String text = ""; - for (String key : ProcessWords.wordDataMap.keySet()) { - text = text + key + " - " + ProcessWords.wordDataMap.get(key).getOccurences() + "\n"; - } - content.setText(text); - EditText thresholdText = (EditText) activity.findViewById(R.id.editThreashold); - thresholdText.setText("" + threshold); - } - - /** - * set the threshold to determine the distance. - * @param threshold to determine the distance. - */ - public static synchronized void setThreshold(int threshold) { - ProcessWords.threshold = threshold; - } - - /** - * - * @param sessionId for each listening session. - */ - public static synchronized void setSessionId(String sessionId) { - ProcessWords.sessionId = sessionId; - } - - /** - * - * retrieve sessionId for each listening session. - */ - public static synchronized String getSessionId() { - return ProcessWords.sessionId; - } - - /** - * @param word that is used for refrerence. - */ - public static synchronized void addWord(String word) { - if (!wordDataMap.keySet().contains(word) && !word.isEmpty()) { - wordDataMap.put(word, new WordData(sessionId, word, 0)); - } - } - - /** - * - * @param word that needs to be removed from the reference list. - */ - public static synchronized void removeWord(String word) { - cleanAndPushToWordMap(); - wordDataMap.remove(word); - } - - /** - * clean in memory content and pubish it to the server. - */ - public static synchronized void cleanAndPushToWordMap() { - for (String word : wordDataMap.keySet()) { - WordData wordData = wordDataMap.get(word); - SenseDataHolder.getWordDataHolder().add(wordData); - wordDataMap.put(word, new WordData(sessionId, word, 0)); - } - } - - /** - * apply porter stem algorithm - * @param word to be stemmed. - * @return - */ - private static String stem(String word) - { - englishStemmer stemmer = new englishStemmer(); - stemmer.setCurrent(word); - boolean result = stemmer.stem(); - if (!result) - { - return word; - } - return stemmer.getCurrent(); - } - - -} 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/speech/detector/util/StringSimilarity.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/speech/detector/util/StringSimilarity.java deleted file mode 100755 index a44e304f4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/StringSimilarity.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.speech.detector.util; - -/** - * Calculates the similarity of strings. - */ -public class StringSimilarity { - - /** - * Calculates the similarity (a number within 0 and 1) between two strings. - */ - public static double similarity(String s1, String s2) { - String longer = s1, shorter = s2; - if (s1.length() < s2.length()) { // longer should always have greater length - longer = s2; - shorter = s1; - } - int longerLength = longer.length(); - if (longerLength == 0) { - return 1.0; /* both strings are zero length */ - } - return ((longerLength - editDistance(longer, shorter)) / (double) longerLength) * 100; - } - - // Example implementation of the Levenshtein Edit Distance - // See http://rosettacode.org/wiki/Levenshtein_distance#Java - private static int editDistance(String s1, String s2) { - s1 = s1.toLowerCase(); - s2 = s2.toLowerCase(); - - int[] costs = new int[s2.length() + 1]; - for (int i = 0; i <= s1.length(); i++) { - int lastValue = i; - for (int j = 0; j <= s2.length(); j++) { - if (i == 0) - costs[j] = j; - else { - if (j > 0) { - int newValue = costs[j - 1]; - if (s1.charAt(i - 1) != s2.charAt(j - 1)) - newValue = Math.min(Math.min(newValue, lastValue), - costs[j]) + 1; - costs[j - 1] = lastValue; - lastValue = newValue; - } - } - } - if (i > 0) - costs[s2.length()] = lastValue; - } - return costs[s2.length()]; - } - - -} 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/speech/detector/util/VoiceRecognitionListener.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/speech/detector/util/VoiceRecognitionListener.java deleted file mode 100755 index 52ce8d52f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/VoiceRecognitionListener.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.speech.detector.util; - -import android.os.Bundle; -import android.speech.RecognitionListener; -import android.speech.SpeechRecognizer; -import org.wso2.carbon.iot.android.sense.speech.detector.IVoiceControl; -import java.util.ArrayList; - -/** - * This triggers android voice recognition listener. - */ -public class VoiceRecognitionListener implements RecognitionListener { - private static VoiceRecognitionListener instance = null; - - IVoiceControl listener; // This is your running activity (we will initialize it later) - - public static VoiceRecognitionListener getInstance() { - if (instance == null) { - instance = new VoiceRecognitionListener(); - } - return instance; - } - - private VoiceRecognitionListener() { } - - public void setListener(IVoiceControl listener) { - this.listener = listener; - } - - public void processVoiceCommands(String... voiceCommands) { - listener.processVoiceCommands(voiceCommands); - } - - // This method will be executed when voice commands were found - public void onResults(Bundle data) { - ArrayList matches = data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION); - String[] commands = new String[matches.size()]; - commands = matches.toArray(commands); - processVoiceCommands(commands); - } - - // User starts speaking - public void onBeginningOfSpeech() { - System.out.println("Starting to listen"); - } - - public void onBufferReceived(byte[] buffer) { } - - // User finished speaking - public void onEndOfSpeech() { - System.out.println("Waiting for result..."); - } - - // If the user said nothing the service will be restarted - public void onError(int error) { - if (listener != null) { - listener.restartListeningService(); - } - } - public void onEvent(int eventType, Bundle params) { } - - public void onPartialResults(Bundle partialResults) { } - - public void onReadyForSpeech(Bundle params) { } - - public void onRmsChanged(float rmsdB) { } -} 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/speech/detector/util/WordData.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/speech/detector/util/WordData.java deleted file mode 100755 index a112cbd81..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/speech/detector/util/WordData.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.speech.detector.util; - -/** - * This defines the data structure of the word data. - */ -public class WordData { - /** - * timestamp for all the occurences - */ - private long timestamp; - private int occurences; - private String word; - private String sessionId; - - public WordData(String sessionId, String word, int occurences) { - this.timestamp = System.currentTimeMillis() / 1000; - this.occurences = occurences; - this.word = word; - this.sessionId = sessionId; - } - - public long getTimestamp() { - return timestamp; - } - - public int getOccurences() { - return occurences; - } - - public String getWord() { - return word; - } - - public String getSessionId() { - return sessionId; - } - - /** - * @param occurences for the word and then add the timestamp for each occurences. - */ - public void addOccurences(int occurences) { - this.occurences = this.occurences + occurences; - this.timestamp = System.currentTimeMillis() / 1000; - } - - -} 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/LocalRegistry.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/LocalRegistry.java deleted file mode 100755 index 8f26a91b9..000000000 --- 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/LocalRegistry.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * 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.util; - -import android.content.Context; -import android.content.SharedPreferences; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.constants.SenseConstants; -import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.transport.MQTTTransportHandler; - -import java.net.MalformedURLException; -import java.net.URL; - -/** - * This is used to store the values in either in memory or in shared preferences. - */ -public class LocalRegistry { - - private static final String SENSE_SHARED_PREFERENCES = "senseSharedPreferences"; - private static final String USERNAME_KEY = "usernameKey"; - private static final String DEVICE_ID_KEY = "deviceIdKey"; - private static final String SERVER_HOST_KEY = "serverHostKey"; - private static final String ACCESS_TOKEN_KEY = "accessTokenKey"; - private static final String REFRESH_TOKEN_KEY = "refreshTokenKey"; - private static final String MQTT_ENDPOINT_KEY = "mqttEndpointKey"; - private static final String IS_ENROLLED_KEY = "enrolledKey"; - private static final String TENANT_DOMAIN_KEY = "tenantDomainKey"; - private static boolean exists = false; - private static String username; - private static String deviceId; - private static String serverURL; - private static MQTTTransportHandler mqttTransportHandler; - private static String accessToken; - private static String refreshToken; - private static String mqttEndpoint; - private static boolean enrolled; - private static String tenantDomain; - - public static boolean isExist(Context context) { - if (!exists) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - String username = sharedpreferences.getString(USERNAME_KEY, ""); - String deviceId = sharedpreferences.getString(DEVICE_ID_KEY, ""); - exists = (username != null && !username.isEmpty() && deviceId != null && !deviceId.isEmpty()); - } - return exists; - } - - public static void setExist(boolean status) { - exists = status; - } - - - public static void addUsername(Context context, String username) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(USERNAME_KEY, username); - editor.commit(); - LocalRegistry.username = username; - } - - public static String getUsername(Context context) { - if (LocalRegistry.username == null || username.isEmpty()) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - LocalRegistry.username = sharedpreferences.getString(USERNAME_KEY, ""); - } - return LocalRegistry.username; - } - - public static void removeUsername(Context context) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.clear(); - editor.remove(USERNAME_KEY); - editor.commit(); - LocalRegistry.username = null; - } - - public static void addDeviceId(Context context, String deviceId) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(DEVICE_ID_KEY, deviceId); - editor.commit(); - LocalRegistry.deviceId = deviceId; - } - - public static void removeDeviceId(Context context) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.remove(DEVICE_ID_KEY); - editor.clear(); - editor.commit(); - LocalRegistry.deviceId = null; - } - - public static String getDeviceId(Context context) { - if (LocalRegistry.deviceId == null || LocalRegistry.deviceId.isEmpty()) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - LocalRegistry.deviceId = sharedpreferences.getString(DEVICE_ID_KEY, ""); - } - return LocalRegistry.deviceId; - } - - public static void addServerURL(Context context, String host) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(SERVER_HOST_KEY, host); - editor.commit(); - LocalRegistry.serverURL = host; - } - - public static void removeServerURL(Context context) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.remove(SERVER_HOST_KEY); - editor.clear(); - editor.commit(); - LocalRegistry.serverURL = null; - } - - public static String getServerURL(Context context) { - if (LocalRegistry.serverURL == null || LocalRegistry.serverURL.isEmpty()) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - LocalRegistry.serverURL = sharedpreferences.getString(SERVER_HOST_KEY, ""); - } - return LocalRegistry.serverURL; - } - - public static void addAccessToken(Context context, String accessToken) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(ACCESS_TOKEN_KEY, accessToken); - editor.commit(); - LocalRegistry.accessToken = accessToken; - } - - public static void removeAccessToken(Context context) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.remove(ACCESS_TOKEN_KEY); - editor.clear(); - editor.commit(); - LocalRegistry.accessToken = null; - } - - public static String getAccessToken(Context context) { - if (LocalRegistry.accessToken == null || LocalRegistry.accessToken.isEmpty()) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - LocalRegistry.accessToken = sharedpreferences.getString(ACCESS_TOKEN_KEY, ""); - } - return LocalRegistry.accessToken; - } - - public static void addRefreshToken(Context context, String refreshToken) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(REFRESH_TOKEN_KEY, refreshToken); - editor.commit(); - LocalRegistry.refreshToken = refreshToken; - } - - public static void removeRefreshToken(Context context) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.remove(REFRESH_TOKEN_KEY); - editor.clear(); - editor.commit(); - LocalRegistry.refreshToken = null; - } - - public static String getRefreshToken(Context context) { - if (LocalRegistry.refreshToken == null || LocalRegistry.refreshToken.isEmpty()) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - LocalRegistry.refreshToken = sharedpreferences.getString(REFRESH_TOKEN_KEY, ""); - } - return LocalRegistry.refreshToken; - } - - public static void addMqttEndpoint(Context context, String endpoint) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(MQTT_ENDPOINT_KEY, endpoint); - editor.commit(); - LocalRegistry.mqttEndpoint = endpoint; - } - - public static void removeMqttEndpoint(Context context) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.remove(MQTT_ENDPOINT_KEY); - editor.clear(); - editor.commit(); - LocalRegistry.mqttEndpoint = null; - } - - public static String getMqttEndpoint(Context context) { - if (LocalRegistry.mqttEndpoint == null) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - LocalRegistry.mqttEndpoint = sharedpreferences.getString(MQTT_ENDPOINT_KEY, ""); - } - return LocalRegistry.mqttEndpoint; - } - - public static void setEnrolled(Context context, boolean enrolled) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putBoolean(IS_ENROLLED_KEY, enrolled); - editor.commit(); - LocalRegistry.enrolled = enrolled; - } - - public static boolean isEnrolled(Context context) { - if (!LocalRegistry.enrolled) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - return LocalRegistry.enrolled = sharedpreferences.getBoolean(IS_ENROLLED_KEY, false); - } - return LocalRegistry.enrolled; - } - - public static void addTenantDomain(Context context, String tenantDomain) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(TENANT_DOMAIN_KEY, tenantDomain); - editor.commit(); - LocalRegistry.tenantDomain = tenantDomain; - } - - public static void removeTenantDomain(Context context) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.remove(TENANT_DOMAIN_KEY); - editor.clear(); - editor.commit(); - LocalRegistry.tenantDomain = null; - } - - public static String getTenantDomain(Context context) { - if (LocalRegistry.tenantDomain == null) { - SharedPreferences sharedpreferences = context.getSharedPreferences(SENSE_SHARED_PREFERENCES, Context.MODE_PRIVATE); - LocalRegistry.tenantDomain = sharedpreferences.getString(TENANT_DOMAIN_KEY, ""); - } - return LocalRegistry.tenantDomain; - } - - public static String getServerHost(Context context) { - - URL url = null; - String urlString = getServerURL(context); - try { - url = new URL(urlString); - return url.getHost(); - } catch (MalformedURLException e) { - Log.e("Host ", "Invalid urlString :" + urlString); - return null; - } - } - -} 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/SenseClient.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/SenseClient.java deleted file mode 100755 index 2d1cbce9d..000000000 --- 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/SenseClient.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.util; - - -import android.content.Context; -import android.os.Build; -import android.util.Log; -import android.widget.Toast; - -import org.wso2.carbon.iot.android.sense.constants.SenseConstants; -import org.wso2.carbon.iot.android.sense.util.dto.RegisterInfo; - -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.logging.Handler; - -/** - * This Client is used for http communication with the server. - */ -public class SenseClient { - private final static String TAG = "SenseService Client"; - - private Context context; - - public SenseClient(Context context) { - this.context = context; - } - - /** - * Enroll the device. - * - * @param username - * @param password - * @param deviceId - * @return - */ - public RegisterInfo register(String username, String password, String deviceId, android.os.Handler mUiHandler) { - Map response = registerWithTimeWait(username, password, deviceId); - String responseStatus = response.get("status"); - RegisterInfo registerInfo = new RegisterInfo(); - if (responseStatus.trim().contains(SenseConstants.Request.REQUEST_SUCCESSFUL)) { - registerInfo.setMsg("Login Successful"); - registerInfo.setIsRegistered(true); - return registerInfo; - } else { - registerInfo.setMsg("Authentication failed, please check your credentials and try again."); - registerInfo.setIsRegistered(false); - return registerInfo; - } - } - - public Map registerWithTimeWait(String username, String password, String deviceId) { - try { - SenseClientAsyncExecutor senseClientAsyncExecutor = new SenseClientAsyncExecutor(context); - String endpoint = LocalRegistry.getServerURL(context); - senseClientAsyncExecutor.execute(username, password, deviceId, endpoint); - Map response = senseClientAsyncExecutor.get(); - if (response != null) { - return response; - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - Log.e("Send Sensor Data", "Thread Interruption for endpoint " + LocalRegistry.getServerURL(context)); - } catch (ExecutionException e) { - Log.e("Send Sensor Data", "Failed to push data to the endpoint " + LocalRegistry.getServerURL(context)); - } - return null; - } - -} 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 deleted file mode 100755 index fbfa0c014..000000000 --- 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 +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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.util; - - -import android.content.Context; -import android.os.AsyncTask; -import android.os.Build; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.constants.SenseConstants; -import org.wso2.carbon.iot.android.sense.util.dto.AccessTokenInfo; -import org.wso2.carbon.iot.android.sense.util.dto.AndroidConfiguration; -import org.wso2.carbon.iot.android.sense.util.dto.AndroidSenseManagerService; -import org.wso2.carbon.iot.android.sense.util.dto.ApiApplicationKey; -import org.wso2.carbon.iot.android.sense.util.dto.ApiApplicationRegistrationService; -import org.wso2.carbon.iot.android.sense.util.dto.ApiRegistrationProfile; -import org.wso2.carbon.iot.android.sense.util.dto.DynamicClientRegistrationService; -import org.wso2.carbon.iot.android.sense.util.dto.OAuthApplicationInfo; -import org.wso2.carbon.iot.android.sense.util.dto.OAuthRequestInterceptor; -import org.wso2.carbon.iot.android.sense.util.dto.RegistrationProfile; -import org.wso2.carbon.iot.android.sense.util.dto.TokenIssuerService; - -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.util.HashMap; -import java.util.Map; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - -import feign.Client; -import feign.Feign; -import feign.FeignException; -import feign.auth.BasicAuthRequestInterceptor; -import feign.jackson.JacksonDecoder; -import feign.jackson.JacksonEncoder; -import feign.jaxrs.JAXRSContract; - -public class SenseClientAsyncExecutor extends AsyncTask> { - - private final static String TAG = "SenseService Client"; - private static final String STATUS = "status"; - private final String PASSWORD_GRANT_TYPE = "password"; - private final String SCOPE = "perm:android-sense:enroll"; - private final static String DEVICE_NAME = Build.MANUFACTURER + " " + Build.MODEL; - private Context context; - - public SenseClientAsyncExecutor(Context context) { - this.context = context; - - } - - TrustManager[] trustAllCerts = new TrustManager[]{ - new X509TrustManager() { - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - public void checkClientTrusted( - java.security.cert.X509Certificate[] certs, String authType) { - } - public void checkServerTrusted( - java.security.cert.X509Certificate[] certs, String authType) { - } - } - }; - - Client disableHostnameVerification = new Client.Default(getTrustedSSLSocketFactory(), new HostnameVerifier() { - @Override - public boolean verify(String s, SSLSession sslSession) { - return true; - } - }); - - @Override - protected Map doInBackground(String... parameters) { - if (android.os.Debug.isDebuggerConnected()) - android.os.Debug.waitForDebugger(); - String response; - Map response_params = new HashMap<>(); - String username = parameters[0]; - String password = parameters[1]; - String deviceId = parameters[2]; - String endpoint = parameters[3]; - Map responseMap = new HashMap<>(); - responseMap.put(STATUS, "200"); - AccessTokenInfo accessTokenInfo = null; - try { - //ApiApplicationRegistration - ApiApplicationRegistrationService apiApplicationRegistrationService = Feign.builder().client(disableHostnameVerification) - .requestInterceptor(new BasicAuthRequestInterceptor(username, password)) - .contract(new JAXRSContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder()) - .target(ApiApplicationRegistrationService.class, endpoint + SenseConstants.API_APPLICATION_REGISTRATION_CONTEXT); - ApiRegistrationProfile apiRegistrationProfile = new ApiRegistrationProfile(); - apiRegistrationProfile.setApplicationName("android_sense_" + deviceId); - apiRegistrationProfile.setIsAllowedToAllDomains(false); - apiRegistrationProfile.setIsMappingAnExistingOAuthApp(false); - apiRegistrationProfile.setTags(new String[]{SenseConstants.DEVICE_TYPE}); - ApiApplicationKey apiApplicationKey = apiApplicationRegistrationService.register(apiRegistrationProfile); - - //PasswordGrantType - TokenIssuerService tokenIssuerService = Feign.builder().client(disableHostnameVerification).requestInterceptor( - new BasicAuthRequestInterceptor(apiApplicationKey.getConsumerKey(), apiApplicationKey.getConsumerSecret())) - .contract(new JAXRSContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder()) - .target(TokenIssuerService.class, endpoint); - accessTokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password, "device_" - + deviceId + " " + SCOPE); - - //DeviceRegister - AndroidSenseManagerService androidSenseManagerService = Feign.builder().client(disableHostnameVerification) - .requestInterceptor(new OAuthRequestInterceptor(accessTokenInfo.getAccess_token())) - .contract(new JAXRSContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder()) - .target(AndroidSenseManagerService.class, endpoint + SenseConstants.REGISTER_CONTEXT); - AndroidConfiguration androidConfiguration = androidSenseManagerService.register(deviceId, DEVICE_NAME); - if (androidConfiguration != null) { - LocalRegistry.addAccessToken(context, accessTokenInfo.getAccess_token()); - LocalRegistry.addRefreshToken(context, accessTokenInfo.getRefresh_token()); - LocalRegistry.addMqttEndpoint(context, androidConfiguration.getMqttEndpoint()); - LocalRegistry.addTenantDomain(context, androidConfiguration.getTenantDomain()); - } - return responseMap; - } catch (FeignException e) { - responseMap.put(STATUS, "" + e.status()); - return responseMap; - } - } - - private SSLSocketFactory getTrustedSSLSocketFactory() { - try { - SSLContext sc = SSLContext.getInstance("SSL"); - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - return sc.getSocketFactory(); - } catch (KeyManagementException | NoSuchAlgorithmException e) { - Log.e(SenseClientAsyncExecutor.class.getName(), "Invalid Certificate"); - return null; - } - - } -} 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/SenseDataHolder.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/SenseDataHolder.java deleted file mode 100755 index 3e2335e91..000000000 --- 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/SenseDataHolder.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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.util; - -import org.wso2.carbon.iot.android.sense.beacon.BeaconScanedData; -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.screen.ScreenData; -import org.wso2.carbon.iot.android.sense.event.streams.sms.SmsData; -import org.wso2.carbon.iot.android.sense.speech.detector.util.WordData; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - - -/** - * This holds the sensor,battery and location data inmemory. - */ -public class SenseDataHolder { - - private static List sensorDataHolder; - private static List batteryDataHolder; - private static List callDataHolder; - private static List locationDataHolder; - private static List wordDataHolder; - private static List speedDataHolder; - private static List beaconScanedDataHolder; - private static List screenDataHolder; - private static List audioDataHolder; - private static List activityDataHolder; - private static List smsDataHolder; - private static List applicationDataHolder; - private static List networkDataHolder; - //LocationData gps; - - - private static final String TAG = SenseDataHolder.class.getName(); - - - public static List getSensorDataHolder() { - if (sensorDataHolder == null) { - sensorDataHolder = new CopyOnWriteArrayList<>(); - } - return sensorDataHolder; - } - - public static List getBatteryDataHolder() { - if (batteryDataHolder == null) { - batteryDataHolder = new CopyOnWriteArrayList<>(); - } - return batteryDataHolder; - } - - public static List getCallDataHolder() { - if (callDataHolder == null) { - callDataHolder = new CopyOnWriteArrayList<>(); - } - return callDataHolder; - } - - public static List getLocationDataHolder() { - - - if (locationDataHolder == null) { - - locationDataHolder = new CopyOnWriteArrayList<>(); - } - return locationDataHolder; - - } - - public static List getWordDataHolder() { - if (wordDataHolder == null) { - wordDataHolder = new CopyOnWriteArrayList<>(); - } - return wordDataHolder; - } - - public static List getSpeedDataHolder() { - if (speedDataHolder == null) { - speedDataHolder = new CopyOnWriteArrayList<>(); - } - return speedDataHolder; - } - - public static List getBeaconScanedDataHolder() { - if (beaconScanedDataHolder == null) { - beaconScanedDataHolder = new CopyOnWriteArrayList<>(); - } - return beaconScanedDataHolder; - } - - public static List getScreenDataHolder() { - if (screenDataHolder == null) { - screenDataHolder = new CopyOnWriteArrayList<>(); - } - return screenDataHolder; - } - - public static List getAudioDataHolder() { - if (audioDataHolder == null) { - audioDataHolder = new CopyOnWriteArrayList<>(); - } - return audioDataHolder; - } - - public static List getActivityDataHolder() { - if (activityDataHolder == null) { - activityDataHolder = new CopyOnWriteArrayList<>(); - } - return activityDataHolder; - } - - public static List getSmsDataHolder() { - if (smsDataHolder == null) { - smsDataHolder = new CopyOnWriteArrayList<>(); - } - return smsDataHolder; - } - - public static List getApplicationDataHolder() { - if (applicationDataHolder == null) { - applicationDataHolder = new CopyOnWriteArrayList<>(); - } - return applicationDataHolder; - } - - public static List getNetworkDataHolder() { - if (networkDataHolder == null) { - networkDataHolder = new CopyOnWriteArrayList<>(); - } - return networkDataHolder; - } - - public static void resetSensorDataHolder() { - sensorDataHolder = null; - } - - public static void resetBatteryDataHolder() { - batteryDataHolder = null; - } - - public static void resetCallDataHolder() { - callDataHolder = null; - } - - public static void resetLocationDataHolder() { - locationDataHolder = null; - } - - public static void resetWordDataHolder() { - wordDataHolder = null; - } - - public static void resetSpeedDataHolder() { - speedDataHolder = null; - } - - public static void resetBeaconScanedDataHolder() { - beaconScanedDataHolder = null; - } - - public static void resetScreenDataHolder() { - screenDataHolder = null; - } - - public static void resetAudioDataHolder() { - audioDataHolder = null; - } - - public static void resetActivityDataHolder() { - activityDataHolder = null; - } - - public static void resetSmsDataHolder() { - smsDataHolder = null; - } - - public static void resetApplicationDataHolder() { - applicationDataHolder = null; - } - - public static void resetNetworkDataHolder() { - networkDataHolder = null; - } -} 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/SenseDataReceiverManager.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/SenseDataReceiverManager.java deleted file mode 100644 index e74362b4e..000000000 --- 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/SenseDataReceiverManager.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.util; - -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Bundle; -import android.provider.Telephony; -import android.support.annotation.Nullable; -import android.telephony.TelephonyManager; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.location.ActivityRecognition; - -import org.wso2.carbon.iot.android.sense.event.streams.activity.ActivityReceiver; -import org.wso2.carbon.iot.android.sense.event.streams.application.ApplicationDataReceiver; -import org.wso2.carbon.iot.android.sense.event.streams.battery.BatteryDataReceiver; -import org.wso2.carbon.iot.android.sense.event.streams.call.CallDataReceiver; -import org.wso2.carbon.iot.android.sense.event.streams.data.NetworkDataReader; -import org.wso2.carbon.iot.android.sense.event.streams.screen.ScreenDataReceiver; -import org.wso2.carbon.iot.android.sense.event.streams.sms.SmsDataReceiver; - -public class SenseDataReceiverManager { - private static BroadcastReceiver batteryDataReceiver; - - private static BroadcastReceiver screenDataReceiver; - - private static BroadcastReceiver callDataReceiver; - - private static GoogleApiClient apiClient; - - private static SmsDataReceiver smsDataReceiver; - - private static ApplicationDataReceiver appDataReceiver; - - private static NetworkDataReader networkDataReader; - - private SenseDataReceiverManager() { - - } - - public static void registerBatteryDataReceiver(Context context) { - if (batteryDataReceiver == null) { - batteryDataReceiver = new BatteryDataReceiver(); - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(Intent.ACTION_BATTERY_LOW); - intentFilter.addAction(Intent.ACTION_BATTERY_OKAY); - intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED); - - context.registerReceiver(batteryDataReceiver, intentFilter); - } - } - - public static void unregisterBatteryDataReceiver(Context context) { - if (batteryDataReceiver != null) { - context.unregisterReceiver(batteryDataReceiver); - batteryDataReceiver = null; - } - } - - public static void registerScreenDataReceiver(Context context) { - if (screenDataReceiver == null) { - screenDataReceiver = new ScreenDataReceiver(); - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(Intent.ACTION_SCREEN_ON); - intentFilter.addAction(Intent.ACTION_SCREEN_OFF); - - context.registerReceiver(screenDataReceiver, intentFilter); - } - } - - public static void unregisterScreenDataReceiver(Context context) { - if (screenDataReceiver != null) { - context.unregisterReceiver(screenDataReceiver); - screenDataReceiver = null; - } - } - - public static void registerCallDataReceiver(Context context) { - if (callDataReceiver == null) { - callDataReceiver = new CallDataReceiver(); - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); - intentFilter.addAction(Intent.ACTION_NEW_OUTGOING_CALL); - intentFilter.setPriority(1000); - - context.registerReceiver(callDataReceiver, intentFilter); - } - } - - public static void unregisterCallDataReceiver(Context context) { - if (callDataReceiver != null) { - context.unregisterReceiver(callDataReceiver); - callDataReceiver = null; - } - } - - public static void registerActivityDataReceiver(Context context) { - if (apiClient == null) { - Intent intent = new Intent(context, ActivityReceiver.class); - final PendingIntent pendingIntent = PendingIntent.getService(context, 888971, intent, PendingIntent.FLAG_UPDATE_CURRENT); - apiClient = new GoogleApiClient.Builder(context) - .addApi(ActivityRecognition.API) - .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { - @Override - public void onConnected(@Nullable Bundle bundle) { - ActivityRecognition.ActivityRecognitionApi.requestActivityUpdates(apiClient, ActivityReceiver.UPDATE_INTERVAL, pendingIntent); - } - - @Override - public void onConnectionSuspended(int i) { - ActivityRecognition.ActivityRecognitionApi.removeActivityUpdates(apiClient, pendingIntent); - } - }) - .build(); - - apiClient.connect(); - } - } - - public static void unregisterActivityDataReceiver(Context context) { - if (apiClient != null) { - apiClient.disconnect(); - apiClient = null; - } - } - - public static void registerSmsDataReceiver(Context context) { - if (smsDataReceiver == null) { - smsDataReceiver = new SmsDataReceiver(); - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(Telephony.Sms.Intents.SMS_RECEIVED_ACTION); - intentFilter.addAction(Telephony.Sms.Intents.SMS_DELIVER_ACTION); - intentFilter.setPriority(1000); - context.registerReceiver(smsDataReceiver, intentFilter); - } - } - - public static void unregisterSmsDataReceiver(Context context) { - if (smsDataReceiver != null) { - context.unregisterReceiver(smsDataReceiver); - smsDataReceiver = null; - } - } - - public static void registerAppDataReceiver(Context context) { - if (appDataReceiver == null) { - appDataReceiver = new ApplicationDataReceiver(); - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED); - intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); - context.registerReceiver(appDataReceiver, intentFilter); - } - } - - public static void unregisterAppDataReceiver(Context context) { - if (appDataReceiver != null) { - context.unregisterReceiver(appDataReceiver); - appDataReceiver = null; - } - } - - public static void registerNetworkDataReader(Context context) { - if (networkDataReader == null) { - networkDataReader = new NetworkDataReader(context); - networkDataReader.execute(); - } - } - - public static void unregisterNetworkDataReader() { - if (networkDataReader != null) { - networkDataReader.cancel(true); - } - networkDataReader = null; - } - - -} 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/SenseUtils.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/SenseUtils.java deleted file mode 100755 index 956e780de..000000000 --- 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/SenseUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.util; - - -import android.content.ContentResolver; -import android.content.Context; -import android.telephony.TelephonyManager; - -import java.util.UUID; - -public class SenseUtils { - - /** - * this generate the device Id - * - * @param baseContext - * @param contentResolver - * @return - */ - //http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id - public static String generateDeviceId(Context baseContext, ContentResolver contentResolver) { - - final TelephonyManager tm = (TelephonyManager) baseContext.getSystemService(Context.TELEPHONY_SERVICE); - - final String tmDevice, tmSerial, androidId; - tmDevice = String.valueOf(tm.getDeviceId()); - tmSerial = String.valueOf(tm.getSimSerialNumber()); - androidId = String.valueOf(android.provider.Settings.Secure.getString(contentResolver, android.provider.Settings.Secure.ANDROID_ID)); - - UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); - return deviceUuid.toString(); - - } -} 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/SenseWakeLock.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/SenseWakeLock.java deleted file mode 100755 index 1a6a36bbb..000000000 --- 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/SenseWakeLock.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.util; - - -import android.content.Context; -import android.os.PowerManager; -import android.util.Log; - -/** - * It doesnt let the phone goto sleep. - */ -public class SenseWakeLock { - - private static PowerManager.WakeLock wakeLock; - private static String TAG = "Wake Lock"; - - public static void acquireWakeLock(Context context) { - Log.i(SenseWakeLock.class.getSimpleName(), "Acquire CPU wakeup lock start"); - if (wakeLock == null) { - Log.i(TAG, "CPU wakeUp log is not null"); - PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SenseWakeLock"); - } - wakeLock.acquire(); - } - - public static void releaseCPUWakeLock() { - if (wakeLock != null) { - wakeLock.release(); - wakeLock = null; - } - Log.i(TAG, "Release wakeup"); - } - -} 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/dto/AccessTokenInfo.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/dto/AccessTokenInfo.java deleted file mode 100755 index 6b3400fb5..000000000 --- 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/dto/AccessTokenInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.util.dto; - -/** - * This hold access token info that returned from the api call - */ -public class AccessTokenInfo { - public String token_type; - public String expires_in; - public String refresh_token; - public String access_token; - - public String getToken_type() { - return token_type; - } - - public void setToken_type(String token_type) { - this.token_type = token_type; - } - - public String getExpires_in() { - return expires_in; - } - - public void setExpires_in(String expires_in) { - this.expires_in = expires_in; - } - - public String getRefresh_token() { - return refresh_token; - } - - public void setRefresh_token(String refresh_token) { - this.refresh_token = refresh_token; - } - - public String getAccess_token() { - return access_token; - } - - public void setAccess_token(String access_token) { - this.access_token = access_token; - } -} 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/dto/AndroidConfiguration.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/dto/AndroidConfiguration.java deleted file mode 100755 index 4ca6bf807..000000000 --- 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/dto/AndroidConfiguration.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.util.dto; - -/** - * This holds the required configuration for agent to connect to the server. - */ -public class AndroidConfiguration { - - public String tenantDomain; - public String mqttEndpoint; - - public String getTenantDomain() { - return tenantDomain; - } - - public void setTenantDomain(String tenantDomain) { - this.tenantDomain = tenantDomain; - } - - public String getMqttEndpoint() { - return mqttEndpoint; - } - - public void setMqttEndpoint(String mqttEndpoint) { - this.mqttEndpoint = mqttEndpoint; - } -} 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/dto/AndroidSenseManagerService.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/dto/AndroidSenseManagerService.java deleted file mode 100755 index 6bdd63c13..000000000 --- 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/dto/AndroidSenseManagerService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.util.dto; - -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; - -/** - * This holds the android manager service definition that is used with netflix feign. - */ -public interface AndroidSenseManagerService { - - @Path("/device/{device_id}/register") - @POST - AndroidConfiguration register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); -} 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/dto/ApiApplicationKey.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/dto/ApiApplicationKey.java deleted file mode 100644 index e4130755e..000000000 --- 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/dto/ApiApplicationKey.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.util.dto; - -/** - * This holds api application consumer key and secret. - */ -public class ApiApplicationKey { - private String client_id; - private String client_secret; - - public String getConsumerKey() { - return this.client_id; - } - - public void setClient_id(String consumerKey) { - this.client_id = consumerKey; - } - - public String getConsumerSecret() { - return this.client_secret; - } - - public void setClient_secret(String consumerSecret) { - this.client_secret = consumerSecret; - } -} 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/dto/ApiApplicationRegistrationService.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/dto/ApiApplicationRegistrationService.java deleted file mode 100755 index 64d4aa66f..000000000 --- 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/dto/ApiApplicationRegistrationService.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.wso2.carbon.iot.android.sense.util.dto; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -/** - * This is the application registration service that exposed for apimApplicationRegistration - */ - -@Path("/register") -public interface ApiApplicationRegistrationService { - - /** - * This method is used to register api application - * - * @param registrationProfile contains the necessary attributes that are needed in order to register an app. - */ - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - ApiApplicationKey register(ApiRegistrationProfile registrationProfile); -} 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/dto/ApiRegistrationProfile.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/dto/ApiRegistrationProfile.java deleted file mode 100755 index 98db81fb8..000000000 --- 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/dto/ApiRegistrationProfile.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.util.dto; - - -/** - * This class represents the data that are required to register - * the oauth application. - */ -public class ApiRegistrationProfile { - - public String applicationName; - public String tags[]; - public boolean isAllowedToAllDomains; - public String consumerKey; - public String consumerSecret; - public boolean isMappingAnExistingOAuthApp; - - public String getApplicationName() { - return applicationName; - } - - public void setApplicationName(String applicationName) { - this.applicationName = applicationName; - } - - public String[] getTags() { - return tags; - } - - public void setTags(String[] tags) { - this.tags = tags; - } - - public boolean isAllowedToAllDomains() { - return isAllowedToAllDomains; - } - - public void setIsAllowedToAllDomains(boolean isAllowedToAllDomains) { - this.isAllowedToAllDomains = isAllowedToAllDomains; - } - - public boolean isMappingAnExistingOAuthApp() { - return isMappingAnExistingOAuthApp; - } - - public void setIsMappingAnExistingOAuthApp(boolean isMappingAnExistingOAuthApp) { - this.isMappingAnExistingOAuthApp = isMappingAnExistingOAuthApp; - } - - public String getConsumerKey() { - return consumerKey; - } - - public void setConsumerKey(String consumerKey) { - this.consumerKey = consumerKey; - } - - public String getConsumerSecret() { - return consumerSecret; - } - - public void setConsumerSecret(String consumerSecret) { - this.consumerSecret = consumerSecret; - } -} \ 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/util/dto/DynamicClientRegistrationService.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/dto/DynamicClientRegistrationService.java deleted file mode 100755 index aa409673a..000000000 --- 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/dto/DynamicClientRegistrationService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.util.dto; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -@Path("/register") -public interface DynamicClientRegistrationService { - - /** - * This method is used to register an Oauth application. - * - * @param profile contains the necessary attributes that are - * needed in order to register an app. - * @return Status 200 if success including consumerKey and consumerSecret. - */ - @POST - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - OAuthApplicationInfo register(RegistrationProfile profile); -} 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/dto/OAuthApplicationInfo.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/dto/OAuthApplicationInfo.java deleted file mode 100755 index 5ad8541be..000000000 --- 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/dto/OAuthApplicationInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.util.dto; - -/** - * This class represents an OAuth application populated with necessary data. - */ -public class OAuthApplicationInfo { - - public String client_id; - public String client_name; - public String callback_url; - public String client_secret; - - public String getClient_id() { - return client_id; - } - - public void setClient_id(String client_id) { - this.client_id = client_id; - } - - public String getClient_name() { - return client_name; - } - - public void setClient_name(String client_name) { - this.client_name = client_name; - } - - public String getCallback_url() { - return callback_url; - } - - public void setCallback_url(String callback_url) { - this.callback_url = callback_url; - } - - public String getClient_secret() { - return client_secret; - } - - public void setClient_secret(String client_secret) { - this.client_secret = client_secret; - } -} 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/dto/OAuthRequestInterceptor.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/dto/OAuthRequestInterceptor.java deleted file mode 100755 index b84a1add8..000000000 --- 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/dto/OAuthRequestInterceptor.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.util.dto; - - -import feign.RequestInterceptor; -import feign.RequestTemplate; - -import static feign.Util.checkNotNull; - -/** - * This is a request interceptor to add oauth token header. - */ -public class OAuthRequestInterceptor implements RequestInterceptor { - - private final String headerValue; - - /** - * Creates an interceptor that authenticates all requests with the specified OAUTH token - * - * @param token the access token to use for authentication - */ - public OAuthRequestInterceptor(String token) { - checkNotNull(token, "access_token"); - headerValue = "Bearer " + token; - } - @Override - public void apply(RequestTemplate template) { - template.header("Authorization", headerValue); - } -} 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/dto/RegisterInfo.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/dto/RegisterInfo.java deleted file mode 100755 index b3052e4e1..000000000 --- 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/dto/RegisterInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.util.dto; - -/** - * This holds the data related to registration. - */ -public class RegisterInfo { - - private boolean isRegistered; - private String msg; - - public boolean isRegistered() { - return isRegistered; - } - - public void setIsRegistered(boolean isRegistered) { - this.isRegistered = isRegistered; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } -} 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/dto/RegistrationProfile.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/dto/RegistrationProfile.java deleted file mode 100755 index 046c112a3..000000000 --- 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/dto/RegistrationProfile.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.wso2.carbon.iot.android.sense.util.dto; - - -/** - * This class represents the data that are required to register - * the oauth application. - */ -public class RegistrationProfile { - - public String callbackUrl; - public String clientName; - public String tokenScope; - public String owner; - public String grantType; - public String applicationType; - - private static final String TAG = RegistrationProfile.class.getSimpleName(); - - public String getCallbackUrl() { - return callbackUrl; - } - - public void setCallbackUrl(String callBackUrl) { - this.callbackUrl = callBackUrl; - } - - public String getClientName() { - return clientName; - } - - public void setClientName(String clientName) { - this.clientName = clientName; - } - - public String getTokenScope() { - return tokenScope; - } - - public void setTokenScope(String tokenScope) { - this.tokenScope = tokenScope; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getGrantType() { - return grantType; - } - - public void setGrantType(String grantType) { - this.grantType = grantType; - } - - public String getApplicationType() { - return applicationType; - } - - public void setApplicationType(String applicationType) { - this.applicationType = applicationType; - } - -} \ 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/util/dto/TokenIssuerService.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/dto/TokenIssuerService.java deleted file mode 100755 index ea2c85cd1..000000000 --- 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/dto/TokenIssuerService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.util.dto; - -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; - -/** - * This hold the api definition that is used as a contract with netflix feign. - */ -@Path("/token") -public interface TokenIssuerService { - - @POST - @Produces(MediaType.APPLICATION_JSON) - AccessTokenInfo getToken(@QueryParam("grant_type") String grant, @QueryParam("username") String username, - @QueryParam("password") String password, @QueryParam("scope") String scope); - - @POST - @Produces(MediaType.APPLICATION_JSON) - AccessTokenInfo getRefreshToken(@QueryParam("grant_type") String grantType, @QueryParam("refreshToken") String refreshToken); - - -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon.png deleted file mode 100644 index 1ed9d05d7..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon_red.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon_red.png deleted file mode 100644 index b86775de6..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/beacon_red.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/mic.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/mic.png deleted file mode 100755 index c79961029..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/mic.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/pushtoserver.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/pushtoserver.png deleted file mode 100755 index 3dc93ed29..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/pushtoserver.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/round_button.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/round_button.xml deleted file mode 100644 index b18dede82..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/round_button.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ 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/res/drawable/sensor.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/sensor.png deleted file mode 100755 index a73fb4ee5..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/sensor.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/side_nav_bar.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/side_nav_bar.xml deleted file mode 100755 index 5dcda6408..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/side_nav_bar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - \ 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/res/drawable/wso2logo.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/wso2logo.png deleted file mode 100755 index b4114a6c1..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/drawable/wso2logo.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_activity_select_sensor.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_activity_select_sensor.xml deleted file mode 100755 index 0650eddb5..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_activity_select_sensor.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_beacon_monitoring.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_beacon_monitoring.xml deleted file mode 100644 index 852bc76e9..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_beacon_monitoring.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - \ 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/res/layout/activity_monitor.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_monitor.xml deleted file mode 100755 index b10638db6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_monitor.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - \ 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/res/layout/activity_register.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_register.xml deleted file mode 100755 index 0409c62b0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_register.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_sense_settings.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_sense_settings.xml deleted file mode 100755 index 82891d0c7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_sense_settings.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_speech_sense_main.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_speech_sense_main.xml deleted file mode 100755 index f024bc223..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/activity_speech_sense_main.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/app_bar_activity_select_sensor.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/app_bar_activity_select_sensor.xml deleted file mode 100755 index 9a9a7e003..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/app_bar_activity_select_sensor.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/beacon_activity_list.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/beacon_activity_list.xml deleted file mode 100644 index 0c3c6b1dc..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/beacon_activity_list.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - 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 deleted file mode 100755 index d3d332de3..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/content_activity_select_sensor.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/display_sensor_values.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/display_sensor_values.xml deleted file mode 100755 index e9e550487..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/display_sensor_values.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - \ 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/res/layout/fragment_select_sensor_dialog.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/fragment_select_sensor_dialog.xml deleted file mode 100755 index 63208a6e0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/fragment_select_sensor_dialog.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/list_item_device.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/list_item_device.xml deleted file mode 100644 index 46cd6c0ee..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/list_item_device.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ 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/res/layout/nav_header_activity_select_sensor.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/nav_header_activity_select_sensor.xml deleted file mode 100755 index d07c2cfe2..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/nav_header_activity_select_sensor.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/tupple_monitoring.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/tupple_monitoring.xml deleted file mode 100644 index a120207f5..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/tupple_monitoring.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ 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/res/layout/web_view_activity.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/web_view_activity.xml deleted file mode 100644 index bc421e322..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/layout/web_view_activity.xml +++ /dev/null @@ -1,6 +0,0 @@ - - \ 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/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 deleted file mode 100755 index cdcb37580..000000000 --- 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 +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ 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/res/menu/activity_select_sensor.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/activity_select_sensor.xml deleted file mode 100755 index c0d1d7170..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/activity_select_sensor.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/menu_sense_settings.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/menu_sense_settings.xml deleted file mode 100755 index f4a7a3d8c..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/menu/menu_sense_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-hdpi/ic_launcher.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100755 index cde69bccc..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-hdpi/wso2logo.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-hdpi/wso2logo.png deleted file mode 100755 index b4114a6c1..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-hdpi/wso2logo.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-mdpi/ic_launcher.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100755 index c133a0cbd..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100755 index bfa42f0e7..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100755 index 324e72cdd..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/raw/client_truststore.bks b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/raw/client_truststore.bks deleted file mode 100755 index 0b3bfedf2..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/raw/client_truststore.bks and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/raw/wso2carbon.cer b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/raw/wso2carbon.cer deleted file mode 100755 index 8c02f03ef..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/raw/wso2carbon.cer and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values-v21/styles.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values-v21/styles.xml deleted file mode 100755 index 65d0c39df..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ -> - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values-w820dp/dimens.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100755 index 63fc81644..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/device.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/device.xml deleted file mode 100755 index e7f032534..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/device.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - false - \ 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/res/values/dimens.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/dimens.xml deleted file mode 100755 index ea9d9f550..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - 16dp - 16dp - - 16dp - 160dp - 40dp - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings.xml deleted file mode 100755 index e3cf8a1e1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,85 +0,0 @@ - - WSO2-SenseAgent - Sense Settings - Server URL https://host:8243 - Speakup to capture the words - DeEnroll - ActivitySelectSensor - - Open navigation drawer - Close navigation drawer - - - Hello blank fragment - - - - This is a sample application using the Bluetooth LE Library.\n\nGithub: https://github.com/alt236/Bluetooth-LE-Library---Android\n\nCopyright: Alexandros Schillings - Device Info - iBeacon Data - Raw Ad Records - RSSI Info - Scan Record - Advertisement: - As Array: - As String: - Bluetooth LE: - Bluetooth: - Bonding State: - Company ID: - Data: - Desc: - Device address: - Device Class: - Major Class: - Services: - Device Name: - Distance: - First RSSI: - First Timestamp: - Last RSSI: - Last Timestamp: - MAC: - Major: - Minor: - RSSI: - Running Average RSSI: - State: - TX Power: - UUID: - Updated: - Descriptor: - - - Connected - Disconnected - Invalid Device Data! - No data - Not supported - Off - On - Supported - unknown - Unknown characteristic - Unknown device - Unknown service - No known services - - %sm - %sdb - Items: %s - - - About - Connect - Disconnect - Scan - Stop - Share - - - Bluetooth LE Scan Results (%s) - Bluetooth LE Device GATT Results (%s, %s) - Please find attached the scan results. - Please select your email client: - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings_activity_register.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings_activity_register.xml deleted file mode 100755 index f45b28c7f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/strings_activity_register.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - Username - Password - Register Device - Sign in - sessionId - This email address is invalid - This password is too short - This password is incorrect - This field is required - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/styles.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/styles.xml deleted file mode 100755 index 35fee10ce..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - 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 deleted file mode 100755 index b3722d082..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - jcenter() - maven { url 'https://repo.eclipse.org/content/repositories/paho-releases/' } - } - dependencies { - 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 - } -} - -allprojects { - repositories { - jcenter() - maven { url 'https://repo.eclipse.org/content/repositories/paho-releases/' } - } -} 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 deleted file mode 100755 index f88c58d1a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#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.14.1-all.zip diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradlew b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradlew.bat b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradlew.bat deleted file mode 100755 index 8a0b282aa..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/pom.xml deleted file mode 100755 index 0b378f763..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - 4.0.0 - org.wso2.iot.agents - org.wso2.carbon.device.mgt.iot.androidsense.agent - 3.0.0 - Android Sense - Android Sense - pom - - - - exec-maven-plugin - org.codehaus.mojo - - - Gradle Build - generate-sources - - exec - - - ./gradlew - - assembleRelease - - - - - - - - - - - wso2-nexus - WSO2 internal Repository - http://maven.wso2.org/nexus/content/groups/wso2-public/ - - true - daily - ignore - - - - wso2.releases - WSO2 internal Repository - http://maven.wso2.org/nexus/content/repositories/releases/ - - true - daily - ignore - - - - - - - - org.wso2.siddhi - siddhi-query-compiler - ${sidhdhi.version} - - - org.wso2.siddhi - siddhi-query-api - ${sidhdhi.version} - - - org.wso2.siddhi - siddhi-core - ${sidhdhi.version} - - - - org.apache.httpcomponents - httpclient - ${apache-httpclient.version} - - - - com.google.code.gson - gson - ${gson.version} - - - - - - 1.7 - 1.7 - - 4.5 - - 3.0.5 - 2.3.1 - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/settings.gradle b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/settings.gradle deleted file mode 100755 index e7b4def49..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/build.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/build.xml deleted file mode 100644 index b265c6f38..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/build.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml deleted file mode 100644 index 4ad612d9f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - androidsense-plugin - org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.iot.androidsense.analytics - WSO2 Carbon - IoT Server Android Sense Analytics Carbon App - pom - - - - - maven-antrun-plugin - 1.7 - - - process-resources - - - - - - - run - - - - - - maven-assembly-plugin - 2.5.5 - - ${project.artifactId}-${carbon.devicemgt.plugins.version} - false - - src/assembly/src.xml - - - - - create-archive - package - - single - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/assembly/src.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/assembly/src.xml deleted file mode 100644 index a5a375010..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/assembly/src.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - src - - zip - - false - ${basedir}/src - - - ${basedir}/target/carbonapps - / - true - - - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/Android-Accelerometer-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/Android-Accelerometer-ExecutionPlan.siddhiql deleted file mode 100755 index 89301c04e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/Android-Accelerometer-ExecutionPlan.siddhiql +++ /dev/null @@ -1,18 +0,0 @@ -@Plan:name('Android-Accelerometer-ExecutionPlan') - -@Plan:description('Process accelerometer changes.') - -@Import('iot.per.device.stream.android.accelerometer:1.0.0') -define stream AccelerometerStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value -float); - -@Export('iot.per.device.stream.android.accelerometer.stats:1.0.0') -define stream AccelerometerStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of AccelerometerStream) -begin - from AccelerometerStream - select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into AccelerometerStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/artifact.xml deleted file mode 100644 index 068ee9a2d..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Accelerometer-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/artifact.xml deleted file mode 100644 index 9eb26b391..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_accelerometer_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/iot_per_device_stream_android_accelerometer_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/iot_per_device_stream_android_accelerometer_stats.xml deleted file mode 100755 index d0e97eb7f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/iot_per_device_stream_android_accelerometer_stats.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - axis - false - false - false - false - STRING - - - value - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.accelerometer.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/artifact.xml deleted file mode 100644 index f3379fe5b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.accelerometer.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/iot.per.device.stream.android.accelerometer.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/iot.per.device.stream.android.accelerometer.stats_1.0.0.json deleted file mode 100755 index 3a48071a8..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/iot.per.device.stream.android.accelerometer.stats_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.accelerometer.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/artifact.xml deleted file mode 100644 index 43194caa4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.accelerometer_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/iot.per.device.stream.android.accelerometer_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/iot.per.device.stream.android.accelerometer_1.0.0.json deleted file mode 100755 index 9b0adbcb7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/iot.per.device.stream.android.accelerometer_1.0.0.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "iot.per.device.stream.android.accelerometer", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/AndroidActivityScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/AndroidActivityScript.xml deleted file mode 100644 index 2df0ad03f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/AndroidActivityScript.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - true - AndroidActivityScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/artifact.xml deleted file mode 100644 index a6e38b2ea..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidActivityScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_event_sink/artifact.xml deleted file mode 100644 index 3a5fed805..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_activity_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_event_sink/iot_per_device_stream_android_activity_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_event_sink/iot_per_device_stream_android_activity_stats.xml deleted file mode 100755 index 01d32787d..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_event_sink/iot_per_device_stream_android_activity_stats.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - action - false - false - false - false - STRING - - - duration - false - false - false - false - LONG - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.activity.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_streams/artifact.xml deleted file mode 100644 index c5331928d..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.activity.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_streams/iot.per.device.stream.android.activity.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_streams/iot.per.device.stream.android.activity.stats_1.0.0.json deleted file mode 100755 index d2cb12a9c..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_stats_streams/iot.per.device.stream.android.activity.stats_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.activity.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "action", - "type": "STRING" - }, - { - "name": "duration", - "type": "LONG" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_streams/artifact.xml deleted file mode 100644 index dc2ba5697..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.activity_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_streams/iot.per.device.stream.android.activity_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_streams/iot.per.device.stream.android.activity_1.0.0.json deleted file mode 100755 index d89df0c7a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_streams/iot.per.device.stream.android.activity_1.0.0.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "iot.per.device.stream.android.activity", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "action", - "type": "STRING" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_activity_executionplan/Android-Activity-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_activity_executionplan/Android-Activity-ExecutionPlan.siddhiql deleted file mode 100755 index d11da88ec..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_activity_executionplan/Android-Activity-ExecutionPlan.siddhiql +++ /dev/null @@ -1,22 +0,0 @@ -@Plan:name('Android-Activity-ExecutionPlan') - -@Plan:description('Identify the start and end of each activities') - -@Import('iot.per.device.stream.android.activity:1.0.0') -define stream ActivitySream (meta_owner string, meta_deviceId string, meta_timestamp long, action string); - -@Export('iot.per.device.stream.android.activity.stats:1.0.0') -define stream ActivityStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, action string, duration long, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of ActivitySream) -begin - from every preActivity = ActivitySream, postActivity = ActivitySream[preActivity.action != action AND preActivity.meta_timestamp <= meta_timestamp] - select preActivity.meta_owner as meta_owner, preActivity.meta_deviceId as meta_deviceId, - preActivity.action as preAction, postActivity.action as postAction, preActivity.meta_timestamp as preTimestamp, postActivity.meta_timestamp as postTimestamp - insert into #ActivityChangeEventStream; - - from every preEvent = #ActivityChangeEventStream, postEvent = #ActivityChangeEventStream[preEvent.postAction == preAction] - select preEvent.meta_owner as meta_owner, preEvent.meta_deviceId as meta_deviceId, postEvent.preTimestamp as meta_timestamp, preEvent.postAction as action, (postEvent.postTimestamp - preEvent.postTimestamp) as duration, - time:extract(postEvent.preTimestamp, 'year') as year, time:extract(postEvent.preTimestamp, 'month') as month, time:extract(postEvent.preTimestamp, 'day') as day, time:extract(postEvent.preTimestamp, 'hour') as hour, time:extract(postEvent.preTimestamp, 'minute') as minute - insert into ActivityStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_activity_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_activity_executionplan/artifact.xml deleted file mode 100644 index 3484a055f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_activity_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Activity-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_executionplan/Android-Audio-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_executionplan/Android-Audio-ExecutionPlan.siddhiql deleted file mode 100755 index a9b5e03e0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_executionplan/Android-Audio-ExecutionPlan.siddhiql +++ /dev/null @@ -1,27 +0,0 @@ -/* Enter a unique ExecutionPlan */ -@Plan:name('Android-Audio-ExecutionPlan') - -@Plan:description('Find the audio listening through head set') - - -@Import('iot.per.device.stream.android.audio:1.0.0') -define stream AudioStream (meta_owner string, meta_deviceId string, meta_timestamp long, audio_playing bool, headset_on bool, music_volume int); - -@Export('iot.per.device.stream.android.headset.stats:1.0.0') -define stream HeadsetStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, duration long, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of AudioStream) -begin - from every preEvent = AudioStream[audio_playing AND headset_on], postEvent = AudioStream[(NOT audio_playing OR NOT headset_on) AND preEvent.meta_timestamp <= meta_timestamp] - select preEvent.meta_owner as meta_owner, preEvent.meta_deviceId as meta_deviceId, postEvent.meta_timestamp as timestamp, 'ACTIVE' as state - insert into #StateChangeEventStream; - - from every preEvent = AudioStream[NOT audio_playing OR NOT headset_on], postEvent = AudioStream[audio_playing AND headset_on AND preEvent.meta_timestamp <= meta_timestamp] - select preEvent.meta_owner as meta_owner, preEvent.meta_deviceId as meta_deviceId, postEvent.meta_timestamp as timestamp, 'INACTIVE' as state - insert into #StateChangeEventStream; - - from every preEvent = #StateChangeEventStream[state == 'ACTIVE'], postEvent = #StateChangeEventStream[state == 'INACTIVE'] - select preEvent.meta_owner as meta_owner, preEvent.meta_deviceId as meta_deviceId, preEvent.timestamp as meta_timestamp, (postEvent.timestamp - preEvent.timestamp) as duration, - time:extract(preEvent.timestamp, 'year') as year, time:extract(preEvent.timestamp, 'month') as month, time:extract(preEvent.timestamp, 'day') as day, time:extract(preEvent.timestamp, 'hour') as hour, time:extract(preEvent.timestamp, 'minute') as minute - insert into HeadsetStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_executionplan/artifact.xml deleted file mode 100644 index d666e9c51..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Audio-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_filter_executionplan/Android-Audio-Filter-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_filter_executionplan/Android-Audio-Filter-ExecutionPlan.siddhiql deleted file mode 100644 index 0e907636e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_filter_executionplan/Android-Audio-Filter-ExecutionPlan.siddhiql +++ /dev/null @@ -1,16 +0,0 @@ -/* Enter a unique ExecutionPlan */ -@Plan:name('Android-Audio-Filter-ExecutionPlan') - -/* Enter a unique description for ExecutionPlan */ -@Plan:description('This converts the true/false params of the orgininal stream into ON/OFF') - -/* define streams/tables and write queries here ... */ - -@Import('iot.per.device.stream.android.audio:1.0.0') -define stream AudioStream (meta_owner string, meta_deviceId string, meta_timestamp long, audio_playing bool, headset_on bool, music_volume int); - -@Export('iot.per.device.stream.android.filtered.audio:1.0.0') -define stream FilteredAudioStream (meta_owner string, meta_deviceId string, meta_timestamp long, audio string, headset string, music_volume int); - -from AudioStream select meta_owner, meta_deviceId, meta_timestamp, ifThenElse(audio_playing, 'ON', 'OFF') as audio, -ifThenElse(headset_on, 'ON', 'OFF') as headset, music_volume insert into FilteredAudioStream; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_filter_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_filter_executionplan/artifact.xml deleted file mode 100644 index d4567ced5..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_audio_filter_executionplan/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Android-Audio-Filter-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/Android-Battery-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/Android-Battery-ExecutionPlan.siddhiql deleted file mode 100755 index f09eb33bc..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/Android-Battery-ExecutionPlan.siddhiql +++ /dev/null @@ -1,19 +0,0 @@ -@Plan:name('Android-Battery-ExecutionPlan') - -@Plan:description('Find the battery status of the android device.') - - -@Import('iot.per.device.stream.android.battery:1.0.0') -define stream BatteryStream (meta_owner string, meta_deviceId string, meta_timestamp long, level int, state string, status int, temperature int); - - -@Export('iot.per.device.stream.android.battery.stats:1.0.0') -define stream BatteryStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, level int, state -string, status int, temperature int, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of BatteryStream) -begin - from BatteryStream - select meta_owner, meta_deviceId, meta_timestamp, level, state, status, temperature, time:extract(preState.meta_timestamp, 'year') as year, time:extract(preState.meta_timestamp, 'month') as month, time:extract(preState.meta_timestamp, 'day') as day, time:extract(preState.meta_timestamp, 'hour') as hour, time:extract(preState.meta_timestamp, 'minute') as minute - insert into BatteryStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/artifact.xml deleted file mode 100644 index 70ab416ec..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Android-Battery-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql deleted file mode 100755 index cd3430b53..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql +++ /dev/null @@ -1,17 +0,0 @@ -@Plan:name('Android-Call-ExecutionPlan') - -@Plan:description('Identify the call durations of incoming and outgoing calls') - - -@Import('iot.per.device.stream.android.call:1.0.0') -define stream CallStream (meta_owner string, meta_deviceId string, meta_timestamp long, number string, type string, startTime long, endTime long); - -@Export('iot.per.device.stream.android.call.stats:1.0.0') -define stream CallStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, number string, type string, duration long, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of CallStream) -begin - from CallStream - select meta_owner, meta_deviceId, meta_timestamp, number, type, (endTime - startTime) as duration, time:extract(meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into CallStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/artifact.xml deleted file mode 100644 index 517a0effd..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Call-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_data_executionplan/Android-Data-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_data_executionplan/Android-Data-ExecutionPlan.siddhiql deleted file mode 100755 index 0d84f26f6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_data_executionplan/Android-Data-ExecutionPlan.siddhiql +++ /dev/null @@ -1,16 +0,0 @@ -@Plan:name('Android-Data-ExecutionPlan') - -@Plan:description('Calculate the total network usage of mobile data and others') - -@Import('iot.per.device.stream.android.data:1.0.0') -define stream DataStream (meta_owner string, meta_deviceId string, meta_timestamp long, type string, received long, sent long); - -@Export('iot.per.device.stream.android.data.stats:1.0.0') -define stream DataStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, type string, total long, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of DataStream) -begin - from DataStream - select meta_owner, meta_deviceId, meta_timestamp, type, (received + sent) as total, time:extract(meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into DataStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_data_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_data_executionplan/artifact.xml deleted file mode 100644 index 26caa3bd0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_data_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Data-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_location_executionplan/Android-Location-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_location_executionplan/Android-Location-ExecutionPlan.siddhiql deleted file mode 100755 index 25a4fb077..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_location_executionplan/Android-Location-ExecutionPlan.siddhiql +++ /dev/null @@ -1,16 +0,0 @@ -@Plan:name('Android-Location-ExecutionPlan') - -@Plan:description('Find the street name of the location and add to a new stream') - -@Import('iot.per.device.stream.android.location:1.0.0') -define stream LocationStream (meta_owner string, meta_deviceId string, meta_timestamp long, latitude double, longitude double); - -@Export('iot.per.device.stream.android.location.stats:1.0.0') -define stream LocationStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, latitude double, longitude double, streetName string, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of LocationStream) -begin - from LocationStream - select meta_owner, meta_deviceId, meta_timestamp, convert(math:round(latitude * 10000), 'double') / 10000.0 as latitude, convert(math:round(longitude * 10000), 'double') / 10000.0 as longitude, "" as streetName, time:extract(preState.meta_timestamp, 'year') as year, time:extract(preState.meta_timestamp, 'month') as month, time:extract(preState.meta_timestamp, 'day') as day, time:extract(preState.meta_timestamp, 'hour') as hour, time:extract(preState.meta_timestamp, 'minute') as minute - insert into LocationStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_location_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_location_executionplan/artifact.xml deleted file mode 100644 index c778e3a90..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_location_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Location-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_screen_executionplan/Android-Screen-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_screen_executionplan/Android-Screen-ExecutionPlan.siddhiql deleted file mode 100755 index 0fc8ece97..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_screen_executionplan/Android-Screen-ExecutionPlan.siddhiql +++ /dev/null @@ -1,19 +0,0 @@ -/* Enter a unique ExecutionPlan */ -@Plan:name('Android-Screen-ExecutionPlan') - -@Plan:description('Identify screen on duration') - - -@Import('iot.per.device.stream.android.screen:1.0.0') -define stream ScreenStream (meta_owner string, meta_deviceId string, meta_timestamp long, state string); - -@Export('iot.per.device.stream.android.screen.stats:1.0.0') -define stream ScreenStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, duration long, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of ScreenStream) -begin - from every preState = ScreenStream[state == 'on'], postState = ScreenStream[state == 'off' AND preState.meta_timestamp <= meta_timestamp] - select preState.meta_owner as meta_owner, preState.meta_deviceId as meta_deviceId, preState.meta_timestamp as meta_timestamp, (postState.meta_timestamp - preState.meta_timestamp) as duration, - time:extract(preState.meta_timestamp, 'year') as year, time:extract(preState.meta_timestamp, 'month') as month, time:extract(preState.meta_timestamp, 'day') as day, time:extract(preState.meta_timestamp, 'hour') as hour, time:extract(preState.meta_timestamp, 'minute') as minute - insert into ScreenStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_screen_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_screen_executionplan/artifact.xml deleted file mode 100644 index 6d11b8886..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_screen_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Screen-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql deleted file mode 100755 index 5eaa1a492..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql +++ /dev/null @@ -1,157 +0,0 @@ -@Plan:name('Android-Sense-ExecutionPlan') - -@Plan:description('ExecutionPlan') - -@Import('org.wso2.iot.android.sense:1.0.0') -define stream AndroidSense (meta_owner string, meta_deviceId string, meta_type string, meta_timestamp long, battery int, battery_state string, battery_status int, battery_temperature int, gps_lat double, gps_long double, accelerometer_x float, accelerometer_y float, accelerometer_z float, speed_limit float, turn_way string, magnetic_x float, magnetic_y float, magnetic_z float, gyroscope_x float, gyroscope_y float, gyroscope_z float, light float, pressure float, proximity float, gravity_x float, gravity_y float, gravity_z float, rotation_x float, rotation_y float, rotation_z float, word string, word_sessionId string, word_status string, beacon_major int, beacon_minor int, beacon_proximity string, beacon_uuid int, call_number string, call_type string, call_start_time long, call_end_time long, screen_state string, audio_playing bool, headset_on bool, music_volume int, activity_type int, confidence int, sms_number string, application_name string, action string, data_type string, data_sent long, data_received long); - -@Export('iot.per.device.stream.android.data:1.0.0') -define stream DataStream (meta_owner string, meta_deviceId string, meta_timestamp long, type string, received long, sent long); - -@Export('iot.per.device.stream.android.activity:1.0.0') -define stream ActivityStream (meta_owner string, meta_deviceId string, meta_timestamp long, action string); - -@Export('iot.per.device.stream.android.call:1.0.0') -define stream CallStream (meta_owner string, meta_deviceId string, meta_timestamp long, number string, type string, startTime long, endTime long); - -@Export('iot.per.device.stream.android.screen:1.0.0') -define stream ScreenStream (meta_owner string, meta_deviceId string, meta_timestamp long, state string); - -@Export('iot.per.device.stream.android.location:1.0.0') -define stream LocationStream (meta_owner string, meta_deviceId string, meta_timestamp long, latitude double, longitude double); - -@Export('iot.per.device.stream.android.audio:1.0.0') -define stream AudioStream (meta_owner string, meta_deviceId string, meta_timestamp long, audio_playing bool, headset_on bool, music_volume int); - -@Export('iot.per.device.stream.android.battery:1.0.0') -define stream BatteryStream (meta_owner string, meta_deviceId string, meta_timestamp long, level int, state string, status int, temperature int); - -@Export('iot.per.device.stream.android.sms:1.0.0') -define stream SmsStream (meta_owner string, meta_deviceId string, meta_timestamp long, number string, type string, body string); - -@Export('org.wso2.iot.LocationStream:1.0.0') -define stream geoLocationStream (meta_deviceId string, meta_deviceType string, timeStamp long, latitude double, longitude double); - -@Export('iot.per.device.stream.android.accelerometer:1.0.0') -define stream AccelerometerStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); - -@Export('iot.per.device.stream.android.gyroscope:1.0.0') -define stream GyroscopeStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); - -@Export('iot.per.device.stream.android.magnetic:1.0.0') -define stream MagneticStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); - -@Export('iot.per.device.stream.android.gravity:1.0.0') -define stream GravityStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); - -@Export('iot.per.device.stream.android.rotation:1.0.0') -define stream RotationStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); - -@Export('iot.per.device.stream.android.pressure:1.0.0') -define stream PressureStream (meta_owner string, meta_deviceId string, meta_timestamp long, pressure float); - -@Export('iot.per.device.stream.android.light:1.0.0') -define stream LightStream (meta_owner string, meta_deviceId string, meta_timestamp long, light float); - -@Export('iot.per.device.stream.android.proximity:1.0.0') -define stream ProximityStream (meta_owner string, meta_deviceId string, meta_timestamp long, proximity float); - -from AndroidSense[meta_type == 'accelerometer'] -select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, accelerometer_x as value -insert into AccelerometerStream; - -from AndroidSense[meta_type == 'accelerometer'] -select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, accelerometer_y as value -insert into AccelerometerStream; - -from AndroidSense[meta_type == 'accelerometer'] -select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, accelerometer_z as value -insert into AccelerometerStream; - -from AndroidSense[meta_type == 'gyroscope'] -select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, gyroscope_x as value -insert into GyroscopeStream; - -from AndroidSense[meta_type == 'gyroscope'] -select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, gyroscope_y as value -insert into GyroscopeStream; - -from AndroidSense[meta_type == 'gyroscope'] -select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, gyroscope_z as value -insert into GyroscopeStream; - -from AndroidSense[meta_type == 'magnetic'] -select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, magnetic_x as value -insert into MagneticStream; - -from AndroidSense[meta_type == 'magnetic'] -select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, magnetic_y as value -insert into MagneticStream; - -from AndroidSense[meta_type == 'magnetic'] -select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, magnetic_z as value -insert into MagneticStream; - -from AndroidSense[meta_type == 'gravity'] -select meta_owner, meta_deviceId, meta_timestamp, gravity_x as x, gravity_y as y, gravity_z as z -insert into GravityStream; - -from AndroidSense[meta_type == 'rotation'] -select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, rotation_x as value -insert into RotationStream; - -from AndroidSense[meta_type == 'rotation'] -select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, rotation_y as value -insert into RotationStream; - -from AndroidSense[meta_type == 'rotation'] -select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, rotation_z as value -insert into RotationStream; - -from AndroidSense[meta_type == 'pressure'] -select meta_owner, meta_deviceId, meta_timestamp, pressure as pressure -insert into PressureStream; - -from AndroidSense[meta_type == 'light'] -select meta_owner, meta_deviceId, meta_timestamp, light as light -insert into LightStream; - -from AndroidSense[meta_type == 'proximity'] -select meta_owner, meta_deviceId, meta_timestamp, proximity as proximity -insert into ProximityStream; - -from AndroidSense[meta_type == 'sms'] -select meta_owner, meta_deviceId, meta_timestamp, sms_number as number, action as type, "" as body -insert into SmsStream; - -from AndroidSense[meta_type == 'battery'] -select meta_owner, meta_deviceId, meta_timestamp, battery as level, battery_state as state, battery_status as status, battery_temperature as temperature -insert into BatteryStream; - -from AndroidSense[meta_type == 'audio'] -select meta_owner, meta_deviceId, meta_timestamp, audio_playing, headset_on, music_volume -insert into AudioStream; - -from AndroidSense[meta_type == 'gps'] -select meta_owner, meta_deviceId, meta_timestamp, gps_lat as latitude, gps_long as longitude -insert into LocationStream; - -from AndroidSense[meta_type == 'screen'] -select meta_owner, meta_deviceId, meta_timestamp, screen_state as state -insert into ScreenStream; - -from AndroidSense[meta_type == 'call'] -select meta_owner, meta_deviceId, meta_timestamp, call_number as number, call_type as type, call_start_time as startTime, call_end_time as endTime -insert into CallStream; - -from AndroidSense[meta_type == 'activity'] -select meta_owner, meta_deviceId, meta_timestamp, action -insert into ActivityStream; - -from AndroidSense[meta_type == 'data'] -select meta_owner, meta_deviceId, meta_timestamp, data_type as type, data_received as received, data_sent as sent -insert into DataStream; - -from AndroidSense[meta_type == 'gps'] -select meta_deviceId ,'android_sense' as meta_deviceType, meta_timestamp as timeStamp, gps_lat as latitude, gps_long as longitude -insert into geoLocationStream; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/artifact.xml deleted file mode 100644 index 0dd982b0c..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Sense-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sms_executionplan/Android-SMS-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sms_executionplan/Android-SMS-ExecutionPlan.siddhiql deleted file mode 100755 index 39163fe41..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sms_executionplan/Android-SMS-ExecutionPlan.siddhiql +++ /dev/null @@ -1,16 +0,0 @@ -@Plan:name('Android-SMS-ExecutionPlan') - -@Plan:description('Process received and sent SMS details') - -@Import('iot.per.device.stream.android.sms:1.0.0') -define stream SmsStream (meta_owner string, meta_deviceId string, meta_timestamp long, number string, type string, body string); - -@Export('iot.per.device.stream.android.sms.stats:1.0.0') -define stream SmsStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, number string, type string, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of SmsStream) -begin - from SmsStream - select meta_owner, meta_deviceId, meta_timestamp, number, type, time:extract(meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into SmsStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sms_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sms_executionplan/artifact.xml deleted file mode 100644 index 49d1a2643..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sms_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-SMS-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/AndroidAudioScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/AndroidAudioScript.xml deleted file mode 100644 index d9be6dc15..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/AndroidAudioScript.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - true - AndroidAudioScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/artifact.xml deleted file mode 100644 index 959c749fe..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidAudioScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_streams/artifact.xml deleted file mode 100644 index 065de45f6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.audio_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_streams/iot.per.device.stream.android.audio_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_streams/iot.per.device.stream.android.audio_1.0.0.json deleted file mode 100755 index 959a7688e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_streams/iot.per.device.stream.android.audio_1.0.0.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "iot.per.device.stream.android.audio", - "version": "1.0.0", - "nickName": "", - "description": "Intermediate stream to map Android sense stream to audio execution plan", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "audio_playing", - "type": "BOOL" - }, - { - "name": "headset_on", - "type": "BOOL" - }, - { - "name": "music_volume", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/AndroidBatteryScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/AndroidBatteryScript.xml deleted file mode 100644 index 76f3cd36b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/AndroidBatteryScript.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - true - AndroidBatteryScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/artifact.xml deleted file mode 100644 index ef0064603..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidBatteryScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/artifact.xml deleted file mode 100644 index 7d9cf504b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot_per_device_stream_android_battery_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/iot_per_device_stream_android_battery_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/iot_per_device_stream_android_battery_stats.xml deleted file mode 100755 index 00d4d1ce1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/iot_per_device_stream_android_battery_stats.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - level - false - false - false - false - INTEGER - - - state - false - false - false - false - STRING - - - status - false - false - false - false - INTEGER - - - temperature - false - false - false - false - INTEGER - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.battery.stats:1.0.0 - - false - PROCESSED_DATA_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/artifact.xml deleted file mode 100644 index c37c7c374..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.battery.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/iot.per.device.stream.android.battery.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/iot.per.device.stream.android.battery.stats_1.0.0.json deleted file mode 100755 index 9b410c691..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/iot.per.device.stream.android.battery.stats_1.0.0.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "iot.per.device.stream.android.battery.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "level", - "type": "INT" - }, - { - "name": "state", - "type": "STRING" - }, - { - "name": "status", - "type": "INT" - }, - { - "name": "temperature", - "type": "INT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_streams/artifact.xml deleted file mode 100644 index 7739d2cd1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.battery_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_streams/iot.per.device.stream.android.battery_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_streams/iot.per.device.stream.android.battery_1.0.0.json deleted file mode 100755 index 5b73e7d47..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_streams/iot.per.device.stream.android.battery_1.0.0.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "iot.per.device.stream.android.battery", - "version": "1.0.0", - "nickName": "", - "description": "Intermediate stream to map Android sense stream to battery execution plan", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "level", - "type": "INT" - }, - { - "name": "state", - "type": "STRING" - }, - { - "name": "status", - "type": "INT" - }, - { - "name": "temperature", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/AndroidCallScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/AndroidCallScript.xml deleted file mode 100644 index b939e8d26..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/AndroidCallScript.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - true - AndroidCallScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/artifact.xml deleted file mode 100644 index e4113d4a1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidCallScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_event_sink/artifact.xml deleted file mode 100644 index 678933f98..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_call_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_event_sink/iot_per_device_stream_android_call_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_event_sink/iot_per_device_stream_android_call_stats.xml deleted file mode 100755 index 5a0c24e21..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_event_sink/iot_per_device_stream_android_call_stats.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - number - false - false - false - false - STRING - - - type - false - false - false - false - STRING - - - duration - false - false - false - false - LONG - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.call.stats:1.0.0 - - false - PROCESSED_DATA_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_streams/artifact.xml deleted file mode 100644 index 721c165a1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.call.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_streams/iot.per.device.stream.android.call.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_streams/iot.per.device.stream.android.call.stats_1.0.0.json deleted file mode 100755 index 8d06ec636..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_streams/iot.per.device.stream.android.call.stats_1.0.0.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "iot.per.device.stream.android.call.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "number", - "type": "STRING" - }, - { - "name": "type", - "type": "STRING" - }, - { - "name": "duration", - "type": "LONG" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_streams/artifact.xml deleted file mode 100644 index 0247c7cb2..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.call_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_streams/iot.per.device.stream.android.call_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_streams/iot.per.device.stream.android.call_1.0.0.json deleted file mode 100755 index 63844e8b1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_streams/iot.per.device.stream.android.call_1.0.0.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "iot.per.device.stream.android.call", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "number", - "type": "STRING" - }, - { - "name": "type", - "type": "STRING" - }, - { - "name": "startTime", - "type": "LONG" - }, - { - "name": "endTime", - "type": "LONG" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/AndroidDataScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/AndroidDataScript.xml deleted file mode 100644 index c4726c0ad..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/AndroidDataScript.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - true - AndroidDataScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/artifact.xml deleted file mode 100644 index fe27bae98..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidDataScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_event_sink/artifact.xml deleted file mode 100644 index dfa583691..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_data_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_event_sink/iot_per_device_stream_android_data_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_event_sink/iot_per_device_stream_android_data_stats.xml deleted file mode 100755 index 71c3bbdd9..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_event_sink/iot_per_device_stream_android_data_stats.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - type - false - false - false - false - STRING - - - total - false - false - false - false - LONG - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.data.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_streams/artifact.xml deleted file mode 100644 index 3b3f006e0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.data.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_streams/iot.per.device.stream.android.data.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_streams/iot.per.device.stream.android.data.stats_1.0.0.json deleted file mode 100755 index 0bfd45bd7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_stats_streams/iot.per.device.stream.android.data.stats_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.data.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "type", - "type": "STRING" - }, - { - "name": "total", - "type": "LONG" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_streams/artifact.xml deleted file mode 100644 index 20ca9b94f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.data_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_streams/iot.per.device.stream.android.data_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_streams/iot.per.device.stream.android.data_1.0.0.json deleted file mode 100755 index c5f942648..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_streams/iot.per.device.stream.android.data_1.0.0.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "iot.per.device.stream.android.data", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "type", - "type": "STRING" - }, - { - "name": "received", - "type": "LONG" - }, - { - "name": "sent", - "type": "LONG" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_event_sink/artifact.xml deleted file mode 100644 index e1b9330bf..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_device_details.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_event_sink/iot_per_device_stream_android_device_details.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_event_sink/iot_per_device_stream_android_device_details.xml deleted file mode 100644 index 4a767d115..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_event_sink/iot_per_device_stream_android_device_details.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_username - false - true - true - false - STRING - - - android_version - false - false - false - false - STRING - - - memory - false - false - false - false - STRING - - - storage - false - false - false - false - STRING - - - installed_apps - false - false - false - false - INTEGER - - - state - false - true - false - false - STRING - - - id - false - true - true - false - STRING - - - name - false - true - false - false - STRING - - - model - false - false - false - false - STRING - - - manufacturer - false - false - false - false - STRING - - - - iot.per.device.stream.android.device.details:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_streams/artifact.xml deleted file mode 100644 index a2bc62bdc..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.device.details_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_streams/iot.per.device.stream.android.device.details_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_streams/iot.per.device.stream.android.device.details_1.0.0.json deleted file mode 100644 index 791d9bf0e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_device_details_streams/iot.per.device.stream.android.device.details_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.device.details", - "version": "1.0.0", - "nickName": "", - "description": "Details of the Android Device", - "metaData": [ - { - "name": "username", - "type": "STRING" - } - ], - "payloadData": [ - { - "name": "android_version", - "type": "STRING" - }, - { - "name": "memory", - "type": "STRING" - }, - { - "name": "storage", - "type": "STRING" - }, - { - "name": "installed_apps", - "type": "INT" - }, - { - "name": "state", - "type": "STRING" - }, - { - "name": "id", - "type": "STRING" - }, - { - "name": "name", - "type": "STRING" - }, - { - "name": "model", - "type": "STRING" - }, - { - "name": "manufacturer", - "type": "STRING" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_filtered_audio_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_filtered_audio_streams/artifact.xml deleted file mode 100644 index 808fa5d43..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_filtered_audio_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.filtered.audio_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_filtered_audio_streams/iot.per.device.stream.android.filtered.audio_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_filtered_audio_streams/iot.per.device.stream.android.filtered.audio_1.0.0.json deleted file mode 100644 index f7ed1268b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_filtered_audio_streams/iot.per.device.stream.android.filtered.audio_1.0.0.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "iot.per.device.stream.android.filtered.audio", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "audio", - "type": "STRING" - }, - { - "name": "headset", - "type": "STRING" - }, - { - "name": "music_volume", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/AndroidFrequentContactsScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/AndroidFrequentContactsScript.xml deleted file mode 100644 index 21101d99f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/AndroidFrequentContactsScript.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - true - AndroidFrequentContactsScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/artifact.xml deleted file mode 100644 index a983ed171..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidFrequentContactsScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_executionplan/Android-Gravity-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_executionplan/Android-Gravity-ExecutionPlan.siddhiql deleted file mode 100755 index 62313b131..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_executionplan/Android-Gravity-ExecutionPlan.siddhiql +++ /dev/null @@ -1,18 +0,0 @@ -@Plan:name('Android-Gravity-ExecutionPlan') - -@Plan:description('Process gravity changes.') - -@Import('iot.per.device.stream.android.gravity:1.0.0') -define stream GravityStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); - -@Export('iot.per.device.stream.android.gravity.stats:1.0.0') -define stream GravityStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, x -float, y float, z float, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of GravityStream) -begin - from GravityStream - select meta_owner, meta_deviceId, meta_timestamp, x, y, z, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into GravityStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_executionplan/artifact.xml deleted file mode 100644 index 2aed83ad8..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Gravity-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_event_sink/artifact.xml deleted file mode 100644 index 155f5ba31..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_gravity_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_event_sink/iot_per_device_stream_android_gravity_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_event_sink/iot_per_device_stream_android_gravity_stats.xml deleted file mode 100755 index f390c4f72..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_event_sink/iot_per_device_stream_android_gravity_stats.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - x - false - false - false - false - FLOAT - - - y - false - false - false - false - FLOAT - - - z - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.gravity.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_streams/artifact.xml deleted file mode 100644 index de493e933..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_streams/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot.per.device.stream.android.gravity.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_streams/iot.per.device.stream.android.gravity.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_streams/iot.per.device.stream.android.gravity.stats_1.0.0.json deleted file mode 100755 index 1364a9223..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_stats_streams/iot.per.device.stream.android.gravity.stats_1.0.0.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "iot.per.device.stream.android.gravity.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" - }, - { - "name": "z", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_streams/artifact.xml deleted file mode 100644 index e8a1e6f11..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.gravity_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_streams/iot.per.device.stream.android.gravity_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_streams/iot.per.device.stream.android.gravity_1.0.0.json deleted file mode 100755 index 1877828f6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gravity_streams/iot.per.device.stream.android.gravity_1.0.0.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "iot.per.device.stream.android.gravity", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" - }, - { - "name": "z", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/Android-Gyroscope-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/Android-Gyroscope-ExecutionPlan.siddhiql deleted file mode 100755 index a6908db95..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/Android-Gyroscope-ExecutionPlan.siddhiql +++ /dev/null @@ -1,18 +0,0 @@ -@Plan:name('Android-Gyroscope-ExecutionPlan') - -@Plan:description('Process gyroscope changes.') - -@Import('iot.per.device.stream.android.gyroscope:1.0.0') -define stream GyroscopeStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); - -@Export('iot.per.device.stream.android.gyroscope.stats:1.0.0') -define stream GyroscopeStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value -float, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of GyroscopeStream) -begin - from GyroscopeStream - select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract (meta_timestamp, 'year') as year, - time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into GyroscopeStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/artifact.xml deleted file mode 100644 index fd2150b23..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Android-Gyroscope-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/artifact.xml deleted file mode 100644 index 261af41aa..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot_per_device_stream_android_gyroscope_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/iot_per_device_stream_android_gyroscope_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/iot_per_device_stream_android_gyroscope_stats.xml deleted file mode 100755 index 170534b05..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/iot_per_device_stream_android_gyroscope_stats.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - axis - false - false - false - false - STRING - - - value - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.gyroscope.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/artifact.xml deleted file mode 100644 index d3540afb0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.gyroscope.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/iot.per.device.stream.android.gyroscope.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/iot.per.device.stream.android.gyroscope.stats_1.0.0.json deleted file mode 100755 index 7084adb19..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/iot.per.device.stream.android.gyroscope.stats_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.gyroscope.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/artifact.xml deleted file mode 100644 index 60ca524f2..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.gyroscope_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/iot.per.device.stream.android.gyroscope_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/iot.per.device.stream.android.gyroscope_1.0.0.json deleted file mode 100755 index bf0dd7ff1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/iot.per.device.stream.android.gyroscope_1.0.0.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "iot.per.device.stream.android.gyroscope", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_script/HeadsetScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_script/HeadsetScript.xml deleted file mode 100644 index 235988174..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_script/HeadsetScript.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - true - HeadsetScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_script/artifact.xml deleted file mode 100644 index dee15c598..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - HeadsetScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_event_sink/artifact.xml deleted file mode 100644 index d59bdd843..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_headset_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_event_sink/iot_per_device_stream_android_headset_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_event_sink/iot_per_device_stream_android_headset_stats.xml deleted file mode 100755 index a6a1fb84f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_event_sink/iot_per_device_stream_android_headset_stats.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - duration - false - false - false - false - LONG - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.headset.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_streams/artifact.xml deleted file mode 100644 index 2710807c7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.headset.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_streams/iot.per.device.stream.android.headset.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_streams/iot.per.device.stream.android.headset.stats_1.0.0.json deleted file mode 100755 index 40b7fce0c..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_headset_stats_streams/iot.per.device.stream.android.headset.stats_1.0.0.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "iot.per.device.stream.android.headset.stats", - "version": "1.0.0", - "nickName": "", - "description": "End stream of head set state staticstics", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "duration", - "type": "LONG" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_executionplan/Android-Light-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_executionplan/Android-Light-ExecutionPlan.siddhiql deleted file mode 100755 index 85d4df09d..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_executionplan/Android-Light-ExecutionPlan.siddhiql +++ /dev/null @@ -1,18 +0,0 @@ -@Plan:name('Android-Light-ExecutionPlan') - -@Plan:description('Process light changes.') - -@Import('iot.per.device.stream.android.light:1.0.0') -define stream LightStream (meta_owner string, meta_deviceId string, meta_timestamp long, light float); - -@Export('iot.per.device.stream.android.light.stats:1.0.0') -define stream LightStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, light float, year int, -month int, day int, hour int, minute int); - -partition with (meta_deviceId of LightStream) -begin - from LightStream - select meta_owner, meta_deviceId, meta_timestamp, light, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into LightStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_executionplan/artifact.xml deleted file mode 100644 index 24d4bd5d7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Light-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_event_sink/artifact.xml deleted file mode 100644 index c866a4d32..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_light_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_event_sink/iot_per_device_stream_android_light_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_event_sink/iot_per_device_stream_android_light_stats.xml deleted file mode 100755 index 19441b9a4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_event_sink/iot_per_device_stream_android_light_stats.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - light - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.light.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_streams/artifact.xml deleted file mode 100644 index aa3c93cb2..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.light.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_streams/iot.per.device.stream.android.light.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_streams/iot.per.device.stream.android.light.stats_1.0.0.json deleted file mode 100755 index 91be5fea4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_stats_streams/iot.per.device.stream.android.light.stats_1.0.0.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "iot.per.device.stream.android.light.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "light", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_streams/artifact.xml deleted file mode 100644 index 0d4c8de7e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.light_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_streams/iot.per.device.stream.android.light_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_streams/iot.per.device.stream.android.light_1.0.0.json deleted file mode 100755 index b2240d3ad..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_light_streams/iot.per.device.stream.android.light_1.0.0.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "iot.per.device.stream.android.light", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "light", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_event_sink/artifact.xml deleted file mode 100644 index 196c34361..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_location.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_event_sink/iot_per_device_stream_android_location.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_event_sink/iot_per_device_stream_android_location.xml deleted file mode 100755 index 888f151cd..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_event_sink/iot_per_device_stream_android_location.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - latitude - false - false - false - false - DOUBLE - - - longitude - false - false - false - false - DOUBLE - - - - iot.per.device.stream.android.location:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/LocationScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/LocationScript.xml deleted file mode 100644 index 17a1e7dd7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/LocationScript.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - true - LocationScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/artifact.xml deleted file mode 100644 index 9c7ac8831..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - LocationScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_event_sink/artifact.xml deleted file mode 100644 index d789db0b8..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_location_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_event_sink/iot_per_device_stream_android_location_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_event_sink/iot_per_device_stream_android_location_stats.xml deleted file mode 100755 index 9fa3c9a86..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_event_sink/iot_per_device_stream_android_location_stats.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - latitude - false - false - false - false - DOUBLE - - - longitude - false - false - false - false - DOUBLE - - - streetName - false - false - false - false - STRING - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.location.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_streams/artifact.xml deleted file mode 100644 index 114ed614b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.location.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_streams/iot.per.device.stream.android.location.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_streams/iot.per.device.stream.android.location.stats_1.0.0.json deleted file mode 100755 index 5c3da4686..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_stats_streams/iot.per.device.stream.android.location.stats_1.0.0.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "iot.per.device.stream.android.location.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "latitude", - "type": "DOUBLE" - }, - { - "name": "longitude", - "type": "DOUBLE" - }, - { - "name": "streetName", - "type": "STRING" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_streams/artifact.xml deleted file mode 100644 index 0be2027b1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.location_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_streams/iot.per.device.stream.android.location_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_streams/iot.per.device.stream.android.location_1.0.0.json deleted file mode 100755 index 50bdaed7e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_streams/iot.per.device.stream.android.location_1.0.0.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "iot.per.device.stream.android.location", - "version": "1.0.0", - "nickName": "", - "description": "Location stream which is mapped from Android sense stream", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "latitude", - "type": "DOUBLE" - }, - { - "name": "longitude", - "type": "DOUBLE" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/Android-Magnetic-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/Android-Magnetic-ExecutionPlan.siddhiql deleted file mode 100755 index 49e355bd6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/Android-Magnetic-ExecutionPlan.siddhiql +++ /dev/null @@ -1,17 +0,0 @@ -@Plan:name('Android-Magnetic-ExecutionPlan') - -@Plan:description('Process magnetic field changes.') - -@Import('iot.per.device.stream.android.magnetic:1.0.0') -define stream MagneticStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); - -@Export('iot.per.device.stream.android.magnetic.stats:1.0.0') -define stream MagneticStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of MagneticStream) -begin - from MagneticStream - select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into MagneticStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/artifact.xml deleted file mode 100644 index 40f53b8c4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Magnetic-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/artifact.xml deleted file mode 100644 index bc5d59666..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_magnetic_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/iot_per_device_stream_android_magnetic_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/iot_per_device_stream_android_magnetic_stats.xml deleted file mode 100755 index 36bb991d8..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/iot_per_device_stream_android_magnetic_stats.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - axis - false - false - false - false - STRING - - - value - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.magnetic.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/artifact.xml deleted file mode 100644 index 96952ef7c..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot.per.device.stream.android.magnetic.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/iot.per.device.stream.android.magnetic.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/iot.per.device.stream.android.magnetic.stats_1.0.0.json deleted file mode 100755 index fb72355a3..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/iot.per.device.stream.android.magnetic.stats_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.magnetic.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/artifact.xml deleted file mode 100644 index c2f9fcbd7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.magnetic_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/iot.per.device.stream.android.magnetic_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/iot.per.device.stream.android.magnetic_1.0.0.json deleted file mode 100755 index 4bd43c399..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/iot.per.device.stream.android.magnetic_1.0.0.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "iot.per.device.stream.android.magnetic", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_executionplan/Android-Pressure-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_executionplan/Android-Pressure-ExecutionPlan.siddhiql deleted file mode 100755 index d5cb64bb3..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_executionplan/Android-Pressure-ExecutionPlan.siddhiql +++ /dev/null @@ -1,18 +0,0 @@ -@Plan:name('Android-Pressure-ExecutionPlan') - -@Plan:description('Process pressure changes.') - -@Import('iot.per.device.stream.android.pressure:1.0.0') -define stream PressureStream (meta_owner string, meta_deviceId string, meta_timestamp long, pressure float); - -@Export('iot.per.device.stream.android.pressure.stats:1.0.0') -define stream PressureStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, pressure float, year int, -month int, day int, hour int, minute int); - -partition with (meta_deviceId of PressureStream) -begin - from PressureStream - select meta_owner, meta_deviceId, meta_timestamp, pressure, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into PressureStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_executionplan/artifact.xml deleted file mode 100644 index f01be9b20..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_executionplan/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Android-Pressure-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_event_sink/artifact.xml deleted file mode 100644 index 365ae520a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_event_sink/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot_per_device_stream_android_pressure_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_event_sink/iot_per_device_stream_android_pressure_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_event_sink/iot_per_device_stream_android_pressure_stats.xml deleted file mode 100755 index 1b152c620..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_event_sink/iot_per_device_stream_android_pressure_stats.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - pressure - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.pressure.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_streams/artifact.xml deleted file mode 100644 index 6acb77773..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_streams/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot.per.device.stream.android.pressure.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_streams/iot.per.device.stream.android.pressure.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_streams/iot.per.device.stream.android.pressure.stats_1.0.0.json deleted file mode 100755 index 3fa0071b3..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_stats_streams/iot.per.device.stream.android.pressure.stats_1.0.0.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "iot.per.device.stream.android.pressure.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "pressure", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_streams/artifact.xml deleted file mode 100644 index 313dcdddf..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.pressure_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_streams/iot.per.device.stream.android.pressure_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_streams/iot.per.device.stream.android.pressure_1.0.0.json deleted file mode 100755 index 38d3c33c0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_pressure_streams/iot.per.device.stream.android.pressure_1.0.0.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "iot.per.device.stream.android.pressure", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "pressure", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_executionplan/Android-Proximity-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_executionplan/Android-Proximity-ExecutionPlan.siddhiql deleted file mode 100755 index cc7b33443..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_executionplan/Android-Proximity-ExecutionPlan.siddhiql +++ /dev/null @@ -1,18 +0,0 @@ -@Plan:name('Android-Proximity-ExecutionPlan') - -@Plan:description('Process proximity changes.') - -@Import('iot.per.device.stream.android.proximity:1.0.0') -define stream ProximityStream (meta_owner string, meta_deviceId string, meta_timestamp long, proximity float); - -@Export('iot.per.device.stream.android.proximity.stats:1.0.0') -define stream ProximityStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, proximity float, year int, -month int, day int, hour int, minute int); - -partition with (meta_deviceId of ProximityStream) -begin - from ProximityStream - select meta_owner, meta_deviceId, meta_timestamp, proximity, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into ProximityStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_executionplan/artifact.xml deleted file mode 100644 index bd310d7b2..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_executionplan/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Android-Proximity-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_event_sink/artifact.xml deleted file mode 100644 index 8a261bc14..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_event_sink/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot_per_device_stream_android_proximity_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_event_sink/iot_per_device_stream_android_proximity_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_event_sink/iot_per_device_stream_android_proximity_stats.xml deleted file mode 100755 index b6501a60e..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_event_sink/iot_per_device_stream_android_proximity_stats.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - proximity - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.proximity.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_streams/artifact.xml deleted file mode 100644 index 960a56b78..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_streams/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot.per.device.stream.android.proximity.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_streams/iot.per.device.stream.android.proximity.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_streams/iot.per.device.stream.android.proximity.stats_1.0.0.json deleted file mode 100755 index cef7398c4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_stats_streams/iot.per.device.stream.android.proximity.stats_1.0.0.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "iot.per.device.stream.android.proximity.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "proximity", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_streams/artifact.xml deleted file mode 100644 index 34322a592..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.proximity_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_streams/iot.per.device.stream.android.proximity_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_streams/iot.per.device.stream.android.proximity_1.0.0.json deleted file mode 100755 index 2e708cb56..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_proximity_streams/iot.per.device.stream.android.proximity_1.0.0.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "iot.per.device.stream.android.proximity", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "proximity", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/Android-Rotation-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/Android-Rotation-ExecutionPlan.siddhiql deleted file mode 100755 index 6df9bfbc1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/Android-Rotation-ExecutionPlan.siddhiql +++ /dev/null @@ -1,18 +0,0 @@ -@Plan:name('Android-Rotation-ExecutionPlan') - -@Plan:description('Process rotation field changes.') - -@Import('iot.per.device.stream.android.rotation:1.0.0') -define stream RotationStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); - -@Export('iot.per.device.stream.android.rotation.stats:1.0.0') -define stream RotationStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value -float, year int, month int, day int, hour int, minute int); - -partition with (meta_deviceId of RotationStream) -begin - from RotationStream - select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute - insert into RotationStatsStream; -end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/artifact.xml deleted file mode 100644 index eb2066187..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Android-Rotation-ExecutionPlan.siddhiql - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/artifact.xml deleted file mode 100644 index 3c132bce6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_rotation_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/iot_per_device_stream_android_rotation_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/iot_per_device_stream_android_rotation_stats.xml deleted file mode 100755 index 41ffd86c6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/iot_per_device_stream_android_rotation_stats.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - true - false - false - STRING - - - meta_timestamp - false - true - false - false - LONG - - - axis - false - false - false - false - STRING - - - value - false - false - false - false - FLOAT - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.rotation.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/artifact.xml deleted file mode 100644 index 77c5434d1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/artifact.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - iot.per.device.stream.android.rotation.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/iot.per.device.stream.android.rotation.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/iot.per.device.stream.android.rotation.stats_1.0.0.json deleted file mode 100755 index fb57c2d1b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/iot.per.device.stream.android.rotation.stats_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.rotation.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/artifact.xml deleted file mode 100644 index 7c54ec372..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.rotation_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/iot.per.device.stream.android.rotation_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/iot.per.device.stream.android.rotation_1.0.0.json deleted file mode 100755 index 315c0d130..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/iot.per.device.stream.android.rotation_1.0.0.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "iot.per.device.stream.android.rotation", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "axis", - "type": "STRING" - }, - { - "name": "value", - "type": "FLOAT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/AndroidScreenScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/AndroidScreenScript.xml deleted file mode 100644 index b6f18662a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/AndroidScreenScript.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - true - AndroidScreenScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/artifact.xml deleted file mode 100644 index e4d5fa9b4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidScreenScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_event_sink/artifact.xml deleted file mode 100644 index 1156683ff..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_screen_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_event_sink/iot_per_device_stream_android_screen_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_event_sink/iot_per_device_stream_android_screen_stats.xml deleted file mode 100755 index 4ad1912b6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_event_sink/iot_per_device_stream_android_screen_stats.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - duration - false - false - false - false - LONG - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.screen.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_streams/artifact.xml deleted file mode 100644 index a37831c8c..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.screen.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_streams/iot.per.device.stream.android.screen.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_streams/iot.per.device.stream.android.screen.stats_1.0.0.json deleted file mode 100755 index 361d31378..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_stats_streams/iot.per.device.stream.android.screen.stats_1.0.0.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "iot.per.device.stream.android.screen.stats", - "version": "1.0.0", - "nickName": "", - "description": "End stream of screen state staticstics", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "duration", - "type": "LONG" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_streams/artifact.xml deleted file mode 100644 index dadd3cc26..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.screen_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_streams/iot.per.device.stream.android.screen_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_streams/iot.per.device.stream.android.screen_1.0.0.json deleted file mode 100755 index 28161bd0b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_streams/iot.per.device.stream.android.screen_1.0.0.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "iot.per.device.stream.android.screen", - "version": "1.0.0", - "nickName": "", - "description": "Intermediate stream to map Android sense stream to screen execution plan", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "state", - "type": "STRING" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_publisher/android_sense_publisher.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_publisher/android_sense_publisher.xml deleted file mode 100644 index fcb3aadf1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_publisher/android_sense_publisher.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_publisher/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_publisher/artifact.xml deleted file mode 100644 index 319b77ccf..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_publisher/artifact.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - android_sense_publisher.xml - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/AndroidSmsScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/AndroidSmsScript.xml deleted file mode 100644 index 4e6c58286..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/AndroidSmsScript.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - true - AndroidSmsScript - - 0 0/5 * * * ? - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/artifact.xml deleted file mode 100644 index 7eb3150ac..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - AndroidSmsScript.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_event_sink/artifact.xml deleted file mode 100644 index cdc4b3901..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_event_sink/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot_per_device_stream_android_sms_stats.xml - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_event_sink/iot_per_device_stream_android_sms_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_event_sink/iot_per_device_stream_android_sms_stats.xml deleted file mode 100755 index 685b95b3d..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_event_sink/iot_per_device_stream_android_sms_stats.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - meta_owner - false - false - false - false - STRING - - - meta_deviceId - false - false - false - false - STRING - - - meta_timestamp - false - false - false - false - LONG - - - number - false - false - false - false - STRING - - - type - false - false - false - false - STRING - - - year - false - false - false - false - INTEGER - - - month - false - false - false - false - INTEGER - - - day - false - false - false - false - INTEGER - - - hour - false - false - false - false - INTEGER - - - minute - false - false - false - false - INTEGER - - - - iot.per.device.stream.android.sms.stats:1.0.0 - - false - EVENT_STORE - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_streams/artifact.xml deleted file mode 100644 index 0502b47f9..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.sms.stats_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_streams/iot.per.device.stream.android.sms.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_streams/iot.per.device.stream.android.sms.stats_1.0.0.json deleted file mode 100755 index 3a6864dab..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_stats_streams/iot.per.device.stream.android.sms.stats_1.0.0.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iot.per.device.stream.android.sms.stats", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "number", - "type": "STRING" - }, - { - "name": "type", - "type": "STRING" - }, - { - "name": "year", - "type": "INT" - }, - { - "name": "month", - "type": "INT" - }, - { - "name": "day", - "type": "INT" - }, - { - "name": "hour", - "type": "INT" - }, - { - "name": "minute", - "type": "INT" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_streams/artifact.xml deleted file mode 100644 index e7fc6f81f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_streams/artifact.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - iot.per.device.stream.android.sms_1.0.0.json - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_streams/iot.per.device.stream.android.sms_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_streams/iot.per.device.stream.android.sms_1.0.0.json deleted file mode 100755 index e35bda298..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_streams/iot.per.device.stream.android.sms_1.0.0.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "iot.per.device.stream.android.sms", - "version": "1.0.0", - "nickName": "", - "description": "", - "metaData": [ - { - "name": "owner", - "type": "STRING" - }, - { - "name": "deviceId", - "type": "STRING" - }, - { - "name": "timestamp", - "type": "LONG" - } - ], - "payloadData": [ - { - "name": "number", - "type": "STRING" - }, - { - "name": "type", - "type": "STRING" - }, - { - "name": "body", - "type": "STRING" - } - ] -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml deleted file mode 100644 index 18fc19e75..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml deleted file mode 100644 index 15f7513d4..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - androidsense-plugin - org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.iot.androidsense.api - war - WSO2 Carbon - Android Sense API - WSO2 Carbon - Android Sense Service-API Implementation - http://wso2.org - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - - - org.apache.axis2.wso2 - axis2-client - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs - provided - - - - - org.codehaus.jackson - jackson-core-asl - - - org.codehaus.jackson - jackson-jaxrs - - - javax - javaee-web-api - provided - - - javax.ws.rs - jsr311-api - provided - - - - org.wso2.carbon - org.wso2.carbon.utils - provided - - - org.bouncycastle.wso2 - bcprov-jdk15on - - - org.wso2.carbon - org.wso2.carbon.user.api - - - org.wso2.carbon - org.wso2.carbon.queuing - - - org.wso2.carbon - org.wso2.carbon.base - - - org.apache.axis2.wso2 - axis2 - - - org.igniterealtime.smack.wso2 - smack - - - org.igniterealtime.smack.wso2 - smackx - - - jaxen - jaxen - - - commons-fileupload.wso2 - commons-fileupload - - - org.apache.ant.wso2 - ant - - - org.apache.ant.wso2 - ant - - - commons-httpclient.wso2 - commons-httpclient - - - org.eclipse.equinox - javax.servlet - - - org.wso2.carbon - org.wso2.carbon.registry.api - - - - - org.wso2.carbon.analytics - org.wso2.carbon.analytics.api - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.identity.jwt.client.extension - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.application.extension - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.extensions - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.annotations - provided - - - - - - - - maven-compiler-plugin - - UTF-8 - ${wso2.maven.compiler.source} - ${wso2.maven.compiler.target} - - - - maven-war-plugin - - android_sense - - - - org.jacoco - jacoco-maven-plugin - - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/site - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java deleted file mode 100644 index bea044028..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseService.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.device.mgt.iot.androidsense.service.impl; - -import io.swagger.annotations.*; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.constants.AndroidSenseConstants; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Info; -import io.swagger.annotations.ResponseHeader; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; - -@SwaggerDefinition( - info = @Info( - version = "1.0.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", value = "android_sense"), - @ExtensionProperty(name = "context", value = "/android_sense"), - }) - } - ), - tags = { - @Tag(name = "android_sense,device_management", description = "") - } -) -@Scopes( - scopes = { - @Scope( - name = "Enroll device", - description = "", - key = "perm:android-sense:enroll", - permissions = {"/device-mgt/devices/enroll/android-sense"} - ) - } -) -@Api(value = "Android Sense Device Management", - description = "This carries all the resources related to the Android sense device management functionalities.") -public interface AndroidSenseService { - - /** - * Retrieve Sensor data for the device type - */ - @GET - @Path("stats/{deviceId}/sensors/{sensorName}") - @ApiOperation( - consumes = "application/json", - produces = "application/json", - httpMethod = "GET", - value = "Retrieve Sensor data for the device type", - notes = "", - response = Response.class, - tags = "android_sense", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK.", - response = Response.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - }), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid Device Identifiers found.", - response = Response.class), - @ApiResponse( - code = 401, - message = "Unauthorized. \n Unauthorized request."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Error on retrieving stats", - response = Response.class) - }) - Response getAndroidSenseDeviceStats( - @ApiParam( - name = "deviceId", - value = "The registered device Id.", - required = true) - @PathParam("deviceId") String deviceId, - @ApiParam( - name = "sensorName", - value = "Name of the sensor", - required = true) - @PathParam("sensorName") String sensor, - @ApiParam( - name = "from", - value = "Get stats from what time", - required = true) - @QueryParam("from") long from, - @ApiParam( - name = "to", - value = "Get stats up to what time", - required = true) - @QueryParam("to") long to); - - /** - * Enroll devices. - */ - @POST - @Path("device/{device_id}/register") - @ApiOperation( - httpMethod = "POST", - value = "Enroll device", - notes = "", - response = Response.class, - tags = "android_sense", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 202, - message = "Accepted.", - response = Response.class), - @ApiResponse( - code = 406, - message = "Not Acceptable"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Error on retrieving stats", - response = Response.class) - }) - Response register( - @ApiParam( - name = "deviceId", - value = "Device identifier id of the device to be added", - required = true) - @PathParam("device_id") String deviceId, - @ApiParam( - name = "deviceName", - value = "Device name of the device to be added", - required = true) - @QueryParam("deviceName") String deviceName); - -} - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseServiceImpl.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseServiceImpl.java deleted file mode 100644 index 24acb80f7..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseServiceImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.device.mgt.iot.androidsense.service.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.analytics.dataservice.commons.SortByField; -import org.wso2.carbon.analytics.dataservice.commons.SortType; -import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; -import org.wso2.carbon.device.mgt.common.*; -import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants; -import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.constants.AndroidSenseConstants; -import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.APIUtil; -import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.AndroidConfiguration; -import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.SensorRecord; - -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * This api is for Android Sense Device Type - */ -public class AndroidSenseServiceImpl implements AndroidSenseService { - - private static Log log = LogFactory.getLog(AndroidSenseServiceImpl.class); - - @Path("stats/{deviceId}/sensors/{sensorName}") - @GET - @Consumes("application/json") - @Produces("application/json") - public Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor, - @QueryParam("from") long from, @QueryParam("to") long to) { - String fromDate = String.valueOf(from); - String toDate = String.valueOf(to); - String query = "meta_deviceId:" + deviceId + " AND meta_timestamp : [" + fromDate + " TO " + toDate + "]"; - String sensorTableName = getSensorEventTableName(sensor); - - try { - if (!APIUtil.getDeviceAccessAuthorizationService().isUserAuthorized(new DeviceIdentifier(deviceId, - AndroidSenseConstants.DEVICE_TYPE), DeviceGroupConstants.Permissions.DEFAULT_STATS_MONITOR_PERMISSIONS)) { - return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); - } - List sensorDatas; - List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField("meta_timestamp", SortType.ASC); - sortByFields.add(sortByField); - sensorDatas = APIUtil.getAllEventsForDevice(sensorTableName, query, sortByFields); - return Response.ok().entity(sensorDatas).build(); - } catch (AnalyticsException e) { - String errorMsg = "Error on retrieving stats on table " + sensorTableName + " with query " + query; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(errorMsg).build(); - } catch (DeviceAccessAuthorizationException e) { - log.error(e.getErrorMessage()); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).build(); - } - } - - /** - * get the event table from the sensor name. - */ - private String getSensorEventTableName(String sensorName) { - String sensorEventTableName; - switch (sensorName) { - case AndroidSenseConstants.SENSOR_ACCELEROMETER: - sensorEventTableName = AndroidSenseConstants.SENSOR_ACCELEROMETER_TABLE; - break; - case AndroidSenseConstants.SENSOR_BATTERY: - sensorEventTableName = AndroidSenseConstants.SENSOR_BATTERY_TABLE; - break; - case AndroidSenseConstants.SENSOR_GRAVITY: - sensorEventTableName = AndroidSenseConstants.SENSOR_GRAVITY_TABLE; - break; - case AndroidSenseConstants.SENSOR_GYROSCOPE: - sensorEventTableName = AndroidSenseConstants.SENSOR_GYROSCOPE_TABLE; - break; - case AndroidSenseConstants.SENSOR_LIGHT: - sensorEventTableName = AndroidSenseConstants.SENSOR_LIGHT_TABLE; - break; - case AndroidSenseConstants.SENSOR_MAGNETIC: - sensorEventTableName = AndroidSenseConstants.SENSOR_MAGNETIC_TABLE; - break; - case AndroidSenseConstants.SENSOR_PRESSURE: - sensorEventTableName = AndroidSenseConstants.SENSOR_PRESSURE_TABLE; - break; - case AndroidSenseConstants.SENSOR_PROXIMITY: - sensorEventTableName = AndroidSenseConstants.SENSOR_PROXIMITY_TABLE; - break; - case AndroidSenseConstants.SENSOR_ROTATION: - sensorEventTableName = AndroidSenseConstants.SENSOR_ROTATION_TABLE; - break; - default: - sensorEventTableName = ""; - } - return sensorEventTableName; - } - - @Path("device/{device_id}/register") - @POST - public Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName) { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(deviceId); - deviceIdentifier.setType(AndroidSenseConstants.DEVICE_TYPE); - try { - Device enrolledDevice = APIUtil.getDeviceManagementService().getDevice(deviceIdentifier); - if (enrolledDevice != null && !enrolledDevice.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.REMOVED)) { - AndroidConfiguration androidConfiguration = new AndroidConfiguration(); - androidConfiguration.setTenantDomain(APIUtil.getAuthenticatedUserTenantDomain()); - androidConfiguration.setMqttEndpoint(APIUtil.getMqttEndpoint()); - return Response.status(Response.Status.ACCEPTED.getStatusCode()).entity(androidConfiguration.toString()) - .build(); - } - Device device = new Device(); - device.setDeviceIdentifier(deviceId); - EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); - enrolmentInfo.setDateOfEnrolment(new Date().getTime()); - enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); - enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE); - device.setName(deviceName); - device.setType(AndroidSenseConstants.DEVICE_TYPE); - enrolmentInfo.setOwner(APIUtil.getAuthenticatedUser()); - enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); - device.setEnrolmentInfo(enrolmentInfo); - boolean added = APIUtil.getDeviceManagementService().enrollDevice(device); - if (added) { - AndroidConfiguration androidConfiguration = new AndroidConfiguration(); - androidConfiguration.setTenantDomain(APIUtil.getAuthenticatedUserTenantDomain()); - androidConfiguration.setMqttEndpoint(APIUtil.getMqttEndpoint()); - return Response.ok(androidConfiguration.toString()).build(); - } else { - return Response.status(Response.Status.NOT_ACCEPTABLE.getStatusCode()).entity(false).build(); - } - } catch (DeviceManagementException e) { - log.error(e.getMessage(), e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(false).build(); - } catch (ConfigurationManagementException e) { - log.error(e.getMessage(), e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(false).build(); - } - } -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/constants/AndroidSenseConstants.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/constants/AndroidSenseConstants.java deleted file mode 100644 index 728aaf178..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/constants/AndroidSenseConstants.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2015, 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.device.mgt.iot.androidsense.service.impl.constants; - -public class AndroidSenseConstants { - - public final static String DEVICE_TYPE = "android_sense"; - - //Android Sensor names - public static final String SENSOR_ACCELEROMETER = "accelerometer"; - public static final String SENSOR_BATTERY = "battery"; - public static final String SENSOR_GRAVITY = "gravity"; - public static final String SENSOR_GYROSCOPE = "gyroscope"; - public static final String SENSOR_LIGHT = "light"; - public static final String SENSOR_MAGNETIC = "magnetic"; - public static final String SENSOR_PRESSURE = "pressure"; - public static final String SENSOR_PROXIMITY = "proximity"; - public static final String SENSOR_ROTATION = "rotation"; - - //Android Sensor table names - public static final String SENSOR_ACCELEROMETER_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_ACCELEROMETER_STATS"; - public static final String SENSOR_BATTERY_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_BATTERY_STATS"; - public static final String SENSOR_GRAVITY_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_GRAVITY_STATS"; - public static final String SENSOR_GYROSCOPE_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_GYROSCOPE_STATS"; - public static final String SENSOR_LIGHT_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_LIGHT_STATS"; - public static final String SENSOR_MAGNETIC_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_MAGNETIC_STATS"; - public static final String SENSOR_PRESSURE_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_PRESSURE_STATS"; - public static final String SENSOR_PROXIMITY_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_PROXIMITY_STATS"; - public static final String SENSOR_ROTATION_TABLE = "IOT_PER_DEVICE_STREAM_ANDROID_ROTATION_STATS"; - - //MQTT Subscribe topic - - //mqtt tranport related constants - public static final String MQTT_ADAPTER_TOPIC_PROPERTY_NAME = "mqtt.adapter.topic"; - - public static final String HOST_NAME = "HostName"; - public static final String LOCALHOST = "localhost"; - public static final String CONFIG_TYPE = "general"; - public static final String DEFAULT_ENDPOINT = "tcp://${mqtt.broker.host}:${mqtt.broker.port}"; - - public static final String SCOPE = "scope"; - - public static final String PERM_ENROLL_ANDROID_SENSE = "/permission/admin/device-mgt/devices/enroll/android-sense"; - public static final String PERM_OWNING_DEVICE_VIEW = "/permission/admin/device-mgt/devices/owning-device/view"; - - public static final String ROLE_NAME = "internal/devicemgt-user"; - -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/listener/AndroidSensePermissionUpdateListener.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/listener/AndroidSensePermissionUpdateListener.java deleted file mode 100644 index b29458e95..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/listener/AndroidSensePermissionUpdateListener.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2017, 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.device.mgt.iot.androidsense.service.impl.listener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.constants.AndroidSenseConstants; -import org.wso2.carbon.user.api.AuthorizationManager; -import org.wso2.carbon.user.api.Permission; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.api.UserStoreManager; -import org.wso2.carbon.user.core.service.RealmService; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -public class AndroidSensePermissionUpdateListener implements ServletContextListener { - - private static Log log = LogFactory.getLog(AndroidSensePermissionUpdateListener.class); - private static PrivilegedCarbonContext threadLocalCarbonContext; - private static RealmService realmService; - - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - realmService = (RealmService) threadLocalCarbonContext.getOSGiService(RealmService.class, null); - UserStoreManager userStoreManager = getUserStoreManager(); - try { - if (userStoreManager != null) { - if (!userStoreManager.isExistingRole(AndroidSenseConstants.ROLE_NAME)) { - userStoreManager.addRole(AndroidSenseConstants.ROLE_NAME, null, getPermissions()); - } else { - getAuthorizationManager().authorizeRole(AndroidSenseConstants.ROLE_NAME, - AndroidSenseConstants.PERM_ENROLL_ANDROID_SENSE, CarbonConstants.UI_PERMISSION_ACTION); - getAuthorizationManager().authorizeRole(AndroidSenseConstants.ROLE_NAME, - AndroidSenseConstants.PERM_OWNING_DEVICE_VIEW, CarbonConstants.UI_PERMISSION_ACTION); - } - } - } catch (UserStoreException e) { - log.error("Error while creating a role and adding a user for Android Sense.", e); - } - } - - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) { - - } - - private UserStoreManager getUserStoreManager() { - UserStoreManager userStoreManager; - try { - if (realmService == null) { - String msg = "Realm service has not initialized."; - throw new IllegalStateException(msg); - } - int tenantId = threadLocalCarbonContext.getTenantId(); - userStoreManager = realmService.getTenantUserRealm(tenantId).getUserStoreManager(); - realmService.getTenantUserRealm(tenantId).getAuthorizationManager(); - } catch (UserStoreException e) { - String msg = "Error occurred while retrieving current user store manager"; - throw new IllegalStateException(msg); - } - return userStoreManager; - } - - private AuthorizationManager getAuthorizationManager() { - AuthorizationManager authorizationManager; - try { - if (realmService == null) { - String msg = "Realm service has not initialized."; - throw new IllegalStateException(msg); - } - int tenantId = threadLocalCarbonContext.getTenantId(); - authorizationManager = realmService.getTenantUserRealm(tenantId).getAuthorizationManager(); - } catch (UserStoreException e) { - String msg = "Error occurred while retrieving current user store manager"; - throw new IllegalStateException(msg); - } - return authorizationManager; - } - - private Permission[] getPermissions() { - Permission androidSense = new Permission(AndroidSenseConstants.PERM_ENROLL_ANDROID_SENSE, - CarbonConstants.UI_PERMISSION_ACTION); - Permission view = new Permission(AndroidSenseConstants.PERM_OWNING_DEVICE_VIEW, - CarbonConstants.UI_PERMISSION_ACTION); - return new Permission[]{androidSense, view}; - } -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/APIUtil.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/APIUtil.java deleted file mode 100644 index 2f8d15644..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/APIUtil.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.analytics.api.AnalyticsDataAPI; -import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; -import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse; -import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry; -import org.wso2.carbon.analytics.dataservice.commons.SortByField; -import org.wso2.carbon.analytics.datasource.commons.Record; -import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; -import org.wso2.carbon.apimgt.application.extension.APIManagementProviderService; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.util.Utils; -import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; -import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.constants.AndroidSenseConstants; -import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; - -import java.net.SocketException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This class provides utility functions used by REST-API. - */ -public class APIUtil { - - private static Log log = LogFactory.getLog(APIUtil.class); - private static int maxEventCount = 100; - - public static String getAuthenticatedUser() { - PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - String username = threadLocalCarbonContext.getUsername(); - String tenantDomain = threadLocalCarbonContext.getTenantDomain(); - if (username.endsWith(tenantDomain)) { - return username.substring(0, username.lastIndexOf("@")); - } - return username; - } - - public static String getAuthenticatedUserTenantDomain() { - PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - return threadLocalCarbonContext.getTenantDomain(); - } - - public static DeviceManagementProviderService getDeviceManagementService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - DeviceManagementProviderService deviceManagementProviderService = - (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null); - if (deviceManagementProviderService == null) { - String msg = "Device Management service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return deviceManagementProviderService; - } - - public static AnalyticsDataAPI getAnalyticsDataAPI() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - AnalyticsDataAPI analyticsDataAPI = - (AnalyticsDataAPI) ctx.getOSGiService(AnalyticsDataAPI.class, null); - if (analyticsDataAPI == null) { - String msg = "Analytics api service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return analyticsDataAPI; - } - - public static List getAllEventsForDevice(String tableName, String query, - List sortByFields) throws AnalyticsException { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - AnalyticsDataAPI analyticsDataAPI = getAnalyticsDataAPI(); - int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query); - if (eventCount == 0) { - return null; - }else if(eventCount>maxEventCount){ - eventCount=maxEventCount; - } - List resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount, - sortByFields); - List recordIds = getRecordIds(resultEntries); - AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds); - Map sensorDatas = createSensorData(AnalyticsDataAPIUtil.listRecords( - analyticsDataAPI, response)); - List sortedSensorData = getSortedSensorData(sensorDatas, resultEntries); - return sortedSensorData; - } - - private static List getRecordIds(List searchResults) { - List ids = new ArrayList<>(); - for (SearchResultEntry searchResult : searchResults) { - ids.add(searchResult.getId()); - } - return ids; - } - - public static List getSortedSensorData(Map sensorDatas, - List searchResults) { - List sortedRecords = new ArrayList<>(); - for (SearchResultEntry searchResultEntry : searchResults) { - sortedRecords.add(sensorDatas.get(searchResultEntry.getId())); - } - return sortedRecords; - } - - /** - * Creates the SensorDatas from records. - * - * @param records the records - * @return the Map of SensorRecord - */ - public static Map createSensorData(List records) { - Map sensorDatas = new HashMap<>(); - for (Record record : records) { - SensorRecord sensorData = createSensorData(record); - sensorDatas.put(sensorData.getId(), sensorData); - } - return sensorDatas; - } - - /** - * Create a SensorRecord object out of a Record object - * - * @param record the record object - * @return SensorRecord object - */ - public static SensorRecord createSensorData(Record record) { - SensorRecord recordBean = new SensorRecord(); - recordBean.setId(record.getId()); - recordBean.setValues(record.getValues()); - return recordBean; - } - - public static APIManagementProviderService getAPIManagementProviderService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - APIManagementProviderService apiManagementProviderService = - (APIManagementProviderService) ctx.getOSGiService(APIManagementProviderService.class, null); - if (apiManagementProviderService == null) { - String msg = "API management provider service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return apiManagementProviderService; - } - - public static JWTClientManagerService getJWTClientManagerService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - JWTClientManagerService jwtClientManagerService = - (JWTClientManagerService) ctx.getOSGiService(JWTClientManagerService.class, null); - if (jwtClientManagerService == null) { - String msg = "JWT Client manager service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return jwtClientManagerService; - } - - public static DeviceAccessAuthorizationService getDeviceAccessAuthorizationService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - DeviceAccessAuthorizationService deviceAccessAuthorizationService = - (DeviceAccessAuthorizationService) ctx.getOSGiService(DeviceAccessAuthorizationService.class, null); - if (deviceAccessAuthorizationService == null) { - String msg = "Device Authorization service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return deviceAccessAuthorizationService; - } - - public static String getTenantDomainOftheUser() { - PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - return threadLocalCarbonContext.getTenantDomain(); - } - - public static PlatformConfigurationManagementService getTenantConfigurationManagementService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - PlatformConfigurationManagementService tenantConfigurationManagementService = - (PlatformConfigurationManagementService) ctx.getOSGiService(PlatformConfigurationManagementService.class, null); - if (tenantConfigurationManagementService == null) { - String msg = "Tenant configuration Management service not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return tenantConfigurationManagementService; - } - - public static String getMqttEndpoint() throws ConfigurationManagementException { - String iotServerIP = Utils.replaceSystemProperty(AndroidSenseConstants.DEFAULT_ENDPOINT); - iotServerIP = iotServerIP.replace(AndroidSenseConstants.LOCALHOST, getServerUrl());; - PlatformConfiguration configuration = APIUtil.getTenantConfigurationManagementService().getConfiguration( - AndroidSenseConstants.CONFIG_TYPE); - if (configuration != null && configuration.getConfiguration() != null && configuration - .getConfiguration().size() > 0) { - List configurations = configuration.getConfiguration(); - for (ConfigurationEntry configurationEntry : configurations) { - switch (configurationEntry.getName()) { - case "ANDROID_SENSE_MQTT_EP": - iotServerIP = (String)configurationEntry.getValue(); - break; - } - } - } - return iotServerIP; - } - - public static String getServerUrl() { - try { - return org.apache.axis2.util.Utils.getIpAddress(); - } catch (SocketException e) { - log.warn("Failed retrieving the hostname, therefore set to localhost", e); - return "localhost"; - } - } -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/AndroidConfiguration.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/AndroidConfiguration.java deleted file mode 100644 index 5fbd21ab3..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/AndroidConfiguration.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.device.mgt.iot.androidsense.service.impl.util; - -import org.json.simple.JSONObject; -import org.wso2.carbon.apimgt.application.extension.constants.ApiApplicationConstants; - -/** - * This holds the required configuration for agent to connect to the server. - */ -public class AndroidConfiguration { - public String tenantDomain; - public String mqttEndpoint; - - public String getTenantDomain() { - return tenantDomain; - } - - public void setTenantDomain(String tenantDomain) { - this.tenantDomain = tenantDomain; - } - - public String getMqttEndpoint() { - return mqttEndpoint; - } - - public void setMqttEndpoint(String mqttEndpoint) { - this.mqttEndpoint = mqttEndpoint; - } - - public String toString() { - JSONObject obj = new JSONObject(); - obj.put("tenantDomain", tenantDomain); - obj.put("mqttEndpoint", mqttEndpoint); - return obj.toString(); - } -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/SensorRecord.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/SensorRecord.java deleted file mode 100644 index 0948be589..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/SensorRecord.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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.device.mgt.iot.androidsense.service.impl.util; - -import org.codehaus.jackson.annotate.JsonIgnoreProperties; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -@XmlRootElement -/** - * This stores sensor event data for android sense. - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class SensorRecord { - - @XmlElementWrapper(required = true, name = "values") - private Map values; - - /** The id. */ - @XmlElement(required = false, name = "id") - private String id; - - /** - * Gets the values. - * @return the values - */ - public Map getValues() { - return values; - } - - /** - * Sets the values. - * @param values the values - */ - public void setValues(Map values) { - this.values = values; - } - - /** - * Sets the id. - * @param id the new id - */ - public void setId(String id) { - this.id = id; - } - - /** - * Gets the id. - * @return the id - */ - public String getId() { - return id; - } - - @Override - public String toString(){ - List valueList = new ArrayList(); - for (Map.Entry entry : values.entrySet()) { - valueList.add(entry.getKey() + ":" + entry.getValue()); - } - return valueList.toString(); - - } - -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/META-INF/permissions.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/META-INF/permissions.xml deleted file mode 100644 index 08889b601..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/META-INF/permissions.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - Set words - /device-mgt/user/operations - /device/*/words - POST - android_sense_user - - - set word threshold information - /device-mgt/user/operations - /device/*/words/threshold - POST - android_sense_user - - - delete words - /device-mgt/user/operations - /device/*/words - DELETE - android_sense_user - - - get device stats - /device-mgt/user/stats - /stats/*/sensors/* - GET - android_sense_device - - - Add device - /device-mgt/user/devices - /device/*/register - POST - android_sense_user - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index fa4461919..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - false - - - CXF,Carbon - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml deleted file mode 100644 index c82a0fc58..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 28b3d23f3..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - Android Sense - Android Sense - - - CXFServlet - org.apache.cxf.transport.servlet.CXFServlet - 1 - - - CXFServlet - /* - - - doAuthentication - true - - - isSharedWithAllTenants - true - - - - - managed-api-enabled - true - - - - org.wso2.carbon.device.mgt.iot.androidsense.service.impl.listener.AndroidSensePermissionUpdateListener - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml deleted file mode 100644 index 520d22943..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - androidsense-plugin - org.wso2.carbon.devicemgt-plugins - 5.0.7-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.iot.androidsense.ui - WSO2 Carbon - IoT Server Android Sense UI - pom - - - - - maven-assembly-plugin - 2.5.5 - - ${project.artifactId}-${carbon.devicemgt.plugins.version} - false - - src/assembly/src.xml - - - - - create-archive - package - - single - - - - - - - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/assembly/src.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/assembly/src.xml deleted file mode 100644 index 2797034e0..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/assembly/src.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - src - - zip - - false - ${basedir}/src - - - ${basedir}/src/main/resources/jaggeryapps/devicemgt - / - true - - - \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.hbs deleted file mode 100644 index 0817dd820..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.hbs +++ /dev/null @@ -1,55 +0,0 @@ -{{! - Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. licenses this file to you 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. -}} - -{{#zone "topCss"}} - {{css "css/custom.css"}} -{{/zone}} - - - - {{#each graphData}} - {{#each this}} - - - {{this}} - - - - - - - - lines - - stack - - - - - Time - - - - {{/each}} - {{/each}} - - -{{#zone "bottomJs"}} - {{js "js/android_sense.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.js deleted file mode 100644 index 8c5dfaf80..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -function onRequest(context) { - - var log = new Log("analytics-view.js"); - var user = context.user; - var graphData={}; - var graphType = request.getParameter("graphType"); - var graph =request.getParameter("sensor"); - graphData[graphType]=[graph]; - var deviceId = request.getParameter("deviceId"); - var deviceType = context.uriParams.deviceType; - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var device = deviceModule.viewDevice(deviceType, deviceId); - if (device && device.status != "error") { - return { - "device": device.content, - "backendApiUrl": "/android_sense/stats/" + deviceId + "/sensors/", - "graphData":graphData - }; - } else { - response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); - exit(); - } - -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.json deleted file mode 100644 index 688e93980..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/public/css/custom.css b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/public/css/custom.css deleted file mode 100644 index 56ac73ceb..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/public/css/custom.css +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -.chartWrapper { - position: relative; - margin-bottom: 40px; -} - -.chart-type-toggle { - background: #737373; - padding: 40px; - font-family: Arial; - font-size: 12px; - color: white; - display: inline-block; - padding: 5px 12px; - margin-top: 5px; - border-radius: 2px; - position: relative; - float: right; - white-space: nowrap; -} - -.y-axis-label { - position: absolute; - top: -40px; - font-weight: 400; - text-transform: capitalize; -} - -.x-axis-label { - position: absolute; - right: 0; - bottom: 40px; - font-weight: 400; - text-transform: capitalize; -} - -#dateRangePickerContainer{ - display: none; -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/public/js/android_sense.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/public/js/android_sense.js deleted file mode 100644 index 3de2154aa..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/public/js/android_sense.js +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -var palette = new Rickshaw.Color.Palette({scheme: "munin"}); -var graphMap = {}; - -function drawGraph_android_sense(from, to) { - - from = new Date(); - from.setDate(from.getDate()-1); - from.setHours(0,0,0,0); - from = parseInt(from.getTime()); - to = parseInt(new Date().getTime()); - - var devices = $("#android_sense-details").data("devices"); - var tzOffset = new Date().getTimezoneOffset() * 60; - - var streamIndex = 0; - var streams = ["battery", "light", "pressure", "proximity", "magnetic", "rotation", "gyroscope", "gravity", "accelerometer"]; - - var graphType = $(".y-axis-label").text(); - populateGraph(); - - function populateGraph() { - if (streams.indexOf(graphType) < 4) { - retrieveDataAndDrawGraph(graphType, from, to); - } else if (streams.indexOf(graphType) < 9) { - retrieveDataAndDrawMultiLineGraph(graphType, from, to); - } - } - - function clearContent(type) { - $("#y-axis-" + type).html(""); - $("#smoother-" + type).html(""); - $("#legend-" + type).html(""); - $("#chart-" + type).html(""); - $("#x_axis-" + type).html(""); - } - - function initGraph(type, isMultilined) { - if (graphMap[type]) { - return graphMap[type]; - } - - var chartWrapperElmId = "#android_sense-div-chart"; - var graphWidth = $(chartWrapperElmId).width() - 100; - - var graphConfig = { - element: document.getElementById("chart-" + type), - width: graphWidth, - height: 400, - strokeWidth: 2, - interpolation: "linear", - xScale: d3.time.scale(), - padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0.2}, - series: [] - }; - - if (devices) { - for (var i = 0; i < devices.length; i++) { - graphConfig['series'].push( - { - 'color': palette.color(), - 'data': [{ - x: parseInt(new Date().getTime() / 1000), - y: 0 - }], - 'name': devices[i].name - }); - } - } else { - if (isMultilined) { - graphConfig['series'].push( - { - 'color': palette.color(), - 'data': [{ - x: parseInt(new Date().getTime() / 1000), - y: 0 - }], - 'name': "x " + type - }, - { - 'color': palette.color(), - 'data': [{ - x: parseInt(new Date().getTime() / 1000), - y: 0 - }], - 'name': "y " + type - }, - { - 'color': palette.color(), - 'data': [{ - x: parseInt(new Date().getTime() / 1000), - y: 0 - }], - 'name': "z " + type - } - ); - } else { - graphConfig['series'].push( - { - 'color': palette.color(), - 'data': [{ - x: parseInt(new Date().getTime() / 1000), - y: 0 - }], - 'name': type - }); - } - } - - var graph = new Rickshaw.Graph(graphConfig); - - var xAxis = new Rickshaw.Graph.Axis.Time({ - graph: graph - }); - xAxis.render(); - - var yAxis = new Rickshaw.Graph.Axis.Y({ - graph: graph, - orientation: 'left', - width: 40, - height: 410, - tickFormat: Rickshaw.Fixtures.Number.formatKMBT, - element: document.getElementById("y-axis-" + type) - - }); - - yAxis.render(); - - var legend = new Rickshaw.Graph.Legend({ - graph: graph, - element: document.getElementById("legend-" + type) - }); - - var hoverDetail = new Rickshaw.Graph.HoverDetail({ - graph: graph, - formatter: function (series, x, y) { - var date = '' + - moment((x + tzOffset) * 1000).format('Do MMM YYYY h:mm:ss a') + ''; - var swatch = ''; - return swatch + series.name + ": " + parseInt(y) + '' + date; - } - }); - - new Rickshaw.Graph.Behavior.Series.Toggle({ - graph: graph, - legend: legend - }); - - new Rickshaw.Graph.Behavior.Series.Order({ - graph: graph, - legend: legend - }); - - new Rickshaw.Graph.Behavior.Series.Highlight({ - graph: graph, - legend: legend - }); - - graph.render(); - - graphMap[type] = {}; - graphMap[type].graph = graph; - graphMap[type].config = graphConfig; - return graphMap[type]; - } - - function retrieveDataAndDrawGraph(type, from, to) { - clearContent(type); - - var graphObj = initGraph(type, false); - var graph = graphObj.graph; - var graphConfig = graphObj.config; - var deviceIndex = 0; - - if (devices) { - getData(); - } else { - var backendApiUrl = $("#android_sense-div-chart").data("backend-api-url") + type + "?from=" + from + "&to=" + to; - var successCallback = function (data) { - if (data) { - drawGraph(JSON.parse(data)); - } - }; - invokerUtil.get(backendApiUrl, successCallback, function (message) { - }); - } - - function getData() { - if (deviceIndex >= devices.length) { - return; - } - var backendApiUrl = $("#android_sense-div-chart").data("backend-api-url") + devices[deviceIndex].deviceIdentifier - + "/sensors/" + type + "?from=" + from + "&to=" + to; - var successCallback = function (data) { - if (data) { - drawGraph(JSON.parse(data)); - } - deviceIndex++; - getData(); - }; - invokerUtil.get(backendApiUrl, successCallback, function (message) { - deviceIndex++; - getData(); - }); - } - - function drawGraph(data) { - if (data.length === 0 || data.length === undefined) { - return; - } - - var chartData = []; - for (var i = 0; i < data.length; i++) { - chartData.push( - { - x: parseInt((data[i].values.meta_timestamp - tzOffset)/1000), - y: parseInt(getFieldData(data[i], type)) - } - ); - } - graphConfig.series[deviceIndex].data = chartData; - graph.update(); - } - } - - function retrieveDataAndDrawMultiLineGraph(type, from, to) { - clearContent(type); - - var graphObj = initGraph(type, true); - var graph = graphObj.graph; - var graphConfig = graphObj.config; - - var deviceIndex = 0; - - if (devices) { - getData(); - } else { - var backendApiUrl = $("#android_sense-div-chart").data("backend-api-url") + type + "?from=" + from + "&to=" + to; - var successCallback = function (data) { - if (data) { - drawGraph(JSON.parse(data)); - } - }; - invokerUtil.get(backendApiUrl, successCallback, function (message) { - }); - } - - function getData() { - if (deviceIndex >= devices.length) { - populateGraph(); - return; - } - var backendApiUrl = $("#android_sense-div-chart").data("backend-api-url") + devices[deviceIndex].deviceIdentifier - + "/sensors/" + type + "?from=" + from + "&to=" + to; - var successCallback = function (data) { - if (data) { - drawGraph(JSON.parse(data)); - } - deviceIndex++; - getData(); - }; - invokerUtil.get(backendApiUrl, successCallback, function (message) { - deviceIndex++; - getData(); - }); - } - - function drawGraph(data) { - if (data.length === 0 || data.length === undefined) { - return; - } - - if (devices) { - var chartData = []; - for (var i = 0; i < data.length; i++) { - chartData.push( - { - x: parseInt(data[i].values.meta_timestamp) - tzOffset, - y: sqrt(pow(parseInt(data[i].values.Y), 2) + pow(parseInt(data[i].values.X), 2) + pow(parseInt(data[i].values.z), 2)) - }); - } - graphConfig.series[deviceIndex].data = chartData; - } else { - var chartDataX = [], chartDataY = [], chartDataZ = []; - for (var i = 0; i < data.length; i++) { - if (data[i].values.axis==="X"){ - chartDataX.push( - { - x: parseInt(((data[i].values.meta_timestamp) - tzOffset)/1000), - y: parseInt(data[i].values.value) - }); - }else if(data[i].values.axis==="Y"){ - chartDataY.push( - { - x: parseInt(((data[i].values.meta_timestamp) - tzOffset)/1000), - y: parseInt(data[i].values.value) - }); - }else if(data[i].values.axis==="Z"){ - chartDataZ.push( - { - x: parseInt(((data[i].values.meta_timestamp) - tzOffset)/1000), - y: parseInt(data[i].values.value) - }); - }else if(data[i].values.hasOwnProperty("x") && data[i].values.hasOwnProperty("y") && data[i].values.hasOwnProperty("z")){ - chartDataX.push( - { - x: parseInt(((data[i].values.meta_timestamp) - tzOffset)/1000), - y: parseInt(data[i].values.x) - }); - chartDataY.push( - { - x: parseInt(((data[i].values.meta_timestamp) - tzOffset)/1000), - y: parseInt(data[i].values.y) - }); - chartDataZ.push( - { - x: parseInt(((data[i].values.meta_timestamp) - tzOffset)/1000), - y: parseInt(data[i].values.z) - }); - } - - } - graphConfig.series[0].data = chartDataX; - graphConfig.series[1].data = chartDataY; - graphConfig.series[2].data = chartDataZ; - } - - graph.update(); - } - - } - - function getFieldData(data, type) { - var columnData; - switch (type) { - case "battery" : - columnData = data.values.level; - break; - case "light" : - columnData = data.values.light; - break; - case "proximity" : - columnData = data.values.proximity; - break; - case "pressure" : - columnData = data.values.pressure; - break; - } - - return columnData; - } -} - -$(document).ready(function() { - $("input:radio").click(function(e) { - var offsetMode = e.target.value; - var graphType = e.target.className; - - if (offsetMode == 'lines') { - graphMap[graphType].graph.setRenderer('line'); - graphMap[graphType].graph.offset = 'zero'; - } else { - graphMap[graphType].graph.setRenderer('stack'); - graphMap[graphType].graph.offset = offsetMode; - } - graphMap[graphType].graph.update(); - }); - -}); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs deleted file mode 100644 index 892d51803..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs +++ /dev/null @@ -1,82 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. licenses this file to you 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. -}} -{{#zone "topCss"}} - -{{/zone}} -{{#zone "device-thumbnail"}} - -{{/zone}} - -{{#zone "device-opetations"}} - -{{/zone}} - -{{#zone "device-details"}} - -{{/zone}} - -{{#zone "device-view-tabs"}} - Device - Statistics - - Device Location -{{/zone}} - -{{#zone "device-view-tab-contents"}} - - {{unit "cdmf.unit.device.type.android_sense.realtime.analytics-view" device=device}} - - - {{#if locationEnabled}} - - - - - - - {{unit "cdmf.unit.geo-dashboard" device=device noGeoFencing=false hideSearch=true}} - - {{else}} - - - - {{#if geoServicesEnabled}} - Device location information is not available. - {{else}} - Geo Location Based Services is not enabled. - {{/if}} - - - - - - {{/if}} - -{{/zone}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js deleted file mode 100644 index 68f5ae744..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -function onRequest(context) { - var log = new Log("device-view.js"); - var deviceType = context.uriParams.deviceType; - var deviceId = request.getParameter("id"); - var owner = request.getParameter("owner"); - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var autoCompleteParams = [ - {"name" : "deviceId", "value" : deviceId} - ]; - - if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var device = deviceModule.viewDevice(deviceType, deviceId, owner); - if (device && device.status != "error") { - var anchor = { "device" : { "id" : device.content.deviceIdentifier, "type" : device.content.type}}; - var viewObject = {}; - viewObject.device = device.content; - viewObject.autoCompleteParams = autoCompleteParams; - viewObject.encodedFeaturePayloads = ""; - viewObject.portalUrl = devicemgtProps['portalURL']; - viewObject.anchor = encodeURI(JSON.stringify(anchor)); - viewObject.locationHistory = stringify(device.content.locationHistory); - viewObject.locationEnabled = (device.content.locationHistory.length !== 0); - viewObject.geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.enabled; - return viewObject; - } else { - response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); - exit(); - } - } -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.json deleted file mode 100644 index 9eecd8f5b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/public/images/android-sense-icon.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/public/images/android-sense-icon.png deleted file mode 100644 index 4baf188bb..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/public/images/android-sense-icon.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/public/images/thumb.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/public/images/thumb.png deleted file mode 100644 index 1524c56fe..000000000 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/public/images/thumb.png and /dev/null differ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.hbs deleted file mode 100644 index dc7ac8fbb..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.hbs +++ /dev/null @@ -1,61 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. licenses this file to you 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. -}} - - - - Android Sense Configuration - - - - - - - - - Deploy Analytics Artifacts - - - - - - - - - - - - - - - - - - - - - - - - - - -{{#zone "bottomJs"}} - {{js "js/platform-configuration.js"}} -{{/zone}} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.js deleted file mode 100644 index 74111c244..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -function onRequest(context){ - var viewModel = {}; - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - viewModel["permissions"] = userModule.getUIPermissions(); - return viewModel; -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.json deleted file mode 100644 index fd2590129..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/configuration.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version" : "1.0.0" -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/public/js/platform-configuration.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/public/js/platform-configuration.js deleted file mode 100644 index 7c522fe6f..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration/public/js/platform-configuration.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -$(document).ready(function () { - invokerUtil.get( - "/api/device-mgt/android_sense/v1.0/configuration", - function (data) { - data = JSON.parse(data); - if (data && data.configuration) { - for (var i = 0; i < data.configuration.length; i++) { - var config = data.configuration[i]; - if (config.name == "ARDUINO_HTTP_IP") { - $("input#http-endpoint").val(config.value); - } else if (config.name == "ARDUINO_HTTP_PORT") { - $("input#https-endpoint").val(config.value); - } - } - } - }, function (data) { - console.log(data); - }); - -}); - - -// Start of HTML embedded invoke methods -var showAdvanceOperation = function (operation, button) { - $(button).addClass('selected'); - $(button).siblings().removeClass('selected'); - var hiddenOperation = ".wr-hidden-operations-content > div"; - $(hiddenOperation + '[data-operation="' + operation + '"]').show(); - $(hiddenOperation + '[data-operation="' + operation + '"]').siblings().hide(); -}; - -// Start of HTML embedded invoke methods -var addConfiguration = function () { - var errorMsgWrapper = "#android_sense-config-error-msg"; - var errorMsg = "#android_sense-config-error-msg span"; - var addConfigFormData = {}; - var configList = []; - var mqttEp = $("input#mqtt-endpoint").val(); - var mqttConfig = { - "name": "ANDROID_SENSE_MQTT_EP", - "value": String(mqttEp), - "contentType": "text" - }; - - configList.push(mqttConfig); - addConfigFormData.type = "android_sense"; - addConfigFormData.configuration = configList; - - var addConfigAPI = "/api/device-mgt/android_sense/v1.0/configuration"; - invokerUtil.post( - addConfigAPI, - addConfigFormData, - function (data) { - data = JSON.parse(data); - if (data.statusCode == 201) { - $("#config-save-form").addClass("hidden"); - $("#record-created-msg").removeClass("hidden"); - } else if (data == 500) { - $(errorMsg).text("Exception occurred at backend."); - } else if (data == 403) { - $(errorMsg).text("Action was not permitted."); - } else { - $(errorMsg).text("An unexpected error occurred."); - } - - $(errorMsgWrapper).removeClass("hidden"); - }, function (data) { - data = data.status; - if (data == 500) { - $(errorMsg).text("Exception occurred at backend."); - } else if (data == 403) { - $(errorMsg).text("Action was not permitted."); - } else { - $(errorMsg).text("An unexpected error occurred."); - } - $(errorMsgWrapper).removeClass("hidden"); - } - ); -}; - -var artifactUpload = function () { - var contentType = "application/json"; - var backendEndBasePath = "/api/device-mgt/v1.0"; - var urix = backendEndBasePath + "/admin/publish-artifact/deploy/android_sense"; - var defaultStatusClasses = "fw fw-stack-1x"; - var content = $("#androidsense-statistic-response-template").find(".content"); - var title = content.find("#title"); - var statusIcon = content.find("#status-icon"); - var data = {} - invokerUtil.post(urix, data, function (data) { - title.html("Deploying statistic artifacts. Please wait..."); - statusIcon.attr("class", defaultStatusClasses + " fw-check"); - $(modalPopupContent).html(content.html()); - showPopup(); - setTimeout(function () { - hidePopup(); - location.reload(true); - }, 5000); - - }, function (jqXHR) { - title.html("Failed to deploy artifacts, Please contact administrator."); - statusIcon.attr("class", defaultStatusClasses + " fw-error"); - $(modalPopupContent).html(content.html()); - showPopup(); - }, contentType); -}; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs deleted file mode 100644 index 4f18f97aa..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs +++ /dev/null @@ -1,70 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. licenses this file to you 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. -}} -{{unit "cdmf.unit.lib.rickshaw-graph"}} - -{{#zone "topCss"}} - {{css "css/custom.css"}} -{{/zone}} - - - - {{#each graphData}} - - {{#each this}} - - - - {{this}} - - - {{this}} - - - - - Time - - - - - - - - - - - - - - - - {{/each}} - - {{/each}} - - - - Realtime Analytics is not available. Failed to connect to the websocket. Please make sure; '$webSocketURL' is available and re-try again. - - -{{#zone "bottomJs"}} - {{js "js/moment.min.js"}} - {{js "js/socket.io.min.js"}} - {{js "js/device-stats.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.js deleted file mode 100644 index 27dd4d435..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -function onRequest(context) { - var log = new Log("stats.js"); - var carbonServer = require("carbon").server; - var device = context.unit.params.device; - - // graph configuration - var graphData = { - Sensors:["accelerometer","magnetic", "gravity", "pressure", "proximity", "gyroscope"], - Realtime_Data:['battery','light','rotation'] - }; - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - var constants = require("/app/modules/constants.js"); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var websocketEndpoint = devicemgtProps["wssURL"].replace("https", "wss"); - var jwtService = carbonServer.osgiService( - 'org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService'); - var jwtClient = jwtService.getJWTClient(); - var encodedClientKeys = session.get(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"]); - var token = ""; - var tokenPair = null; - var user = userModule.getCarbonUser(); - var tenantDomain = user.domain; - if (encodedClientKeys) { - var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"]; - var resp = tokenUtil.decode(encodedClientKeys).split(":"); - if (tenantDomain == "carbon.super") { - tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {}); - if (tokenPair) { - token = tokenPair.accessToken; - } - websocketEndpoint = websocketEndpoint + "/secured-websocket-proxy/org.wso2.iot.android.sense/1.0.0?" + - "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; - } else { - tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + tenantDomain,"default", {}); - if (tokenPair) { - token = tokenPair.accessToken; - } - websocketEndpoint = websocketEndpoint + "/secured-websocket-proxy/t/"+tenantDomain+"/org.wso2.iot.android.sense/1.0.0?" + - "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; - } - - } - return {"device": device, "websocketEndpoint": websocketEndpoint, "graphData":graphData}; -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.json deleted file mode 100644 index 688e93980..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/css/custom.css b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/css/custom.css deleted file mode 100644 index 0b018a267..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/css/custom.css +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -.no-gutters { - margin-right: 0; - margin-left: 0; -} - -.no-gutters > .col, -.no-gutters > [class*="col-"] { - padding-right: 0; - padding-left: 0; -} - -.details-view-toggle-button { - display: inline-block; -} - -.custom_x_axis { - position: static; -} - -.rickshaw_legend { - color: #000000; - background: #FFFFFF; - padding: 1px 2px; -} - -.sensor_graph{ - border:0.5px solid #cecece; - margin-bottom: 30px; - padding: 20px; -} - -.sensor_graph > h3 { - text-transform: capitalize; - margin-top: 5px; -} - -.chartWrapper { - padding-top: 20px; -} - -.col-md-6 { - transition: all 400ms ease; - opacity: 1; -} - -.max{ - width: 100%; -} - -.max_hide{ - display: none; -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js deleted file mode 100644 index b7ac7f692..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -var ws; -var typeId = 3; -var batteryId = 5; - -var accelerometer_xId = 11; -var accelerometer_yId = 12; -var accelerometer_zId = 13; - -var magnetic_xId = 16; -var magnetic_yId = 17; -var magnetic_zId = 18; - -var gyroscope_xId = 19; -var gyroscope_yId = 20; -var gyroscope_zId = 21; - -var lightId = 22; - -var pressureId = 23; - -var proximityId = 24; - -var gravity_xId = 25; -var gravity_yId = 26; -var gravity_zId = 27; - -var rotation_xId = 28; -var rotation_yId = 29; -var rotation_zId = 30; - -var batteryData = []; - -var lightData = []; - -var pressureData = []; - -var proximityData = []; - -var accelerometer_xData = []; -var accelerometer_yData = []; -var accelerometer_zData = []; - -var magnetic_xData = []; -var magnetic_yData = []; -var magnetic_zData = []; - -var gyroscope_xData = []; -var gyroscope_yData = []; -var gyroscope_zData = []; - -var gravity_xData = []; -var gravity_yData = []; -var gravity_zData = []; - -var rotation_xData = []; -var rotation_yData = []; -var rotation_zData = []; - -var graphMap = {}; -var graphSettingsMap = {}; - -var palette = new Rickshaw.Color.Palette({scheme: "munin"}); - -var elemTop; - -$(window).load(function () { - - graphMap["battery"]=lineGraph("battery", batteryData); - graphMap["light"]=lineGraph("light", lightData); - graphMap["pressure"]=lineGraph("pressure", pressureData); - graphMap["proximity"]=lineGraph("proximity", proximityData); - graphMap["accelerometer"]=threeDlineGraph("accelerometer", accelerometer_xData, accelerometer_yData, accelerometer_zData); - graphMap["magnetic"]=threeDlineGraph("magnetic", magnetic_xData, magnetic_yData, magnetic_zData); - graphMap["gyroscope"]=threeDlineGraph("gyroscope", gyroscope_xData, gyroscope_yData, gyroscope_zData); - graphMap["gravity"]=threeDlineGraph("gravity", gravity_xData, gravity_yData, gravity_zData); - graphMap["rotation"]=threeDlineGraph("rotation", rotation_xData, rotation_yData, rotation_zData); - - var websocketUrl = $("#stat-section").data("websocketurl"); - connect(websocketUrl) -}); - -window.onbeforeunload = function() { - disconnect(); -}; - -function threeDlineGraph(type, xChartData, yChartData, zChartData) { - var tNow = new Date().getTime() / 1000; - for (var i = 0; i < 30; i++) { - xChartData.push({ - x: tNow - (30 - i) * 15, - y: parseFloat(0) - }); - yChartData.push({ - x: tNow - (30 - i) * 15, - y: parseFloat(0) - }); - zChartData.push({ - x: tNow - (30 - i) * 15, - y: parseFloat(0) - }); - } - - var $elem = $("#chart-" + type); - - var graph = new Rickshaw.Graph({ - element: $elem[0], - width: $elem.width() - 100, - height: 300, - renderer: "line", - interpolation: "linear", - padding: {top: 0.2, left: 0.0, right: 0.0, bottom: 0.2}, - xScale: d3.time.scale(), - series: [ - {'color': palette.color(), 'data': xChartData, 'name': "x - " + type}, - {'color': palette.color(), 'data': yChartData, 'name': "y - " + type}, - {'color': palette.color(), 'data': zChartData, 'name': "z - " + type} - ] - }); - - var xAxis = new Rickshaw.Graph.Axis.Time({ - graph: graph - }); - - xAxis.render(); - - new Rickshaw.Graph.Axis.Y({ - graph: graph, - orientation: 'left', - height: 300, - tickFormat: Rickshaw.Fixtures.Number.formatKMBT, - element: document.getElementById("y-axis-"+type) - }); - - new Rickshaw.Graph.Legend({ - graph: graph, - element: document.getElementById('legend-' + type) - }); - - var detail = new Rickshaw.Graph.HoverDetail({ - graph: graph - }); - - new Rickshaw.Graph.HoverDetail({ - graph: graph, - formatter: function (series, x, y) { - var date = '' + moment(x * 1000).format('Do MMM YYYY h:mm:ss a') + ''; - var swatch = ''; - return swatch + series.name + ": " + parseInt(y) + '' + date; - } - }); - - graph.render(); - - return graph; -} - -function lineGraph(type, chartData) { - var tNow = new Date().getTime() / 1000; - for (var i = 0; i < 30; i++) { - chartData.push({ - x: tNow - (30 - i) * 15, - y: parseFloat(0) - }); - } - - var $elem = $("#chart-" + type); - - var graph = new Rickshaw.Graph({ - element: $elem[0], - width: $elem.width() - 100, - height: 300, - renderer: "line", - interpolation: "linear", - padding: {top: 0.2, left: 0.0, right: 0.0, bottom: 0.2}, - xScale: d3.time.scale(), - series: [{ - 'color': palette.color(), - 'data': chartData, - 'name': type - }] - }); - - var xAxis = new Rickshaw.Graph.Axis.Time({ - graph: graph - }); - - xAxis.render(); - - new Rickshaw.Graph.Axis.Y({ - graph: graph, - orientation: 'left', - height: 300, - tickFormat: Rickshaw.Fixtures.Number.formatKMBT, - element: document.getElementById('y-axis-'+type) - }); - - new Rickshaw.Graph.Legend({ - graph: graph, - element: document.getElementById('legend-' + type) - }); - - new Rickshaw.Graph.HoverDetail({ - graph: graph, - formatter: function (series, x, y) { - var date = '' + moment(x * 1000).format('Do MMM YYYY h:mm:ss a') + ''; - var swatch = ''; - return swatch + series.name + ": " + parseInt(y) + '' + date; - } - }); - - graph.render(); - - return graph; -} - -//websocket connection -function connect(target) { - if ('WebSocket' in window) { - ws = new WebSocket(target); - } else if ('MozWebSocket' in window) { - ws = new MozWebSocket(target); - } else { - console.log('WebSocket is not supported by this browser.'); - } - if (ws) { - ws.onmessage = function (event) { - var dataPoint = JSON.parse(event.data); - if (dataPoint) { - var time = parseInt(dataPoint[4]) / 1000; - switch (dataPoint[typeId]) { - case "battery": - graphUpdate(batteryData, time, dataPoint[batteryId]); - graphMap["battery"].update(); - break; - - case "light": - graphUpdate(lightData, time, dataPoint[lightId]); - graphMap["light"].update(); - break; - - case "pressure": - graphUpdate(pressureData, time, dataPoint[pressureId]); - graphMap["pressure"].update(); - break; - - case "proximity": - graphUpdate(proximityData, time, dataPoint[proximityId]); - graphMap["proximity"].update(); - break; - - case "accelerometer": - graphUpdate(accelerometer_xData, time, dataPoint[accelerometer_xId]); - graphUpdate(accelerometer_yData, time, dataPoint[accelerometer_yId]); - graphUpdate(accelerometer_zData, time, dataPoint[accelerometer_zId]); - graphMap["accelerometer"].update(); - break; - - case "magnetic": - graphUpdate(magnetic_xData, time, dataPoint[magnetic_xId]); - graphUpdate(magnetic_yData, time, dataPoint[magnetic_yId]); - graphUpdate(magnetic_zData, time, dataPoint[magnetic_zId]); - graphMap["magnetic"].update(); - break; - - case "gyroscope": - graphUpdate(gyroscope_xData, time, dataPoint[gyroscope_xId]); - graphUpdate(gyroscope_yData, time, dataPoint[gyroscope_yId]); - graphUpdate(gyroscope_zData, time, dataPoint[gyroscope_zId]); - graphMap["gyroscope"].update(); - break; - - case "rotation": - graphUpdate(magnetic_xData, time, dataPoint[rotation_xId]); - graphUpdate(magnetic_yData, time, dataPoint[rotation_yId]); - graphUpdate(magnetic_zData, time, dataPoint[rotation_zId]); - graphMap["rotation"].update(); - break; - - case "gravity": - graphUpdate(gravity_xData, time, dataPoint[gravity_xId]); - graphUpdate(gravity_yData, time, dataPoint[gravity_yId]); - graphUpdate(gravity_zData, time, dataPoint[gravity_zId]); - graphMap["gravity"].update(); - break; - } - } - }; - ws.onerror = function (event) { - var websocketURL = event.currentTarget.url; - websocketURL = websocketURL.replace("wss://","https://"); - var uriParts = websocketURL.split("/"); - websocketURL = uriParts[0] + "//" + uriParts[2]; - var errorMsg = $("#websocker-onerror").html(); - errorMsg = errorMsg.replace(new RegExp('\\$webSocketURL', 'g'), websocketURL); - $("#stat-section").html("" + errorMsg + ""); - }; - } -} - -function graphUpdate(chartData, xValue, yValue) { - chartData.push({ - x: parseInt(xValue), - y: parseFloat(yValue) - }); - chartData.shift(); -} - -function disconnect() { - if (ws != null) { - ws.close(); - ws = null; - } -} - -function maximizeGraph(graph, width,height){ - graphSettingsMap[graph.element.id] = {'width': graph.width, 'height': graph.height}; - graph.configure({ - width: width*2, - height: height*2 - - }); - graph.update(); -} - -function minimizeGraph(graph){ - var graphSettings = graphSettingsMap[graph.element.id]; - graph.configure({ - width: graphSettings.width, - height: graphSettings.height - }); - graph.update(); -} - -//maximize minimize functionality -$(".fw-expand").click(function(e) { - var innerGraph= graphMap[e.target.nextElementSibling.innerHTML]; - var width = $(".chartWrapper").width(); - var height = $(".chartWrapper").height(); - - if($(this).hasClass("default-view")){ - elemTop = $('#'+innerGraph.element.id).parents('.graph')[0].offsetTop; - $(this).removeClass("default-view"); - $(this).removeClass("fw-expand"); - $(this).addClass("fw-contract"); - maximizeGraph(innerGraph,width,height); - $(this).parent().parent().addClass("max"); - $(this).closest(".graph").siblings().addClass("max_hide"); - $(this).closest(".graph").parent().siblings().addClass("max_hide"); - }else{ - $(this).addClass("default-view"); - $(this).addClass("fw-expand"); - $(this).removeClass("fw-contract"); - minimizeGraph(innerGraph); - $(this).parent().parent().removeClass("max"); - $(this).closest(".graph").siblings().removeClass("max_hide"); - $(this).closest(".graph").parent().siblings().removeClass("max_hide"); - focusToArea() - } -}); - -//graph focusing function -function focusToArea(){ - var container = $("body"); - container.animate({ - scrollTop: elemTop - }); -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/moment.min.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/moment.min.js deleted file mode 100644 index 78e5aaadc..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/moment.min.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you 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. - */ - -//! moment.js -//! version : 2.10.2 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Ac.apply(null,arguments)}function b(a){Ac=a}function c(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}function e(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function f(a,b){var c,d=[];for(c=0;c0)for(c in Cc)d=Cc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function m(b){l(this,b),this._d=new Date(+b._d),Dc===!1&&(Dc=!0,a.updateOffset(this),Dc=!1)}function n(a){return a instanceof m||null!=a&&g(a,"_isAMomentObject")}function o(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function p(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&o(a[d])!==o(b[d]))&&g++;return g+f}function q(){}function r(a){return a?a.toLowerCase().replace("_","-"):a}function s(a){for(var b,c,d,e,f=0;f0;){if(d=t(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&p(e,c,!0)>=b-1)break;b--}f++}return null}function t(a){var b=null;if(!Ec[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Bc._abbr,require("./locale/"+a),u(b)}catch(c){}return Ec[a]}function u(a,b){var c;return a&&(c="undefined"==typeof b?w(a):v(a,b),c&&(Bc=c)),Bc._abbr}function v(a,b){return null!==b?(b.abbr=a,Ec[a]||(Ec[a]=new q),Ec[a].set(b),u(a),Ec[a]):(delete Ec[a],null)}function w(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Bc;if(!d(a)){if(b=t(a))return b;a=[a]}return s(a)}function x(a,b){var c=a.toLowerCase();Fc[c]=Fc[c+"s"]=Fc[b]=a}function y(a){return"string"==typeof a?Fc[a]||Fc[a.toLowerCase()]:void 0}function z(a){var b,c,d={};for(c in a)g(a,c)&&(b=y(c),b&&(d[b]=a[c]));return d}function A(b,c){return function(d){return null!=d?(C(this,b,d),a.updateOffset(this,c),this):B(this,b)}}function B(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function C(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function D(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=y(a),"function"==typeof this[a])return this[a](b);return this}function E(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthb;b++)d[b]=Jc[d[b]]?Jc[d[b]]:G(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function I(a,b){return a.isValid()?(b=J(b,a.localeData()),Ic[b]||(Ic[b]=H(b)),Ic[b](a)):a.localeData().invalidDate()}function J(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Hc.lastIndex=0;d>=0&&Hc.test(a);)a=a.replace(Hc,c),Hc.lastIndex=0,d-=1;return a}function K(a,b,c){Yc[a]="function"==typeof b?b:function(a){return a&&c?c:b}}function L(a,b){return g(Yc,a)?Yc[a](b._strict,b._locale):new RegExp(M(a))}function M(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function N(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=o(a)}),c=0;cd;d++){if(e=i([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function U(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),Q(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function V(b){return null!=b?(U(this,b),a.updateOffset(this,!0),this):B(this,"Month")}function W(){return Q(this.year(),this.month())}function X(a){var b,c=a._a;return c&&-2===a._pf.overflow&&(b=c[_c]<0||c[_c]>11?_c:c[ad]<1||c[ad]>Q(c[$c],c[_c])?ad:c[bd]<0||c[bd]>24||24===c[bd]&&(0!==c[cd]||0!==c[dd]||0!==c[ed])?bd:c[cd]<0||c[cd]>59?cd:c[dd]<0||c[dd]>59?dd:c[ed]<0||c[ed]>999?ed:-1,a._pf._overflowDayOfYear&&($c>b||b>ad)&&(b=ad),a._pf.overflow=b),a}function Y(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function Z(a,b){var c=!0;return h(function(){return c&&(Y(a),c=!1),b.apply(this,arguments)},b)}function $(a,b){hd[a]||(Y(b),hd[a]=!0)}function _(a){var b,c,d=a._i,e=id.exec(d);if(e){for(a._pf.iso=!0,b=0,c=jd.length;c>b;b++)if(jd[b][1].exec(d)){a._f=jd[b][0]+(e[6]||" ");break}for(b=0,c=kd.length;c>b;b++)if(kd[b][1].exec(d)){a._f+=kd[b][0];break}d.match(Vc)&&(a._f+="Z"),sa(a)}else a._isValid=!1}function aa(b){var c=ld.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(_(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ba(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function ca(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function da(a){return ea(a)?366:365}function ea(a){return a%4===0&&a%100!==0||a%400===0}function fa(){return ea(this.year())}function ga(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=za(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ha(a){return ga(a,this._week.dow,this._week.doy).week}function ia(){return this._week.dow}function ja(){return this._week.doy}function ka(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function la(a){var b=ga(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ma(a,b,c,d,e){var f,g,h=ca(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:da(a-1)+g}}function na(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oa(a,b,c){return null!=a?a:null!=b?b:c}function pa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function qa(a){var b,c,d,e,f=[];if(!a._d){for(d=pa(a),a._w&&null==a._a[ad]&&null==a._a[_c]&&ra(a),a._dayOfYear&&(e=oa(a._a[$c],d[$c]),a._dayOfYear>da(e)&&(a._pf._overflowDayOfYear=!0),c=ca(e,0,a._dayOfYear),a._a[_c]=c.getUTCMonth(),a._a[ad]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[bd]&&0===a._a[cd]&&0===a._a[dd]&&0===a._a[ed]&&(a._nextDay=!0,a._a[bd]=0),a._d=(a._useUTC?ca:ba).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[bd]=24)}}function ra(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=oa(b.GG,a._a[$c],ga(za(),1,4).year),d=oa(b.W,1),e=oa(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=oa(b.gg,a._a[$c],ga(za(),f,g).year),d=oa(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=ma(c,d,e,g,f),a._a[$c]=h.year,a._dayOfYear=h.dayOfYear}function sa(b){if(b._f===a.ISO_8601)return void _(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=J(b._f,b._locale).match(Gc)||[],c=0;c0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Jc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),P(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[bd]<=12&&(b._pf.bigHour=void 0),b._a[bd]=ta(b._locale,b._a[bd],b._meridiem),qa(b),X(b)}function ta(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function ua(a){var b,d,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;fg)&&(e=g,d=b));h(a,d||b)}function va(a){if(!a._d){var b=z(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],qa(a)}}function wa(a){var b,c=a._i,e=a._f;return a._locale=a._locale||w(a._l),null===c||void 0===e&&""===c?k({nullInput:!0}):("string"==typeof c&&(a._i=c=a._locale.preparse(c)),n(c)?new m(X(c)):(d(e)?ua(a):e?sa(a):xa(a),b=new m(X(a)),b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b))}function xa(b){var c=b._i;void 0===c?b._d=new Date:e(c)?b._d=new Date(+c):"string"==typeof c?aa(b):d(c)?(b._a=f(c.slice(0),function(a){return parseInt(a,10)}),qa(b)):"object"==typeof c?va(b):"number"==typeof c?b._d=new Date(c):a.createFromInputFallback(b)}function ya(a,b,d,e,f){var g={};return"boolean"==typeof d&&(e=d,d=void 0),g._isAMomentObject=!0,g._useUTC=g._isUTC=f,g._l=d,g._i=a,g._f=b,g._strict=e,g._pf=c(),wa(g)}function za(a,b,c,d){return ya(a,b,c,d,!1)}function Aa(a,b){var c,e;if(1===b.length&&d(b[0])&&(b=b[0]),!b.length)return za();for(c=b[0],e=1;ea&&(a=-a,c="-"),c+E(~~(a/60),2)+b+E(~~a%60,2)})}function Ga(a){var b=(a||"").match(Vc)||[],c=b[b.length-1]||[],d=(c+"").match(qd)||["-",0,0],e=+(60*d[1])+o(d[2]);return"+"===d[0]?e:-e}function Ha(b,c){var d,f;return c._isUTC?(d=c.clone(),f=(n(b)||e(b)?+b:+za(b))-+d,d._d.setTime(+d._d+f),a.updateOffset(d,!1),d):za(b).local();return c._isUTC?za(b).zone(c._offset||0):za(b).local()}function Ia(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ja(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ga(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ia(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?Za(this,Ua(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ia(this)}function Ka(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function La(a){return this.utcOffset(0,a)}function Ma(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ia(this),"m")),this}function Na(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ga(this._i)),this}function Oa(a){return a=a?za(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Pa(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Qa(){if(this._a){var a=this._isUTC?i(this._a):za(this._a);return this.isValid()&&p(this._a,a.toArray())>0}return!1}function Ra(){return!this._isUTC}function Sa(){return this._isUTC}function Ta(){return this._isUTC&&0===this._offset}function Ua(a,b){var c,d,e,f=a,h=null;return Ea(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(h=rd.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:o(h[ad])*c,h:o(h[bd])*c,m:o(h[cd])*c,s:o(h[dd])*c,ms:o(h[ed])*c}):(h=sd.exec(a))?(c="-"===h[1]?-1:1,f={y:Va(h[2],c),M:Va(h[3],c),d:Va(h[4],c),h:Va(h[5],c),m:Va(h[6],c),s:Va(h[7],c),w:Va(h[8],c)}):null==f?f={}:"object"==typeof f&&("from"in f||"to"in f)&&(e=Xa(za(f.from),za(f.to)),f={},f.ms=e.milliseconds,f.M=e.months),d=new Da(f),Ea(a)&&g(a,"_locale")&&(d._locale=a._locale),d}function Va(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Wa(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Xa(a,b){var c;return b=Ha(b,a),a.isBefore(b)?c=Wa(a,b):(c=Wa(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function Ya(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||($(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ua(c,d),Za(this,e,a),this}}function Za(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&C(b,"Date",B(b,"Date")+g*d),h&&U(b,B(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function $a(a){var b=a||za(),c=Ha(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,za(b)))}function _a(){return new m(this)}function ab(a,b){var c;return b=y("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=n(a)?a:za(a),+this>+a):(c=n(a)?+a:+za(a),c<+this.clone().startOf(b))}function bb(a,b){var c;return b=y("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=n(a)?a:za(a),+a>+this):(c=n(a)?+a:+za(a),+this.clone().endOf(b)a?Math.ceil(a):Math.floor(a)}function fb(a,b,c){var d,e,f=Ha(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=y(b),"year"===b||"month"===b||"quarter"===b?(e=gb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:eb(e)}function gb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function hb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ib(){var a=this.clone().utc();return 0b;b++)if(this._weekdaysParse[b]||(c=za([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Jb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Eb(a,this.localeData()),this.add(a-b,"d")):b}function Kb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Lb(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Mb(a,b){F(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Nb(a,b){return b._meridiemParse}function Ob(a){return"p"===(a+"").toLowerCase().charAt(0)}function Pb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Qb(a){F(0,[a,3],0,"millisecond")}function Rb(){return this._isUTC?"UTC":""}function Sb(){return this._isUTC?"Coordinated Universal Time":""}function Tb(a){return za(1e3*a)}function Ub(){return za.apply(null,arguments).parseZone()}function Vb(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function Wb(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b}function Xb(){return this._invalidDate}function Yb(a){return this._ordinal.replace("%d",a)}function Zb(a){return a}function $b(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function _b(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function ac(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function bc(a,b,c,d){var e=w(),f=i().set(d,b);return e[c](f,a)}function cc(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return bc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=bc(a,f,c,e);return g}function dc(a,b){return cc(a,b,"months",12,"month")}function ec(a,b){return cc(a,b,"monthsShort",12,"month")}function fc(a,b){return cc(a,b,"weekdays",7,"day")}function gc(a,b){return cc(a,b,"weekdaysShort",7,"day")}function hc(a,b){return cc(a,b,"weekdaysMin",7,"day")}function ic(){var a=this._data;return this._milliseconds=Od(this._milliseconds),this._days=Od(this._days),this._months=Od(this._months),a.milliseconds=Od(a.milliseconds),a.seconds=Od(a.seconds),a.minutes=Od(a.minutes),a.hours=Od(a.hours),a.months=Od(a.months),a.years=Od(a.years),this}function jc(a,b,c,d){var e=Ua(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function kc(a,b){return jc(this,a,b,1)}function lc(a,b){return jc(this,a,b,-1)}function mc(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;return g.milliseconds=d%1e3,a=eb(d/1e3),g.seconds=a%60,b=eb(a/60),g.minutes=b%60,c=eb(b/60),g.hours=c%24,e+=eb(c/24),h=eb(nc(e)),e-=eb(oc(h)),f+=eb(e/30),e%=30,h+=eb(f/12),f%=12,g.days=e,g.months=f,g.years=h,this}function nc(a){return 400*a/146097}function oc(a){return 146097*a/400}function pc(a){var b,c,d=this._milliseconds;if(a=y(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+12*nc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(oc(this._months/12)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 24*b*60+d/6e4;case"second":return 24*b*60*60+d/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+d;default:throw new Error("Unknown unit "+a)}}function qc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*o(this._months/12)}function rc(a){return function(){return this.as(a)}}function sc(a){return a=y(a),this[a+"s"]()}function tc(a){return function(){return this._data[a]}}function uc(){return eb(this.days()/7)}function vc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function wc(a,b,c){var d=Ua(a).abs(),e=ce(d.as("s")),f=ce(d.as("m")),g=ce(d.as("h")),h=ce(d.as("d")),i=ce(d.as("M")),j=ce(d.as("y")),k=e0,k[4]=c,vc.apply(null,k)}function xc(a,b){return void 0===de[a]?!1:void 0===b?de[a]:(de[a]=b,!0)}function yc(a){var b=this.localeData(),c=wc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function zc(){var a=ee(this.years()),b=ee(this.months()),c=ee(this.days()),d=ee(this.hours()),e=ee(this.minutes()),f=ee(this.seconds()+this.milliseconds()/1e3),g=this.asSeconds();return g?(0>g?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}var Ac,Bc,Cc=a.momentProperties=[],Dc=!1,Ec={},Fc={},Gc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Hc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ic={},Jc={},Kc=/\d/,Lc=/\d\d/,Mc=/\d{3}/,Nc=/\d{4}/,Oc=/[+-]?\d{6}/,Pc=/\d\d?/,Qc=/\d{1,3}/,Rc=/\d{1,4}/,Sc=/[+-]?\d{1,6}/,Tc=/\d+/,Uc=/[+-]?\d+/,Vc=/Z|[+-]\d\d:?\d\d/gi,Wc=/[+-]?\d+(\.\d{1,3})?/,Xc=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Yc={},Zc={},$c=0,_c=1,ad=2,bd=3,cd=4,dd=5,ed=6;F("M",["MM",2],"Mo",function(){return this.month()+1}),F("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),F("MMMM",0,0,function(a){return this.localeData().months(this,a)}),x("month","M"),K("M",Pc),K("MM",Pc,Lc),K("MMM",Xc),K("MMMM",Xc),N(["M","MM"],function(a,b){b[_c]=o(a)-1}),N(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[_c]=e:c._pf.invalidMonth=a});var fd="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),gd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),hd={};a.suppressDeprecationWarnings=!1;var id=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,jd=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],kd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ld=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=Z("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),F(0,["YY",2],0,function(){return this.year()%100}),F(0,["YYYY",4],0,"year"),F(0,["YYYYY",5],0,"year"),F(0,["YYYYYY",6,!0],0,"year"),x("year","y"),K("Y",Uc),K("YY",Pc,Lc),K("YYYY",Rc,Nc),K("YYYYY",Sc,Oc),K("YYYYYY",Sc,Oc),N(["YYYY","YYYYY","YYYYYY"],$c),N("YY",function(b,c){c[$c]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return o(a)+(o(a)>68?1900:2e3)};var md=A("FullYear",!1);F("w",["ww",2],"wo","week"),F("W",["WW",2],"Wo","isoWeek"),x("week","w"),x("isoWeek","W"),K("w",Pc),K("ww",Pc,Lc),K("W",Pc),K("WW",Pc,Lc),O(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=o(a)});var nd={dow:0,doy:6};F("DDD",["DDDD",3],"DDDo","dayOfYear"),x("dayOfYear","DDD"),K("DDD",Qc),K("DDDD",Mc),N(["DDD","DDDD"],function(a,b,c){c._dayOfYear=o(a)}),a.ISO_8601=function(){};var od=Z("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=za.apply(null,arguments);return this>a?this:a}),pd=Z("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=za.apply(null,arguments);return a>this?this:a});Fa("Z",":"),Fa("ZZ",""),K("Z",Vc),K("ZZ",Vc),N(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ga(a)});var qd=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var rd=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,sd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Ua.fn=Da.prototype;var td=Ya(1,"add"),ud=Ya(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var vd=Z("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});F(0,["gg",2],0,function(){return this.weekYear()%100}),F(0,["GG",2],0,function(){return this.isoWeekYear()%100}),xb("gggg","weekYear"),xb("ggggg","weekYear"),xb("GGGG","isoWeekYear"),xb("GGGGG","isoWeekYear"),x("weekYear","gg"),x("isoWeekYear","GG"),K("G",Uc),K("g",Uc),K("GG",Pc,Lc),K("gg",Pc,Lc),K("GGGG",Rc,Nc),K("gggg",Rc,Nc),K("GGGGG",Sc,Oc),K("ggggg",Sc,Oc),O(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=o(a)}),O(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),F("Q",0,0,"quarter"),x("quarter","Q"),K("Q",Kc),N("Q",function(a,b){b[_c]=3*(o(a)-1)}),F("D",["DD",2],"Do","date"),x("date","D"),K("D",Pc),K("DD",Pc,Lc),K("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),N(["D","DD"],ad),N("Do",function(a,b){b[ad]=o(a.match(Pc)[0],10)});var wd=A("Date",!0);F("d",0,"do","day"),F("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),F("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),F("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),F("e",0,0,"weekday"),F("E",0,0,"isoWeekday"),x("day","d"),x("weekday","e"),x("isoWeekday","E"),K("d",Pc),K("e",Pc),K("E",Pc),K("dd",Xc),K("ddd",Xc),K("dddd",Xc),O(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:c._pf.invalidWeekday=a}),O(["d","e","E"],function(a,b,c,d){b[d]=o(a)});var xd="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),yd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),zd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");F("H",["HH",2],0,"hour"),F("h",["hh",2],0,function(){return this.hours()%12||12}),Mb("a",!0),Mb("A",!1),x("hour","h"),K("a",Nb),K("A",Nb),K("H",Pc),K("h",Pc),K("HH",Pc,Lc),K("hh",Pc,Lc),N(["H","HH"],bd),N(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),N(["h","hh"],function(a,b,c){b[bd]=o(a),c._pf.bigHour=!0});var Ad=/[ap]\.?m?\.?/i,Bd=A("Hours",!0);F("m",["mm",2],0,"minute"),x("minute","m"),K("m",Pc),K("mm",Pc,Lc),N(["m","mm"],cd);var Cd=A("Minutes",!1);F("s",["ss",2],0,"second"),x("second","s"),K("s",Pc),K("ss",Pc,Lc),N(["s","ss"],dd);var Dd=A("Seconds",!1);F("S",0,0,function(){return~~(this.millisecond()/100)}),F(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Qb("SSS"),Qb("SSSS"),x("millisecond","ms"),K("S",Qc,Kc),K("SS",Qc,Lc),K("SSS",Qc,Mc),K("SSSS",Tc),N(["S","SS","SSS","SSSS"],function(a,b){b[ed]=o(1e3*("0."+a))});var Ed=A("Milliseconds",!1);F("z",0,0,"zoneAbbr"),F("zz",0,0,"zoneName");var Fd=m.prototype;Fd.add=td,Fd.calendar=$a,Fd.clone=_a,Fd.diff=fb,Fd.endOf=pb,Fd.format=jb,Fd.from=kb,Fd.fromNow=lb,Fd.get=D,Fd.invalidAt=wb,Fd.isAfter=ab,Fd.isBefore=bb,Fd.isBetween=cb,Fd.isSame=db,Fd.isValid=ub,Fd.lang=vd,Fd.locale=mb,Fd.localeData=nb,Fd.max=pd,Fd.min=od,Fd.parsingFlags=vb,Fd.set=D,Fd.startOf=ob,Fd.subtract=ud,Fd.toArray=tb,Fd.toDate=sb,Fd.toISOString=ib,Fd.toJSON=ib,Fd.toString=hb,Fd.unix=rb,Fd.valueOf=qb,Fd.year=md,Fd.isLeapYear=fa,Fd.weekYear=zb,Fd.isoWeekYear=Ab,Fd.quarter=Fd.quarters=Db,Fd.month=V,Fd.daysInMonth=W,Fd.week=Fd.weeks=ka,Fd.isoWeek=Fd.isoWeeks=la,Fd.weeksInYear=Cb,Fd.isoWeeksInYear=Bb,Fd.date=wd,Fd.day=Fd.days=Jb,Fd.weekday=Kb,Fd.isoWeekday=Lb,Fd.dayOfYear=na,Fd.hour=Fd.hours=Bd,Fd.minute=Fd.minutes=Cd,Fd.second=Fd.seconds=Dd,Fd.millisecond=Fd.milliseconds=Ed,Fd.utcOffset=Ja,Fd.utc=La,Fd.local=Ma,Fd.parseZone=Na,Fd.hasAlignedHourOffset=Oa,Fd.isDST=Pa,Fd.isDSTShifted=Qa,Fd.isLocal=Ra,Fd.isUtcOffset=Sa,Fd.isUtc=Ta,Fd.isUTC=Ta,Fd.zoneAbbr=Rb,Fd.zoneName=Sb,Fd.dates=Z("dates accessor is deprecated. Use date instead.",wd),Fd.months=Z("months accessor is deprecated. Use month instead",V),Fd.years=Z("years accessor is deprecated. Use year instead",md),Fd.zone=Z("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ka);var Gd=Fd,Hd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Id={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},Jd="Invalid date",Kd="%d",Ld=/\d{1,2}/,Md={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Nd=q.prototype;Nd._calendar=Hd,Nd.calendar=Vb,Nd._longDateFormat=Id,Nd.longDateFormat=Wb,Nd._invalidDate=Jd,Nd.invalidDate=Xb,Nd._ordinal=Kd,Nd.ordinal=Yb,Nd._ordinalParse=Ld, -Nd.preparse=Zb,Nd.postformat=Zb,Nd._relativeTime=Md,Nd.relativeTime=$b,Nd.pastFuture=_b,Nd.set=ac,Nd.months=R,Nd._months=fd,Nd.monthsShort=S,Nd._monthsShort=gd,Nd.monthsParse=T,Nd.week=ha,Nd._week=nd,Nd.firstDayOfYear=ja,Nd.firstDayOfWeek=ia,Nd.weekdays=Fb,Nd._weekdays=xd,Nd.weekdaysMin=Hb,Nd._weekdaysMin=zd,Nd.weekdaysShort=Gb,Nd._weekdaysShort=yd,Nd.weekdaysParse=Ib,Nd.isPM=Ob,Nd._meridiemParse=Ad,Nd.meridiem=Pb,u("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===o(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=Z("moment.lang is deprecated. Use moment.locale instead.",u),a.langData=Z("moment.langData is deprecated. Use moment.localeData instead.",w);var Od=Math.abs,Pd=rc("ms"),Qd=rc("s"),Rd=rc("m"),Sd=rc("h"),Td=rc("d"),Ud=rc("w"),Vd=rc("M"),Wd=rc("y"),Xd=tc("milliseconds"),Yd=tc("seconds"),Zd=tc("minutes"),$d=tc("hours"),_d=tc("days"),ae=tc("months"),be=tc("years"),ce=Math.round,de={s:45,m:45,h:22,d:26,M:11},ee=Math.abs,fe=Da.prototype;fe.abs=ic,fe.add=kc,fe.subtract=lc,fe.as=pc,fe.asMilliseconds=Pd,fe.asSeconds=Qd,fe.asMinutes=Rd,fe.asHours=Sd,fe.asDays=Td,fe.asWeeks=Ud,fe.asMonths=Vd,fe.asYears=Wd,fe.valueOf=qc,fe._bubble=mc,fe.get=sc,fe.milliseconds=Xd,fe.seconds=Yd,fe.minutes=Zd,fe.hours=$d,fe.days=_d,fe.weeks=uc,fe.months=ae,fe.years=be,fe.humanize=yc,fe.toISOString=zc,fe.toString=zc,fe.toJSON=zc,fe.locale=mb,fe.localeData=nb,fe.toIsoString=Z("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",zc),fe.lang=vd,F("X",0,0,"unix"),F("x",0,0,"valueOf"),K("x",Uc),K("X",Wc),N("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),N("x",function(a,b,c){c._d=new Date(o(a))}),a.version="2.10.2",b(za),a.fn=Gd,a.min=Ba,a.max=Ca,a.utc=i,a.unix=Tb,a.months=dc,a.isDate=e,a.locale=u,a.invalid=k,a.duration=Ua,a.isMoment=n,a.weekdays=fc,a.parseZone=Ub,a.localeData=w,a.isDuration=Ea,a.monthsShort=ec,a.weekdaysMin=hc,a.defineLocale=v,a.weekdaysShort=gc,a.normalizeUnits=y,a.relativeTimeThreshold=xc;var ge=a;return ge}); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/socket.io.min.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/socket.io.min.js deleted file mode 100644 index 7e870c986..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/socket.io.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! Socket.IO.min.js build:0.9.16, production. Copyright(c) 2011 LearnBoost MIT Licensed */ -var io="undefined"==typeof module?{}:module.exports;(function(){(function(a,b){var c=a;c.version="0.9.16",c.protocol=1,c.transports=[],c.j=[],c.sockets={},c.connect=function(a,d){var e=c.util.parseUri(a),f,g;b&&b.location&&(e.protocol=e.protocol||b.location.protocol.slice(0,-1),e.host=e.host||(b.document?b.document.domain:b.location.hostname),e.port=e.port||b.location.port),f=c.util.uniqueUri(e);var h={host:e.host,secure:"https"==e.protocol,port:e.port||("https"==e.protocol?443:80),query:e.query||""};c.util.merge(h,d);if(h["force new connection"]||!c.sockets[f])g=new c.Socket(h);return!h["force new connection"]&&g&&(c.sockets[f]=g),g=g||c.sockets[f],g.of(e.path.length>1?e.path:"")}})("object"==typeof module?module.exports:this.io={},this),function(a,b){var c=a.util={},d=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];c.parseUri=function(a){var b=d.exec(a||""),c={},f=14;while(f--)c[e[f]]=b[f]||"";return c},c.uniqueUri=function(a){var c=a.protocol,d=a.host,e=a.port;return"document"in b?(d=d||document.domain,e=e||(c=="https"&&document.location.protocol!=="https:"?443:document.location.port)):(d=d||"localhost",!e&&c=="https"&&(e=443)),(c||"http")+"://"+d+":"+(e||80)},c.query=function(a,b){var d=c.chunkQuery(a||""),e=[];c.merge(d,c.chunkQuery(b||""));for(var f in d)d.hasOwnProperty(f)&&e.push(f+"="+d[f]);return e.length?"?"+e.join("&"):""},c.chunkQuery=function(a){var b={},c=a.split("&"),d=0,e=c.length,f;for(;db.length?a:b,f=a.length>b.length?b:a;for(var g=0,h=f.length;g0&&a.splice(0,1)[0]!=c.transport.name);a.length?h(a):c.publish("connect_failed")}}},c.options["connect timeout"]))})}c.sessionid=d,c.closeTimeout=f*1e3,c.heartbeatTimeout=e*1e3,c.transports||(c.transports=c.origTransports=g?b.util.intersect(g.split(","),c.options.transports):c.options.transports),c.setHeartbeatTimeout(),h(c.transports),c.once("connect",function(){clearTimeout(c.connectTimeoutTimer),a&&typeof a=="function"&&a()})}),this},d.prototype.setHeartbeatTimeout=function(){clearTimeout(this.heartbeatTimeoutTimer);if(this.transport&&!this.transport.heartbeats())return;var a=this;this.heartbeatTimeoutTimer=setTimeout(function(){a.transport.onClose()},this.heartbeatTimeout)},d.prototype.packet=function(a){return this.connected&&!this.doBuffer?this.transport.packet(a):this.buffer.push(a),this},d.prototype.setBuffer=function(a){this.doBuffer=a,!a&&this.connected&&this.buffer.length&&(this.options.manualFlush||this.flushBuffer())},d.prototype.flushBuffer=function(){this.transport.payload(this.buffer),this.buffer=[]},d.prototype.disconnect=function(){if(this.connected||this.connecting)this.open&&this.of("").packet({type:"disconnect"}),this.onDisconnect("booted");return this},d.prototype.disconnectSync=function(){var a=b.util.request(),c=["http"+(this.options.secure?"s":"")+":/",this.options.host+":"+this.options.port,this.options.resource,b.protocol,"",this.sessionid].join("/")+"/?disconnect=1";a.open("GET",c,!1),a.send(null),this.onDisconnect("booted")},d.prototype.isXDomain=function(){var a=c.location.port||("https:"==c.location.protocol?443:80);return this.options.host!==c.location.hostname||this.options.port!=a},d.prototype.onConnect=function(){this.connected||(this.connected=!0,this.connecting=!1,this.doBuffer||this.setBuffer(!1),this.emit("connect"))},d.prototype.onOpen=function(){this.open=!0},d.prototype.onClose=function(){this.open=!1,clearTimeout(this.heartbeatTimeoutTimer)},d.prototype.onPacket=function(a){this.of(a.endpoint).onPacket(a)},d.prototype.onError=function(a){a&&a.advice&&a.advice==="reconnect"&&(this.connected||this.connecting)&&(this.disconnect(),this.options.reconnect&&this.reconnect()),this.publish("error",a&&a.reason?a.reason:a)},d.prototype.onDisconnect=function(a){var b=this.connected,c=this.connecting;this.connected=!1,this.connecting=!1,this.open=!1;if(b||c)this.transport.close(),this.transport.clearTimeouts(),b&&(this.publish("disconnect",a),"booted"!=a&&this.options.reconnect&&!this.reconnecting&&this.reconnect())},d.prototype.reconnect=function(){function e(){if(a.connected){for(var b in a.namespaces)a.namespaces.hasOwnProperty(b)&&""!==b&&a.namespaces[b].packet({type:"connect"});a.publish("reconnect",a.transport.name,a.reconnectionAttempts)}clearTimeout(a.reconnectionTimer),a.removeListener("connect_failed",f),a.removeListener("connect",f),a.reconnecting=!1,delete a.reconnectionAttempts,delete a.reconnectionDelay,delete a.reconnectionTimer,delete a.redoTransports,a.options["try multiple transports"]=c}function f(){if(!a.reconnecting)return;if(a.connected)return e();if(a.connecting&&a.reconnecting)return a.reconnectionTimer=setTimeout(f,1e3);a.reconnectionAttempts++>=b?a.redoTransports?(a.publish("reconnect_failed"),e()):(a.on("connect_failed",f),a.options["try multiple transports"]=!0,a.transports=a.origTransports,a.transport=a.getTransport(),a.redoTransports=!0,a.connect()):(a.reconnectionDelay=10:!1},c.xdomainCheck=function(){return!0},typeof window!="undefined"&&(WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0),b.transports.push("flashsocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);if("undefined"!=typeof window)var swfobject=function(){function A(){if(t)return;try{var a=i.getElementsByTagName("body")[0].appendChild(Q("span"));a.parentNode.removeChild(a)}catch(b){return}t=!0;var c=l.length;for(var d=0;d0)for(var c=0;c0){var g=P(d);if(g)if(S(m[c].swfVersion)&&!(y.wk&&y.wk<312))U(d,!0),e&&(f.success=!0,f.ref=G(d),e(f));else if(m[c].expressInstall&&H()){var h={};h.data=m[c].expressInstall,h.width=g.getAttribute("width")||"0",h.height=g.getAttribute("height")||"0",g.getAttribute("class")&&(h.styleclass=g.getAttribute("class")),g.getAttribute("align")&&(h.align=g.getAttribute("align"));var i={},j=g.getElementsByTagName("param"),k=j.length;for(var l=0;l');h.outerHTML='"+k+"",n[n.length]=c.id,g=P(c.id)}else{var m=Q(b);m.setAttribute("type",e);for(var o in c)c[o]!=Object.prototype[o]&&(o.toLowerCase()=="styleclass"?m.setAttribute("class",c[o]):o.toLowerCase()!="classid"&&m.setAttribute(o,c[o]));for(var p in d)d[p]!=Object.prototype[p]&&p.toLowerCase()!="movie"&&M(m,p,d[p]);h.parentNode.replaceChild(m,h),g=m}}return g}function M(a,b,c){var d=Q("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)}function N(a){var b=P(a);b&&b.nodeName=="OBJECT"&&(y.ie&&y.win?(b.style.display="none",function(){b.readyState==4?O(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function O(a){var b=P(a);if(b){for(var c in b)typeof b[c]=="function"&&(b[c]=null);b.parentNode.removeChild(b)}}function P(a){var b=null;try{b=i.getElementById(a)}catch(c){}return b}function Q(a){return i.createElement(a)}function R(a,b,c){a.attachEvent(b,c),o[o.length]=[a,b,c]}function S(a){var b=y.pv,c=a.split(".");return c[0]=parseInt(c[0],10),c[1]=parseInt(c[1],10)||0,c[2]=parseInt(c[2],10)||0,b[0]>c[0]||b[0]==c[0]&&b[1]>c[1]||b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]?!0:!1}function T(c,d,e,f){if(y.ie&&y.mac)return;var g=i.getElementsByTagName("head")[0];if(!g)return;var h=e&&typeof e=="string"?e:"screen";f&&(v=null,w=null);if(!v||w!=h){var j=Q("style");j.setAttribute("type","text/css"),j.setAttribute("media",h),v=g.appendChild(j),y.ie&&y.win&&typeof i.styleSheets!=a&&i.styleSheets.length>0&&(v=i.styleSheets[i.styleSheets.length-1]),w=h}y.ie&&y.win?v&&typeof v.addRule==b&&v.addRule(c,d):v&&typeof i.createTextNode!=a&&v.appendChild(i.createTextNode(c+" {"+d+"}"))}function U(a,b){if(!x)return;var c=b?"visible":"hidden";t&&P(a)?P(a).style.visibility=c:T("#"+a,"visibility:"+c)}function V(b){var c=/[\\\"<>\.;]/,d=c.exec(b)!=null;return d&&typeof encodeURIComponent!=a?encodeURIComponent(b):b}var a="undefined",b="object",c="Shockwave Flash",d="ShockwaveFlash.ShockwaveFlash",e="application/x-shockwave-flash",f="SWFObjectExprInst",g="onreadystatechange",h=window,i=document,j=navigator,k=!1,l=[D],m=[],n=[],o=[],p,q,r,s,t=!1,u=!1,v,w,x=!0,y=function(){var f=typeof i.getElementById!=a&&typeof i.getElementsByTagName!=a&&typeof i.createElement!=a,g=j.userAgent.toLowerCase(),l=j.platform.toLowerCase(),m=l?/win/.test(l):/win/.test(g),n=l?/mac/.test(l):/mac/.test(g),o=/webkit/.test(g)?parseFloat(g.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,p=!1,q=[0,0,0],r=null;if(typeof j.plugins!=a&&typeof j.plugins[c]==b)r=j.plugins[c].description,r&&(typeof j.mimeTypes==a||!j.mimeTypes[e]||!!j.mimeTypes[e].enabledPlugin)&&(k=!0,p=!1,r=r.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),q[0]=parseInt(r.replace(/^(.*)\..*$/,"$1"),10),q[1]=parseInt(r.replace(/^.*\.(.*)\s.*$/,"$1"),10),q[2]=/[a-zA-Z]/.test(r)?parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof h[["Active"].concat("Object").join("X")]!=a)try{var s=new(window[["Active"].concat("Object").join("X")])(d);s&&(r=s.GetVariable("$version"),r&&(p=!0,r=r.split(" ")[1].split(","),q=[parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)]))}catch(t){}return{w3:f,pv:q,wk:o,ie:p,win:m,mac:n}}(),z=function(){if(!y.w3)return;(typeof i.readyState!=a&&i.readyState=="complete"||typeof i.readyState==a&&(i.getElementsByTagName("body")[0]||i.body))&&A(),t||(typeof i.addEventListener!=a&&i.addEventListener("DOMContentLoaded",A,!1),y.ie&&y.win&&(i.attachEvent(g,function(){i.readyState=="complete"&&(i.detachEvent(g,arguments.callee),A())}),h==top&&function(){if(t)return;try{i.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}A()}()),y.wk&&function(){if(t)return;if(!/loaded|complete/.test(i.readyState)){setTimeout(arguments.callee,0);return}A()}(),C(A))}(),W=function(){y.ie&&y.win&&window.attachEvent("onunload",function(){var a=o.length;for(var b=0;b= 10.0.0 is required.");return}location.protocol=="file:"&&a.error("WARNING: web-socket-js doesn't work in file:///... URL unless you set Flash Security Settings properly. Open the page via Web server i.e. http://..."),WebSocket=function(a,b,c,d,e){var f=this;f.__id=WebSocket.__nextId++,WebSocket.__instances[f.__id]=f,f.readyState=WebSocket.CONNECTING,f.bufferedAmount=0,f.__events={},b?typeof b=="string"&&(b=[b]):b=[],setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(f.__id,a,b,c||null,d||0,e||null)})},0)},WebSocket.prototype.send=function(a){if(this.readyState==WebSocket.CONNECTING)throw"INVALID_STATE_ERR: Web Socket connection has not been established";var b=WebSocket.__flash.send(this.__id,encodeURIComponent(a));return b<0?!0:(this.bufferedAmount+=b,!1)},WebSocket.prototype.close=function(){if(this.readyState==WebSocket.CLOSED||this.readyState==WebSocket.CLOSING)return;this.readyState=WebSocket.CLOSING,WebSocket.__flash.close(this.__id)},WebSocket.prototype.addEventListener=function(a,b,c){a in this.__events||(this.__events[a]=[]),this.__events[a].push(b)},WebSocket.prototype.removeEventListener=function(a,b,c){if(!(a in this.__events))return;var d=this.__events[a];for(var e=d.length-1;e>=0;--e)if(d[e]===b){d.splice(e,1);break}},WebSocket.prototype.dispatchEvent=function(a){var b=this.__events[a.type]||[];for(var c=0;c