From: Jay Sharma Date: Tue, 1 Sep 2015 04:33:20 +0000 (+0530) Subject: [Resource-Encapsulation] Enabled Sample bundle build for Android platform X-Git-Tag: 1.2.0+RC1~1133^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=970e18a650a5310c3930f0feeb73f4638e2206c5;p=platform%2Fupstream%2Fiotivity.git [Resource-Encapsulation] Enabled Sample bundle build for Android platform - [Resource Container] Soft Sensor Bundle build for android - Added Exception to RCSRemoteResourceObject API Change-Id: I98e3711857a6339efc09e146c2e6fb399e654b44 Signed-off-by: Jay Sharma Reviewed-on: https://gerrit.iotivity.org/gerrit/2329 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- diff --git a/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp b/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp index 369ef51..c842038 100644 --- a/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp +++ b/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp @@ -287,7 +287,16 @@ namespace OIC { SCOPE_LOG_F(DEBUG, TAG); - return getCachedAttributes().at(key); + //check whether key is available or not + RCSResourceAttributes cachedAttributes= getCachedAttributes(); + if(cachedAttributes.contains(key)) + { + return getCachedAttributes().at(key); + } + else + { + throw BadRequestException{ "Requested Attribute is not present" }; + } } std::string RCSRemoteResourceObject::getUri() const diff --git a/service/resource-encapsulation/src/resourceContainer/SConscript b/service/resource-encapsulation/src/resourceContainer/SConscript index 966cc12..373c979 100644 --- a/service/resource-encapsulation/src/resourceContainer/SConscript +++ b/service/resource-encapsulation/src/resourceContainer/SConscript @@ -127,7 +127,7 @@ resource_container_env.InstallTarget([res_container_static,res_container_shared] ###################################################################### # build soft sensor sample bundle ###################################################################### -if target_os == 'linux': +if target_os in ['linux', 'android']: ss_resource_bundle_env = resource_container_env.Clone() ss_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC']) diff --git a/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/SoftSensorBundleActivator.cpp b/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/SoftSensorBundleActivator.cpp index 2647188..1a60d57 100644 --- a/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/SoftSensorBundleActivator.cpp +++ b/service/resource-encapsulation/src/resourceContainer/examples/SoftSensorSampleBundle/src/SoftSensorBundleActivator.cpp @@ -21,6 +21,7 @@ #include "SoftSensorBundleActivator.h" #include "DiscomfortIndexSensorResource.h" #include +#include SoftSensorBundleActivator *bundle; @@ -70,8 +71,14 @@ void SoftSensorBundleActivator::createResource(resourceInfo resourceInfo) DiscomfortIndexSensorResource *newResource = new DiscomfortIndexSensorResource(); newResource->m_bundleId = m_bundleId; - newResource->m_uri = "/softsensor/discomfortIndex/" + std::to_string( - discomfortIndexSensorCount++); + + std::string indexCount;//string which will contain the indexCount + stringstream convert; // stringstream used for the conversion + convert << discomfortIndexSensorCount++;//add the value of Number to the characters in the stream + indexCount = convert.str();//set indexCount to the content of the stream + + newResource->m_uri = "/softsensor/discomfortIndex/" + indexCount; + newResource->m_resourceType = resourceInfo.resourceType; newResource->m_mapResourceProperty = resourceInfo.resourceProperty;