private class WeatherBug.FormatTask
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
APP_VERSION
APRS-recognized application name.
|
private int |
CONNECT_TIMEOUT
Connect timeout for the URL connection.
|
private long |
MILLIS_DAY
Number of milliseconds in 24 hours.
|
private java.lang.String |
NEWLINE
WeatherBug proprietary line separator - do not localize.
|
private int |
READ_TIMEOUT
read timeout for the URL connection.
|
private java.text.DecimalFormat |
SECONDS
Rapid fire interval formatter.
|
private java.lang.String |
urlBase
Reusable base for URL query.
|
Constructor and Description |
---|
FormatTask()
Creates a new instance of FormatTask and initializes URL base.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
isLastInterval(java.util.Calendar calendar,
long interval)
Checks if the current time is within the last sample interval of the
day.
|
private java.lang.String |
readData(java.io.InputStream is)
Reads lines of text from an input stream.
|
void |
run()
Task proc.
|
private void |
writeData(java.lang.String data)
Transmits formatted sensor data to WeatherBug as a URL.
|
private final long MILLIS_DAY
private final java.text.DecimalFormat SECONDS
private final int CONNECT_TIMEOUT
private final int READ_TIMEOUT
private final java.lang.String APP_VERSION
private final java.lang.String NEWLINE
private java.lang.String urlBase
FormatTask()
public void run()
run
in interface java.lang.Runnable
private void writeData(java.lang.String data)
data
- formatted sensor data.private java.lang.String readData(java.io.InputStream is) throws java.io.IOException
is
- input stream.java.io.IOException
- if read fails.private boolean isLastInterval(java.util.Calendar calendar, long interval)
calendar
- representing the current time.interval
- sampling interval to check.