|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
eeml.DataIn
This is the class to use for receiving data from remote environments/applications. It is asynchronous which means that once a DataIn object is constructed it invokes an onReceiveEEML() method every time it receives data. You therefore must have a method void onReceiveEEML(DataIn d) in your application, and you would normally use the getValue() method to extract relevant data.
DataIn myDataIn = new DataIn(this,"http://remote_url/001.xml",5000);
void onReceiveEEML(DataIn d){
float myVariable = d.getValue(0);
float myVariable2 = d.getValue("tagName");
}
| Field Summary |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
DataIn(processing.core.PApplet parent_,
java.lang.String url,
int period)
This object is asynchronous which means that it is set up to make requests at a particular interval (say once every five seconds, meaning period would be '5000'). |
|
DataIn(processing.core.PApplet parent_,
java.lang.String url,
java.lang.String key,
int period)
Just like DataIn(PApplet parent_, String url, int period) but enables the setting of a header to authenticate access to Pachube |
|
| Method Summary | |
int |
countDatastreams()
Returns the number of data elements in the remote EEML. |
int[] |
getId(java.lang.String tag)
Returns an array of all the data stream ID's that are tagged with String tag. |
float |
getMaximum(int id)
Used to determine the maximum value of a numeric data stream. |
float |
getMinimum(int id)
Used to determine the minimum value of a numeric data stream. |
java.lang.String |
getStatus()
Used to determine the status of an EEML feed ("live", "frozen" or "no status")/ |
java.lang.String |
getStringValue(int id)
Returns the string value of the remote data feed identified through its id number (useful when a stream's value is a string). |
java.lang.String |
getStringValue(java.lang.String tag)
Returns the string value of the remote data feed identified through its tag (useful when a stream's value is a string). |
java.lang.String |
getTag(int id)
Returns the tags for a specific data stream id. |
java.lang.String[] |
getUnits(int id)
Used to determine the units of a data stream. |
java.lang.String |
getURL()
Returns the URL requested by this object (useful in the onReceiveEEML method to determine which particular DataIn object's request has been received). |
float |
getValue(int id)
Returns the value of the remote data feed identified through its id number. |
float |
getValue(java.lang.String tag)
Returns the value of a remote data feed identified through its tag -- if there are several streams with the same tag, then only the first identified is returned. |
void |
printXML()
Useful for debugging; returns the entire EEML document received. |
void |
quit()
Ignore. |
void |
run()
Ignore -- this is where the threads are created. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DataIn(processing.core.PApplet parent_,
java.lang.String url,
int period)
DataIn d = new DataIn(this,"http://remoteurl/001.xml",5000);
url - the URL to connect toperiod - the number of milliseconds between requests to the remote feed.getValue(String tag),
getValue(int id),
DataIn(PApplet parent_, String url, String key, int period)
public DataIn(processing.core.PApplet parent_,
java.lang.String url,
java.lang.String key,
int period)
DataIn d = new DataIn(this,"http://pachube.com/api/001.xml", "YourKeyGoesHere", 5000);
url - the URL to connect tokey - the Pachube API key used to access Pachube feeds (requires registration at pachube.com)period - the number of milliseconds between requests to the remote feed.getValue(String tag),
getValue(int id)| Method Detail |
public float getValue(int id)
d.getValue(2);
id -
public float getValue(java.lang.String tag)
d.getValue("usefulTag");
tag -
getId(String tag)public java.lang.String getStringValue(int id)
String avatarName = d.getStringValue(4);
id -
getValue(int id),
getStringValue(String tag)public java.lang.String getStringValue(java.lang.String tag)
String avatarName = d.getStringValue("avatarName");
tag -
getValue(int id),
getStringValue(String tag)public java.lang.String getTag(int id)
public int[] getId(java.lang.String tag)
tag -
public int countDatastreams()
public void printXML()
public java.lang.String getURL()
if (thisD.getURL().equals(thatD.getURL()){
doSomething(); // we know which feed's EEML we have just received
}
@return
public void run()
public java.lang.String getStatus()
public float getMaximum(int id)
public float getMinimum(int id)
public java.lang.String[] getUnits(int id)
{ "Celsius","C","basicSI" }
public void quit()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||