sensor: set the maximum retention period (1 month) 17/77817/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 1 Jul 2016 06:45:00 +0000 (15:45 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 1 Jul 2016 06:45:00 +0000 (15:45 +0900)
Change-Id: Id37d909394ad1db7b8aafad4f673f7e9ef326f67
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
src/sensor/SensorProvider.cpp
src/sensor/TypesInternal.h

index e205246..32f0584 100644 (file)
@@ -119,6 +119,9 @@ int SensorProvider::__addClient(std::string pkgId, int retentionPeriod, Json opt
        Json tmp;
        int ret;
 
+       /* Validate the retention period */
+       IF_FAIL_RETURN(retentionPeriod > 0 && retentionPeriod <= MAX_RETENTION_PERIOD, ERR_INVALID_PARAMETER);
+
        /* Check if the app already started Sensor recording */
        ret = __clientInfo.get(getSubject(), pkgId, tmp);
        IF_FAIL_RETURN(ret != ERR_NONE, ERR_ALREADY_STARTED);
index 8d84066..1894520 100644 (file)
@@ -33,7 +33,7 @@
 #define SECONDS_PER_HOUR       3600
 #define SECONDS_PER_DAY                86400
 
-/* Default  Parameters */
+#define MAX_RETENTION_PERIOD   2678400                         /* 1 month (31 days) */
 #define DEFAULT_RETENTION              SECONDS_PER_HOUR        /* 1 hour */
 #define DEFAULT_QUERY_PERIOD   SECONDS_PER_DAY         /* 1 day */