summaryrefslogtreecommitdiff
path: root/src/controller.c
diff options
context:
space:
mode:
authorGeunsun, Lee <gs86.lee@samsung.com>2017-07-10 16:45:53 +0900
committerGeunSun Lee <gs86.lee@samsung.com>2017-07-14 01:00:46 +0000
commit6ffdd858967c99fe675fb676c6a2049be0eb5197 (patch)
tree1ed2346fc56833254b430455d02e54c7a3d1d2aa /src/controller.c
parent101467ea3e01e4e4eb6c30daa9d539e7cf83a3ee (diff)
downloadrcc-6ffdd858967c99fe675fb676c6a2049be0eb5197.tar.gz
rcc-6ffdd858967c99fe675fb676c6a2049be0eb5197.tar.bz2
rcc-6ffdd858967c99fe675fb676c6a2049be0eb5197.zip
Implement multiple sensor logic
Change-Id: I9f33f9c9336c32f7ab798d50a10cd0a3ef1a3c33
Diffstat (limited to 'src/controller.c')
-rw-r--r--src/controller.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/controller.c b/src/controller.c
index b84b259..ae6ba1a 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -37,16 +37,36 @@
#define GPIO_INFRARED_MOTION_NUM_1 4
#define I2C_ILLUMINANCE_FIRST_PIN_1 3
+#define USE_MULTIPLE_SENSOR 1
+
typedef struct app_data_s {
Ecore_Timer *getter_timer[PIN_MAX];
} app_data;
static Eina_Bool _infrared_motion_getter_timer(void *data)
{
+#if USE_MULTIPLE_SENSOR
+ int gpio_num[3] = { 16, 23, 26 };
+ int i = 0;
+ int value[3] = { 0, };
+
+ for (i = 0; i < 3; i++) {
+ if (model_read_infrared_motion_sensor(gpio_num[i], &value[i]) == -1) {
+ _E("Failed to get Infrared Motion value [GPIO:%d]", gpio_num[i]);
+ continue;
+ }
+ _I("[GPIO:%d] Infrared Motion Value is [%d]", gpio_num[i], value[i]);
+ }
+
+
+ //@TODO: Send the data to Analyzer using connectivity APIs
+
+#else
int value = 0;
retv_if(resource_read_infrared_motion_sensor(GPIO_INFRARED_MOTION_NUM_1, &value) == -1, ECORE_CALLBACK_CANCEL);
_I("Infrared Motion Value is [%d]", value);
+#endif
return ECORE_CALLBACK_RENEW;
}
@@ -75,6 +95,13 @@ static bool service_app_create(void *data)
{
app_data *ad = data;
+#if USE_MULTIPLE_SENSOR
+ ad->getter_timer[GPIO_INFRARED_MOTION_NUM_1] = ecore_timer_add(3.0, _infrared_motion_getter_timer, ad);
+ if (!ad->getter_timer[GPIO_INFRARED_MOTION_NUM_1]) {
+ _E("Failed to add infrared motion getter timer");
+ return false;
+ }
+#else
/* One Pin Sensor */
ad->getter_timer[GPIO_INFRARED_MOTION_NUM_1] = ecore_timer_add(3.0, _infrared_motion_getter_timer, ad);
if (!ad->getter_timer[GPIO_INFRARED_MOTION_NUM_1]) {
@@ -95,6 +122,7 @@ static bool service_app_create(void *data)
_D("Failed to add ultra sonic getter timer");
return false;
}
+#endif
return true;
}