Change-Id: Ia0b2d1f7027ee68343a8de715ece26267a0c4dbf
Signed-off-by: Heewon Park <h_w.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10951
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
*/
public class CloudProp {
private static final String TAG = CloudProp.class.getName();
*/
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;
*/
public String getAuthCode()
{
*/
public String getAuthCode()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHCODE))
return mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHCODE);
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.");
}
Log.e(TAG, "getAuthCode is failed.");
}
*/
public String getAuthProvider()
{
*/
public String getAuthProvider()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_AUTHPROVIDER))
return mRep.getValue(ESConstants.OC_RSRVD_ES_AUTHPROVIDER);
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.");
}
Log.e(TAG, "getAuthProvider is failed.");
}
*/
public String getCiServer()
{
*/
public String getCiServer()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_CISERVER))
return mRep.getValue(ESConstants.OC_RSRVD_ES_CISERVER);
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.");
}
Log.e(TAG, "getCiServer is failed.");
}
*/
public class DeviceProp {
private static final String TAG = DeviceProp.class.getName();
*/
public class DeviceProp {
private static final String TAG = DeviceProp.class.getName();
- protected OcRepresentation mRep;
+ protected OcRepresentation mRep = null;
*/
public String getSsid()
{
*/
public String getSsid()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_SSID))
return mRep.getValue(ESConstants.OC_RSRVD_ES_SSID);
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.");
}
Log.e(TAG, "getSsid is failed.");
}
*/
public String getPassword()
{
*/
public String getPassword()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_CRED))
return mRep.getValue(ESConstants.OC_RSRVD_ES_CRED);
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.");
}
Log.e(TAG, "getPassword is failed.");
}
*/
public WIFI_AUTHTYPE getAuthType()
{
*/
public WIFI_AUTHTYPE getAuthType()
{
+ 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));
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;
Log.e(TAG, "getAuthType is failed.");
}
return WIFI_AUTHTYPE.NONE_AUTH;
*/
public WIFI_ENCTYPE getEncType()
{
*/
public WIFI_ENCTYPE getEncType()
{
+ 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));
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;
Log.e(TAG, "getEncType is failed.");
}
return WIFI_ENCTYPE.NONE_ENC;
*/
public String getLanguage()
{
*/
public String getLanguage()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if(mRep.hasAttribute(ESConstants.OC_RSRVD_ES_LANGUAGE))
return mRep.getValue(ESConstants.OC_RSRVD_ES_LANGUAGE);
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.");
}
Log.e(TAG, "getLanguage is failed.");
}
*/
public String getCountry()
{
*/
public String getCountry()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_COUNTRY))
return mRep.getValue(ESConstants.OC_RSRVD_ES_COUNTRY);
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.");
}
Log.e(TAG, "getCountry is failed.");
}
*/
public String getLocation()
{
*/
public String getLocation()
{
+ if(mRep == null)
+ {
+ return null;
+ }
+
+ try
+ {
if (mRep.hasAttribute(ESConstants.OC_RSRVD_ES_LOCATION))
return mRep.getValue(ESConstants.OC_RSRVD_ES_LOCATION);
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.");
}
Log.e(TAG, "getLocation is failed.");
}
}
public OcRepresentation toOCRepresentation()
}
public OcRepresentation toOCRepresentation()
*/
public String getDeviceName()
{
*/
public String getDeviceName()
{
+ if(mProvRep == null)
+ {
+ return null;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
-
- return new String("");
*/
public String getModelNumber()
{
*/
public String getModelNumber()
{
+ if(mProvRep == null)
+ {
+ return null;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
-
- return new String("");
*/
public ArrayList<WIFI_MODE> getWiFiModes()
{
*/
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) {
List<OcRepresentation> children = mProvRep.getChildren();
ArrayList<WIFI_MODE> modes = new ArrayList<WIFI_MODE>();
for (OcRepresentation child : children) {
*/
public WIFI_FREQ getWiFiFreq()
{
*/
public WIFI_FREQ getWiFiFreq()
{
+ if(mProvRep == null)
+ {
+ return WIFI_FREQ.WIFI_FREQ_NONE;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
- return WIFI_FREQ.WIFI_FREQ_NONE;
*/
public boolean isCloudAccessible()
{
*/
public boolean isCloudAccessible()
{
+ if(mProvRep == null)
+ {
+ return false;
+ }
+
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {
List<OcRepresentation> children = mProvRep.getChildren();
for (OcRepresentation child : children) {