Merge pull request #450 from menakaj/android-sense-agent-fixes

Android sense agent fixes
merge-requests/1/head
sinthuja 8 years ago committed by GitHub
commit 59fd3a6fc7

@ -29,9 +29,9 @@ import org.wso2.carbon.iot.android.sense.constants.SenseConstants;
import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.AndroidSenseMQTTHandler;
import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.transport.MQTTTransportHandler;
import org.wso2.carbon.iot.android.sense.data.publisher.mqtt.transport.TransportHandlerException;
import org.wso2.carbon.iot.android.sense.event.streams.Location.LocationData;
import org.wso2.carbon.iot.android.sense.event.streams.Sensor.SensorData;
import org.wso2.carbon.iot.android.sense.event.streams.Speed.SpeedData;
import org.wso2.carbon.iot.android.sense.event.streams.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;

@ -15,10 +15,9 @@
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.beacon.MonitoringActivity;
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;
/**

@ -0,0 +1,60 @@
/*
* 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 java.util.Date;
public class NetworkData {
//Mobile or Wifi
private String DATA_TYPE;
private long dataReceived;
private long dataSent;
private long timeStamp;
public NetworkData(long received, long sent) {
this.dataReceived = received;
this.dataSent = sent;
this.timeStamp = new Date().getTime();
}
public String getDataType() {
return DATA_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;
}
}

@ -0,0 +1,42 @@
/*
* 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.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.wso2.carbon.iot.android.sense.util.SenseDataHolder;
public class NetworkDataReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
long sent = android.net.TrafficStats.getTotalTxBytes();
long received = android.net.TrafficStats.getTotalRxBytes();
Log.d("NetworkData :", "Received: " + sent + " Received : " + received);
NetworkData networkData = new NetworkData(received, sent);
SenseDataHolder.getNetworkDataHolder().add(networkData);
}
}

@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and limitations under the License.
*
*/
package org.wso2.carbon.iot.android.sense.event.streams.Location;
package org.wso2.carbon.iot.android.sense.event.streams.location;
import java.util.Date;

@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and limitations under the License.
*
*/
package org.wso2.carbon.iot.android.sense.event.streams.Location;
package org.wso2.carbon.iot.android.sense.event.streams.location;
import android.content.Context;
import android.content.Intent;

@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and limitations under the License.
*
*/
package org.wso2.carbon.iot.android.sense.event.streams.Sensor;
package org.wso2.carbon.iot.android.sense.event.streams.sensor;
import android.content.Context;
import android.content.SharedPreferences;

@ -12,10 +12,10 @@
*
*/
package org.wso2.carbon.iot.android.sense.event.streams.Speed;
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.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;
@ -37,9 +37,6 @@ import java.util.concurrent.TimeUnit;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.app.Activity;
import org.wso2.carbon.iot.android.sense.event.streams.Location.LocationDataReader;
public class SpeedDataReader extends DataReader implements SensorEventListener {

@ -18,9 +18,8 @@ import android.os.AsyncTask;
import android.widget.EditText;
import org.apache.commons.codec.language.Soundex;
import org.wso2.carbon.iot.android.sense.event.streams.Location.LocationData;
import org.wso2.carbon.iot.android.sense.util.SenseDataHolder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@ -14,9 +14,9 @@
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.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;

Loading…
Cancel
Save