+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SENSOR_RECORDER_H__
-#define __SENSOR_RECORDER_H__
-
-#include <SensorRecorderTypes.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-int sensor_recorder_test();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
/* This header SHOULD NOT be included by other headers in this directory. */
#include <ServiceBase.h>
-#include <SensorRecorderTypes.h>
namespace ctx {
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SENSOR_RECORDER_TYPES_H__
-#define __SENSOR_RECORDER_TYPES_H__
-
-#include <tizen.h>
-
-
-#endif
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CAPI_SENSOR_RECORDER_INTERNAL_H__
+#define __CAPI_SENSOR_RECORDER_INTERNAL_H__
+
+#include <tizen.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Error */
+#define CTX_SENSOR_RECORDER_ERROR_STARTED (TIZEN_ERROR_CONTEXT | 0x01)
+
+/* Subject name */
+#define CTX_SENSOR_RECORDER_BASE "sensor/"
+#define CTX_SENSOR_RECORDER_PEDOMETER CTX_SENSOR_RECORDER_BASE "pedometer"
+#define CTX_SENSOR_RECORDER_PRESSURE CTX_SENSOR_RECORDER_BASE "pressure"
+#define CTX_SENSOR_RECORDER_HEART_RATE CTX_SENSOR_RECORDER_BASE "heart_rate"
+#define CTX_SENSOR_RECORDER_SLEEP_MONITOR CTX_SENSOR_RECORDER_BASE "sleep"
+
+/* Key */
+#define CTX_SENSOR_RECORDER_KEY_RETENTION "Retention"
+#define CTX_SENSOR_RECORDER_KEY_INTERVAL "Interval"
+#define CTX_SENSOR_RECORDER_KEY_START_TIME "StartTime"
+#define CTX_SENSOR_RECORDER_KEY_END_TIME "EndTime"
+#define CTX_SENSOR_RECORDER_KEY_ANCHOR "Anchor"
+
+#define CTX_SENSOR_RECORDER_KEY_STEPS "Steps"
+#define CTX_SENSOR_RECORDER_KEY_WALK_STEPS "WalkSteps"
+#define CTX_SENSOR_RECORDER_KEY_RUN_STEPS "RunSteps"
+#define CTX_SENSOR_RECORDER_KEY_DISTANCE "Dist"
+#define CTX_SENSOR_RECORDER_KEY_CALORIES "Cal"
+#define CTX_SENSOR_RECORDER_KEY_PRESSURE "Pressure"
+#define CTX_SENSOR_RECORDER_KEY_AVG_PRESSURE "AvgPressure"
+#define CTX_SENSOR_RECORDER_KEY_MIN_PRESSURE "MinPressure"
+#define CTX_SENSOR_RECORDER_KEY_MAX_PRESSURE "MaxPressure"
+#define CTX_SENSOR_RECORDER_KEY_SLEEP_STATE "SleepState"
+#define CTX_SENSOR_RECORDER_KEY_HEART_RATE "HeartRate"
+
+typedef void* ctx_sensor_rec_option_h;
+
+typedef void* ctx_sensor_rec_query_h;
+
+typedef void* ctx_sensor_rec_data_h;
+
+typedef int ctx_sensor_rec_error_e;
+
+int ctx_sensor_rec_is_supported(const char* subject, bool *supported);
+
+int ctx_sensor_rec_start(const char* subject, ctx_sensor_rec_option_h option);
+
+int ctx_sensor_rec_stop(const char* subject);
+
+
+int ctx_sensor_rec_create_option(ctx_sensor_rec_option_h *option);
+
+int ctx_sensor_rec_destroy_option(ctx_sensor_rec_option_h option);
+
+int ctx_sensor_rec_option_set_int(ctx_sensor_rec_option_h option, const char* param, int value);
+
+
+int ctx_sensor_rec_create_query(ctx_sensor_rec_query_h *query);
+
+int ctx_sensor_rec_destroy_query(ctx_sensor_rec_query_h query);
+
+int ctx_sensor_rec_query_set_int(ctx_sensor_rec_query_h query, const char* param, int value);
+
+int ctx_sensor_rec_query_set_time(ctx_sensor_rec_query_h query, const char* param, time_t t);
+
+
+typedef bool (*ctx_sensor_rec_data_cb)(const char* subject, ctx_sensor_rec_data_h data, int remains, ctx_sensor_rec_error_e error, void *user_data);
+
+int ctx_sensor_rec_read(const char* subject, ctx_sensor_rec_query_h query, ctx_sensor_rec_data_cb cb, void *user_data);
+
+int ctx_sensor_rec_read_sync(const char* subject, ctx_sensor_rec_query_h query, ctx_sensor_rec_data_cb cb, void *user_data);
+
+
+int ctx_sensor_rec_data_get_time(ctx_sensor_rec_data_h data, time_t *start_time, time_t *end_time);
+
+int ctx_sensor_rec_data_get_int(ctx_sensor_rec_data_h data, const char* key, int *value);
+
+int ctx_sensor_rec_data_get_double(ctx_sensor_rec_data_h data, const char* key, double *value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <SensorRecorderTypesPrivate.h>
-#include <SensorRecorder.h>
-
-using namespace ctx;
-
-/* TODO: Remove this test code */
-EXPORT_API int sensor_recorder_test()
-{
- return E_SUPPORT;
-}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sensor_recorder_internal.h>
+#include <SensorRecorderTypesPrivate.h>
+
+EXPORT_API int ctx_sensor_rec_is_supported(const char* subject, bool *supported)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_start(const char* subject, ctx_sensor_rec_option_h option)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_stop(const char* subject)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_create_option(ctx_sensor_rec_option_h *option)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_destroy_option(ctx_sensor_rec_option_h option)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_option_set_int(ctx_sensor_rec_option_h option, const char* param, int value)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_create_query(ctx_sensor_rec_query_h *query)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_destroy_query(ctx_sensor_rec_query_h query)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_query_set_int(ctx_sensor_rec_query_h query, const char* param, int value)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_query_set_time(ctx_sensor_rec_query_h query, const char* param, time_t t)
+{
+ return E_SUPPORT;
+}
+
+static int __getQuery(ctx_sensor_rec_query_h query, int& startTime, int& endTime, int& anchor, int& interval)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_read(const char* subject, ctx_sensor_rec_query_h query, ctx_sensor_rec_data_cb cb, void *user_data)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_read_sync(const char* subject, ctx_sensor_rec_query_h query, ctx_sensor_rec_data_cb cb, void *user_data)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_data_get_time(ctx_sensor_rec_data_h data, time_t *start_time, time_t *end_time)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_data_get_int(ctx_sensor_rec_data_h data, const char* key, int *value)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_data_get_double(ctx_sensor_rec_data_h data, const char* key, double *value)
+{
+ return E_SUPPORT;
+}
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <SensorRecorderTypesPrivate.h>
-#include <ServiceProxy.h>
-#include <SensorRecorder.h>
-
-using namespace ctx;
-
-/* TODO: Remove this test code */
-EXPORT_API int sensor_recorder_test()
-{
- // ServiceProxy object can be maintained as a static object.
- ServiceProxy proxy(CTX_SENSOR_RECORDER);
-
- GVariant* output = NULL;
-
- int err = proxy.call("test", g_variant_new("(i)", 100), &output);
-
- _I(YELLOW("Return: %d (%s)"), err, CTX_ERROR_STR(err));
-
- return err;
-}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sensor_recorder_internal.h>
+#include <SensorRecorderTypesPrivate.h>
+#include <ServiceProxy.h>
+#include <map>
+#include <cmath>
+
+typedef std::map<std::string, int> ctx_sensor_rec_option_t;
+typedef std::map<std::string, int> ctx_sensor_rec_query_t;
+
+using namespace ctx;
+
+EXPORT_API int ctx_sensor_rec_is_supported(const char* subject, bool *supported)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_start(const char* subject, ctx_sensor_rec_option_h option)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_stop(const char* subject)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_create_option(ctx_sensor_rec_option_h *option)
+{
+ IF_FAIL_RETURN(option, E_PARAM);
+
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_destroy_option(ctx_sensor_rec_option_h option)
+{
+ IF_FAIL_RETURN(option, E_PARAM);
+
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_option_set_int(ctx_sensor_rec_option_h option, const char* param, int value)
+{
+ IF_FAIL_RETURN(option, E_PARAM);
+ IF_FAIL_RETURN(STR_EQ(param, CTX_SENSOR_RECORDER_KEY_INTERVAL) ||
+ STR_EQ(param, CTX_SENSOR_RECORDER_KEY_RETENTION), E_PARAM);
+
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_create_query(ctx_sensor_rec_query_h *query)
+{
+ IF_FAIL_RETURN(query, E_PARAM);
+
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_destroy_query(ctx_sensor_rec_query_h query)
+{
+ IF_FAIL_RETURN(query, E_PARAM);
+
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_query_set_int(ctx_sensor_rec_query_h query, const char* param, int value)
+{
+ IF_FAIL_RETURN(query, E_PARAM);
+ IF_FAIL_RETURN(STR_EQ(param, CTX_SENSOR_RECORDER_KEY_ANCHOR) ||
+ STR_EQ(param, CTX_SENSOR_RECORDER_KEY_INTERVAL), E_PARAM);
+
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_query_set_time(ctx_sensor_rec_query_h query, const char* param, time_t t)
+{
+ IF_FAIL_RETURN(query, E_PARAM);
+ IF_FAIL_RETURN(STR_EQ(param, CTX_SENSOR_RECORDER_KEY_START_TIME) ||
+ STR_EQ(param, CTX_SENSOR_RECORDER_KEY_END_TIME), E_PARAM);
+
+ return E_SUPPORT;
+}
+
+static int __getQuery(ctx_sensor_rec_query_h query, int& startTime, int& endTime, int& anchor, int& interval)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_read(const char* subject, ctx_sensor_rec_query_h query, ctx_sensor_rec_data_cb cb, void *user_data)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_read_sync(const char* subject, ctx_sensor_rec_query_h query, ctx_sensor_rec_data_cb cb, void *user_data)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_data_get_time(ctx_sensor_rec_data_h data, time_t *start_time, time_t *end_time)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_data_get_int(ctx_sensor_rec_data_h data, const char* key, int *value)
+{
+ return E_SUPPORT;
+}
+
+EXPORT_API int ctx_sensor_rec_data_get_double(ctx_sensor_rec_data_h data, const char* key, double *value)
+{
+ return E_SUPPORT;
+}
" <arg type='i' name='return' direction='out'/>" \
"</method>"
+#ifndef STR_EQ
+#define STR_EQ(X, Y) (g_strcmp0((X), (Y)) == 0)
+#endif
+
#endif