From cb1cc05d6587ed55e64bd7ab73dd100f5e87cb59 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Fri, 1 Apr 2016 19:14:42 +0900 Subject: [PATCH] sensord: remove the changing g_main_context API * this feature is not used anymore Change-Id: I9073d2ee3908ca5d332b7659801e7f0f2b00d825 Signed-off-by: kibak.yoon --- src/client/client.cpp | 13 ------------- src/client/reg_event_info.h | 4 +--- src/client/sensor_client_info.cpp | 17 ----------------- src/client/sensor_client_info.h | 1 - src/client/sensor_event_listener.cpp | 10 +--------- src/client/sensor_event_listener.h | 1 - src/client/sensor_handle_info.cpp | 14 -------------- src/client/sensor_handle_info.h | 2 -- src/client/sensor_internal.h | 11 ----------- 9 files changed, 2 insertions(+), 71 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index 302f6e9..ac357bf 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -976,19 +976,6 @@ API bool sensord_change_event_max_batch_latency(int handle, unsigned int event_t return change_event_batch(handle, event_type, prev_interval, max_batch_latency); } -API bool sensord_change_event_maincontext(int handle, unsigned int event_type, GMainContext *maincontext) -{ - AUTOLOCK(lock); - - if (!sensor_client_info::get_instance().set_event_maincontext(handle, event_type, maincontext)) { - _E("Failed to get event info with handle = %d, event_type = 0x%x, maincontext = 0x%x", handle, event_type, maincontext); - return false; - } - - _I("handle = %d, event_type = 0x%x, maincontext = 0x%x", handle, event_type, maincontext); - return true; -} - API bool sensord_set_option(int handle, int option) { sensor_id_t sensor_id; diff --git a/src/client/reg_event_info.h b/src/client/reg_event_info.h index fa8994c..bf20efc 100644 --- a/src/client/reg_event_info.h +++ b/src/client/reg_event_info.h @@ -20,7 +20,6 @@ #ifndef _REG_EVENT_INFO_H_ #define _REG_EVENT_INFO_H_ -#include #include typedef enum { @@ -41,13 +40,12 @@ public: void *m_user_data; unsigned long long m_previous_event_time; bool m_fired; - GMainContext *m_maincontext; reg_event_info() : m_id(0), m_handle(-1), type(0), m_interval(POLL_1HZ_MS), m_latency(0), m_cb_type(SENSOR_EVENT_CB), m_cb(NULL), m_user_data(NULL), - m_previous_event_time(0), m_fired(false), m_maincontext(NULL) {} + m_previous_event_time(0), m_fired(false) {} ~reg_event_info() {} }; diff --git a/src/client/sensor_client_info.cpp b/src/client/sensor_client_info.cpp index ded2acc..d6133c3 100644 --- a/src/client/sensor_client_info.cpp +++ b/src/client/sensor_client_info.cpp @@ -249,23 +249,6 @@ bool sensor_client_info::set_event_batch(int handle, unsigned int event_type, un return true; } -bool sensor_client_info::set_event_maincontext(int handle, unsigned int event_type, GMainContext *maincontext) -{ - AUTOLOCK(m_handle_info_lock); - - auto it_handle = m_sensor_handle_infos.find(handle); - - if (it_handle == m_sensor_handle_infos.end()) { - _E("Handle[%d] is not found for client %s", handle, get_client_name()); - return false; - } - - if (!it_handle->second.change_reg_event_maincontext(event_type, maincontext)) - return false; - - return true; -} - bool sensor_client_info::set_accuracy(int handle, int accuracy) { AUTOLOCK(m_handle_info_lock); diff --git a/src/client/sensor_client_info.h b/src/client/sensor_client_info.h index 47a4adf..33524f1 100644 --- a/src/client/sensor_client_info.h +++ b/src/client/sensor_client_info.h @@ -76,7 +76,6 @@ public: bool set_sensor_state(int handle, int sensor_state); bool set_sensor_option(int handle, int sensor_option); bool set_event_batch(int handle, unsigned int event_type, unsigned int interval, unsigned int latency); - bool set_event_maincontext(int handle, unsigned int event_type, GMainContext *maincontext); bool set_accuracy(int handle, int accuracy); bool set_bad_accuracy(int handle, int bad_accuracy); bool get_event_info(int handle, unsigned int event_type, unsigned int &interval, unsigned int &latency, int &cb_type, void* &cb, void* &user_data); diff --git a/src/client/sensor_event_listener.cpp b/src/client/sensor_event_listener.cpp index c71b9cd..5964ab6 100644 --- a/src/client/sensor_event_listener.cpp +++ b/src/client/sensor_event_listener.cpp @@ -255,7 +255,6 @@ client_callback_info* sensor_event_listener::get_callback_info(sensor_id_t senso callback_info->timestamp = 0; callback_info->accuracy = -1; callback_info->accuracy_user_data = NULL; - callback_info->maincontext = event_info->m_maincontext; callback_info->sensor_data = sensor_data; callback_info->buffer = buffer; @@ -264,14 +263,7 @@ client_callback_info* sensor_event_listener::get_callback_info(sensor_id_t senso void sensor_event_listener::post_callback_to_main_loop(client_callback_info* cb_info) { - if (cb_info->maincontext) { - GSource *_source = g_idle_source_new(); - - g_source_attach(_source, cb_info->maincontext); - g_source_set_callback(_source, callback_dispatcher, cb_info, NULL); - } else { - g_idle_add_full(G_PRIORITY_DEFAULT, callback_dispatcher, cb_info, NULL); - } + g_idle_add_full(G_PRIORITY_DEFAULT, callback_dispatcher, cb_info, NULL); } bool sensor_event_listener::is_valid_callback(client_callback_info *cb_info) diff --git a/src/client/sensor_event_listener.h b/src/client/sensor_event_listener.h index fa7b77e..54f5a40 100644 --- a/src/client/sensor_event_listener.h +++ b/src/client/sensor_event_listener.h @@ -59,7 +59,6 @@ typedef struct { unsigned long long timestamp; int accuracy; void *accuracy_user_data; - GMainContext *maincontext; void *buffer; } client_callback_info; diff --git a/src/client/sensor_handle_info.cpp b/src/client/sensor_handle_info.cpp index 796107f..10cd629 100644 --- a/src/client/sensor_handle_info.cpp +++ b/src/client/sensor_handle_info.cpp @@ -131,20 +131,6 @@ bool sensor_handle_info::change_reg_event_batch(unsigned int event_type, unsigne return true; } -bool sensor_handle_info::change_reg_event_maincontext(unsigned int event_type, GMainContext *maincontext) -{ - auto it_event = m_reg_event_infos.find(event_type); - - if (it_event == m_reg_event_infos.end()) { - _E("Event %s[0x%x] is not registered for client %s", get_event_name(event_type), event_type, get_client_name()); - return false; - } - - it_event->second.m_maincontext = maincontext; - - return true; -} - void sensor_handle_info::get_batch(unsigned int &interval, unsigned int &latency) { if (m_reg_event_infos.empty()) { diff --git a/src/client/sensor_handle_info.h b/src/client/sensor_handle_info.h index fa0fb4c..d551952 100644 --- a/src/client/sensor_handle_info.h +++ b/src/client/sensor_handle_info.h @@ -25,7 +25,6 @@ #include #include #include -#include typedef std::unordered_map event_info_map; @@ -47,7 +46,6 @@ public: bool delete_reg_event_info(unsigned int event_type); bool change_reg_event_batch(unsigned int event_type, unsigned int interval, unsigned int latency); - bool change_reg_event_maincontext(unsigned int event_type, GMainContext *maincontext); reg_event_info* get_reg_event_info(const unsigned int event_type); void get_reg_event_types(event_type_vector &event_types); diff --git a/src/client/sensor_internal.h b/src/client/sensor_internal.h index e5cd958..7a0a3e1 100644 --- a/src/client/sensor_internal.h +++ b/src/client/sensor_internal.h @@ -26,7 +26,6 @@ #include "stdbool.h" #include -#include /*header for common sensor type*/ #include @@ -318,16 +317,6 @@ bool sensord_change_event_interval(int handle, unsigned int event_type, unsigned bool sensord_change_event_max_batch_latency(int handle, unsigned int event_type, unsigned int max_batch_latency); /** - * @brief Change the maincontext of a specifed event type in a connected sensor. - * - * @param[in] handle a handle represensting a connected sensor. - * @param[in] event_type an event type to change maincontext. - * @param[in] maincontext an event is passed to default GMainLoop as default. And it can be changed to specific GMainContext. - * @return true on success, otherwise false. - */ -bool sensord_change_event_maincontext(int handle, unsigned int event_type, GMainContext *maincontext); - -/** * @brief Change the option of a connected sensor. * * @param[in] handle a handle represensting a connected sensor. -- 2.7.4