summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/controller.h28
-rw-r--r--inc/log.h98
-rw-r--r--inc/model.h37
-rw-r--r--inc/model/model_infrared_motion_sensor.h29
-rw-r--r--inc/model/model_infrared_obstacle_avoidance_sensor.h29
-rw-r--r--inc/model/model_ultrasonic_sensor.h22
6 files changed, 243 insertions, 0 deletions
diff --git a/inc/controller.h b/inc/controller.h
new file mode 100644
index 0000000..aef6e47
--- /dev/null
+++ b/inc/controller.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ *
+ * 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 __POSITION_FINDER_CONTROLLER_H__
+#define __POSITION_FINDER_CONTROLLER_H__
+
+typedef int (*controller_event_cb)(const char *event_name, void *event_info, void *data);
+
+extern int controller_register_event_cb(const char *event_name, controller_event_cb event_cb, void *data);
+extern int controller_unregister_event_cb(const char *event_name, controller_event_cb event_cb);
+extern int controller_send_event(const char *event_name, void *event_info);
+
+#endif /* __POSITION_FINDER_CONTROLLER_H__ */
diff --git a/inc/log.h b/inc/log.h
new file mode 100644
index 0000000..e154be1
--- /dev/null
+++ b/inc/log.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ *
+ * 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 __POSITION_FINDER_SERVER_H__
+#define __POSITION_FINDER_SERVER_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "POSITION_FINDER_SERVER"
+
+#if !defined(_D)
+#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_I)
+#define _I(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_W)
+#define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_E)
+#define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
+#endif
+
+#define retvm_if(expr, val, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return val; \
+ } \
+} while (0)
+
+#define retv_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return (val); \
+ } \
+} while (0)
+
+#define retm_if(expr, fmt, arg...) do { \
+ if(expr) { \
+ _E(fmt, ##arg); \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define ret_if(expr) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define goto_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> goto", #expr); \
+ goto val; \
+ } \
+} while (0)
+
+#define break_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> break", #expr); \
+ break; \
+ } \
+}
+
+#define continue_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> continue", #expr); \
+ continue; \
+ } \
+}
+
+
+
+#endif /* __POSITION_FINDER_SERVER_H__ */
diff --git a/inc/model.h b/inc/model.h
new file mode 100644
index 0000000..f564175
--- /dev/null
+++ b/inc/model.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ *
+ * 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 __POSITION_FINDER_MODEL_H__
+#define __POSITION_FINDER_MODEL_H__
+
+enum sensor_type {
+ SENSOR_TYPE_ULTRASONIC,
+ SENSOR_TYPE_INFRARED_MOTION, /* HC_SR501 */
+ SENSOR_TYPE_INFRARED_OBSTACLE_AVOIDANCE, /* HC_SR501 */
+};
+typedef enum sensor_type sensor_type_e;
+
+extern int model_init(sensor_type_e sensor_type);
+extern void model_fini(void);
+
+extern int model_alloc(void **data);
+
+extern int model_read_int_value(int *out_value);
+extern int model_write(void *data);
+
+#endif /* __POSITION_FINDER_MODEL_H__ */
diff --git a/inc/model/model_infrared_motion_sensor.h b/inc/model/model_infrared_motion_sensor.h
new file mode 100644
index 0000000..4ff90c7
--- /dev/null
+++ b/inc/model/model_infrared_motion_sensor.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ *
+ * 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 __POSITION_FINDER_MODEL_INFRARED_MOTION_SENSOR_H__
+#define __POSITION_FINDER_MODEL_INFRARED_MOTION_SENSOR_H__
+
+typedef struct infrared_motion_event infrared_motion_event_s;
+
+extern int model_init_infrared_motion_sensor(void);
+extern void model_fini_infrared_motion_sensor(void);
+
+extern int model_read_infrared_motion_sensor(int *out_value);
+
+#endif /* __POSITION_FINDER_MODEL_INFRARED_MOTION_SENSOR_H__ */
diff --git a/inc/model/model_infrared_obstacle_avoidance_sensor.h b/inc/model/model_infrared_obstacle_avoidance_sensor.h
new file mode 100644
index 0000000..bfba8f9
--- /dev/null
+++ b/inc/model/model_infrared_obstacle_avoidance_sensor.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ *
+ * 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 __POSITION_FINDER_MODEL_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
+#define __POSITION_FINDER_MODEL_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
+
+typedef struct infrared_obstacle_avoidance_event infrared_obstacle_avoidance_event_s;
+
+extern int model_init_infrared_obstacle_avoidance_sensor(void);
+extern void model_fini_infrared_obstacle_avoidance_sensor(void);
+
+extern int model_read_infrared_obstacle_avoidance_sensor(int *out_value);
+
+#endif /* __POSITION_FINDER_MODEL_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__ */
diff --git a/inc/model/model_ultrasonic_sensor.h b/inc/model/model_ultrasonic_sensor.h
new file mode 100644
index 0000000..e0c9f56
--- /dev/null
+++ b/inc/model/model_ultrasonic_sensor.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ *
+ * 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 __POSITION_FINDER_MODEL_ULTRASONIC_SENSOR_H__
+#define __POSITION_FINDER_MODEL_ULTRASONIC_SENSOR_H__
+
+#endif /* __POSITION_FINDER_MODEL_ULTRASONIC_SENSOR_H__ */