Class LocationContext
- java.lang.Object
-
- eu.h2020.helios_social.core.context.Context
-
- eu.h2020.helios_social.core.context.ext.LocationContext
-
- All Implemented Interfaces:
SensorValueListener
public class LocationContext extends Context implements SensorValueListener
LocationContext - a location-based context class.
This class extends the base class Context, and it is defined by location center coordinates and radius. Location value updates are obtained from LocationSensor via SensorValueListener
-
-
Constructor Summary
Constructors Constructor Description LocationContext(java.lang.String name, double lat, double lon, double radius)
Creates a LocationContext.LocationContext(java.lang.String id, java.lang.String name, double lat, double lon, double radius)
Creates a LocationContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getLat()
Gets the latitude value of this contextandroid.location.Location
getLocation()
Gets the current location valuedouble
getLon()
Gets the longitude value (lon) of this contextdouble
getRadius()
Gets the radius of this contextvoid
receiveValue(java.lang.Object value)
Receives location value from LocationSensor.void
setLat(double lat)
Sets the latitude value (lat) of this contextvoid
setLon(double lon)
Sets the longitude value (lon) of this contextvoid
setRadius(double radius)
Sets the radius valuevoid
updateLocation(android.location.Location location)
Updates the current location value-
Methods inherited from class eu.h2020.helios_social.core.context.Context
addSensor, addSensors, getContextListeners, getId, getName, getSensors, isActive, registerContextListener, removeSensor, setActive, setName, unregisterContextListener
-
-
-
-
Constructor Detail
-
LocationContext
public LocationContext(java.lang.String name, double lat, double lon, double radius)
Creates a LocationContext. The context is defined by the latitude (lat) and longitude (lon) values and the radius, and is active in the circular area defined by center coordinates (lat, lon) and radius.- Parameters:
name
- the name of the contextlat
- the latitude value of the center pointlon
- the longitude value of the center pointradius
- the radius of the circle
-
LocationContext
public LocationContext(java.lang.String id, java.lang.String name, double lat, double lon, double radius)
Creates a LocationContext. The context is defined by the latitude (lat) and longitude (lon) values and the radius, and is active in the circular area defined by center coordinates (lat, lon) and radius.- Parameters:
id
- the identifier of the contextname
- the name of the contextlat
- the latitude value of the center pointlon
- the longitude value of the center pointradius
- the radius of the circle
-
-
Method Detail
-
getLat
public double getLat()
Gets the latitude value of this context- Returns:
- the latitude value
-
setLat
public void setLat(double lat)
Sets the latitude value (lat) of this context- Parameters:
lat
- the latitude
-
getLon
public double getLon()
Gets the longitude value (lon) of this context- Returns:
- the longitude value
-
setLon
public void setLon(double lon)
Sets the longitude value (lon) of this context- Parameters:
lon
- the longitude
-
getRadius
public double getRadius()
Gets the radius of this context- Returns:
- the radius value
-
setRadius
public void setRadius(double radius)
Sets the radius value- Parameters:
radius
- the radius value
-
updateLocation
public void updateLocation(android.location.Location location)
Updates the current location value- Parameters:
location
- the updated location
-
getLocation
public android.location.Location getLocation()
Gets the current location value- Returns:
- the location
-
receiveValue
public void receiveValue(java.lang.Object value)
Receives location value from LocationSensor. This method implements the SensorValueListener interface method, which is called when the related sensor obtains updated location value.- Specified by:
receiveValue
in interfaceSensorValueListener
- Parameters:
value
- the received Location value
-
-