return ECORE_CALLBACK_RENEW;
}
-static void gathering_start(void *data)
+static void gathering_stop(void *data)
{
app_data *ad = data;
ret_if(!ad);
- if (ad->getter_co2)
+ if (ad->getter_co2) {
ecore_timer_del(ad->getter_co2);
+ ad->getter_co2 = NULL;
+ }
+}
+
+static void gathering_start(void *data)
+{
+ app_data *ad = data;
+ ret_if(!ad);
ad->getter_co2 = ecore_timer_add(SENSOR_GATHER_INTERVAL, __get_co2, ad);
if (!ad->getter_co2)
_E("Failed to add getter_co2");
-
- return;
}
#ifdef USE_ST_SDK
if (things_status == ST_THINGS_STATUS_REGISTERED_TO_CLOUD)
ecore_main_loop_thread_safe_call_async(gathering_start, g_ad);
+ else
+ ecore_main_loop_thread_safe_call_async(gathering_stop, g_ad);
}
static bool handle_get_request(st_things_get_request_message_s* req_msg, st_things_representation_s* resp_rep)
static void service_app_control(app_control_h app_control, void *user_data)
{
#ifdef USE_ST_SDK
+ __things_stop();
__things_start();
#else
+ gathering_stop(user_data);
gathering_start(user_data);
#endif
}
if (!ad)
return;
- if (ad->getter_co2)
- ecore_timer_del(ad->getter_co2);
-
#ifdef USE_ST_SDK
__things_stop();
__things_deinit();