diff options
author | Jin Yoon <jinny.yoon@samsung.com> | 2017-06-26 13:23:10 +0900 |
---|---|---|
committer | Jin Yoon <jinny.yoon@samsung.com> | 2017-06-26 13:23:10 +0900 |
commit | e95b32b4041c1c61c43bfff15830e677f8aac911 (patch) | |
tree | 915a846c2980d65d1ab2972de1bf3fccece1cb65 /inc | |
parent | e762cca4c09b48d273b4d28da794bb9f816dd49f (diff) | |
download | rcc-e95b32b4041c1c61c43bfff15830e677f8aac911.tar.gz rcc-e95b32b4041c1c61c43bfff15830e677f8aac911.tar.bz2 rcc-e95b32b4041c1c61c43bfff15830e677f8aac911.zip |
Initial version
Diffstat (limited to 'inc')
-rw-r--r-- | inc/controller.h | 28 | ||||
-rw-r--r-- | inc/log.h | 98 | ||||
-rw-r--r-- | inc/model.h | 37 | ||||
-rw-r--r-- | inc/model/model_infrared_motion_sensor.h | 29 | ||||
-rw-r--r-- | inc/model/model_infrared_obstacle_avoidance_sensor.h | 29 | ||||
-rw-r--r-- | inc/model/model_ultrasonic_sensor.h | 22 |
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__ */ |