*/
public class CloudProp {
private static final String TAG = CloudProp.class.getName();
- protected OcRepresentation mRep;
- protected String mCloudID;
+ protected OcRepresentation mRep = null;
+ protected String mCloudID = null;
/**
* Constructor
*/
public String getAuthCode()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHCODE))
return mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHCODE);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getAuthCode is failed.");
}
- return new String("");
+ return null;
}
/**
*/
public String getAuthProvider()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHPROVIDER))
return mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHPROVIDER);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getAuthProvider is failed.");
}
- return new String("");
+ return null;
}
/**
*/
public String getCiServer()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_CISERVER))
return mRep.getValue(ESConstants.OC_RSRVD_ES_CISERVER);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getCiServer is failed.");
}
- return new String("");
+ return null;
}
/**
*/
public class DeviceProp {
private static final String TAG = DeviceProp.class.getName();
- protected OcRepresentation mRep;
+ protected OcRepresentation mRep = null;
/**
* Constructor
*/
public String getSsid()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_SSID))
return mRep.getValue(ESConstants.OC_RSRVD_ES_SSID);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getSsid is failed.");
}
- return new String("");
+ return null;
}
/**
*/
public String getPassword()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_CRED))
return mRep.getValue(ESConstants.OC_RSRVD_ES_CRED);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getPassword is failed.");
}
- return new String("");
+ return null;
}
/**
*/
public WIFI_AUTHTYPE getAuthType()
{
- try {
+ if(mRep == null)
+ {
+ return WIFI_AUTHTYPE.NONE_AUTH;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHTYPE))
return WIFI_AUTHTYPE.fromInt((int)mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHTYPE));
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getAuthType is failed.");
}
return WIFI_AUTHTYPE.NONE_AUTH;
*/
public WIFI_ENCTYPE getEncType()
{
- try {
+ if(mRep == null)
+ {
+ return WIFI_ENCTYPE.NONE_ENC;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_ENCTYPE))
return WIFI_ENCTYPE.fromInt((int)mRep.getValue(ESConstants.OC_RSRVD_ES_ENCTYPE));
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getEncType is failed.");
}
return WIFI_ENCTYPE.NONE_ENC;
*/
public String getLanguage()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_LANGUAGE))
return mRep.getValue(ESConstants.OC_RSRVD_ES_LANGUAGE);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getLanguage is failed.");
}
- return new String("");
+ return null;
}
/**
*/
public String getCountry()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_COUNTRY))
return mRep.getValue(ESConstants.OC_RSRVD_ES_COUNTRY);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getCountry is failed.");
}
- return new String("");
+ return null;
}
/**
*/
public String getLocation()
{
- try {
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_LOCATION))
return mRep.getValue(ESConstants.OC_RSRVD_ES_LOCATION);
- } catch (OcException e) {
+ }
+ catch (OcException e)
+ {
Log.e(TAG, "getLocation is failed.");
}
- return new String("");
+ return null;
}
public OcRepresentation toOCRepresentation()
*/
public String getDeviceName()
{
+ if(mProvRep == null)
+ {
+ return null;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
}
}
}
-
- return new String("");
+ return null;
}
/**
*/
public String getModelNumber()
{
+ if(mProvRep == null)
+ {
+ return null;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
}
}
}
-
- return new String("");
+ return null;
}
/**
*/
public ArrayList<WIFI_MODE> getWiFiModes()
{
+ if(mProvRep == null)
+ {
+ return null;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
ArrayList<WIFI_MODE> modes = new ArrayList<WIFI_MODE>();
for (OcRepresentation child : children) {
}
}
}
-
return modes;
}
*/
public WIFI_FREQ getWiFiFreq()
{
+ if(mProvRep == null)
+ {
+ return WIFI_FREQ.WIFI_FREQ_NONE;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
}
}
}
- return WIFI_FREQ.WIFI_FREQ_NONE;
+ return null;
}
/**
*/
public boolean isCloudAccessible()
{
+ if(mProvRep == null)
+ {
+ return false;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {