Remove Vasum zone control code 51/44351/1
authorMu-Woong <muwoong.lee@samsung.com>
Tue, 21 Jul 2015 06:06:20 +0000 (15:06 +0900)
committerMu-Woong <muwoong.lee@samsung.com>
Tue, 21 Jul 2015 06:06:20 +0000 (15:06 +0900)
Change-Id: I7528e43c3094a685bd061368a58743c717acb359
Signed-off-by: Mu-Woong <muwoong.lee@samsung.com>
include/place_context_provider.h
src/place_context_provider.cpp
src/place_geofence/myplace_handle.cpp
src/place_geofence/myplace_handle.h
src/place_geofence/place_geofence.cpp
src/place_geofence/place_geofence.h
src/sub_provider_base.cpp
src/sub_provider_base.h

index 849bc14..1cc83fc 100644 (file)
@@ -28,11 +28,11 @@ namespace ctx {
                        ~place_context_provider();
 
                        bool init();
-                       bool is_supported(const char* subject, const char* zone);
-                       int subscribe(const char* subject, ctx::json option, ctx::json* request_result, const char* zone);
-                       int unsubscribe(const char* subject, ctx::json option, const char* zone);
-                       int read(const char* subject, ctx::json option, ctx::json* request_result, const char* zone);
-                       int write(const char* subject, ctx::json data, ctx::json* request_result, const char* zone);
+                       bool is_supported(const char* subject);
+                       int subscribe(const char* subject, ctx::json option, ctx::json* request_result);
+                       int unsubscribe(const char* subject, ctx::json option);
+                       int read(const char* subject, ctx::json option, ctx::json* request_result);
+                       int write(const char* subject, ctx::json data, ctx::json* request_result);
 
        };      /* class place_context_provider */
 
index 8f92c1e..fdb6f37 100644 (file)
@@ -29,7 +29,7 @@
 
 #define CREATE_SUB_PROVIDER(subject, subprovider) do { \
        ctx::sub_provider_base *sub = new ctx::subprovider(); \
-       if (sub->is_supported(NULL)) { \
+       if (sub->is_supported()) { \
                subject_map[(subject)] = sub; \
        } else { \
                _E("%s is not supported", subject); \
@@ -83,52 +83,52 @@ bool ctx::place_context_provider::init()
        return true;
 }
 
-bool ctx::place_context_provider::is_supported(const char* subject, const char* zone)
+bool ctx::place_context_provider::is_supported(const char* subject)
 {
        subject_map_t::iterator it = subject_map.find(subject);
 
        if (it != subject_map.end())
-               return it->second->is_supported(zone);
+               return it->second->is_supported();
 
        return false;
 }
 
-int ctx::place_context_provider::subscribe(const char* subject, ctx::json option, ctx::json* request_result, const char* zone)
+int ctx::place_context_provider::subscribe(const char* subject, ctx::json option, ctx::json* request_result)
 {
        subject_map_t::iterator it = subject_map.find(subject);
 
        if (it != subject_map.end())
-               return it->second->subscribe(option, request_result, zone);
+               return it->second->subscribe(option, request_result);
 
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::place_context_provider::unsubscribe(const char* subject, ctx::json option, const char* zone)
+int ctx::place_context_provider::unsubscribe(const char* subject, ctx::json option)
 {
        subject_map_t::iterator it = subject_map.find(subject);
 
        if (it != subject_map.end())
-               return it->second->unsubscribe(option, zone);
+               return it->second->unsubscribe(option);
 
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::place_context_provider::read(const char* subject, ctx::json option, ctx::json* request_result, const char* zone)
+int ctx::place_context_provider::read(const char* subject, ctx::json option, ctx::json* request_result)
 {
        subject_map_t::iterator it = subject_map.find(subject);
 
        if (it != subject_map.end())
-               return it->second->read(option, request_result, zone);
+               return it->second->read(option, request_result);
 
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::place_context_provider::write(const char* subject, ctx::json data, ctx::json* request_result, const char* zone)
+int ctx::place_context_provider::write(const char* subject, ctx::json data, ctx::json* request_result)
 {
        subject_map_t::iterator it = subject_map.find(subject);
 
        if (it != subject_map.end())
-               return it->second->write(data, request_result, zone);
+               return it->second->write(data, request_result);
 
        return ERR_NOT_SUPPORTED;
 }
index c1a0695..cb830ff 100644 (file)
@@ -32,23 +32,6 @@ ctx::myplace_handle::~myplace_handle()
        stop_monitor();
 }
 
-void ctx::myplace_handle::add_zone(const char* zone)
-{
-       _D("'%s' subscribes Place-%d", zone, _place_id);
-       _zone.insert(zone);
-}
-
-void ctx::myplace_handle::remove_zone(const char* zone)
-{
-       _D("'%s' unsubscribes Place-%d", zone, _place_id);
-       _zone.erase(zone);
-}
-
-bool ctx::myplace_handle::zone_empty()
-{
-       return _zone.empty();
-}
-
 bool ctx::myplace_handle::start_monitor(int place_id)
 {
        _D("Starts to monitor Place-%d", place_id);
@@ -204,9 +187,7 @@ void ctx::myplace_handle::emit_state_change()
        data.set(NULL, PLACE_STATUS_DATA_MYPLACE_ID, _place_id);
        data.set(NULL, PLACE_STATUS_DATA_MYPLACE_EVENT, get_state_string(current_state));
 
-       for (string_set_t::iterator it = _zone.begin(); it != _zone.end(); ++it) {
-               context_manager::publish(PLACE_SUBJ_GEOFENCE, option, ERR_NONE, data, it->c_str());
-       }
+       context_manager::publish(PLACE_SUBJ_GEOFENCE, option, ERR_NONE, data);
 }
 
 bool ctx::myplace_handle::fence_list_cb(int geofence_id, geofence_h fence, int fence_index, int fence_cnt, void* user_data)
index 3649958..c8b4913 100644 (file)
@@ -34,14 +34,10 @@ namespace ctx {
                        ~myplace_handle();
 
                        bool start_monitor(int place_id);
-                       void add_zone(const char* zone);
-                       void remove_zone(const char* zone);
-                       bool zone_empty();
                        int get_place_id();
 
                private:
                        int _place_id;
-                       string_set_t _zone;
                        geofence_state_e prev_state;
                        geofence_manager_h geo_handle;
                        geo_state_map_t geo_state_map;
index 7875ec5..c952e91 100644 (file)
@@ -37,7 +37,7 @@ ctx::place_geofence_detector::~place_geofence_detector()
        handle_map.clear();
 }
 
-int ctx::place_geofence_detector::subscribe(ctx::json option, ctx::json* request_result, const char* zone)
+int ctx::place_geofence_detector::subscribe(ctx::json option, ctx::json* request_result)
 {
        int pid = -1;
        option.get(NULL, PLACE_STATUS_OPT_MYPLACE_ID, &pid);
@@ -46,7 +46,6 @@ int ctx::place_geofence_detector::subscribe(ctx::json option, ctx::json* request
        handle_map_t::iterator it = handle_map.find(pid);
        if (it != handle_map.end()) {
                _D("Place ID %d is being monitored already", pid);
-               it->second->add_zone(zone);
                return ERR_NONE;
        }
 
@@ -60,13 +59,12 @@ int ctx::place_geofence_detector::subscribe(ctx::json option, ctx::json* request
                return ERR_OPERATION_FAILED;
        }
 
-       handle->add_zone(zone);
        handle_map[pid] = handle;
 
        return ERR_NONE;
 }
 
-int ctx::place_geofence_detector::unsubscribe(ctx::json option, const char* zone)
+int ctx::place_geofence_detector::unsubscribe(ctx::json option)
 {
        int pid = -1;
        option.get(NULL, PLACE_STATUS_OPT_MYPLACE_ID, &pid);
@@ -78,16 +76,13 @@ int ctx::place_geofence_detector::unsubscribe(ctx::json option, const char* zone
                return ERR_NONE;
        }
 
-       it->second->remove_zone(zone);
-       if (it->second->zone_empty()) {
-               delete it->second;
-               handle_map.erase(it);
-       }
+       delete it->second;
+       handle_map.erase(it);
 
        return ERR_NONE;
 }
 
-bool ctx::place_geofence_detector::is_supported(const char* zone)
+bool ctx::place_geofence_detector::is_supported()
 {
        bool supported = false;
 
index fe1f3b0..90ef108 100644 (file)
@@ -27,9 +27,9 @@ namespace ctx {
                        place_geofence_detector();
                        ~place_geofence_detector();
 
-                       int subscribe(ctx::json option, ctx::json* request_result, const char* zone);
-                       int unsubscribe(ctx::json option, const char* zone);
-                       bool is_supported(const char* zone);
+                       int subscribe(ctx::json option, ctx::json* request_result);
+                       int unsubscribe(ctx::json option);
+                       bool is_supported();
 
        };      /* class place_geofence_detector */
 
index 589e676..8cf50a2 100644 (file)
 
 #include "sub_provider_base.h"
 
-int ctx::sub_provider_base::subscribe(ctx::json option, ctx::json* request_result, const char* zone)
+int ctx::sub_provider_base::subscribe(ctx::json option, ctx::json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::sub_provider_base::unsubscribe(ctx::json option, const char* zone)
+int ctx::sub_provider_base::unsubscribe(ctx::json option)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::sub_provider_base::read(ctx::json option, ctx::json* request_result, const char* zone)
+int ctx::sub_provider_base::read(ctx::json option, ctx::json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::sub_provider_base::write(ctx::json data, ctx::json* request_result, const char* zone)
+int ctx::sub_provider_base::write(ctx::json data, ctx::json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-bool ctx::sub_provider_base::is_supported(const char* zone)
+bool ctx::sub_provider_base::is_supported()
 {
        return false;
 }
index 38a2c5c..1b78760 100644 (file)
@@ -27,11 +27,11 @@ namespace ctx {
                        sub_provider_base(){}
                        virtual ~sub_provider_base(){}
 
-                       virtual int subscribe(ctx::json option, ctx::json* request_result, const char* zone);
-                       virtual int unsubscribe(ctx::json option, const char* zone);
-                       virtual int read(ctx::json option, ctx::json* request_result, const char* zone);
-                       virtual int write(ctx::json data, ctx::json* request_result, const char* zone);
-                       virtual bool is_supported(const char* zone);
+                       virtual int subscribe(ctx::json option, ctx::json* request_result);
+                       virtual int unsubscribe(ctx::json option);
+                       virtual int read(ctx::json option, ctx::json* request_result);
+                       virtual int write(ctx::json data, ctx::json* request_result);
+                       virtual bool is_supported();
        };
 }