}
void DiscomfortIndexSensorResource::handleSetAttributesRequest(
- RCSResourceAttributes &value)
+ const RCSResourceAttributes &value,
+ const std::map< std::string, std::string > &queryParams)
{
+ (void)queryParams;
BundleResource::setAttributes(value);
}
-RCSResourceAttributes &DiscomfortIndexSensorResource::handleGetAttributesRequest()
+RCSResourceAttributes DiscomfortIndexSensorResource::handleGetAttributesRequest(
+ const std::map< std::string, std::string > &queryParams)
{
+ (void)queryParams;
return BundleResource::getAttributes();
}
m_pDiscomfortIndexSensor->executeDISensorLogic(&m_mapInputData, &strDiscomfortIndex);
- setAttribute("discomfortIndex", RCSResourceAttributes::Value(strDiscomfortIndex.c_str()));
+ setAttribute("discomfortIndex", RCSResourceAttributes::Value(strDiscomfortIndex.c_str()), true);
for (auto it : m_mapInputData)
{
void DiscomfortIndexSensorResource::onUpdatedInputResource(const std::string attributeName,
std::vector<RCSResourceAttributes::Value> values)
{
- double sum = 0;
- double dConvert;
+ double sum = 0.0;
+ double dConvert = 0.0;
int inputCount = 0;
std::string itString;
++inputCount;
}
- double result = sum / inputCount;
+ double result = 0.0;
+ if (inputCount)
+ {
+ result = sum / inputCount;
+ }
std::string indexCount;//string which will contain the indexCount
std::stringstream convert; // stringstream used for the conversion
convert << result;//add the value of Number to the characters in the stream