public class OrangeConnection
extends java.lang.Object
Constructor and Description |
---|
OrangeConnection()
Initialise an unauthenticated connection to retrieve public data
|
Modifier and Type | Method and Description |
---|---|
void |
close()
To be used to securely kill the connection upon process termination.
|
java.lang.String |
getApplication(int global_id)
Returns the arbitrary application label for the given sensor ID.
|
java.lang.String[] |
getApplicationList(int[] ids)
Returns an array comprised of the application label for each identified sensor.
|
SensorData[] |
getDataBetween(int global_id,
java.util.Date start,
java.util.Date end)
Returns an array of SensorData types, each describing one single reading update
sent by the named sensor by both reading and timestamp.
|
SensorData[] |
getDataSince(int global_id,
java.util.Date time)
Returns an array of SensorData types, each describing one single reading update
sent by the named sensor by both reading and timestamp.
|
java.util.Date |
getDateAdded(int global_id)
Returns the timestamp for the very first reading received from the identified sensor.
|
java.util.Date[] |
getDateAddedList(int[] ids)
Returns a Date array containing the timestamp for each identified sensor's very first received reading.
|
int[] |
getIDsWhere(java.lang.String[] cols,
java.lang.String[] args)
Returns an array of global_ids filtered by multiple given columns and values.
|
int[] |
getIDsWhere(java.lang.String col,
java.lang.String arg)
Returns an array of global_ids filtered by a given column matching a
value.
|
int[] |
getIDsWhereSince(java.lang.String[] cols,
java.lang.String[] args,
java.util.Date timestamp)
Returns an array of global_ids filtered by a list of columns and values, and a
timestamp.
|
int[] |
getIDsWhereSince(java.lang.String col,
java.lang.String arg,
java.util.Date timestamp)
Returns an array of global_ids filtered by both a column with a value and a
timestamp.
|
float |
getLastReading(int global_id)
Returns the most recently received reading from a given sensor.
|
float[] |
getLastReadingList(int[] ids)
Returns an array composed of the most recently received reading from each sensor
identified in ids.
|
java.util.Date |
getLastTimestamp(int global_id)
Returns the timestamp for the most recently received reading from a given sensor.
|
java.util.Date[] |
getLastTimestampList(int[] ids)
Returns an array composed of the timestamp for each identified sensor's latest reading.
|
double |
getLat(int global_id)
Returns the latitude of the identified sensor as a double to six decimal places.
|
SensorData[] |
getLatestList(int[] ids)
Returns a list of SensorData objects containing the latest reading and timestamp for each
named sensor ID.
|
double[] |
getLatList(int[] ids)
Returns the latitude of each identified sensor as an element in an array of doubles.
|
double |
getLng(int global_id)
Returns the longitude of the identified sensor as a double to six decimal places.
|
double[] |
getLngList(int[] ids)
Returns the longitude of each identified sensor as an element in an array of doubles.
|
java.lang.String |
getMeasures(int global_id)
Returns the 'measures' attribute for a given sensor ID.
|
java.lang.String[] |
getMeasuresList(int[] ids)
Returns an array comprised of the measures attribute for each identified sensor.
|
Position |
getPosition(int global_id)
Returns the Position of the identified sensor, containing the global_id with its latitude and longitude.
|
Position[] |
getPositionList(int[] ids)
Returns the Positions of the identified sensors as an array.
|
java.lang.String |
getUnit(int global_id)
Returns the unit of measurement for the identified sensor.
|
java.lang.String[] |
getUnitList(int[] ids)
Returns an array comprised of the unit of measurement for each identified sensor.
|
public OrangeConnection()
public void close()
public int[] getIDsWhere(java.lang.String col, java.lang.String arg)
Valid columns to query are limited to:
col
- one of application, measures, or unitarg
- an argument to filter bypublic int[] getIDsWhere(java.lang.String[] cols, java.lang.String[] args)
cols
- a String array containing column names - one of application, measures, or unitargs
- an array of string arguments to filter bypublic int[] getIDsWhereSince(java.lang.String col, java.lang.String arg, java.util.Date timestamp)
col
- one of application, measures, or unitarg
- a value to filter bytimestamp
- returned values will have timestamps greater than thispublic int[] getIDsWhereSince(java.lang.String[] cols, java.lang.String[] args, java.util.Date timestamp)
col
- a list containing 'application', 'measures', and/or 'unit'arg
- a list containing respective values to filter bytimestamp
- returned values will have timestamps greater than thispublic java.lang.String getApplication(int global_id)
global_id
- a sensor's global, unique identifierpublic java.lang.String[] getApplicationList(int[] ids)
ids
- an array of unique sensor global_idspublic java.lang.String getMeasures(int global_id)
global_id
- a sensor's global, unique identifierpublic java.lang.String[] getMeasuresList(int[] ids)
ids
- an array of unique sensor global_idsgetMeasures(int)
public java.lang.String getUnit(int global_id)
global_id
- a sensor's global, unique identifierpublic java.lang.String[] getUnitList(int[] ids)
ids
- an array of unique sensor IDS (global_ids)public double getLat(int global_id)
global_id
- a sensor's global, unique identifierpublic double[] getLatList(int[] ids)
ids
- an array of unique sensor IDs (global_ids)getLat(int)
public double getLng(int global_id)
global_id
- a sensor's global, unique identifierpublic double[] getLngList(int[] ids)
ids
- an array of unique sensor IDs (global_ids)getLng(int)
public Position getPosition(int global_id)
global_id
- a sensor's global, unique identifierPosition
public Position[] getPositionList(int[] ids)
ids
- an array of unique sensor IDs (global_ids)Position
public SensorData[] getLatestList(int[] ids)
ids
- an array of unique sensor IDs (global_ids)public java.util.Date getDateAdded(int global_id)
global_id
- a sensor's global, unique identifierpublic java.util.Date[] getDateAddedList(int[] ids)
ids
- an array of unique sensor IDs (global_ids)public float getLastReading(int global_id)
global_id
- a sensor's global, unique identifierpublic float[] getLastReadingList(int[] ids)
ids
- an array of unique sensor IDs (global_id)public java.util.Date getLastTimestamp(int global_id)
global_id
- a sensor's global, unique identifierpublic java.util.Date[] getLastTimestampList(int[] ids)
ids
- an array of unique sensor ID (global_id)public SensorData[] getDataSince(int global_id, java.util.Date time)
global_id
- a sensor's global, unique identifiertime
- an earlier date or time from which all reading updates from the named sensor will be retrievedSensorData
public SensorData[] getDataBetween(int global_id, java.util.Date start, java.util.Date end)
global_id
- a sensor's global, unique identifierstart
- the date from which data will be retrievedend
- the date to which data will be retrievedSensorData