sensord: remove the changing g_main_context API 78/64478/3
authorkibak.yoon <kibak.yoon@samsung.com>
Fri, 1 Apr 2016 10:14:42 +0000 (19:14 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Fri, 1 Apr 2016 10:35:47 +0000 (19:35 +0900)
* this feature is not used anymore

Change-Id: I9073d2ee3908ca5d332b7659801e7f0f2b00d825
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/client/client.cpp
src/client/reg_event_info.h
src/client/sensor_client_info.cpp
src/client/sensor_client_info.h
src/client/sensor_event_listener.cpp
src/client/sensor_event_listener.h
src/client/sensor_handle_info.cpp
src/client/sensor_handle_info.h
src/client/sensor_internal.h

index 302f6e9..ac357bf 100644 (file)
@@ -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;
index fa8994c..bf20efc 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef _REG_EVENT_INFO_H_
 #define _REG_EVENT_INFO_H_
 
-#include <glib.h>
 #include <sensor_common.h>
 
 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() {}
 };
index ded2acc..d6133c3 100644 (file)
@@ -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);
index 47a4adf..33524f1 100644 (file)
@@ -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);
index c71b9cd..5964ab6 100644 (file)
@@ -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)
index fa7b77e..54f5a40 100644 (file)
@@ -59,7 +59,6 @@ typedef struct {
        unsigned long long timestamp;
        int accuracy;
        void *accuracy_user_data;
-       GMainContext *maincontext;
        void *buffer;
 } client_callback_info;
 
index 796107f..10cd629 100644 (file)
@@ -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()) {
index fa0fb4c..d551952 100644 (file)
@@ -25,7 +25,6 @@
 #include <sensor_log.h>
 #include <string.h>
 #include <unordered_map>
-#include <glib.h>
 
 typedef std::unordered_map<unsigned int,reg_event_info> 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);
index e5cd958..7a0a3e1 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "stdbool.h"
 #include <sys/types.h>
-#include <glib.h>
 
 /*header for common sensor type*/
 #include <sensor_common.h>
@@ -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.