__uninstallMonitor = NULL;
}
-int RecorderClientInfo::get(std::string subject, std::string pkgId, Json& option)
+int RecorderClientInfo::get(std::string subject, std::string pkgId, CtxJson& option)
{
bool ret;
std::string optStr;
return E_NONE;
}
-int RecorderClientInfo::get(std::string subject, std::vector<Json>& options)
+int RecorderClientInfo::get(std::string subject, std::vector<CtxJson>& options)
{
bool ret;
std::string optStr;
for (auto& tuple : tuples) {
tuple->getAt(0, &optStr);
- options.push_back(Json(optStr));
+ options.push_back(CtxJson(optStr));
}
return E_NONE;
return true;
}
-bool RecorderClientInfo::set(std::string subject, std::string pkgId, Json option, int retentionPeriod)
+bool RecorderClientInfo::set(std::string subject, std::string pkgId, CtxJson option, int retentionPeriod)
{
bool ret;
char *query = sqlite3_mprintf(
return ret;
}
-void RecorderClientInfo::getParam(std::vector<Json> &options, const char *key, float *min, float *max)
+void RecorderClientInfo::getParam(std::vector<CtxJson> &options, const char *key, float *min, float *max)
{
double val;
- for (Json& opt : options) {
+ for (CtxJson& opt : options) {
if (!opt.get(NULL, key, &val))
continue;
if (min)
#include <string>
#include <vector>
-#include <Json.h>
+#include <CtxJson.h>
#include <SensorRecorderTypesPrivate.h>
#include "UninstallMonitor.h"
RecorderClientInfo();
~RecorderClientInfo();
- int get(std::string subject, std::string pkgId, Json& option);
- int get(std::string subject, std::vector<Json>& options);
+ int get(std::string subject, std::string pkgId, CtxJson& option);
+ int get(std::string subject, std::vector<CtxJson>& options);
bool exist(std::string subject);
- bool set(std::string subject, std::string pkgId, Json option, int retentionPeriod);
+ bool set(std::string subject, std::string pkgId, CtxJson option, int retentionPeriod);
bool remove(std::string subject, std::string pkgId);
- void getParam(std::vector<Json>& options, const char *key, float *min, float *max);
+ void getParam(std::vector<CtxJson>& options, const char *key, float *min, float *max);
static void purgeClient(std::string pkgId);
static void setHostService(SensorRecorderService* hostService);
return NULL;
}
-int SensorProvider::readRecords(Json option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples)
+int SensorProvider::readRecords(CtxJson option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples)
{
int endTime = static_cast<int>(time(NULL)) + 1;
int startTime = endTime - DEFAULT_QUERY_PERIOD - 1;
return ret;
}
-int SensorProvider::startRecording(const std::string& pkgId, Json option)
+int SensorProvider::startRecording(const std::string& pkgId, CtxJson option)
{
int retentionPeriod = DEFAULT_RETENTION;
return __removeClient(pkgId);
}
-bool SensorProvider::verifyOption(Json option)
+bool SensorProvider::verifyOption(CtxJson option)
{
std::list<std::string> keys;
option.getKeys(&keys);
return keys.size() == 0;
}
-int SensorProvider::__addClient(std::string pkgId, int retentionPeriod, Json option)
+int SensorProvider::__addClient(std::string pkgId, int retentionPeriod, CtxJson option)
{
- Json tmp;
+ CtxJson tmp;
int ret;
/* Validate the retention period */
int SensorProvider::__removeClient(std::string pkgId)
{
- std::vector<Json> options;
+ std::vector<CtxJson> options;
int ret;
/* Remove the app's request first */
const char* getSubject();
- int readRecords(Json option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples);
- int startRecording(const std::string& pkgId, Json option);
+ int readRecords(CtxJson option, std::string* projection, std::vector<std::shared_ptr<Tuple>>* tuples);
+ int startRecording(const std::string& pkgId, CtxJson option);
int stopRecording(const std::string& pkgId);
virtual bool isSupported();
virtual SensorLogger* getLogger() = 0;
virtual Querier* getQuerier() = 0;
- virtual bool verifyOption(Json option);
+ virtual bool verifyOption(CtxJson option);
private:
- int __addClient(std::string pkgId, int retentionPeriod, Json option);
+ int __addClient(std::string pkgId, int retentionPeriod, CtxJson option);
int __removeClient(std::string pkgId);
std::string __subject;
return &__querier;
}
-bool HeartRateProvider::verifyOption(Json option)
+bool HeartRateProvider::verifyOption(CtxJson option)
{
std::list<std::string> keys;
option.getKeys(&keys);
protected:
SensorLogger* getLogger();
Querier* getQuerier();
- bool verifyOption(Json option);
+ bool verifyOption(CtxJson option);
private:
HeartRateLogger __logger;
bool HeartRateLogger::start()
{
- std::vector<Json> options;
+ std::vector<CtxJson> options;
RecorderClientInfo clientInfo;
float interval = MAX_MEASURING_INTERVAL;