#ifndef __CONTEXT_MANAGER_H__
#define __CONTEXT_MANAGER_H__
+#include <stdlib.h>
+
namespace ctx {
/* Forward Declaration */
class json;
/*
*/
- bool register_trigger_item(const char *subject, int operation, ctx::json attributes, ctx::json options);
+ bool unregister_provider(const char *subject);
+
+ /*
+ */
+ bool register_trigger_item(const char *subject, int operation, ctx::json attributes, ctx::json options, const char* owner = NULL);
+
+ /*
+ */
+ bool unregister_trigger_item(const char *subject);
/*
*/
public:
virtual ~context_manager_iface() {}
virtual bool register_provider(const char *subject, context_provider_info &provider_info) = 0;
- virtual bool register_trigger_item(const char *subject, int operation, ctx::json attributes, ctx::json options) = 0;
+ virtual bool unregister_provider(const char *subject) = 0;
+ virtual bool register_trigger_item(const char *subject, int operation, ctx::json attributes, ctx::json options, const char* owner = NULL) = 0;
+ virtual bool unregister_trigger_item(const char *subject) = 0;
virtual bool publish(const char *subject, ctx::json &option, int error, ctx::json &data_updated) = 0;
virtual bool reply_to_read(const char *subject, ctx::json &option, int error, ctx::json &data_read) = 0;
}; /* class context_manager_iface */
std::string str();
bool get_keys(std::list<std::string>* list);
+ bool valid();
bool set(const char* path, const char* key, json& val);
bool set(const char* path, const char* key, int val);
#define ERR_RULE_NOT_ENABLED (TIZEN_ERROR_CONTEXT | 0x06)
#define ERR_INVALID_RULE (TIZEN_ERROR_CONTEXT | 0x07)
#define ERR_RULE_NOT_EXIST (TIZEN_ERROR_CONTEXT | 0x08)
+#define ERR_INVALID_DATA ERR_INVALID_RULE
+#define ERR_DATA_EXIST (TIZEN_ERROR_CONTEXT | 0X09)
/* Logging and Error Handling */
#define _I SLOGI
return _instance->register_provider(subject, provider_info);
}
-bool ctx::context_manager::register_trigger_item(const char *subject, int operation, ctx::json attributes, ctx::json options)
+bool ctx::context_manager::unregister_provider(const char* subject)
{
IF_FAIL_RETURN_TAG(_instance, false, _E, "Not initialized");
- return _instance->register_trigger_item(subject, operation, attributes, options);
+ return _instance->unregister_provider(subject);
+}
+
+bool ctx::context_manager::register_trigger_item(const char *subject, int operation, ctx::json attributes, ctx::json options, const char* owner)
+{
+ IF_FAIL_RETURN_TAG(_instance, false, _E, "Not initialized");
+ return _instance->register_trigger_item(subject, operation, attributes, options, owner);
+}
+
+bool ctx::context_manager::unregister_trigger_item(const char *subject)
+{
+ IF_FAIL_RETURN_TAG(_instance, false, _E, "Not initialized");
+ return _instance->unregister_trigger_item(subject);
}
bool ctx::context_manager::publish(const char* subject, ctx::json option, int error, ctx::json data_updated)
}
}
+bool ctx::json::valid()
+{
+ return (json_node != NULL);
+}
+
ctx::json& ctx::json::operator=(const json& j)
{
release();
{
ASSERT_NOT_NULL(subject);
IF_FAIL_RETURN_TAG(initialize(), false, _E, "Connection failed");
- return dbus_handle->request(REQ_SUPPORT, generate_req_id(), subject, NULL, NULL, NULL);
+
+ int error = dbus_handle->request(REQ_SUPPORT, generate_req_id(), subject, NULL, NULL, NULL);
+ _D("Error: %#x", error);
+ return error;
}
bool ctx::request_handler::register_callback(const char* subject, subject_response_cb callback)