public final class

TmdActivity

extends Object
implements Parcelable
java.lang.Object
   ↳ fi.moprim.tmd.sdk.model.TmdActivity

Class Overview

This class includes all information pertaining to the TMD activity collected from the Moprim Cloud.

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator CREATOR
Public Constructors
TmdActivity(Parcel in)
Parcel constructor
Public Methods
int describeContents()
String getActivity()
double getCo2()
String getCorrectedActivity()
String getDestination()
double getDistance()
double getDuration()
abstract long getId()
long getLastTimestamp()
String getMetadata()
The metadata annotated to the TMD activity
String getOrigin()
String getOriginalActivity()
String getPolyline()
To decode the polyline, check polylineDecode(String)
double getSpeed()
long getTimestampDownload()
Return the UTC timestamp of the last download of the TMD activity
long getTimestampEnd()
long getTimestampStart()
boolean hasSameTimestamps(TmdActivity other)
Activities are usually compared with their timestamps.
boolean isCheckedByUser()
boolean isCorrect()
This function is only used to validate the results of the TMD
abstract boolean isSyncedWithCloud()
boolean overlaps(TmdActivity other, boolean inclusive)
void setCorrectedActivity(String correctedActivity)
Set the corrected label of the activity
void setMetadata(String metadata)
Set the metadata to annotate the TMD activity
abstract void setSynced(boolean synced)
JSONObject toGeoJson()
JSONObject toJson()
String toString()
String toString(SimpleDateFormat simpleDateFormat)
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator CREATOR

Public Constructors

public TmdActivity (Parcel in)

Parcel constructor

Parameters
in the parcel

Public Methods

public int describeContents ()

public String getActivity ()

Returns
  • the label of the activity

public double getCo2 ()

Returns
  • the amount of CO2 (in grams) generated during the activity.

public String getCorrectedActivity ()

Returns
  • the corrected label of the activity

public String getDestination ()

Returns
  • the destination of the activity, null for stationary

public double getDistance ()

Returns
  • the distance in meters covered in the activity

public double getDuration ()

Returns
  • the duration in seconds of the activity

public abstract long getId ()

public long getLastTimestamp ()

public String getMetadata ()

The metadata annotated to the TMD activity

Returns
  • metadata annotated to the TMD activity, can be null

public String getOrigin ()

Returns
  • the origin of the activity, or the location for the stationary activity

public String getOriginalActivity ()

Returns
  • the original label of the activity

public String getPolyline ()

To decode the polyline, check polylineDecode(String)

Returns
  • the encoded polyline of the GPS locations during the activity

public double getSpeed ()

Returns
  • the average speed in kilometers per hours during the activity

public long getTimestampDownload ()

Return the UTC timestamp of the last download of the TMD activity

Returns
  • the UTC timestamp (in ms) of the last download of the TMD activity

public long getTimestampEnd ()

Returns
  • the UTC timestamp (in ms) of the end of the TMD activity

public long getTimestampStart ()

Returns
  • the UTC timestamp (in ms) of the start of the TMD activity

public boolean hasSameTimestamps (TmdActivity other)

Activities are usually compared with their timestamps.

Returns
  • true if the activity has same start and stop timestamp than `other`

public boolean isCheckedByUser ()

Returns
  • true if the corrected label has been set by the user

public boolean isCorrect ()

This function is only used to validate the results of the TMD

Returns
  • true if the corrected activity and original activity are the same

public abstract boolean isSyncedWithCloud ()

public boolean overlaps (TmdActivity other, boolean inclusive)

Returns
  • true if the timestamps of both activity overlap

public void setCorrectedActivity (String correctedActivity)

Set the corrected label of the activity

Parameters
correctedActivity the new label for the activity

public void setMetadata (String metadata)

Set the metadata to annotate the TMD activity

Parameters
metadata the metadata

public abstract void setSynced (boolean synced)

public JSONObject toGeoJson ()

Returns
  • a GeoJSON representation of the activity
Throws
JSONException

public JSONObject toJson ()

Returns
  • a JSON representation of the activity
Throws
JSONException

public String toString ()

public String toString (SimpleDateFormat simpleDateFormat)

public void writeToParcel (Parcel dest, int flags)