123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- package de.tudarmstadt.informatik.hostage.logging;
- import java.io.Serializable;
- import android.os.Parcel;
- import android.os.Parcelable;
- /**
- * Holds all necessary information about a single network.
- */
- public class NetworkRecord implements Parcelable, Serializable {
- private static final long serialVersionUID = -1586629159904177836L;
- private String bssid;
- private String ssid;
- private long timestampLocation;
- private double latitude;
- private double longitude;
- private float accuracy;
- public static final Parcelable.Creator<NetworkRecord> CREATOR = new Parcelable.Creator<NetworkRecord>() {
- @Override
- public NetworkRecord createFromParcel(Parcel source) {
- return new NetworkRecord(source);
- }
- @Override
- public NetworkRecord[] newArray(int size) {
- return new NetworkRecord[size];
- }
- };
- public NetworkRecord() {
- }
- public NetworkRecord(Parcel source) {
- super();
- this.bssid = source.readString();
- this.ssid = source.readString();
- this.timestampLocation = source.readLong();
- this.latitude = source.readDouble();
- this.longitude = source.readDouble();
- this.accuracy = source.readFloat();
- }
- @Override
- public int describeContents() {
- return 0;
- }
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(bssid);
- dest.writeString(ssid);
- dest.writeLong(timestampLocation);
- dest.writeDouble(latitude);
- dest.writeDouble(longitude);
- dest.writeFloat(accuracy);
- }
- /**
- * @return the bssid
- */
- public String getBssid() {
- return bssid;
- }
- /**
- * @param bssid
- * the bssid to set
- */
- public void setBssid(String bssid) {
- this.bssid = bssid;
- }
- /**
- * @return the ssid
- */
- public String getSsid() {
- return ssid;
- }
- /**
- * @param ssid
- * the ssid to set
- */
- public void setSsid(String ssid) {
- this.ssid = ssid;
- }
- /**
- * @return the timestampLocation
- */
- public long getTimestampLocation() {
- return timestampLocation;
- }
- /**
- * @param timestampLocation
- * the timestampLocation to set
- */
- public void setTimestampLocation(long timestampLocation) {
- this.timestampLocation = timestampLocation;
- }
- /**
- * @return the latitude
- */
- public double getLatitude() {
- return latitude;
- }
- /**
- * @param latitude
- * the latitude to set
- */
- public void setLatitude(double latitude) {
- this.latitude = latitude;
- }
- /**
- * @return the longitude
- */
- public double getLongitude() {
- return longitude;
- }
- /**
- * @param longitude
- * the longitude to set
- */
- public void setLongitude(double longitude) {
- this.longitude = longitude;
- }
- /**
- * @return the accuracy
- */
- public float getAccuracy() {
- return accuracy;
- }
- /**
- * @param accuracy
- * the accuracy to set
- */
- public void setAccuracy(float accuracy) {
- this.accuracy = accuracy;
- }
- public String toJSON() {
- return String.format("{\"bssid\":\"%s\",\"ssid\":%s,\"latitude\":%s,\"longitude\":%s,\"timestamp\":%s,\"attacks\":%d,\"portscans\":%d}", bssid, ssid,
- latitude, longitude, timestampLocation, -1, -1);
- }
- }
|