Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber.extensions.geolocation
Class GeolocationPacketExtension

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.extensions.geolocation.GeolocationPacketExtension
All Implemented Interfaces:
org.jivesoftware.smack.packet.PacketExtension

public class GeolocationPacketExtension
extends Object
implements org.jivesoftware.smack.packet.PacketExtension

This class implements the Geolocation Extension defined in the XEP-0080

Author:
Guillaume Schreiner

Field Summary
static String ALT
          The name of the geolocation map key corresponding to the altitude in meters above or below sea level (e.g.
static String AREA
          The name of the geolocation map key that we use for storing named areas such as a campus or neighborhood (e.g.
static String BEARING
          The name of the geolocation map key that we use for storing GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.
static String BUILDING
          The name of the geolocation map key that we use for indicating a specific building on a street or in an area (e.g.
static String COUNTRY
          The name of the geolocation map key that we use for indicating the nation where the user is located (e.g.
static String DATUM
          GPS datum.
static String DESCRIPTION
          The name of the geolocation map key that we use for storing a natural-language name for or description of a given location (e.g.
static String ERROR
          The name of the geolocation map key that we use for storing horizontal GPS errors in arc minutes (e.g.
static String FLOOR
          The name of the geolocation map key that we use for storing a particular floor in a building (e.g.
static String LAT
          The name of the geolocation map key that we use for storing geographic latitude in decimal degrees North (e.g.
static String LOCALITY
          The name of the geolocation map key that we use for indicating a locality within the administrative region, such as a town or city (e.g.
static String LON
          The name of the geolocation map key that we use for indicating longitude in decimal degrees East (e.g.
static String POSTALCODE
          The name of the geolocation map key that we use for storing post codes (or any code used for postal delivery) (e.g.
static String REGION
          The name of the geolocation map key that we use for indicating an administrative region of the nation, such as a state or province (e.g.
static String ROOM
          The name of the geolocation map key that we use for indicating a particular room in a building (e.g.
static String STREET
          The name of the geolocation map key that we use for storing a thoroughfare within a locality, or a crossing of two thoroughfares (e.g.
static String TEXT
          The name of the geolocation map key that we use to indicate a catch-all element that captures any other information about the location (e.g.
static String TIMESTAMP
          The name of the geolocation map key that we use to indicate UTC timestamp specifying the moment when the reading was taken (e.g.
 
Constructor Summary
GeolocationPacketExtension()
           
 
Method Summary
 boolean containsLatLon()
          Test if latitude and longitude are set.
 float getAlt()
          Returns altitude in meters above or below sea level.
 String getArea()
          A named area such as a campus or neighborhood.
 float getBearing()
          Returns GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.
 String getBuilding()
          Returns the name of a specific building on a street or in an area.
 String getCountry()
          Return the nation where the user is located.
 String getDatum()
          Return the value of GPS Datum.
 String getDescription()
          Returns a natural-language name for or description of a this location.
 String getElementName()
          Returns the XML element name of the extension sub-packet root element.
 float getError()
          Returns horizontal GPS errors in arc minutes.
 String getFloor()
          The number or name of a a particular floor in a building.
 float getLat()
          Returns geographic latitude in decimal degrees North.
 String getLocality()
          Returns a locality within the administrative region, such as a town or city.
 float getLon()
          Returns a float containing the longitude in decimal degrees East (e.g.
 String getNamespace()
          Returns the XML namespace of the extension sub-packet root element.
 String getPostalCode()
          Returns a postal code (or any code used for postal delivery).
 String getRegion()
          Returns an administrative region of the nation, such as a state or province (e.g.
 String getRoom()
          Returns a String indicating a particular room in a building.
 String getStreet()
          Returns a String indicating a thoroughfare within a locality, or a crossing of two thoroughfares.
 String getText()
          Returns a String stored in the "Text" element of the geolocation details.
 String getTimestamp()
          Returns a String containing a UTC timestamp specifying the moment when the reading was taken.
 void setAlt(float alt)
          Sets the altitude in meters above or below sea level.
 void setAlt(String alt)
          Sets the altitude in meters above or below sea level.
 void setArea(String area)
          Sets the value of a named area such as a campus or neighborhood.
 void setBearing(float bearing)
          Sets GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.
 void setBearing(String bearing)
          Sets GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.
 void setBuilding(String building)
          Sets the name of a specific building on a street or in an area.
 void setCountry(String country)
          Sets the name of the nation where the user is located.
 void setDatum(String datum)
          Sets the value of GPS Datum.
 void setDescription(String description)
          Sets a natural-language name for or description of a this location.
 void setError(float error)
          Sets the value of horizontal GPS errors in arc minutes.
 void setError(String error)
          Sets the value of horizontal GPS errors in arc minutes.
 void setFloor(String floor)
          Sets the number or name of a a particular floor in a building.
 void setLat(float lat)
          Sets geographic latitude in decimal degrees North.
 void setLat(String lat)
          Sets geographic latitude in decimal degrees North.
 void setLocality(String locality)
          Sets a locality within the administrative region, such as a town or city.
 void setLon(float lon)
          Sets the longitude in decimal degrees East.
 void setLon(String lon)
          Sets the longitude in decimal degrees East.
 void setPostalCode(String postalCode)
          Sets a postal code (or any code used for postal delivery).
 void setRegion(String region)
          Sets an administrative region of the nation, such as a state or province (e.g.
 void setRoom(String room)
          Sets the name or number indicating a particular room in a building.
 void setStreet(String street)
          Sets the name of a street.
 void setText(String text)
          Sets a String to store in the "Text" element of the geolocation details.
 void setTimestamp(String timestamp)
          Set timestamp in UTC format as described in XEP-0082: XMPP Date and Time Profiles
 String toXML()
          Returns the XML representation of the PacketExtension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALT

public static final String ALT
The name of the geolocation map key corresponding to the altitude in meters above or below sea level (e.g. 1609).

See Also:
Constant Field Values

AREA

public static final String AREA
The name of the geolocation map key that we use for storing named areas such as a campus or neighborhood (e.g. Central Park).

See Also:
Constant Field Values

BEARING

public static final String BEARING
The name of the geolocation map key that we use for storing GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

See Also:
Constant Field Values

BUILDING

public static final String BUILDING
The name of the geolocation map key that we use for indicating a specific building on a street or in an area (e.g. The Empire State Building).

See Also:
Constant Field Values

COUNTRY

public static final String COUNTRY
The name of the geolocation map key that we use for indicating the nation where the user is located (e.g. Greenland).

See Also:
Constant Field Values

DATUM

public static final String DATUM
GPS datum.

See Also:
Constant Field Values

DESCRIPTION

public static final String DESCRIPTION
The name of the geolocation map key that we use for storing a natural-language name for or description of a given location (e.g. Bill's house).

See Also:
Constant Field Values

ERROR

public static final String ERROR
The name of the geolocation map key that we use for storing horizontal GPS errors in arc minutes (e.g. 10).

See Also:
Constant Field Values

FLOOR

public static final String FLOOR
The name of the geolocation map key that we use for storing a particular floor in a building (e.g. 102).

See Also:
Constant Field Values

LAT

public static final String LAT
The name of the geolocation map key that we use for storing geographic latitude in decimal degrees North (e.g. 39.75).

See Also:
Constant Field Values

LOCALITY

public static final String LOCALITY
The name of the geolocation map key that we use for indicating a locality within the administrative region, such as a town or city (e.g. Paris).

See Also:
Constant Field Values

LON

public static final String LON
The name of the geolocation map key that we use for indicating longitude in decimal degrees East (e.g. -104.99).

See Also:
Constant Field Values

POSTALCODE

public static final String POSTALCODE
The name of the geolocation map key that we use for storing post codes (or any code used for postal delivery) (e.g. 67000).

See Also:
Constant Field Values

REGION

public static final String REGION
The name of the geolocation map key that we use for indicating an administrative region of the nation, such as a state or province (e.g. Ile de France).

See Also:
Constant Field Values

ROOM

public static final String ROOM
The name of the geolocation map key that we use for indicating a particular room in a building (e.g. C-425).

See Also:
Constant Field Values

STREET

public static final String STREET
The name of the geolocation map key that we use for storing a thoroughfare within a locality, or a crossing of two thoroughfares (e.g. 34th and Broadway).

See Also:
Constant Field Values

TEXT

public static final String TEXT
The name of the geolocation map key that we use to indicate a catch-all element that captures any other information about the location (e.g. North-West corner of the lobby).

See Also:
Constant Field Values

TIMESTAMP

public static final String TIMESTAMP
The name of the geolocation map key that we use to indicate UTC timestamp specifying the moment when the reading was taken (e.g. 2007-05-27T21:12Z).

See Also:
Constant Field Values
Constructor Detail

GeolocationPacketExtension

public GeolocationPacketExtension()
Method Detail

toXML

public String toXML()
Returns the XML representation of the PacketExtension.

Specified by:
toXML in interface org.jivesoftware.smack.packet.PacketExtension
Returns:
the packet extension as XML.

getElementName

public String getElementName()
Returns the XML element name of the extension sub-packet root element. The current implementation would always return "geoloc".

Specified by:
getElementName in interface org.jivesoftware.smack.packet.PacketExtension
Returns:
the XML element name of the packet extension.

getNamespace

public String getNamespace()
Returns the XML namespace of the extension sub-packet root element. The namespace is always "http://jabber.org/protocol/geoloc"

Specified by:
getNamespace in interface org.jivesoftware.smack.packet.PacketExtension
Returns:
the XML namespace of the packet extension.

getAlt

public float getAlt()
Returns altitude in meters above or below sea level.

Returns:
the altitude in meters above or belos sea level (e.g. 1609).

setAlt

public void setAlt(float alt)
Sets the altitude in meters above or below sea level.

Parameters:
alt - the altitude in meters above or belos sea level (e.g. 1609).

setAlt

public void setAlt(String alt)
Sets the altitude in meters above or below sea level.

Parameters:
alt - the altitude in meters above or belos sea level (e.g. 1609).

getArea

public String getArea()
A named area such as a campus or neighborhood.

Returns:
a String indicating a named area such as a campus or a neighborhood (e.g. Central Park).

setArea

public void setArea(String area)
Sets the value of a named area such as a campus or neighborhood.

Parameters:
area - the value of a named area such as a campus or neighborhood.

getBearing

public float getBearing()
Returns GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

Returns:
a float value indicating GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

setBearing

public void setBearing(float bearing)
Sets GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

Parameters:
bearing - a float value indicating GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

setBearing

public void setBearing(String bearing)
Sets GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

Parameters:
bearing - a String value indicating GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.

getBuilding

public String getBuilding()
Returns the name of a specific building on a street or in an area.

Returns:
a String containing the name of a specific building on a street or in an area (e.g. The Empire State Building).

setBuilding

public void setBuilding(String building)
Sets the name of a specific building on a street or in an area.

Parameters:
building - a String indicating the name of a specific building on a street or in an area (e.g. The Empire State Building).

getCountry

public String getCountry()
Return the nation where the user is located.

Returns:
a String containing the name of the nation where the user is located (e.g. Greenland).

setCountry

public void setCountry(String country)
Sets the name of the nation where the user is located.

Parameters:
country - a String containing the name of the nation where the user is located (e.g. Greenland).

getDatum

public String getDatum()
Return the value of GPS Datum.

Returns:
a String containing the value of GPS Datum.

setDatum

public void setDatum(String datum)
Sets the value of GPS Datum.

Parameters:
datum - the value of GPS Datum.

getDescription

public String getDescription()
Returns a natural-language name for or description of a this location.

Returns:
a java.lang.String containing a natural-language description of this location (e.g. Bill's house)

setDescription

public void setDescription(String description)
Sets a natural-language name for or description of a this location.

Parameters:
description - a java.lang.String containing a natural-language description of this location (e.g. Bill's house)

getError

public float getError()
Returns horizontal GPS errors in arc minutes.

Returns:
a float indicating horizontal GPS errors in arc minutes (e.g. 10).

setError

public void setError(float error)
Sets the value of horizontal GPS errors in arc minutes.

Parameters:
error - a float indicating horizontal GPS errors in arc minutes (e.g. 10).

setError

public void setError(String error)
Sets the value of horizontal GPS errors in arc minutes.

Parameters:
error - a String indicating horizontal GPS errors in arc minutes (e.g. 10).

getFloor

public String getFloor()
The number or name of a a particular floor in a building.

Returns:
a String indicating the number or name of a particular floor in a building (e.g. 102)

setFloor

public void setFloor(String floor)
Sets the number or name of a a particular floor in a building.

Parameters:
floor - a String indicating the number or name of a particular floor in a building (e.g. 102)

getLat

public float getLat()
Returns geographic latitude in decimal degrees North.

Returns:
a float value indicating geographic latitude in decimal degrees (e.g. 39.75).

setLat

public void setLat(float lat)
Sets geographic latitude in decimal degrees North.

Parameters:
lat - a float value indicating geographic latitude in decimal degrees (e.g. 39.75).

setLat

public void setLat(String lat)
Sets geographic latitude in decimal degrees North.

Parameters:
lat - a String value indicating geographic latitude in decimal degrees (e.g. 39.75).

getLocality

public String getLocality()
Returns a locality within the administrative region, such as a town or city.

Returns:
a String indicating a locality within the administrative region (e.g. Paris).

setLocality

public void setLocality(String locality)
Sets a locality within the administrative region, such as a town or city.

Parameters:
locality - a String indicating a locality within the administrative region (e.g. Paris).

getLon

public float getLon()
Returns a float containing the longitude in decimal degrees East (e.g. -104.99).

Returns:
a float containing the longitude in decimal degrees East (e.g. -104.99).

setLon

public void setLon(float lon)
Sets the longitude in decimal degrees East.

Parameters:
lon - a float containing the longitude in decimal degrees East (e.g. -104.99).

setLon

public void setLon(String lon)
Sets the longitude in decimal degrees East.

Parameters:
lon - a String containing the longitude in decimal degrees East (e.g. -104.99).

getPostalCode

public String getPostalCode()
Returns a postal code (or any code used for postal delivery).

Returns:
a String containing the value of a postal or zip code (e.g. 67000).

setPostalCode

public void setPostalCode(String postalCode)
Sets a postal code (or any code used for postal delivery).

Parameters:
postalCode - a String containing the value of a postal or zip code (e.g. 67000).

getRegion

public String getRegion()
Returns an administrative region of the nation, such as a state or province (e.g. Ile de France).

Returns:
a String indicating an administrative region of the nation, such as a state or province (e.g. Ile de France).

setRegion

public void setRegion(String region)
Sets an administrative region of the nation, such as a state or province (e.g. Ile de France).

Parameters:
region - a String indicating an administrative region of the nation, such as a state or province (e.g. Ile de France).

getRoom

public String getRoom()
Returns a String indicating a particular room in a building.

Returns:
a String indicating a particular room in a building (e.g. C-425).

setRoom

public void setRoom(String room)
Sets the name or number indicating a particular room in a building.

Parameters:
room - a String indicating the name ornumber a particular room in a building (e.g. C-425).

getStreet

public String getStreet()
Returns a String indicating a thoroughfare within a locality, or a crossing of two thoroughfares.

Returns:
a String indicating a thoroughfare within a locality, or a crossing of two thoroughfares (e.g. 34th and Broadway).

setStreet

public void setStreet(String street)
Sets the name of a street.

Parameters:
street - a String indicating a thoroughfare within a locality, or a crossing of two thoroughfares (e.g. 34th and Broadway).

getText

public String getText()
Returns a String stored in the "Text" element of the geolocation details.

Returns:
a String stored in the "Text" element of the geolocation details.

setText

public void setText(String text)
Sets a String to store in the "Text" element of the geolocation details.

Parameters:
text - a String stored in the "Text" element of the geolocation details.

getTimestamp

public String getTimestamp()
Returns a String containing a UTC timestamp specifying the moment when the reading was taken.

Returns:
a String containing a UTC timestamp specifying the moment when the reading was taken (e.g. 2007-05-27T21:12Z).

setTimestamp

public void setTimestamp(String timestamp)
Set timestamp in UTC format as described in XEP-0082: XMPP Date and Time Profiles

Parameters:
timestamp - the timestamp in UTC format (e.g. 2007-05-27T21:12Z).

containsLatLon

public boolean containsLatLon()
Test if latitude and longitude are set.

Returns:
true if the geolocation extension contains both latitude and longitude and false otherwise.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.