public class WeatherStationRestRequester extends RestRequester
Modifier and Type | Field and Description |
---|---|
protected static String |
CLASSNAME |
protected static boolean |
debugOut_ |
protected static String |
DEFAULT_WEATHERSTATION_IP
DEFAULT IP address to use: 10.0.0.80 .
|
protected static String |
DEFAULT_WEATHERSTATION_REST_URL_PATHSTR |
protected static boolean |
doWrites_ |
protected static StringBuilder |
helpMsg_ |
static String |
LOG_TAG |
protected String |
restUrlPath_
The start path to use in therest URL.
|
(package private) Builder |
xmlBuilder_ |
acceptJSON_, authenticating_, baseUrl_, password_, SYSTEM_FILE_SEPERATOR, SYSTEM_LINE_SEPERATOR, USER_AGENT, username_
Constructor and Description |
---|
WeatherStationRestRequester()
Default constructor .
|
WeatherStationRestRequester(String server,
String user,
String pass)
Constructor to customize all connection settings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canConnect()
Check connectivity to the WeatherStation URL specified by the class parms.
|
double |
getAltitude()
returns altitude.
|
String |
getAltitudeUnits()
returns altitude Units.
|
double |
getBatteryPercent()
returns BatteryPercent.
|
String |
getBatteryPercentUnits()
returns Battery Percent Units.
|
double |
getBatteryVoltage()
returns BatteryVoltage.
|
String |
getBatteryVoltageUnits()
returns Battery Voltage Units.
|
protected static StringBuilder |
getHelpMsg()
initializes and gets the helpMsg_
class var.
|
protected static String |
getHelpMsgStr()
gets the help as a String.
|
double |
getHumidity()
returns humidity.
|
String |
getHumidityUnits()
returns humidity Units.
|
private JsonObject |
getJsonWeather(String restRequest)
Reads and parses out the weather JsonObject from the JSON.
|
double |
getPressure()
returns pressure.
|
String |
getPressureUnits()
returns pressure Units.
|
String |
getRestUrlPath()
Get Method for class field 'restUrlPath_'.
|
double |
getTemperature()
returns temperature.
|
String |
getTemperatureUnits()
returns temperature Units.
|
StringBuilder |
getWeather()
returns all the Weather data.
|
static void |
main(String[] args)
Class main commandLine entry method that has a test command and some convienience commands, as well as a pure rest command.
|
static String |
prettyJson(String jsonStr)
Makes the JSON string pretty with indenting.
|
protected void |
restCMD(String[] args)
commandLine command executor method for the default rest Command.
|
void |
setRestUrlPath(String restUrlPath)
Set Method for class field 'restUrlPath_'.
|
protected void |
templateCMD(String[] args)
Template method for future commandLine command executor methods.
|
callService, callService, getAcceptJSON, getBaseUrl, getPassword, getServiceUrl, getUsername, isInit, responseIndenter, serviceGet, servicePost, setAcceptJSON, setBaseUrl, setPassword, setUsername
protected static final String CLASSNAME
public static final String LOG_TAG
protected static final String DEFAULT_WEATHERSTATION_IP
protected static final String DEFAULT_WEATHERSTATION_REST_URL_PATHSTR
protected static StringBuilder helpMsg_
protected static boolean debugOut_
protected static boolean doWrites_
protected String restUrlPath_
Builder xmlBuilder_
public WeatherStationRestRequester()
public WeatherStationRestRequester(String server, String user, String pass)
public static void main(String[] args)
public void setRestUrlPath(String restUrlPath)
restUrlPath_
- is the value to set this class field to.public String getRestUrlPath()
public boolean canConnect()
public StringBuilder getWeather()
private JsonObject getJsonWeather(String restRequest)
public double getTemperature()
public String getTemperatureUnits()
public double getPressure()
public String getPressureUnits()
public double getHumidity()
public String getHumidityUnits()
public double getAltitude()
public String getAltitudeUnits()
public double getBatteryVoltage()
public String getBatteryVoltageUnits()
public double getBatteryPercent()
public String getBatteryPercentUnits()
protected void restCMD(String[] args)
args
- the array of commandLine args that got passed inprotected void templateCMD(String[] args)
args
- the array of commandLine args that got passed inprotected static String getHelpMsgStr()
public static String prettyJson(String jsonStr)
protected static StringBuilder getHelpMsg()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses