Replace ctx::json with ctx:Json 80/60080/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 23 Feb 2016 07:41:24 +0000 (16:41 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 23 Feb 2016 07:41:24 +0000 (16:41 +0900)
Change-Id: I71196345c2b860cca85701bd8d949f2a43b73e2d
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
58 files changed:
include/custom_context_provider.h
src/custom/custom_base.cpp
src/custom/custom_base.h
src/custom/custom_context_provider.cpp
src/device/activity/activity_base.cpp
src/device/provider_base.cpp
src/device/provider_base.h
src/device/social/call.cpp
src/device/social/call.h
src/device/social/email.cpp
src/device/social/message.cpp
src/device/system/alarm.cpp
src/device/system/alarm.h
src/device/system/battery.cpp
src/device/system/headphone.cpp
src/device/system/headphone.h
src/device/system/psmode.cpp
src/device/system/runtime-info/charger.cpp
src/device/system/runtime-info/gps.cpp
src/device/system/runtime-info/usb.cpp
src/device/system/time.cpp
src/device/system/wifi.cpp
src/device/system/wifi.h
src/place/geofence/myplace_handle.cpp
src/place/geofence/place_geofence.cpp
src/place/geofence/place_geofence.h
src/place/recognition/place_recognition.cpp
src/place/recognition/place_recognition.h
src/place/recognition/user_places/location_logger.cpp
src/place/recognition/user_places/places_detector.cpp
src/place/recognition/user_places/places_detector.h
src/place/recognition/user_places/user_places.cpp
src/place/recognition/user_places/user_places.h
src/place/recognition/user_places/visit_detector.cpp
src/place/recognition/user_places/visit_detector.h
src/statistics/app/active_window_monitor.cpp
src/statistics/app/app_stats_provider.cpp
src/statistics/app/app_stats_provider.h
src/statistics/app/db_handle.cpp
src/statistics/app/db_handle.h
src/statistics/app/db_init.cpp
src/statistics/app/db_init.h
src/statistics/app/install_monitor.cpp
src/statistics/app/install_monitor.h
src/statistics/media/db_handle.cpp
src/statistics/media/db_handle.h
src/statistics/media/media_content_monitor.cpp
src/statistics/media/media_content_monitor.h
src/statistics/media/media_stats_provider.cpp
src/statistics/media/media_stats_provider.h
src/statistics/shared/db_handle_base.cpp
src/statistics/shared/db_handle_base.h
src/statistics/social/db_handle.cpp
src/statistics/social/db_handle.h
src/statistics/social/log_aggregator.cpp
src/statistics/social/log_aggregator.h
src/statistics/social/social_stats_provider.cpp
src/statistics/social/social_stats_provider.h

index 10e42754cfb5d2cec066f29b65727830a34f0c50..17c8cc4f7df9209fd17066b0117719d72364654d 100644 (file)
@@ -21,9 +21,9 @@ namespace ctx {
        bool init_custom_context_provider();
 
        namespace custom_context_provider {
-       int add_item(std::string subject, std::string name, ctx::json tmpl, const char* owner, bool is_init = false);
+       int add_item(std::string subject, std::string name, ctx::Json tmpl, const char* owner, bool is_init = false);
        int remove_item(std::string subject);
-       int publish_data(std::string subject, ctx::json fact);
+       int publish_data(std::string subject, ctx::Json fact);
 
        context_provider_iface* create(void* data);
        void destroy(void* data);
index 59cbec910aabb30628b3e9d5a8f01fd283002420..c5ac58d3fe7973fc2e7407721ad14f4b34df66ca 100644 (file)
@@ -17,7 +17,7 @@
 #include <context_mgr.h>
 #include "custom_base.h"
 
-ctx::custom_base::custom_base(std::string subject, std::string name, ctx::json tmpl, std::string owner) :
+ctx::custom_base::custom_base(std::string subject, std::string name, ctx::Json tmpl, std::string owner) :
        _subject(subject),
        _name(name),
        _tmpl(tmpl),
@@ -45,30 +45,30 @@ void ctx::custom_base::unsubmit_trigger_item()
        context_manager::unregister_trigger_item(_subject.c_str());
 }
 
-int ctx::custom_base::subscribe(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::custom_base::subscribe(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
        return ERR_NONE;
 
 }
 
-int ctx::custom_base::unsubscribe(const char *subject, ctx::json option)
+int ctx::custom_base::unsubscribe(const char *subject, ctx::Json option)
 {
        return ERR_NONE;
 }
 
-int ctx::custom_base::read(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::custom_base::read(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
-       ctx::json data = latest.str();
+       ctx::Json data = latest.str();
        ctx::context_manager::reply_to_read(_subject.c_str(), NULL, ERR_NONE, data);
        return ERR_NONE;
 }
 
-int ctx::custom_base::write(const char *subject, ctx::json data, ctx::json *request_result)
+int ctx::custom_base::write(const char *subject, ctx::Json data, ctx::Json *request_result)
 {
        return ERR_NONE;
 }
 
-void ctx::custom_base::handle_update(ctx::json data)
+void ctx::custom_base::handle_update(ctx::Json data)
 {
        // Store latest state
        latest = data.str();
@@ -85,7 +85,7 @@ std::string ctx::custom_base::get_owner()
        return _owner;
 }
 
-ctx::json ctx::custom_base::get_template()
+ctx::Json ctx::custom_base::get_template()
 {
        return _tmpl;
 }
index e2e8bcec125bad2970daac0626c0f3c4f8c83170..0278e0f08e590bb1b87c8249255df2c0f37ce460 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef _CUSTOM_BASE_H_
 #define _CUSTOM_BASE_H_
 
-#include <json.h>
+#include <Json.h>
 #include <provider_iface.h>
 #include <types_internal.h>
 
@@ -25,30 +25,30 @@ namespace ctx {
 
        class custom_base : public context_provider_iface {
        public:
-               custom_base(std::string subject, std::string name, ctx::json tmpl, std::string owner);
+               custom_base(std::string subject, std::string name, ctx::Json tmpl, std::string owner);
                ~custom_base();
 
-               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);
+               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);
 
                static bool is_supported();
                void submit_trigger_item();
                void unsubmit_trigger_item();
 
-               void handle_update(ctx::json data);
+               void handle_update(ctx::Json data);
 
                const char* get_subject();
                std::string get_owner();
-               ctx::json get_template();
+               ctx::Json get_template();
 
        private:
                std::string _subject;
                std::string _name;
-               ctx::json _tmpl;
+               ctx::Json _tmpl;
                std::string _owner;
-               ctx::json latest;
+               ctx::Json latest;
        };
 }
 
index dd79fd5558dd56d4d589aa5bd713e4f5bb3f472b..29c91004027669a6ca5f55a5e5222af9b2a1cbea 100644 (file)
@@ -25,9 +25,9 @@
 
 std::map<std::string, ctx::custom_base*> custom_map;
 
-static bool is_valid_fact(std::string subject, ctx::json& fact);
-static bool check_value_int(ctx::json& tmpl, std::string key, int value);
-static bool check_value_string(ctx::json& tmpl, std::string key, std::string value);
+static bool is_valid_fact(std::string subject, ctx::Json& fact);
+static bool check_value_int(ctx::Json& tmpl, std::string key, int value);
+static bool check_value_string(ctx::Json& tmpl, std::string key, std::string value);
 
 void register_provider(const char *subject, const char *privilege)
 {
@@ -66,7 +66,7 @@ EXTAPI bool ctx::init_custom_context_provider()
                        + "(subject TEXT DEFAULT '' NOT NULL PRIMARY KEY, name TEXT DEFAULT '' NOT NULL, operation INTEGER DEFAULT 3 NOT NULL, "
                        + "attributes TEXT DEFAULT '' NOT NULL, owner TEXT DEFAULT '' NOT NULL)";
 
-       std::vector<json> record;
+       std::vector<Json> record;
        bool ret = db_manager::execute_sync(q.c_str(), &record);
        IF_FAIL_RETURN_TAG(ret, false, _E, "Create template table failed");
 
@@ -77,9 +77,9 @@ EXTAPI bool ctx::init_custom_context_provider()
        IF_FAIL_RETURN(record.size() > 0, true);
 
        int error;
-       std::vector<json>::iterator vec_end = record.end();
-       for (std::vector<json>::iterator vec_pos = record.begin(); vec_pos != vec_end; ++vec_pos) {
-               ctx::json elem = *vec_pos;
+       std::vector<Json>::iterator vec_end = record.end();
+       for (std::vector<Json>::iterator vec_pos = record.begin(); vec_pos != vec_end; ++vec_pos) {
+               ctx::Json elem = *vec_pos;
                std::string subject;
                std::string name;
                std::string attributes;
@@ -89,7 +89,7 @@ EXTAPI bool ctx::init_custom_context_provider()
                elem.get(NULL, "attributes", &attributes);
                elem.get(NULL, "owner", &owner);
 
-               error = ctx::custom_context_provider::add_item(subject, name, ctx::json(attributes), owner.c_str(), true);
+               error = ctx::custom_context_provider::add_item(subject, name, ctx::Json(attributes), owner.c_str(), true);
                if (error != ERR_NONE) {
                        _E("Failed to add custom item(%s): %#x", subject.c_str(), error);
                }
@@ -98,7 +98,7 @@ EXTAPI bool ctx::init_custom_context_provider()
        return true;
 }
 
-EXTAPI int ctx::custom_context_provider::add_item(std::string subject, std::string name, ctx::json tmpl, const char* owner, bool is_init)
+EXTAPI int ctx::custom_context_provider::add_item(std::string subject, std::string name, ctx::Json tmpl, const char* owner, bool is_init)
 {
        std::map<std::string, ctx::custom_base*>::iterator it;
        it = custom_map.find(subject);
@@ -122,7 +122,7 @@ EXTAPI int ctx::custom_context_provider::add_item(std::string subject, std::stri
        if (!is_init) {
                std::string q = "INSERT OR IGNORE INTO context_trigger_custom_template (subject, name, attributes, owner) VALUES ('"
                                + subject + "', '" + name +  "', '" + tmpl.str() + "', '" + owner + "'); ";
-               std::vector<json> record;
+               std::vector<Json> record;
                bool ret = db_manager::execute_sync(q.c_str(), &record);
                IF_FAIL_RETURN_TAG(ret, false, _E, "Failed to query custom templates");
        }
@@ -140,14 +140,14 @@ EXTAPI int ctx::custom_context_provider::remove_item(std::string subject)
 
        // Remove item from custom template db
        std::string q = "DELETE FROM context_trigger_custom_template WHERE subject = '" + subject + "'";
-       std::vector<json> record;
+       std::vector<Json> record;
        bool ret = db_manager::execute_sync(q.c_str(), &record);
        IF_FAIL_RETURN_TAG(ret, false, _E, "Failed to query custom templates");
 
        return ERR_NONE;
 }
 
-EXTAPI int ctx::custom_context_provider::publish_data(std::string subject, ctx::json fact)
+EXTAPI int ctx::custom_context_provider::publish_data(std::string subject, ctx::Json fact)
 {
        std::map<std::string, ctx::custom_base*>::iterator it;
        it = custom_map.find(subject);
@@ -160,14 +160,14 @@ EXTAPI int ctx::custom_context_provider::publish_data(std::string subject, ctx::
        return ERR_NONE;
 }
 
-bool is_valid_fact(std::string subject, ctx::json& fact)
+bool is_valid_fact(std::string subject, ctx::Json& fact)
 {
-       ctx::json tmpl = custom_map[subject]->get_template();
+       ctx::Json tmpl = custom_map[subject]->get_template();
        IF_FAIL_RETURN_TAG(tmpl != EMPTY_JSON_OBJECT, false, _E, "Failed to get template");
 
        bool ret;
        std::list<std::string> keys;
-       fact.get_keys(&keys);
+       fact.getKeys(&keys);
 
        for (std::list<std::string>::iterator it = keys.begin(); it != keys.end(); it++) {
                std::string key = *it;
@@ -197,7 +197,7 @@ bool is_valid_fact(std::string subject, ctx::json& fact)
        return true;
 }
 
-bool check_value_int(ctx::json& tmpl, std::string key, int value)
+bool check_value_int(ctx::Json& tmpl, std::string key, int value)
 {
        int min, max;
 
@@ -212,15 +212,15 @@ bool check_value_int(ctx::json& tmpl, std::string key, int value)
        return true;
 }
 
-bool check_value_string(ctx::json& tmpl, std::string key, std::string value)
+bool check_value_string(ctx::Json& tmpl, std::string key, std::string value)
 {
        // case1: any value is accepted
-       if (tmpl.array_get_size(key.c_str(), "values") <= 0)
+       if (tmpl.getSize(key.c_str(), "values") <= 0)
                return true;
 
        // case2: check acceptable value
        std::string t_val;
-       for (int i = 0; tmpl.get_array_elem(key.c_str(), "values", i, &t_val); i++) {
+       for (int i = 0; tmpl.getAt(key.c_str(), "values", i, &t_val); i++) {
                if (t_val == value)
                        return true;
        }
index 1b834fd097d69e8a347176c7593e4dd613d19d4c..e0a902784b85963e533c9f4b55a98bcb84a7ef4d 100644 (file)
@@ -44,7 +44,7 @@ void ctx::user_activity_base::handle_event(activity_type_e activity, const activ
 {
        IF_FAIL_VOID_TAG(activity == activity_type, _E, "Invalid activity: %d", activity);
 
-       ctx::json data_read;
+       ctx::Json data_read;
        data_read.set(NULL, USER_ACT_EVENT, USER_ACT_DETECTED);
 
        activity_accuracy_e accuracy = ACTIVITY_ACCURACY_LOW;
index acc61cd2550ab2519877c5176e447d1883d3cfe4..fefe21217dbfe576c54883d80baeaf6cec039d1a 100644 (file)
@@ -22,7 +22,7 @@ ctx::device_provider_base::device_provider_base()
 {
 }
 
-int ctx::device_provider_base::subscribe(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::device_provider_base::subscribe(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
        IF_FAIL_RETURN(!being_subscribed, ERR_NONE);
 
@@ -36,7 +36,7 @@ int ctx::device_provider_base::subscribe(const char *subject, ctx::json option,
        return ret;
 }
 
-int ctx::device_provider_base::unsubscribe(const char *subject, ctx::json option)
+int ctx::device_provider_base::unsubscribe(const char *subject, ctx::Json option)
 {
        int ret = ERR_NONE;
 
@@ -47,7 +47,7 @@ int ctx::device_provider_base::unsubscribe(const char *subject, ctx::json option
        return ret;
 }
 
-int ctx::device_provider_base::read(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::device_provider_base::read(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
        int ret = read();
 
@@ -57,7 +57,7 @@ int ctx::device_provider_base::read(const char *subject, ctx::json option, ctx::
        return ret;
 }
 
-int ctx::device_provider_base::write(const char *subject, ctx::json data, ctx::json *request_result)
+int ctx::device_provider_base::write(const char *subject, ctx::Json data, ctx::Json *request_result)
 {
        int ret = write();
 
index c05f4c7895a0ce0735f616dd3b2edb9aff5821e2..39983b18e595d2bd4b9484cdf2504396aefce11c 100644 (file)
@@ -18,7 +18,7 @@
 #define __CONTEXT_DEVICE_PROVIDER_BASE_H__
 
 #include <types_internal.h>
-#include <json.h>
+#include <Json.h>
 #include <provider_iface.h>
 
 #define CREATE_INSTANCE(prvd) \
@@ -66,10 +66,10 @@ namespace ctx {
 
        class device_provider_base : public context_provider_iface {
        public:
-               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);
+               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);
 
        protected:
                bool being_subscribed;
index 52e6aa33e677def3599f7da94f096c498c4ab425..745442c8a28913428e2101ccf976b34dafff625c 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <stdlib.h>
-#include <json.h>
+#include <Json.h>
 #include <context_mgr.h>
 #include "social_types.h"
 #include "call.h"
@@ -38,7 +38,7 @@ static telephony_noti_e call_noti_ids[] =
    TELEPHONY_NOTI_VIDEO_CALL_STATUS_ALERTING,
    TELEPHONY_NOTI_VIDEO_CALL_STATUS_INCOMING,
 };
-static ctx::json latest;
+static ctx::Json latest;
 
 ctx::social_status_call::social_status_call()
 {
@@ -76,7 +76,7 @@ void ctx::social_status_call::call_event_cb(telephony_h handle, telephony_noti_e
 void ctx::social_status_call::handle_call_event(telephony_h handle, telephony_noti_e noti_id, void* id)
 {
 
-       json data;
+       Json data;
        unsigned int count;
        telephony_call_h *call_list;
 
@@ -311,7 +311,7 @@ int ctx::social_status_call::unsubscribe()
        return ERR_NONE;
 }
 
-bool ctx::social_status_call::read_current_status(telephony_h& handle, ctx::json& data)
+bool ctx::social_status_call::read_current_status(telephony_h& handle, ctx::Json& data)
 {
        unsigned int count = 0;
        telephony_call_h *call_list = NULL;
@@ -362,7 +362,7 @@ int ctx::social_status_call::read()
        }
 
        bool ret = true;
-       json data;
+       Json data;
        data.set(NULL, SOCIAL_ST_STATE, SOCIAL_ST_IDLE);
 
        for (unsigned int i = 0; i < handle_list.count; i++) {
index a67eaa10d606b2a617128693c581b5332dad82b2..cdd906cbaf89d3e2591d490d6f10510b1c677e0f 100644 (file)
@@ -43,7 +43,7 @@ namespace ctx {
                void release_telephony();
                bool set_callback();
                void unset_callback();
-               bool read_current_status(telephony_h& handle, ctx::json& data);
+               bool read_current_status(telephony_h& handle, ctx::Json& data);
 
                bool get_call_state(telephony_call_h& handle, std::string& state);
                bool get_call_type(telephony_call_h& handle, std::string& type);
index 90a4efb33ea783f3a10563da6220e59bf3cc4f2c..831a9639bd8eb728acd6d4710e98d73393be065e 100644 (file)
@@ -60,13 +60,13 @@ void ctx::social_status_email::onSignal(const char* sender, const char* path, co
        if (sub_type == NOTI_DOWNLOAD_FINISH) {
                //TODO: Check if this signal actually means that there are new mails
                _D("sub type: %d, gi1: %d, gc: %s, gi2: %d, gi3: %d", sub_type, gi1, gc, gi2, gi3);
-               ctx::json data_updated;
+               ctx::Json data_updated;
                data_updated.set(NULL, SOCIAL_ST_EVENT, SOCIAL_ST_RECEIVED);
                context_manager::publish(SOCIAL_ST_SUBJ_EMAIL, NULL, ERR_NONE, data_updated);
 
        } else if (sub_type == NOTI_SEND_FINISH) {
                _D("sub type: %d, gi1: %d, gc: %s, gi2: %d, gi3: %d", sub_type, gi1, gc, gi2, gi3);
-               ctx::json data_updated;
+               ctx::Json data_updated;
                data_updated.set(NULL, SOCIAL_ST_EVENT, SOCIAL_ST_SENT);
                context_manager::publish(SOCIAL_ST_SUBJ_EMAIL, NULL, ERR_NONE, data_updated);
        }
index 5d091fbd8db0d788e7a88103c07e16c0e246b0c5..4d46fe96f796aef3f76e7c64853cc8f5c2bdc3c3 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <json.h>
+#include <Json.h>
 #include <context_mgr.h>
 #include "social_types.h"
 #include "message.h"
@@ -59,7 +59,7 @@ void ctx::social_status_message::handle_state_change(msg_struct_t msg)
        int err;
        int type;
        char address[MAX_ADDR_SIZE];
-       ctx::json data;
+       ctx::Json data;
 
        err = msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &type);
        IF_FAIL_VOID_TAG(err == MSG_SUCCESS, _W, "Getting message type failed");
index 0b75fb5a0ee27c4033f31de7a0b93a139e1c4b21..bd800eea4a66e60e24cbedfc8c496d50b3b653a4 100644 (file)
@@ -51,42 +51,42 @@ void ctx::device_status_alarm::submit_trigger_item()
                        NULL);
 }
 
-int ctx::device_status_alarm::subscribe(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::device_status_alarm::subscribe(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
        int ret = subscribe(option);
        destroy_if_unused();
        return ret;
 }
 
-int ctx::device_status_alarm::unsubscribe(const char *subject, ctx::json option)
+int ctx::device_status_alarm::unsubscribe(const char *subject, ctx::Json option)
 {
        int ret = unsubscribe(option);
        destroy_if_unused();
        return ret;
 }
 
-int ctx::device_status_alarm::read(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::device_status_alarm::read(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
        destroy_if_unused();
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::device_status_alarm::write(const char *subject, ctx::json data, ctx::json *request_result)
+int ctx::device_status_alarm::write(const char *subject, ctx::Json data, ctx::Json *request_result)
 {
        destroy_if_unused();
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::device_status_alarm::subscribe(ctx::json option)
+int ctx::device_status_alarm::subscribe(ctx::Json option)
 {
        int dow = get_arranged_day_of_week(option);
 
        int time;
-       for (int i = 0; option.get_array_elem(NULL, DEVICE_ST_TIME_OF_DAY, i, &time); i++) {
+       for (int i = 0; option.getAt(NULL, DEVICE_ST_TIME_OF_DAY, i, &time); i++) {
                add(time, dow);
        }
 
-       ctx::json* elem = new(std::nothrow) ctx::json(option);
+       ctx::Json* elem = new(std::nothrow) ctx::Json(option);
        if (elem) {
                option_set.insert(elem);
        } else {
@@ -98,12 +98,12 @@ int ctx::device_status_alarm::subscribe(ctx::json option)
        return ERR_NONE;
 }
 
-int ctx::device_status_alarm::unsubscribe(ctx::json option)
+int ctx::device_status_alarm::unsubscribe(ctx::Json option)
 {
        int dow = get_arranged_day_of_week(option);
 
        int time;
-       for (int i = 0; option.get_array_elem(NULL, DEVICE_ST_TIME_OF_DAY, i, &time); i++) {
+       for (int i = 0; option.getAt(NULL, DEVICE_ST_TIME_OF_DAY, i, &time); i++) {
                remove(time, dow);
        }
 
@@ -116,12 +116,12 @@ int ctx::device_status_alarm::unsubscribe(ctx::json option)
        return ERR_NONE;
 }
 
-int ctx::device_status_alarm::get_arranged_day_of_week(ctx::json& option)
+int ctx::device_status_alarm::get_arranged_day_of_week(ctx::Json& option)
 {
        int dow = 0;
 
        std::string tmp_d;
-       for (int i = 0; option.get_array_elem(NULL, DEVICE_ST_DAY_OF_WEEK, i, &tmp_d); i++) {
+       for (int i = 0; option.getAt(NULL, DEVICE_ST_DAY_OF_WEEK, i, &tmp_d); i++) {
                dow |= ctx::timer_util::convert_day_of_week_string_to_int(tmp_d);
        }
        _D("Requested day of week (%#x)", dow);
@@ -252,25 +252,25 @@ void ctx::device_status_alarm::on_timer_expired(int hour, int min, int day_of_we
 {
        _I("Time: %02d:%02d, Day of Week: %#x", hour, min, day_of_week);
 
-       ctx::json data_read;
+       ctx::Json data_read;
        int result_time = hour * 60 + min;
        std::string result_day = ctx::timer_util::convert_day_of_week_int_to_string(day_of_week);
        data_read.set(NULL, DEVICE_ST_TIME_OF_DAY, result_time);
        data_read.set(NULL, DEVICE_ST_DAY_OF_WEEK, result_day);
 
        for (option_t::iterator it = option_set.begin(); it != option_set.end(); ++it) {
-               ctx::json option = (**it);
+               ctx::Json option = (**it);
                if (is_matched(option, result_time, result_day)) {
                        context_manager::publish(DEVICE_ST_SUBJ_ALARM, option, ERR_NONE, data_read);
                }
        }
 }
 
-bool ctx::device_status_alarm::is_matched(ctx::json& option, int time, std::string day)
+bool ctx::device_status_alarm::is_matched(ctx::Json& option, int time, std::string day)
 {
        bool ret = false;
        int opt_time;
-       for (int i = 0; option.get_array_elem(NULL, DEVICE_ST_TIME_OF_DAY, i, &opt_time); i++){
+       for (int i = 0; option.getAt(NULL, DEVICE_ST_TIME_OF_DAY, i, &opt_time); i++){
                if (time == opt_time) {
                        ret = true;
                        break;
@@ -279,7 +279,7 @@ bool ctx::device_status_alarm::is_matched(ctx::json& option, int time, std::stri
        IF_FAIL_RETURN(ret, false);
 
        std::string opt_day;
-       for (int i = 0; option.get_array_elem(NULL, DEVICE_ST_DAY_OF_WEEK, i, &opt_day); i++){
+       for (int i = 0; option.getAt(NULL, DEVICE_ST_DAY_OF_WEEK, i, &opt_day); i++){
                if (day == opt_day) {
                        return true;
                }
@@ -288,7 +288,7 @@ bool ctx::device_status_alarm::is_matched(ctx::json& option, int time, std::stri
        return false;
 }
 
-ctx::device_status_alarm::option_t::iterator ctx::device_status_alarm::find_option(ctx::json& option)
+ctx::device_status_alarm::option_t::iterator ctx::device_status_alarm::find_option(ctx::Json& option)
 {
        for (ctx::device_status_alarm::option_t::iterator it = option_set.begin(); it != option_set.end(); ++it) {
                if (option == (**it))
index 7596f7462a7c5acc5b8944e8de78e294024a2ff8..8f518367fbb96ebd8195a723c8967a96d48a6dc8 100644 (file)
@@ -30,13 +30,13 @@ namespace ctx {
                GENERATE_PROVIDER_COMMON_DECL(device_status_alarm);
 
        public:
-               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);
+               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);
 
-               int subscribe(ctx::json option);
-               int unsubscribe(ctx::json option);
+               int subscribe(ctx::Json option);
+               int unsubscribe(ctx::Json option);
                static bool is_supported();
                static void submit_trigger_item();
 
@@ -45,7 +45,7 @@ namespace ctx {
                ~device_status_alarm();
                void handle_update();
                static void update_cb(void* user_data);
-               int get_arranged_day_of_week(ctx::json& option);
+               int get_arranged_day_of_week(ctx::Json& option);
 
                struct ref_count_array_s {
                        int count[7];   /* reference counts for days of week*/
@@ -60,7 +60,7 @@ namespace ctx {
 
                typedef std::map<int, ref_count_array_s> ref_count_map_t;
                typedef std::map<int, timer_state_s> timer_state_map_t;
-               typedef std::set<ctx::json*> option_t;
+               typedef std::set<ctx::Json*> option_t;
 
                ref_count_map_t ref_count_map;
                timer_state_map_t timer_state_map;
@@ -76,8 +76,8 @@ namespace ctx {
                void on_timer_expired(int hour, int min, int day_of_week);
                bool on_timer_expired(int timer_id, void *user_data);
 
-               bool is_matched(ctx::json& option, int time, std::string day);
-               option_t::iterator find_option(ctx::json& option);
+               bool is_matched(ctx::Json& option, int time, std::string day);
+               option_t::iterator find_option(ctx::Json& option);
 
                void destroy_if_unused();
 
index 0060955244f815d5ea57f91b3596469aadd5fd3c..5be24b688df783c96548ae499d2feb22eebad1ab 100644 (file)
@@ -58,7 +58,7 @@ void ctx::device_status_battery::handle_update(device_callback_e device_type, vo
        const char* level_string = trans_to_string(level);
        IF_FAIL_VOID(level_string);
 
-       ctx::json data_read;
+       ctx::Json data_read;
        data_read.set(NULL, DEVICE_ST_LEVEL, level_string);
 
        bool charging_state = false;
@@ -120,7 +120,7 @@ int ctx::device_status_battery::unsubscribe()
 int ctx::device_status_battery::read()
 {
        device_battery_level_e level;
-       ctx::json data_read;
+       ctx::Json data_read;
 
        int ret = device_battery_get_level_status(&level);
        IF_FAIL_RETURN(ret == DEVICE_ERROR_NONE, ERR_OPERATION_FAILED);
index 2160cdc6808bf60dff376341b36e5efe1f3c0d78..ac3d5db631ee02efc25a5a33901b3dbff747f981 100644 (file)
@@ -79,7 +79,7 @@ int ctx::device_status_headphone::read()
        if (!being_subscribed)
                connected = get_current_status();
 
-       json data;
+       Json data;
        generate_data_packet(data);
        ctx::context_manager::reply_to_read(DEVICE_ST_SUBJ_HEADPHONE, NULL, ERR_NONE, data);
 
@@ -140,7 +140,7 @@ bool ctx::device_status_headphone::get_current_status()
        return ((audio_jack_state != RUNTIME_INFO_AUDIO_JACK_STATUS_UNCONNECTED) || bt_audio_state);
 }
 
-void ctx::device_status_headphone::generate_data_packet(ctx::json &data)
+void ctx::device_status_headphone::generate_data_packet(ctx::Json &data)
 {
        data.set(NULL, DEVICE_ST_IS_CONNECTED, connected ? DEVICE_ST_TRUE : DEVICE_ST_FALSE);
 
@@ -165,7 +165,7 @@ bool ctx::device_status_headphone::handle_event()
 
        IF_FAIL_RETURN(prev_state != connected, false);
 
-       ctx::json data;
+       ctx::Json data;
        generate_data_packet(data);
        ctx::context_manager::publish(DEVICE_ST_SUBJ_HEADPHONE, NULL, ERR_NONE, data);
        return true;
index 16c2f1e3c402b9c2483faaf0849850de473b4691..f451d52779452bbd0735dcab2f3185c150ce93d5 100644 (file)
@@ -51,7 +51,7 @@ namespace ctx {
                void unset_bt_audio_callback();
                void set_bt_audio_state(bool state);
 
-               void generate_data_packet(json &data);
+               void generate_data_packet(Json &data);
                bool handle_event();
                void handle_audio_jack_event();
 
index 90980d06820fadefdffc94c7225c925ef8c14e4f..dcfc3595c9611e417975df0b2a00379bd2b85816 100644 (file)
@@ -48,7 +48,7 @@ void ctx::device_status_psmode::update_cb(keynode_t *node, void* user_data)
 void ctx::device_status_psmode::handle_update(keynode_t *node)
 {
        int status;
-       ctx::json data_read;
+       ctx::Json data_read;
 
        status = vconf_keynode_get_int(node);
        IF_FAIL_VOID_TAG(status >= 0, _E, "Getting state failed");
@@ -78,7 +78,7 @@ int ctx::device_status_psmode::read()
        int ret = vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &mode);
        IF_FAIL_RETURN(ret == VCONF_OK, ERR_OPERATION_FAILED);
 
-       ctx::json data_read;
+       ctx::Json data_read;
        data_read.set(NULL, DEVICE_ST_IS_ENABLED, mode == 0 ? DEVICE_ST_FALSE : DEVICE_ST_TRUE);
 
        ctx::context_manager::reply_to_read(DEVICE_ST_SUBJ_PSMODE, NULL, ERR_NONE, data_read);
index 821a9b5ca56cbabc4c4a0caf495fbbdd101b7898..ae16d8cddcab138b0f337b2f94910e2a0a6e9a11 100644 (file)
@@ -47,7 +47,7 @@ void ctx::device_status_charger::handle_update()
        int ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_CHARGER_CONNECTED, &charger_status);
        IF_FAIL_VOID_TAG(ret == RUNTIME_INFO_ERROR_NONE, _E, "Getting runtime info failed");
 
-       ctx::json data_read;
+       ctx::Json data_read;
        data_read.set(NULL, DEVICE_ST_IS_CONNECTED, charger_status ? DEVICE_ST_TRUE : DEVICE_ST_FALSE);
 
        context_manager::publish(DEVICE_ST_SUBJ_CHARGER, NULL, ERR_NONE, data_read);
@@ -56,7 +56,7 @@ void ctx::device_status_charger::handle_update()
 int ctx::device_status_charger::read()
 {
        bool charger_status = false;
-       ctx::json data_read;
+       ctx::Json data_read;
 
        int ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_CHARGER_CONNECTED, &charger_status);
        IF_FAIL_RETURN_TAG(ret == RUNTIME_INFO_ERROR_NONE, ERR_OPERATION_FAILED, _E, "Getting runtime info failed");
index 74ebb3c45985b8965e7920de9417d3a0e2b23164..80aa16c4c36ebb4b7386144716877e28b2bc1263 100644 (file)
@@ -67,7 +67,7 @@ void ctx::device_status_gps::handle_update()
        int ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_GPS_STATUS, &gps_status);
        IF_FAIL_VOID_TAG(ret == RUNTIME_INFO_ERROR_NONE, _E, "Getting runtime info failed");
 
-       ctx::json data_read;
+       ctx::Json data_read;
 
        const char* state_str = get_state_string(gps_status);
        IF_FAIL_VOID(state_str);
@@ -80,7 +80,7 @@ void ctx::device_status_gps::handle_update()
 int ctx::device_status_gps::read()
 {
        int gps_status;
-       ctx::json data_read;
+       ctx::Json data_read;
 
        int ret = runtime_info_get_value_int(RUNTIME_INFO_KEY_GPS_STATUS, &gps_status);
        IF_FAIL_RETURN_TAG(ret == RUNTIME_INFO_ERROR_NONE, ERR_OPERATION_FAILED, _E, "Getting runtime info failed");
index 77d19ad08787d6886cf9e121e7ae6ca59c99f591..0ab4d0d70903c05bcec19b09ccf7e9632b92a2be 100644 (file)
@@ -47,7 +47,7 @@ void ctx::device_status_usb::handle_update()
        int ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &status);
        IF_FAIL_VOID_TAG(ret == RUNTIME_INFO_ERROR_NONE, _E, "Getting runtime info failed");
 
-       ctx::json data_read;
+       ctx::Json data_read;
        data_read.set(NULL, DEVICE_ST_IS_CONNECTED, status ? DEVICE_ST_TRUE : DEVICE_ST_FALSE);
 
        context_manager::publish(DEVICE_ST_SUBJ_USB, NULL, ERR_NONE, data_read);
@@ -56,7 +56,7 @@ void ctx::device_status_usb::handle_update()
 int ctx::device_status_usb::read()
 {
        bool status = false;
-       ctx::json data_read;
+       ctx::Json data_read;
 
        int ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_USB_CONNECTED, &status);
        IF_FAIL_RETURN_TAG(ret == RUNTIME_INFO_ERROR_NONE, ERR_OPERATION_FAILED, _E, "Getting runtime info failed");
index c4166a968e7259ef17112a00d5122b5789568d7d..65ba55a886b94475f68d78b1e4b8a17eb053d597 100644 (file)
@@ -68,7 +68,7 @@ int ctx::device_status_time::read()
        int minute_of_day = timeinfo.tm_hour * 60 + timeinfo.tm_min;
        std::string day_of_week = ctx::timer_util::convert_day_of_week_int_to_string(0x01 << timeinfo.tm_wday);
 
-       ctx::json data_read;
+       ctx::Json data_read;
        data_read.set(NULL, DEVICE_ST_DAY_OF_MONTH, day_of_month);
        data_read.set(NULL, DEVICE_ST_DAY_OF_WEEK, day_of_week);
        data_read.set(NULL, DEVICE_ST_TIME_OF_DAY, minute_of_day);
index 3680768eba56c4d7d67e611db99999d7e70eca3c..a40c179ad01798da323030daa4b8513ddb46c0d7 100644 (file)
@@ -135,7 +135,7 @@ void ctx::device_status_wifi::clear_bssid()
        _D("No WiFi connection");
 }
 
-bool ctx::device_status_wifi::get_response_packet(ctx::json &data)
+bool ctx::device_status_wifi::get_response_packet(ctx::Json &data)
 {
        switch (last_state) {
        case _DISABLED:
@@ -162,7 +162,7 @@ int ctx::device_status_wifi::read()
 {
        IF_FAIL_RETURN(get_current_state(), ERR_OPERATION_FAILED);
 
-       ctx::json data_read;
+       ctx::Json data_read;
 
        if (get_response_packet(data_read)) {
                ctx::context_manager::reply_to_read(DEVICE_ST_SUBJ_WIFI, NULL, ERR_NONE, data_read);
@@ -246,7 +246,7 @@ void ctx::device_status_wifi::aggregate_updated_data()
                        clear_bssid();
                }
 
-               ctx::json data;
+               ctx::Json data;
                if (being_subscribed && get_response_packet(data))
                        context_manager::publish(DEVICE_ST_SUBJ_WIFI, NULL, ERR_NONE, data);
        }
index 6dc505d1b970eb5a87c1bd6fc53dcb8e84a18c15..6bd81c10ec405e7283f0a8a99d5ddbb2dae7ac37 100644 (file)
@@ -54,7 +54,7 @@ namespace ctx {
                bool get_current_state();
                bool get_bssid();
                void clear_bssid();
-               bool get_response_packet(json &data);
+               bool get_response_packet(Json &data);
                void aggregate_updated_data();
                bool start_monitor();
                void stop_monitor();
index cb830ff3a106c213c290f3a97666f4bc6327bb32..8ea7684facd4540cba88fee9ea6d8f0b3c3cec05 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <types_internal.h>
-#include <json.h>
+#include <Json.h>
 #include <context_mgr.h>
 #include "place_geofence_types.h"
 #include "myplace_handle.h"
@@ -180,10 +180,10 @@ void ctx::myplace_handle::emit_state_change()
 
        prev_state = current_state;
 
-       json option;
+       Json option;
        option.set(NULL, PLACE_STATUS_DATA_MYPLACE_ID, _place_id);
 
-       json data;
+       Json data;
        data.set(NULL, PLACE_STATUS_DATA_MYPLACE_ID, _place_id);
        data.set(NULL, PLACE_STATUS_DATA_MYPLACE_EVENT, get_state_string(current_state));
 
index 53fb40b56b88b436412ef289f469218d498e860d..c1525a1a52ca4b47a877488e04ed0c5147c97d5f 100644 (file)
@@ -17,7 +17,7 @@
 #include <geofence_manager.h>
 
 #include <types_internal.h>
-#include <json.h>
+#include <Json.h>
 #include <context_mgr.h>
 #include "place_geofence.h"
 
@@ -79,33 +79,33 @@ void ctx::place_geofence_provider::__destroy_if_unused()
 }
 
 
-int ctx::place_geofence_provider::subscribe(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::place_geofence_provider::subscribe(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
        int ret = __subscribe(option);
        __destroy_if_unused();
        return ret;
 }
 
-int ctx::place_geofence_provider::unsubscribe(const char *subject, ctx::json option)
+int ctx::place_geofence_provider::unsubscribe(const char *subject, ctx::Json option)
 {
        int ret = __unsubscribe(option);
        __destroy_if_unused();
        return ret;
 }
 
-int ctx::place_geofence_provider::read(const char *subject, ctx::json option, ctx::json *request_result)
+int ctx::place_geofence_provider::read(const char *subject, ctx::Json option, ctx::Json *request_result)
 {
        __destroy_if_unused();
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::place_geofence_provider::write(const char *subject, ctx::json data, ctx::json *request_result)
+int ctx::place_geofence_provider::write(const char *subject, ctx::Json data, ctx::Json *request_result)
 {
        __destroy_if_unused();
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::place_geofence_provider::__subscribe(ctx::json option)
+int ctx::place_geofence_provider::__subscribe(ctx::Json option)
 {
        int pid = -1;
        option.get(NULL, PLACE_STATUS_OPT_MYPLACE_ID, &pid);
@@ -132,7 +132,7 @@ int ctx::place_geofence_provider::__subscribe(ctx::json option)
        return ERR_NONE;
 }
 
-int ctx::place_geofence_provider::__unsubscribe(ctx::json option)
+int ctx::place_geofence_provider::__unsubscribe(ctx::Json option)
 {
        int pid = -1;
        option.get(NULL, PLACE_STATUS_OPT_MYPLACE_ID, &pid);
index 9fb8ae8bac2d6eb16b19c8901a7255fe1be13009..05de0079f8c3aee9bef49a92e8e19017e363b7c1 100644 (file)
@@ -33,10 +33,10 @@ namespace ctx {
                static bool is_supported();
                static void submit_trigger_item();
 
-               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);
+               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);
 
        private:
                static place_geofence_provider *__instance;
@@ -45,8 +45,8 @@ namespace ctx {
                place_geofence_provider();
                ~place_geofence_provider();
 
-               int __subscribe(ctx::json option);
-               int __unsubscribe(ctx::json option);
+               int __subscribe(ctx::Json option);
+               int __unsubscribe(ctx::Json option);
                void __destroy_if_unused();
        };
 
index 137d3b6dd24a556df724d822ebe8794419afa8d8..7fb092fc6296a4c890ae86fd13a9081702e02b75 100644 (file)
@@ -38,23 +38,23 @@ void ctx::place_recognition_provider::destroy(void *data)
        _I(BLUE("Destroyed"));
 }
 
-int ctx::place_recognition_provider::subscribe(const char *subject, ctx::json option, ctx::json* request_result)
+int ctx::place_recognition_provider::subscribe(const char *subject, ctx::Json option, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::place_recognition_provider::unsubscribe(const char *subject, ctx::json option)
+int ctx::place_recognition_provider::unsubscribe(const char *subject, ctx::Json option)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::place_recognition_provider::read(const char *subject, ctx::json option, ctx::json* request_result)
+int ctx::place_recognition_provider::read(const char *subject, ctx::Json option, ctx::Json* request_result)
 {
        _I(BLUE("Read"));
        _J("Option", option);
 
        std::vector<std::shared_ptr<ctx::Place>> places = engine.get_places();
-       json data_read = engine.compose_json(places);
+       Json data_read = engine.compose_json(places);
 
        // The below function needs to be called once.
        // It does not need to be called within this read() function.
@@ -66,7 +66,7 @@ int ctx::place_recognition_provider::read(const char *subject, ctx::json option,
        return ERR_NONE;
 }
 
-int ctx::place_recognition_provider::write(const char *subject, ctx::json data, ctx::json* request_result)
+int ctx::place_recognition_provider::write(const char *subject, ctx::Json data, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
index 1f870af90404ed687824f5ad94f2a06131cf164b..8f254248095e49c34d73107fc591cfaa69397d44 100644 (file)
@@ -30,10 +30,10 @@ namespace ctx {
                static void destroy(void *data);
                static bool is_supported();
 
-               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);
+               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);
 
        private:
                static place_recognition_provider *__instance;
index 4adc07c580c5fa2dfee8ddb76bc39447897e0192..eddf0dc39d401d6423a5ecdf5cdb0c9b62988c15 100644 (file)
@@ -19,7 +19,7 @@
 #include "../place_recognition_types.h"
 #include <db_mgr.h>
 #include <sstream>
-#include <json.h>
+#include <Json.h>
 #include "user_places_params.h"
 #include "debug_utils.h"
 
@@ -182,7 +182,7 @@ int ctx::LocationLogger::create_table()
 
 int ctx::LocationLogger::db_insert_log(location_event_s location_event)
 {
-       json data;
+       Json data;
        data.set(NULL, LOCATION_COLUMN_LATITUDE, location_event.coordinates.latitude, GEO_LOCATION_PRECISION);
        data.set(NULL, LOCATION_COLUMN_LONGITUDE, location_event.coordinates.longitude, GEO_LOCATION_PRECISION);
        data.set(NULL, LOCATION_COLUMN_ACCURACY, location_event.coordinates.accuracy, GEO_LOCATION_PRECISION);
index 974fd7b199bc6a123f2d70bee574e0cfa3caaf79..1530ef932e171060d18727937f9f58651c3bbc9d 100644 (file)
@@ -17,7 +17,7 @@
 #include <sstream>
 #include <types_internal.h>
 #include <db_mgr.h>
-#include <json.h>
+#include <Json.h>
 #include "similar.h"
 #include "places_detector.h"
 #include "place_categer.h"
@@ -77,7 +77,7 @@ bool ctx::PlacesDetector::on_timer_expired(int timer_id, void* user_data)
        return true;
 }
 
-void ctx::PlacesDetector::on_query_result_received(unsigned int query_id, int error, std::vector<json>& records)
+void ctx::PlacesDetector::on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records)
 {
        // TODO:
        // The below "state machine" approach was choosen because it is not possible to use synchronized database queries in the main thread.
@@ -123,7 +123,7 @@ void ctx::PlacesDetector::db_get_places()
        _D("load places execute query result: %s", ret ? "SUCCESS" : "FAIL");
 }
 
-double ctx::PlacesDetector::double_value_from_json(json &row, const char* key)
+double ctx::PlacesDetector::double_value_from_json(Json &row, const char* key)
 {
        double value;
        row.get(NULL, key, &value);
@@ -131,7 +131,7 @@ double ctx::PlacesDetector::double_value_from_json(json &row, const char* key)
        return value;
 }
 
-ctx::categs_t ctx::PlacesDetector::visit_categs_from_json(json &row)
+ctx::categs_t ctx::PlacesDetector::visit_categs_from_json(Json &row)
 {
        categs_t categs;
        categs[PLACE_CATEG_ID_HOME] = double_value_from_json(row, VISIT_COLUMN_CATEG_HOME);
@@ -140,7 +140,7 @@ ctx::categs_t ctx::PlacesDetector::visit_categs_from_json(json &row)
        return categs;
 }
 
-ctx::visit_s ctx::PlacesDetector::visit_from_json(json &row)
+ctx::visit_s ctx::PlacesDetector::visit_from_json(Json &row)
 {
        int start_time;
        int end_time;
@@ -170,12 +170,12 @@ ctx::visit_s ctx::PlacesDetector::visit_from_json(json &row)
        return visit;
 }
 
-ctx::visits_t ctx::PlacesDetector::visits_from_jsons(std::vector<json>& records)
+ctx::visits_t ctx::PlacesDetector::visits_from_jsons(std::vector<Json>& records)
 {
        visits_t visits;
        _D("db_result: number of all visits: %d", records.size());
 
-       for (json &row : records) {
+       for (Json &row : records) {
                visit_s visit = visit_from_json(row);
                visits.push_back(visit);
        }
@@ -183,7 +183,7 @@ ctx::visits_t ctx::PlacesDetector::visits_from_jsons(std::vector<json>& records)
        return visits;
 }
 
-std::shared_ptr<ctx::Place> ctx::PlacesDetector::place_from_json(json &row)
+std::shared_ptr<ctx::Place> ctx::PlacesDetector::place_from_json(Json &row)
 {
        std::shared_ptr<Place> place = std::make_shared<Place>();
        { // category
@@ -211,12 +211,12 @@ std::shared_ptr<ctx::Place> ctx::PlacesDetector::place_from_json(json &row)
        return place;
 }
 
-std::vector<std::shared_ptr<ctx::Place>> ctx::PlacesDetector::places_from_jsons(std::vector<json>& records)
+std::vector<std::shared_ptr<ctx::Place>> ctx::PlacesDetector::places_from_jsons(std::vector<Json>& records)
 {
        std::vector<std::shared_ptr<Place>> places;
        _D("db_result: number of all places: %d", records.size());
 
-       for (json &row : records) {
+       for (Json &row : records) {
                std::shared_ptr<Place> place = place_from_json(row);
                places.push_back(place);
        }
@@ -432,7 +432,7 @@ void ctx::PlacesDetector::db_create_table()
 
 void ctx::PlacesDetector::db_insert_place(const Place &place)
 {
-       json data;
+       Json data;
        data.set(NULL, PLACE_COLUMN_CATEG_ID, place.categ_id);
        data.set(NULL, PLACE_COLUMN_CATEG_CONFIDENCE, place.categ_confidence);
        data.set(NULL, PLACE_COLUMN_NAME, place.name);
index 72767c4bc72378058bfae1e178442ddedb5dd63f..9adeb920d5a2b2f7ab13813b3e5d0d41df24cab2 100644 (file)
@@ -40,12 +40,12 @@ namespace ctx {
 
        private:
                bool test_mode;
-               double double_value_from_json(json &row, const char* key);
-               categs_t visit_categs_from_json(json &row);
-               visit_s visit_from_json(json &row);
-               visits_t visits_from_jsons(std::vector<json>& records);
-               std::shared_ptr<ctx::Place> place_from_json(json &row);
-               std::vector<std::shared_ptr<Place>> places_from_jsons(std::vector<json>& records);
+               double double_value_from_json(Json &row, const char* key);
+               categs_t visit_categs_from_json(Json &row);
+               visit_s visit_from_json(Json &row);
+               visits_t visits_from_jsons(std::vector<Json>& records);
+               std::shared_ptr<ctx::Place> place_from_json(Json &row);
+               std::vector<std::shared_ptr<Place>> places_from_jsons(std::vector<Json>& records);
                std::shared_ptr<graph_t> graph_from_visits(const std::vector<visit_s> &visits);
                void db_create_table();
                void db_delete_places();
@@ -68,7 +68,7 @@ namespace ctx {
                bool on_timer_expired(int timer_id, void* user_data);
                void on_creation_result_received(unsigned int query_id, int error) {}
                void on_insertion_result_received(unsigned int query_id, int error, int64_t row_id) {}
-               void on_query_result_received(unsigned int query_id, int error, std::vector<json>& records);
+               void on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records);
                std::shared_ptr<components_t> merge_visits(const std::vector<visit_s> &visits);
                std::vector<std::shared_ptr<Place>> get_places();
 
index 4747ed1ae2fd1da0fa2ad1a02ebc095b61290b0e..46c8d31c15472d6b5c342ec6b53dadc9a9ce53ff 100644 (file)
@@ -111,11 +111,11 @@ std::vector<std::shared_ptr<ctx::Place>> ctx::UserPlaces::get_places()
  *       ]
  * }
  */
-ctx::json ctx::UserPlaces::compose_json(std::vector<std::shared_ptr<Place>> places)
+ctx::Json ctx::UserPlaces::compose_json(std::vector<std::shared_ptr<Place>> places)
 {
-       ctx::json data;
+       ctx::Json data;
        for (std::shared_ptr<ctx::Place> place : places) {
-               ctx::json place_j;
+               ctx::Json place_j;
                place_j.set(NULL, PLACE_CATEG_ID, place->categ_id);
                place_j.set(NULL, PLACE_CATEG_CONFIDENCE, place->categ_confidence);
                place_j.set(NULL, PLACE_NAME, place->name);
@@ -125,7 +125,7 @@ ctx::json ctx::UserPlaces::compose_json(std::vector<std::shared_ptr<Place>> plac
                }
                place_j.set(NULL, PLACE_WIFI_APS, place->wifi_aps);
                place_j.set(NULL, PLACE_CREATE_DATE, static_cast<int>(place->create_date));
-               data.array_append(NULL, DATA_READ, place_j);
+               data.append(NULL, DATA_READ, place_j);
        }
        return data;
 }
index 2ad10ce49beaa620e3680e43415a6446fa495d2a..d2c66daac0104d3379aa4e42fa487681e4aae4c4 100644 (file)
@@ -21,7 +21,7 @@
 #include "places_detector.h"
 #include <vector>
 #include "user_places_types.h"
-#include <json.h>
+#include <Json.h>
 
 namespace ctx {
 
@@ -38,7 +38,7 @@ namespace ctx {
 
                void set_mode(place_recog_mode_e energy_mode);
                std::vector<std::shared_ptr<Place>> get_places();
-               static json compose_json(std::vector<std::shared_ptr<Place>> places);
+               static Json compose_json(std::vector<std::shared_ptr<Place>> places);
 
        };      /* class UserPlaces */
 
index 0123b93e508f794b4b9d4e3324fef0a466958d10..ccd9cb7b6ebd6d48001b31f58632099296218122 100644 (file)
@@ -20,7 +20,7 @@
 #include <sstream>
 #include <types_internal.h>
 #include <db_mgr.h>
-#include <json.h>
+#include <Json.h>
 #include "../place_recognition_types.h"
 #include "visit_detector.h"
 #include "user_places_params.h"
@@ -372,7 +372,7 @@ void ctx::VisitDetector::db_create_table()
        _D("db: visit Table Creation Result: %s", ret ? "SUCCESS" : "FAIL");
 }
 
-void ctx::VisitDetector::json_put_visit_categ(json &data, const char* key, const categs_t &categs, int categ_type)
+void ctx::VisitDetector::json_put_visit_categ(Json &data, const char* key, const categs_t &categs, int categ_type)
 {
        auto categ_p = categs.find(categ_type);
        if (categ_p == categs.end()) {
@@ -382,7 +382,7 @@ void ctx::VisitDetector::json_put_visit_categ(json &data, const char* key, const
        }
 }
 
-void ctx::VisitDetector::json_put_visit_categs(json &data, const categs_t &categs)
+void ctx::VisitDetector::json_put_visit_categs(Json &data, const categs_t &categs)
 {
        json_put_visit_categ(data, VISIT_COLUMN_CATEG_HOME, categs, PLACE_CATEG_ID_HOME);
        json_put_visit_categ(data, VISIT_COLUMN_CATEG_WORK, categs, PLACE_CATEG_ID_WORK);
@@ -394,7 +394,7 @@ int ctx::VisitDetector::db_insert_visit(visit_s visit)
        std::stringstream macs_ss;
        macs_ss << *visit.mac_set;
 
-       json data;
+       Json data;
        data.set(NULL, VISIT_COLUMN_WIFI_APS, macs_ss.str().c_str());
 
        data.set(NULL, VISIT_COLUMN_LOCATION_VALID, visit.location_valid);
index ccde0b213c924958ff5f945eeca5213127b9228f..52d0b201a1b463f0f163db206d87ff2f289a1099 100644 (file)
@@ -23,7 +23,7 @@
 #include <unordered_map>
 #include <unordered_set>
 #include "user_places_types.h"
-#include <json.h>
+#include <Json.h>
 #include "visit_listener_iface.h"
 #include "location_logger.h"
 #include "location_listener_iface.h"
@@ -80,8 +80,8 @@ namespace ctx {
                bool protrudes_from(const mac_counts_t &mac_counts, const mac_set_t &mac_set);
 
                void db_create_table();
-               void json_put_visit_categ(json &data, const char* key, const categs_t &categs, int categ_type);
-               void json_put_visit_categs(json &data, const categs_t &categs);
+               void json_put_visit_categ(Json &data, const char* key, const categs_t &categs, int categ_type);
+               void json_put_visit_categs(Json &data, const categs_t &categs);
                int db_insert_visit(visit_s visit);
                void set_period(place_recog_mode_e mode);
 
index 701209b483b3213ea3b21fe5b55aabe6d3f5f2e7..f429a9c14ebc07f319aaf50142be02eaabebb432 100644 (file)
@@ -19,7 +19,7 @@
 #include <app_manager.h>
 
 #include <db_mgr.h>
-#include <json.h>
+#include <Json.h>
 #include <types_internal.h>
 #include "../shared/system_info.h"
 #include "app_stats_types.h"
@@ -85,7 +85,7 @@ void ctx::app_use_monitor::create_record(std::string app_id)
        int system_volume;
        int media_volume;
        std::string bssid;
-       json data;
+       Json data;
        data.set(NULL, STATS_APP_ID, app_id);
 
        if (ctx::system_info::get_audio_jack_state(&audiojack))
index 06aa46836026f5388d619bd7ab58b1cf69c2b081..cdb53f4ec097657255026b375ff2a2bcec30f1c0 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <types_internal.h>
-#include <json.h>
+#include <Json.h>
 #include <context_mgr.h>
 #include "app_stats_provider.h"
 #include "db_handle.h"
@@ -98,17 +98,17 @@ CATCH:
        return false;
 }
 
-int ctx::app_statistics_provider::subscribe(const char* subject, ctx::json option, ctx::json* request_result)
+int ctx::app_statistics_provider::subscribe(const char* subject, ctx::Json option, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::app_statistics_provider::unsubscribe(const char* subject, ctx::json option)
+int ctx::app_statistics_provider::unsubscribe(const char* subject, ctx::Json option)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::app_statistics_provider::read(const char* subject, ctx::json option, ctx::json* request_result)
+int ctx::app_statistics_provider::read(const char* subject, ctx::Json option, ctx::Json* request_result)
 {
        ctx::app_db_handle *handle = new(std::nothrow) ctx::app_db_handle();
        IF_FAIL_RETURN_TAG(handle, ERR_OPERATION_FAILED, _E, "Memory allocation failed");
@@ -122,7 +122,7 @@ int ctx::app_statistics_provider::read(const char* subject, ctx::json option, ct
        return ERR_NONE;
 }
 
-int ctx::app_statistics_provider::write(const char* subject, ctx::json data, ctx::json* request_result)
+int ctx::app_statistics_provider::write(const char* subject, ctx::Json data, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
index f5804bd2e16901f74a57564e5cf87d94881e787e..7735fd253e5a31e598141344d059546c920e19ef 100644 (file)
@@ -29,10 +29,10 @@ namespace ctx {
                static bool is_supported(const char *subject);
                static void submit_trigger_item();
 
-               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);
+               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);
 
        private:
                static app_statistics_provider *__instance;
index 5491d24aa5021290241737dc25e8b0c7d92c543d..d293ed4ae254e7779efd5122fedbd4e558d06a49 100644 (file)
@@ -29,7 +29,7 @@ ctx::app_db_handle::~app_db_handle()
 {
 }
 
-int ctx::app_db_handle::read(const char* subject, ctx::json filter)
+int ctx::app_db_handle::read(const char* subject, ctx::Json filter)
 {
        std::string query;
 
@@ -61,7 +61,7 @@ int ctx::app_db_handle::read(const char* subject, ctx::json filter)
        return ERR_NONE;
 }
 
-std::string ctx::app_db_handle::create_where_clause_with_device_status(ctx::json filter)
+std::string ctx::app_db_handle::create_where_clause_with_device_status(ctx::Json filter)
 {
        std::stringstream where_clause;
        std::string bssid;
@@ -78,19 +78,19 @@ std::string ctx::app_db_handle::create_where_clause_with_device_status(ctx::json
        return where_clause.str();
 }
 
-std::string ctx::app_db_handle::create_sql_peak_time(ctx::json filter)
+std::string ctx::app_db_handle::create_sql_peak_time(ctx::Json filter)
 {
        return stats_db_handle_base::create_sql_peak_time(filter, APP_TABLE_USAGE_LOG, create_where_clause(filter));
 }
 
-std::string ctx::app_db_handle::create_sql_common_setting(ctx::json filter)
+std::string ctx::app_db_handle::create_sql_common_setting(ctx::Json filter)
 {
        return stats_db_handle_base::create_sql_common_setting(filter, APP_TABLE_USAGE_LOG, create_where_clause(filter));
 }
 
-std::string ctx::app_db_handle::create_sql_frequency(ctx::json filter)
+std::string ctx::app_db_handle::create_sql_frequency(ctx::Json filter)
 {
-       ctx::json filter_cleaned;
+       ctx::Json filter_cleaned;
        std::string week_str;
        std::string time_of_day;
        std::string app_id;
@@ -134,7 +134,7 @@ std::string ctx::app_db_handle::create_sql_frequency(ctx::json filter)
        return query.str();
 }
 
-std::string ctx::app_db_handle::create_sql_recently_used(ctx::json filter)
+std::string ctx::app_db_handle::create_sql_recently_used(ctx::Json filter)
 {
        std::stringstream query;
        int limit = DEFAULT_LIMIT;
@@ -155,7 +155,7 @@ std::string ctx::app_db_handle::create_sql_recently_used(ctx::json filter)
        return query.str();
 }
 
-std::string ctx::app_db_handle::create_sql_frequently_used(ctx::json filter)
+std::string ctx::app_db_handle::create_sql_frequently_used(ctx::Json filter)
 {
        std::stringstream query;
        int limit = DEFAULT_LIMIT;
@@ -176,7 +176,7 @@ std::string ctx::app_db_handle::create_sql_frequently_used(ctx::json filter)
        return query.str();
 }
 
-std::string ctx::app_db_handle::create_sql_rarely_used(ctx::json filter)
+std::string ctx::app_db_handle::create_sql_rarely_used(ctx::Json filter)
 {
        std::stringstream query;
        int limit = DEFAULT_LIMIT;
@@ -199,11 +199,11 @@ std::string ctx::app_db_handle::create_sql_rarely_used(ctx::json filter)
        return query.str();
 }
 
-void ctx::app_db_handle::reply_trigger_item(int error, ctx::json &json_result)
+void ctx::app_db_handle::reply_trigger_item(int error, ctx::Json &json_result)
 {
        IF_FAIL_VOID_TAG(STR_EQ(req_subject.c_str(), APP_SUBJ_FREQUENCY), _E, "Invalid subject");
 
-       ctx::json results;
+       ctx::Json results;
        std::string val_str;
        int val;
 
index f629f0070b17a768dcd37b93da4a6f905122423c..c4cc79e62ea046f1cafe6b6f38d8f257be44e585 100644 (file)
@@ -18,7 +18,7 @@
 #define __CONTEXT_APP_DB_HANDLE_H__
 
 #include <string>
-#include <json.h>
+#include <Json.h>
 #include "../shared/db_handle_base.h"
 
 namespace ctx {
@@ -27,17 +27,17 @@ namespace ctx {
                        app_db_handle();
                        ~app_db_handle();
 
-                       int read(const char* subject, ctx::json filter);
+                       int read(const char* subject, ctx::Json filter);
 
                private:
-                       std::string create_where_clause_with_device_status(ctx::json filter);
-                       std::string create_sql_recently_used(ctx::json filter);
-                       std::string create_sql_frequently_used(ctx::json filter);
-                       std::string create_sql_rarely_used(ctx::json filter);
-                       std::string create_sql_peak_time(ctx::json filter);
-                       std::string create_sql_common_setting(ctx::json filter);
-                       std::string create_sql_frequency(ctx::json filter);
-                       void reply_trigger_item(int error, ctx::json &json_result);
+                       std::string create_where_clause_with_device_status(ctx::Json filter);
+                       std::string create_sql_recently_used(ctx::Json filter);
+                       std::string create_sql_frequently_used(ctx::Json filter);
+                       std::string create_sql_rarely_used(ctx::Json filter);
+                       std::string create_sql_peak_time(ctx::Json filter);
+                       std::string create_sql_common_setting(ctx::Json filter);
+                       std::string create_sql_frequency(ctx::Json filter);
+                       void reply_trigger_item(int error, ctx::Json &json_result);
        };
 }
 
index a5a7af97104e9050fc393bbea395020038162a56..170158535bbfd37797dc6140185b6928f43fe903 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <sstream>
-#include <json.h>
+#include <Json.h>
 #include <types_internal.h>
 #include <db_mgr.h>
 #include "app_stats_types.h"
@@ -78,7 +78,7 @@ bool ctx::app_db_initializer::package_info_cb(package_info_h package_info, void
 
 bool ctx::app_db_initializer::app_info_cb(package_info_app_component_type_e comp_type, const char *app_id, void *user_data)
 {
-       json data;
+       Json data;
        data.set(NULL, STATS_APP_ID, app_id);
        return db_manager::insert(0, APP_TABLE_REMOVABLE_APP, data, NULL);
 }
@@ -91,7 +91,7 @@ void ctx::app_db_initializer::on_insertion_result_received(unsigned int query_id
 {
 }
 
-void ctx::app_db_initializer::on_query_result_received(unsigned int query_id, int error, std::vector<json>& records)
+void ctx::app_db_initializer::on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records)
 {
        if (query_id != EMPTY_CHECKER_QID) {
                _E("Unknown Query ID: %d", query_id);
index b0426751e45bd87ec995322d08e1eee0a103c23a..2bd20ad1e0737fdbbd639086fa88d774d7c62171 100644 (file)
@@ -30,7 +30,7 @@ namespace ctx {
 
                        void on_creation_result_received(unsigned int query_id, int error);
                        void on_insertion_result_received(unsigned int query_id, int error, int64_t row_id);
-                       void on_query_result_received(unsigned int query_id, int error, std::vector<json>& records);
+                       void on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records);
 
                        static bool package_info_cb(package_info_h package_info, void *user_data);
                        static bool app_info_cb(package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
index 7cec2124baeb8f539ad950fede04e8a40f6ca8a0..d4b92ce674ef67494aaa099cf10e1e17ae0f6a27 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <sstream>
 #include <glib.h>
-#include <json.h>
+#include <Json.h>
 #include <types_internal.h>
 #include <db_mgr.h>
 #include "app_stats_types.h"
@@ -81,7 +81,7 @@ void ctx::app_install_monitor::package_event_cb(const char *type, const char *pa
 bool ctx::app_install_monitor::app_info_cb(package_info_app_component_type_e comp_type, const char *app_id, void *user_data)
 {
        if (last_event_type == PACKAGE_MANAGER_EVENT_TYPE_INSTALL) {
-               json data;
+               Json data;
                data.set(NULL, STATS_APP_ID, app_id);
                db_manager::insert(0, APP_TABLE_REMOVABLE_APP, data, NULL);
        } else if (last_event_type == PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL) {
index 0bfee659c4cc61dc596061b942ec62071ada46bc..cba445db5aede4e1b8ac64a5f2e7f719b0c6ca94 100644 (file)
@@ -31,7 +31,7 @@ namespace ctx {
 
                void on_creation_result_received(unsigned int query_id, int error) {}
                void on_insertion_result_received(unsigned int query_id, int error, int64_t row_id) {}
-               void on_query_result_received(unsigned int query_id, int error, std::vector<json>& records) {}
+               void on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records) {}
 
                static std::string create_deletion_query(const char* table_name, const char* app_id);
                static void package_event_cb(const char *type, const char *package, package_manager_event_type_e event_type, package_manager_event_state_e event_state, int progress, package_manager_error_e error, void *user_data);
index 6515c9f68d47f56b9d57fcd44bcccf390d1887bf..bc744292a38eccce666ad8eca36c861b1757be4c 100644 (file)
@@ -30,7 +30,7 @@ ctx::media_db_handle::~media_db_handle()
 {
 }
 
-int ctx::media_db_handle::read(const char* subject, ctx::json filter)
+int ctx::media_db_handle::read(const char* subject, ctx::Json filter)
 {
        //TODO: filter validation (in the API side?)
        std::string query;
@@ -64,7 +64,7 @@ int ctx::media_db_handle::read(const char* subject, ctx::json filter)
        return ERR_NONE;
 }
 
-std::string ctx::media_db_handle::create_where_clause(int media_type, ctx::json filter)
+std::string ctx::media_db_handle::create_where_clause(int media_type, ctx::Json filter)
 {
        std::stringstream where_clause;
 
@@ -74,21 +74,21 @@ std::string ctx::media_db_handle::create_where_clause(int media_type, ctx::json
        return where_clause.str();
 }
 
-std::string ctx::media_db_handle::create_sql_peak_time(int media_type, ctx::json filter)
+std::string ctx::media_db_handle::create_sql_peak_time(int media_type, ctx::Json filter)
 {
        std::string where = create_where_clause(media_type, filter);
        return stats_db_handle_base::create_sql_peak_time(filter, MEDIA_TABLE_NAME, where);
 }
 
-std::string ctx::media_db_handle::create_sql_common_setting(int media_type, ctx::json filter)
+std::string ctx::media_db_handle::create_sql_common_setting(int media_type, ctx::Json filter)
 {
        std::string where = create_where_clause(media_type, filter);
        return stats_db_handle_base::create_sql_common_setting(filter, MEDIA_TABLE_NAME, where);
 }
 
-std::string ctx::media_db_handle::create_sql_frequency(int media_type, ctx::json filter)
+std::string ctx::media_db_handle::create_sql_frequency(int media_type, ctx::Json filter)
 {
-       ctx::json filter_cleaned;
+       ctx::Json filter_cleaned;
        std::string week_str;
        std::string time_of_day;
 
@@ -109,12 +109,12 @@ std::string ctx::media_db_handle::create_sql_frequency(int media_type, ctx::json
        return query.str();
 }
 
-void ctx::media_db_handle::reply_trigger_item(int error, ctx::json &json_result)
+void ctx::media_db_handle::reply_trigger_item(int error, ctx::Json &json_result)
 {
        IF_FAIL_VOID_TAG(STR_EQ(req_subject.c_str(), MEDIA_SUBJ_MUSIC_FREQUENCY) ||
                STR_EQ(req_subject.c_str(), MEDIA_SUBJ_VIDEO_FREQUENCY), _E, "Invalid subject");
 
-       ctx::json results;
+       ctx::Json results;
        int val;
 
        json_result.get(NULL, STATS_TOTAL_COUNT, &val);
index 8fbe72afab93b19e433e4b12a4e1dd152a4860d7..deb3ded65ad6fa19f4d256cfbd0fe22f95fcf181 100644 (file)
@@ -18,7 +18,7 @@
 #define __CONTEXT_MEDIA_DB_HANDLE_H__
 
 #include <string>
-#include <json.h>
+#include <Json.h>
 #include "../shared/db_handle_base.h"
 
 namespace ctx {
@@ -27,14 +27,14 @@ namespace ctx {
                        media_db_handle();
                        ~media_db_handle();
 
-                       int read(const char* subject, ctx::json filter);
+                       int read(const char* subject, ctx::Json filter);
 
                private:
-                       std::string create_where_clause(int media_type, ctx::json filter);
-                       std::string create_sql_peak_time(int media_type, ctx::json filter);
-                       std::string create_sql_common_setting(int media_type, ctx::json filter);
-                       std::string create_sql_frequency(int media_type, ctx::json filter);
-                       void reply_trigger_item(int error, ctx::json &json_result);
+                       std::string create_where_clause(int media_type, ctx::Json filter);
+                       std::string create_sql_peak_time(int media_type, ctx::Json filter);
+                       std::string create_sql_common_setting(int media_type, ctx::Json filter);
+                       std::string create_sql_frequency(int media_type, ctx::Json filter);
+                       void reply_trigger_item(int error, ctx::Json &json_result);
        };
 }
 
index 9c945d74d4d97668bbdf6262f89c4c482d1205d2..156d9b57a08452630fed9e553609ea8fd742ac76 100644 (file)
@@ -121,7 +121,7 @@ void ctx::media_content_monitor::update_play_count(const char *uuid, int type, i
        db_manager::execute(0, query.str().c_str(), this);
 }
 
-void ctx::media_content_monitor::on_query_result_received(unsigned int query_id, int error, std::vector<json>& records)
+void ctx::media_content_monitor::on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records)
 {
        IF_FAIL_VOID(!records.empty());
 
@@ -135,7 +135,7 @@ void ctx::media_content_monitor::insert_log(int media_type)
 {
        int system_volume = -1, media_volume = -1, audiojack = -1;
 
-       json data;
+       Json data;
        data.set(NULL, CX_MEDIA_TYPE, media_type);
 
        if (ctx::system_info::get_audio_jack_state(&audiojack))
index d51d54cc23b73b4e2c2ee3aae0232a17d49d4e85..4bd97dba135a0ef2eeebf163218c53dc0965868f 100644 (file)
@@ -37,7 +37,7 @@ namespace ctx {
 
                void on_creation_result_received(unsigned int query_id, int error) {}
                void on_insertion_result_received(unsigned int query_id, int error, int64_t row_id) {}
-               void on_query_result_received(unsigned int query_id, int error, std::vector<json>& records);
+               void on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records);
 
                static void on_media_content_db_updated(media_content_error_e error, int pid,
                                media_content_db_update_item_type_e update_item,
index d6ad2b7697fc3967a8cebdb1390f9acf18c30dab..e68fe6b787dbc17929b1aeb2259dd15a674e133c 100644 (file)
@@ -83,17 +83,17 @@ bool ctx::media_statistics_provider::init()
        return true;
 }
 
-int ctx::media_statistics_provider::subscribe(const char* subject, ctx::json option, ctx::json* request_result)
+int ctx::media_statistics_provider::subscribe(const char* subject, ctx::Json option, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::media_statistics_provider::unsubscribe(const char* subject, ctx::json option)
+int ctx::media_statistics_provider::unsubscribe(const char* subject, ctx::Json option)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::media_statistics_provider::read(const char* subject, ctx::json option, ctx::json* request_result)
+int ctx::media_statistics_provider::read(const char* subject, ctx::Json option, ctx::Json* request_result)
 {
        media_db_handle *handle = new(std::nothrow) media_db_handle();
        IF_FAIL_RETURN_TAG(handle, ERR_OPERATION_FAILED, _E, "Memory allocation failed");
@@ -107,7 +107,7 @@ int ctx::media_statistics_provider::read(const char* subject, ctx::json option,
        return ERR_NONE;
 }
 
-int ctx::media_statistics_provider::write(const char* subject, ctx::json data, ctx::json* request_result)
+int ctx::media_statistics_provider::write(const char* subject, ctx::Json data, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
index 49949c32ae04121ca7ef562f0d0b09bfbfbe1cb1..72bb19864b4944b28d5519d95d9e737af63efcf8 100644 (file)
@@ -29,10 +29,10 @@ namespace ctx {
                static bool is_supported(const char *subject);
                static void submit_trigger_item();
 
-               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);
+               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);
 
        private:
                static media_statistics_provider *__instance;
index e3d06024ebee9dccea762cce41f369b3f199a7e0..f525b3d18b7272222c1e46a78e67d2f402a6b71e 100644 (file)
@@ -41,7 +41,7 @@ int ctx::stats_db_handle_base::generate_qid()
        return qid;
 }
 
-bool ctx::stats_db_handle_base::execute_query(const char* subject, ctx::json filter, const char* query)
+bool ctx::stats_db_handle_base::execute_query(const char* subject, ctx::Json filter, const char* query)
 {
        bool ret = db_manager::execute(generate_qid(), query, this);
        IF_FAIL_RETURN(ret, false);
@@ -52,7 +52,7 @@ bool ctx::stats_db_handle_base::execute_query(const char* subject, ctx::json fil
        return true;
 }
 
-std::string ctx::stats_db_handle_base::create_where_clause(ctx::json filter)
+std::string ctx::stats_db_handle_base::create_where_clause(ctx::Json filter)
 {
        std::stringstream where_clause;
        int week = 0;
@@ -142,7 +142,7 @@ std::string ctx::stats_db_handle_base::create_where_clause(ctx::json filter)
        return where_clause.str();
 }
 
-std::string ctx::stats_db_handle_base::create_sql_peak_time(ctx::json filter, const char* table_name, std::string where_clause)
+std::string ctx::stats_db_handle_base::create_sql_peak_time(ctx::Json filter, const char* table_name, std::string where_clause)
 {
        std::stringstream query;
        int limit = DEFAULT_LIMIT;
@@ -161,7 +161,7 @@ std::string ctx::stats_db_handle_base::create_sql_peak_time(ctx::json filter, co
        return query.str();
 }
 
-std::string ctx::stats_db_handle_base::create_sql_common_setting(ctx::json filter, const char* table_name, std::string where_clause)
+std::string ctx::stats_db_handle_base::create_sql_common_setting(ctx::Json filter, const char* table_name, std::string where_clause)
 {
        std::stringstream query;
 
@@ -197,28 +197,28 @@ void ctx::stats_db_handle_base::on_insertion_result_received(unsigned int query_
        delete this;
 }
 
-void ctx::stats_db_handle_base::json_vector_to_array(std::vector<json> &vec_json, ctx::json &json_result)
+void ctx::stats_db_handle_base::json_vector_to_array(std::vector<Json> &vec_json, ctx::Json &json_result)
 {
-       std::vector<json>::iterator json_vec_end = vec_json.end();
+       std::vector<Json>::iterator json_vec_end = vec_json.end();
 
-       for(std::vector<json>::iterator json_vec_pos = vec_json.begin(); json_vec_pos != json_vec_end; ++json_vec_pos) {
-               json origin_j = *json_vec_pos;
-               json_result.array_append(NULL, STATS_QUERY_RESULT, origin_j);
+       for(std::vector<Json>::iterator json_vec_pos = vec_json.begin(); json_vec_pos != json_vec_end; ++json_vec_pos) {
+               Json origin_j = *json_vec_pos;
+               json_result.append(NULL, STATS_QUERY_RESULT, origin_j);
        }
 }
 
-void ctx::stats_db_handle_base::on_query_result_received(unsigned int query_id, int error, std::vector<json>& records)
+void ctx::stats_db_handle_base::on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records)
 {
        if (is_trigger_item) {
                if (records.size() == 1) {
                        reply_trigger_item(error, records[0]);
                } else {
                        _E("Invalid query result");
-                       json dummy;
+                       Json dummy;
                        context_manager::reply_to_read(req_subject.c_str(), req_filter, ERR_OPERATION_FAILED, dummy);
                }
        } else {
-               json results = "{\"" STATS_QUERY_RESULT "\":[]}";
+               Json results = "{\"" STATS_QUERY_RESULT "\":[]}";
                json_vector_to_array(records, results);
                context_manager::reply_to_read(req_subject.c_str(), req_filter, error, results);
        }
index 6e05696687c9ad70736c676adc43aebd67a99ca7..7c883806e3d61164ce34ec48f457b3f931eaa637 100644 (file)
@@ -18,7 +18,7 @@
 #define __CONTEXT_STATS_DB_HANDLE_BASE_H__
 
 #include <string>
-#include <json.h>
+#include <Json.h>
 #include <db_listener_iface.h>
 
 namespace ctx {
@@ -26,25 +26,25 @@ namespace ctx {
                protected:
                        bool is_trigger_item;
                        std::string req_subject;
-                       ctx::json req_filter;
+                       ctx::Json req_filter;
 
                        stats_db_handle_base();
                        ~stats_db_handle_base();
 
-                       std::string create_where_clause(ctx::json filter);
-                       std::string create_sql_peak_time(ctx::json filter, const char* table_name, std::string where_clause);
-                       std::string create_sql_common_setting(ctx::json filter, const char* table_name, std::string where_clause);
+                       std::string create_where_clause(ctx::Json filter);
+                       std::string create_sql_peak_time(ctx::Json filter, const char* table_name, std::string where_clause);
+                       std::string create_sql_common_setting(ctx::Json filter, const char* table_name, std::string where_clause);
 
-                       bool execute_query(const char* subject, ctx::json filter, const char* query);
-                       virtual void reply_trigger_item(int error, ctx::json &json_result) = 0;
+                       bool execute_query(const char* subject, ctx::Json filter, const char* query);
+                       virtual void reply_trigger_item(int error, ctx::Json &json_result) = 0;
                        static int generate_qid();
 
                private:
-                       void json_vector_to_array(std::vector<json> &vec_json, ctx::json &json_result);
+                       void json_vector_to_array(std::vector<Json> &vec_json, ctx::Json &json_result);
 
                        void on_creation_result_received(unsigned int query_id, int error);
                        void on_insertion_result_received(unsigned int query_id, int error, int64_t row_id);
-                       void on_query_result_received(unsigned int query_id, int error, std::vector<json>& records);
+                       void on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records);
        };
 }
 
index e6a1a018cbf40dc3974761d4b875837a56afe4ed..a42e62554c56c888c003c591aa7c6e7a62fdec2e 100644 (file)
@@ -30,7 +30,7 @@ ctx::social_db_handle::~social_db_handle()
 {
 }
 
-int ctx::social_db_handle::read(const char* subject, ctx::json filter)
+int ctx::social_db_handle::read(const char* subject, ctx::Json filter)
 {
        std::string query;
 
@@ -50,7 +50,7 @@ int ctx::social_db_handle::read(const char* subject, ctx::json filter)
        return ERR_NONE;
 }
 
-std::string ctx::social_db_handle::create_where_clause(ctx::json filter)
+std::string ctx::social_db_handle::create_where_clause(ctx::Json filter)
 {
        std::stringstream where_clause;
        int comm_type = -1;
@@ -77,7 +77,7 @@ std::string ctx::social_db_handle::create_where_clause(ctx::json filter)
        return where_clause.str();
 }
 
-std::string ctx::social_db_handle::create_sql_freq_address(ctx::json filter)
+std::string ctx::social_db_handle::create_sql_freq_address(ctx::Json filter)
 {
        std::stringstream query;
        int limit = DEFAULT_LIMIT;
@@ -98,9 +98,9 @@ std::string ctx::social_db_handle::create_sql_freq_address(ctx::json filter)
        return query.str();
 }
 
-std::string ctx::social_db_handle::create_sql_frequency(ctx::json filter)
+std::string ctx::social_db_handle::create_sql_frequency(ctx::Json filter)
 {
-       ctx::json filter_cleaned;
+       ctx::Json filter_cleaned;
        std::string week_str;
        std::string time_of_day;
        std::string address;
@@ -143,11 +143,11 @@ std::string ctx::social_db_handle::create_sql_frequency(ctx::json filter)
        return query.str();
 }
 
-void ctx::social_db_handle::reply_trigger_item(int error, ctx::json &json_result)
+void ctx::social_db_handle::reply_trigger_item(int error, ctx::Json &json_result)
 {
        IF_FAIL_VOID_TAG(STR_EQ(req_subject.c_str(), SOCIAL_SUBJ_FREQUENCY), _E, "Invalid subject");
 
-       ctx::json results;
+       ctx::Json results;
        std::string val_str;
        int val;
 
index a8eecb133c4ece99ddfda71a3be926b583dea64c..1bf88fd75c685fe8ffb600262e2bc1de9553039d 100644 (file)
@@ -18,7 +18,7 @@
 #define __CONTEXT_SOCIAL_DB_HANDLE_H__
 
 #include <string>
-#include <json.h>
+#include <Json.h>
 #include "../shared/db_handle_base.h"
 
 namespace ctx {
@@ -27,13 +27,13 @@ namespace ctx {
                        social_db_handle();
                        ~social_db_handle();
 
-                       int read(const char* subject, ctx::json filter);
+                       int read(const char* subject, ctx::Json filter);
 
                private:
-                       std::string create_where_clause(ctx::json filter);
-                       std::string create_sql_freq_address(ctx::json filter);
-                       std::string create_sql_frequency(ctx::json filter);
-                       void reply_trigger_item(int error, ctx::json &json_result);
+                       std::string create_where_clause(ctx::Json filter);
+                       std::string create_sql_freq_address(ctx::Json filter);
+                       std::string create_sql_frequency(ctx::Json filter);
+                       void reply_trigger_item(int error, ctx::Json &json_result);
        };
 }
 
index 2c4af98522f96d36966412cdc6fa1d6c31622113..309316f7a41f831a7afd660ac861c387f3d1ebf5 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <sstream>
-#include <json.h>
+#include <Json.h>
 #include <db_mgr.h>
 #include <timer_mgr.h>
 #include <types_internal.h>
@@ -60,7 +60,7 @@ void ctx::contact_log_aggregator::aggregate_contact_log()
                        " FROM " SOCIAL_TABLE_CONTACT_LOG, this);
 }
 
-void ctx::contact_log_aggregator::on_query_result_received(unsigned int query_id, int error, std::vector<json>& records)
+void ctx::contact_log_aggregator::on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records)
 {
        IF_FAIL_VOID_TAG(!records.empty(), _E, "Invalid query result");
 
@@ -131,7 +131,7 @@ void ctx::contact_log_aggregator::insert_contact_log_list(contacts_list_h list)
                contacts_list_get_current_record_p(list, &record);
                if (record == NULL) break;
 
-               ctx::json data;
+               ctx::Json data;
 
                char* address = NULL;
                int log_type;
index 57c154fd3c761bad8abb5afd869316376c1165df..e7aefb726fb60cbcf9177b1433ec1b0cf7629050 100644 (file)
@@ -41,7 +41,7 @@ namespace ctx {
 
                        void on_creation_result_received(unsigned int query_id, int error) {}
                        void on_insertion_result_received(unsigned int query_id, int error, int64_t row_id) {}
-                       void on_query_result_received(unsigned int query_id, int error, std::vector<json>& records);
+                       void on_query_result_received(unsigned int query_id, int error, std::vector<Json>& records);
                        bool on_timer_expired(int timer_id, void* user_data);
 
        };      /* class phone_contact_log_aggregator */
index 92bb856d6dcb47812ddb169cc82d283f4446b7dd..90aa35b36c979450484fb17f55be2bdf84134daa 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <types_internal.h>
-#include <json.h>
+#include <Json.h>
 #include <context_mgr.h>
 #include "social_stats_provider.h"
 #include "db_handle.h"
@@ -81,17 +81,17 @@ bool ctx::social_statistics_provider::init()
        return true;
 }
 
-int ctx::social_statistics_provider::subscribe(const char* subject, ctx::json option, ctx::json* request_result)
+int ctx::social_statistics_provider::subscribe(const char* subject, ctx::Json option, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::social_statistics_provider::unsubscribe(const char* subject, ctx::json option)
+int ctx::social_statistics_provider::unsubscribe(const char* subject, ctx::Json option)
 {
        return ERR_NOT_SUPPORTED;
 }
 
-int ctx::social_statistics_provider::read(const char* subject, ctx::json option, ctx::json* request_result)
+int ctx::social_statistics_provider::read(const char* subject, ctx::Json option, ctx::Json* request_result)
 {
        ctx::social_db_handle *handle = new(std::nothrow) ctx::social_db_handle();
        IF_FAIL_RETURN_TAG(handle, ERR_OPERATION_FAILED, _E, "Memory allocation failed");
@@ -105,7 +105,7 @@ int ctx::social_statistics_provider::read(const char* subject, ctx::json option,
        return ERR_NONE;
 }
 
-int ctx::social_statistics_provider::write(const char* subject, ctx::json data, ctx::json* request_result)
+int ctx::social_statistics_provider::write(const char* subject, ctx::Json data, ctx::Json* request_result)
 {
        return ERR_NOT_SUPPORTED;
 }
index 64ab05956036b634b5b279162162b1a956d6903a..7ba803ddab1d8d1cf0e2da888a23c3d611534c65 100644 (file)
@@ -29,10 +29,10 @@ namespace ctx {
                static bool is_supported(const char *subject);
                static void submit_trigger_item();
 
-               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);
+               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);
 
        private:
                static social_statistics_provider *__instance;