sensor: align recording request json format with sensor api 19/77819/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 1 Jul 2016 06:45:58 +0000 (15:45 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 1 Jul 2016 06:45:58 +0000 (15:45 +0900)
Change-Id: Ief0236c20797bdd14fa327cbd3a085c93ff1a0bc
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
src/sensor/SensorProvider.cpp

index 8cc8e1f..71e4c01 100644 (file)
@@ -98,6 +98,7 @@ int SensorProvider::write(Json data, Json *requestResult)
 
        std::string operation;
        std::string pkgId;
+       Json option;
        int retentionPeriod = DEFAULT_RETENTION;
 
        _J("Data", data);
@@ -105,13 +106,15 @@ int SensorProvider::write(Json data, Json *requestResult)
        IF_FAIL_RETURN(data.get(NULL, KEY_OPERATION, &operation), ERR_INVALID_PARAMETER);
        IF_FAIL_RETURN(data.get(NULL, KEY_CLIENT_PKG_ID, &pkgId), ERR_INVALID_PARAMETER);
 
-       if (data.get(NULL, KEY_RETENTION, &retentionPeriod))
-               retentionPeriod *= SECONDS_PER_HOUR;
+       data.get(NULL, KEY_OPTION, &option);
 
-       /* TODO: remove the operation & pkg id from the json */
+       if (option.get(NULL, KEY_RETENTION, &retentionPeriod)) {
+               retentionPeriod *= SECONDS_PER_HOUR;
+               option.remove(NULL, KEY_RETENTION);
+       }
 
        if (operation == VAL_START)
-               return __addClient(pkgId, retentionPeriod, data);
+               return __addClient(pkgId, retentionPeriod, option);
        else if (operation == VAL_STOP)
                return __removeClient(pkgId);