Applied C++ naming rule(class, method names) 58/81458/1
authorkmook <kmook.choi@samsung.com>
Tue, 26 Jul 2016 10:00:25 +0000 (19:00 +0900)
committerkmook <kmook.choi@samsung.com>
Tue, 26 Jul 2016 10:00:25 +0000 (19:00 +0900)
Change-Id: I6dbe91518d05f84d90060a6b90fe5b5c71097f15
Signed-off-by: kmook <kmook.choi@samsung.com>
52 files changed:
daemon/ClientInfo.cpp [moved from daemon/client.cpp with 65% similarity]
daemon/ClientInfo.h [moved from daemon/client.h with 64% similarity]
daemon/ClientManager.cpp
daemon/ClientManager.h
daemon/ConnectionManager.cpp
daemon/ConnectionManager.h
daemon/DbusServer.cpp
daemon/DiscoveryManager.cpp
daemon/DiscoveryManager.h
daemon/IDevice.h
daemon/IDiscoveryProvider.cpp
daemon/IDiscoveryProvider.h
daemon/IManager.h
daemon/IServiceProvider.h
daemon/Json.cpp [moved from daemon/conv_json.cpp with 83% similarity]
daemon/Json.h [new file with mode: 0644]
daemon/Request.cpp [new file with mode: 0755]
daemon/Request.h [moved from daemon/request.h with 51% similarity]
daemon/RequestHandler.cpp
daemon/RequestHandler.h
daemon/Server.cpp
daemon/Server.h
daemon/ServiceManager.cpp
daemon/ServiceManager.h
daemon/conv_json.h [deleted file]
daemon/discovery_provider/IotconDiscoveryProvider.cpp
daemon/discovery_provider/IotconDiscoveryProvider.h
daemon/discovery_provider/SmartviewDiscoveryProvider.cpp
daemon/discovery_provider/SmartviewDiscoveryProvider.h
daemon/discovery_provider/WifiDirectDiscoveryProvider.cpp
daemon/discovery_provider/WifiDirectDiscoveryProvider.h
daemon/discovery_provider/iotcon/DeviceAdapter.cpp
daemon/discovery_provider/iotcon/DeviceAdapter.h
daemon/discovery_provider/iotcon/ResourceHandle.cpp
daemon/discovery_provider/iotcon/ResourceHandle.h
daemon/discovery_provider/iotcon/ServiceAdapter.cpp
daemon/discovery_provider/smartview/SmartViewDevice.cpp [moved from daemon/discovery_provider/smartview/device.cpp with 79% similarity]
daemon/discovery_provider/smartview/SmartViewDevice.h [moved from daemon/discovery_provider/smartview/device.h with 76% similarity]
daemon/discovery_provider/smartview/SmartViewService.cpp [moved from daemon/discovery_provider/smartview/service.cpp with 60% similarity]
daemon/discovery_provider/smartview/SmartViewService.h [moved from daemon/discovery_provider/smartview/service.h with 84% similarity]
daemon/request.cpp [deleted file]
daemon/service_provider/AppCommServiceInfo.h
daemon/service_provider/AppCommServiceProvider.cpp
daemon/service_provider/AppCommServiceProvider.h
daemon/service_provider/RemoteAppControlServiceInfo.h
daemon/service_provider/RemoteAppControlServiceProvider.cpp
daemon/service_provider/RemoteAppControlServiceProvider.h
lib/conv_lib.cpp
lib/conv_lib_channel.cpp
lib/conv_lib_json.cpp
lib/conv_lib_json.h
lib/conv_lib_payload.cpp

similarity index 65%
rename from daemon/client.cpp
rename to daemon/ClientInfo.cpp
index 28754a8..378c9a5 100755 (executable)
  */
 
 #include <glib.h>
-#include "client.h"
+#include "ClientInfo.h"
 #include "Log.h"
 #include "d2d_conv_manager.h"
 
 using namespace std;
 
-conv::client::client(string client_id, GDBusMethodInvocation *inv)
+conv::ClientInfo::ClientInfo(string clientId, GDBusMethodInvocation *inv)
 {
-       id = client_id;
+       id = clientId;
 }
 
-conv::client::~client()
+conv::ClientInfo::~ClientInfo()
 {
-       for (service_info_map_t::iterator it = service_info_map.begin(); it != service_info_map.end(); ++it) {
+       for (ServiceInfoMap::iterator it = service_info_map.begin(); it != service_info_map.end(); ++it) {
                delete (it->second);
        }
        service_info_map.clear();
 }
 
-int conv::client::add_device()
+int conv::ClientInfo::add_device()
 {
        return CONV_ERROR_NONE;
 }
 
-int conv::client::remove_device()
+int conv::ClientInfo::remove_device()
 {
        return CONV_ERROR_NONE;
 }
 
-string conv::client::get_id()
+string conv::ClientInfo::getId()
 {
        return id;
 }
 
-conv::IServiceInfo* conv::client::get_service_info(string type, string id)
+conv::IServiceInfo* conv::ClientInfo::getServiceInfo(string type, string id)
 {
-       service_info_map_t::iterator it;
+       ServiceInfoMap::iterator it;
        it = service_info_map.find(std::pair<string, string>(type, id));
 
        if ( it != service_info_map.end() ) {
@@ -63,9 +63,9 @@ conv::IServiceInfo* conv::client::get_service_info(string type, string id)
        }
 }
 
-int conv::client::add_service_info(string type, string id, IServiceInfo* info)
+int conv::ClientInfo::addServiceInfo(string type, string id, IServiceInfo* info)
 {
-       service_info_map.insert(std::pair<service_key_t, IServiceInfo*>(std::pair<string, string>(type, id), info));
+       service_info_map.insert(std::pair<ServiceKey, IServiceInfo*>(std::pair<string, string>(type, id), info));
        _D("service info is added : %s, %s", type.c_str(), id.c_str());
 
        return CONV_ERROR_NONE;
similarity index 64%
rename from daemon/client.h
rename to daemon/ClientInfo.h
index b09116b..c121182 100755 (executable)
 #include <vector>
 #include <map>
 #include <gio/gio.h>
-#include "client.h"
-#include "conv_json.h"
+#include "Json.h"
 #include "IDevice.h"
 #include "IServiceInfo.h"
 
 namespace conv {
-       class client {
-               typedef std::vector<IDevice*> device_list_t;
-               typedef std::pair<std::string, std::string> service_key_t;
-               typedef std::map<service_key_t, IServiceInfo*> service_info_map_t;
+       class ClientInfo {
+               typedef std::vector<IDevice*> DeviceList;
+               typedef std::pair<std::string, std::string> ServiceKey;
+               typedef std::map<ServiceKey, IServiceInfo*> ServiceInfoMap;
 
                public:
-                       client(std::string id, GDBusMethodInvocation *inv);
-                       ~client();
+                       ClientInfo(std::string id, GDBusMethodInvocation *inv);
+                       ~ClientInfo();
 
                        int add_device();
                        int remove_device();
 
-                       std::string get_id();
+                       std::string getId();
 
-                       IServiceInfo* get_service_info(std::string type, std::string id);
-                       int add_service_info(std::string type, std::string id, IServiceInfo* info);
+                       IServiceInfo* getServiceInfo(std::string type, std::string id);
+                       int addServiceInfo(std::string type, std::string id, IServiceInfo* info);
                private:
-                       device_list_t device_list;
-                       service_info_map_t service_info_map;
+                       DeviceList device_list;
+                       ServiceInfoMap service_info_map;
 
                protected:
                        std::string id;
index 87ad709..5b8084f 100755 (executable)
@@ -50,24 +50,24 @@ void conv::client_manager::setInstance(conv::ClientManager* mgr)
 }
 
 
-int conv::ClientManager::handleRequest(request* requestObj)
+int conv::ClientManager::handleRequest(Request* requestObj)
 {
        _D("handle_request called");
 
        return CONV_ERROR_NONE;
 }
 
-conv::client* conv::client_manager::getClient(std::string clientId)
+conv::ClientInfo* conv::client_manager::getClient(std::string clientId)
 {
        IF_FAIL_RETURN_TAG(_instance, NULL, _E, "Not initialized");
 
        return _instance->getClient(clientId);
 }
 
-conv::client* conv::ClientManager::getClient(std::string clientId)
+conv::ClientInfo* conv::ClientManager::getClient(std::string clientId)
 {
        for (ClientList::iterator it = clientList.begin(); it != clientList.end(); ++it) {
-               if ( !(*it)->get_id().compare(clientId) )
+               if ( !(*it)->getId().compare(clientId) )
                {
                        // already exists
                        _D("client exists");
@@ -76,7 +76,7 @@ conv::client* conv::ClientManager::getClient(std::string clientId)
        }
 
        _D("new client obj created");
-       client* clientObj = new(std::nothrow) conv::client(clientId, NULL);
+       ClientInfo* clientObj = new(std::nothrow) conv::ClientInfo(clientId, NULL);
 
        clientList.push_back(clientObj);
        return clientObj;
index 34b54f7..9cb840f 100755 (executable)
 #include <vector>
 #include <string>
 #include "IManager.h"
-#include "client.h"
+#include "ClientInfo.h"
 
 namespace conv {
        class ClientManager : public IManager  {
-               typedef std::vector<client*> ClientList;
+               typedef std::vector<ClientInfo*> ClientList;
                public:
                        ClientManager();
                        ~ClientManager();
 
                        int init();
                        int release();
-                       int handleRequest(request* requestObj);
-                       conv::client* getClient(std::string clientId);
+                       int handleRequest(Request* requestObj);
+                       conv::ClientInfo* getClient(std::string clientId);
 
                private:
                        ClientList clientList;
@@ -42,7 +42,7 @@ namespace conv {
 
        namespace client_manager {
                void setInstance(ClientManager* mgr);
-               conv::client* getClient(std::string clientId);
+               conv::ClientInfo* getClient(std::string clientId);
        }
 }
 
index dddced9..6e2af16 100755 (executable)
@@ -18,7 +18,7 @@
 #include "access_control/Privilege.h"
 
 static conv::ConnectionManager *_instance;
-static conv::request* cur_Req;
+static conv::Request* cur_Req;
 
 using namespace std;
 
@@ -45,20 +45,20 @@ void conv::connection_manager::setInstance(conv::ConnectionManager* mgr)
        _instance = mgr;
 }
 
-int conv::ConnectionManager::handleRequest(request* requestObj)
+int conv::ConnectionManager::handleRequest(Request* requestObj)
 {
        _D("handle_request called");
        int error = CONV_ERROR_INVALID_OPERATION;
 
-       if ( !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_INTERNET) ||
-                       !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_BLUETOOTH) ) {
+       if ( !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_INTERNET) ||
+                       !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_BLUETOOTH) ) {
                _E("permission denied");
                requestObj->reply(CONV_ERROR_PERMISSION_DENIED);
                delete requestObj;
                return CONV_ERROR_PERMISSION_DENIED;
        }
 
-       switch (requestObj->get_type()) {
+       switch (requestObj->getType()) {
                case REQ_SUBSCRIBE:
                {
                        cur_Req = requestObj;
@@ -73,14 +73,14 @@ int conv::ConnectionManager::handleRequest(request* requestObj)
                break;
                case REQ_WRITE:
                {
-                       json cb_json, jservice, description, tmp_payload;
+                       Json cb_json, jservice, description, tmp_payload;
                        string did;
-                       description = requestObj->get_description();
+                       description = requestObj->getDescription();
                        description.get(NULL, CONV_JSON_SERVICE, &jservice);
                        jservice.get(CONV_JSON_SERVICE_DATA_PATH, CONV_JSON_SERVICE_DATA_ID, &did);
                        // TODO:
                        //make callback data and invoke
-                       cb_json.set(NULL, CONV_JSON_DESCRIPTION, requestObj->get_description());
+                       cb_json.set(NULL, CONV_JSON_DESCRIPTION, requestObj->getDescription());
                        cb_json.set(NULL, CONV_JSON_PAYLOAD, tmp_payload);
                        if (cur_Req != NULL) {
                                cur_Req->publish(CONV_ERROR_NONE, cb_json);
@@ -101,7 +101,7 @@ int conv::ConnectionManager::handleRequest(request* requestObj)
        return CONV_ERROR_NONE;
 }
 
-int conv::connection_manager::handleRequest(request* requestObj)
+int conv::connection_manager::handleRequest(Request* requestObj)
 {
        IF_FAIL_RETURN_TAG(_instance, CONV_ERROR_INVALID_PARAMETER, _E, "Not initialized");
        _instance->handleRequest(requestObj);
index 6b713b4..e45a3a3 100644 (file)
@@ -21,7 +21,7 @@
 #include <glib.h>
 #include <vector>
 #include "IManager.h"
-#include "request.h"
+#include "Request.h"
 
 namespace conv {
        class ConnectionManager : public IManager  {
@@ -31,12 +31,12 @@ namespace conv {
 
                        int init();
                        int release();
-                       int handleRequest(request* requestObj);
+                       int handleRequest(Request* requestObj);
        };
 
        namespace connection_manager {
                void setInstance(ConnectionManager* mgr);
-               int handleRequest(request* requestObj);
+               int handleRequest(Request* requestObj);
        }
 }
 
index 713dd26..f541473 100755 (executable)
@@ -89,9 +89,9 @@ static void __handle_request(GDBusConnection* conn, const char *sender, GVariant
                return;
        }
 
-       conv::request *recvRequest = NULL;
+       conv::Request *recvRequest = NULL;
        try{
-               recvRequest = new conv::request(req_type, DEFAULT_APP_ID, req_id, subject, input, sender, creds, invocation);
+               recvRequest = new conv::Request(req_type, DEFAULT_APP_ID, req_id, subject, input, sender, creds, invocation);
        } catch (std::bad_alloc& ba) {
                _E("Memory Allocation Failed..");
                g_dbus_method_invocation_return_value(invocation, g_variant_new("(iss)", CONV_ERROR_INVALID_OPERATION, EMPTY_JSON_OBJECT, EMPTY_JSON_OBJECT));
index 8051f22..e807238 100755 (executable)
@@ -43,9 +43,9 @@ conv::DiscoveryManager::~DiscoveryManager()
 int conv::DiscoveryManager::init()
 {
        _D("Discovery_Manager Init!!..");
-       register_provider(new(std::nothrow) conv::SmartviewDiscoveryProvider());
-       register_provider(new(std::nothrow) conv::WifiDirectDiscoveryProvider());
-       register_provider(new(std::nothrow) conv::IotconDiscoveryProvider());
+       registerProvider(new(std::nothrow) conv::SmartviewDiscoveryProvider());
+       registerProvider(new(std::nothrow) conv::WifiDirectDiscoveryProvider());
+       registerProvider(new(std::nothrow) conv::IotconDiscoveryProvider());
 
        request_map.clear();
        request_timer_map.clear();
@@ -55,29 +55,29 @@ int conv::DiscoveryManager::init()
 
 int conv::DiscoveryManager::release()
 {
-       for (discovery_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it)
+       for (discovery_provider_list_t::iterator it = __providerList.begin(); it != __providerList.end(); ++it)
                (*it)->stop();
 
-       for (discovery_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it)
+       for (discovery_provider_list_t::iterator it = __providerList.begin(); it != __providerList.end(); ++it)
                delete *it;
 
-       provider_list.clear();
+       __providerList.clear();
 
        return CONV_ERROR_NONE;
 }
 
-void conv::discovery_manager::set_instance(conv::DiscoveryManager* mgr)
+void conv::discovery_manager::setInstance(conv::DiscoveryManager* mgr)
 {
        _instance = mgr;
 }
 
-int conv::DiscoveryManager::notify_time_up(std::string client)
+int conv::DiscoveryManager::notifyTimeOut(std::string client)
 {
        // 1. When no client is using discovery, it should be stopped
-       _D("notify_time_up.. with current discovery count :%d", count_discovery_request);
+       _D("notifyTimeOut.. with current discovery count :%d", count_discovery_request);
        if (--count_discovery_request <= 0) {
                count_discovery_request = 0;
-               stop_discovery();
+               stopDiscovery();
        }
 
        // 2. Reqeust to stop timer related to client in the timer_map
@@ -91,15 +91,15 @@ int conv::DiscoveryManager::notify_time_up(std::string client)
        // 3. Notify the client that the requested discovery has been finished
        request_map_t::iterator request_itr = request_map.find(client);
        if (request_itr != request_map.end()) {
-               json no_data;
-               request* cur_Req = request_itr->second;
+               Json no_data;
+               Request* cur_Req = request_itr->second;
                cur_Req->publish(CONV_DISCOVERY_FINISHED, no_data);
        }
 
        return CONV_ERROR_NONE;
 }
 
-void conv::DiscoveryManager::timer_worker(void* data)
+void conv::DiscoveryManager::__timer_worker(void* data)
 {
        gpointer* param = reinterpret_cast<gpointer*> (data);
        std::string* req_client = reinterpret_cast<std::string*> (param[0]);
@@ -107,10 +107,10 @@ void conv::DiscoveryManager::timer_worker(void* data)
 
        _D("Timer_Worker.. req_client[%s] discovery_manager[%x]", (*req_client).c_str(), cur_disc_mgr);
 
-       cur_disc_mgr->notify_time_up(*req_client);
+       cur_disc_mgr->notifyTimeOut(*req_client);
 }
 
-int conv::DiscoveryManager::checkBoundaryForTimeout(int givenTimeout)
+int conv::DiscoveryManager::checkBoundaryForTimeOut(int givenTimeout)
 {
        if ( givenTimeout < CONV_DISCOVERY_MIN_VALUE )
                return CONV_DISCOVERY_MIN_VALUE;
@@ -120,13 +120,13 @@ int conv::DiscoveryManager::checkBoundaryForTimeout(int givenTimeout)
                return givenTimeout;
 }
 
-int conv::DiscoveryManager::handleRequest(request* requestObj)
+int conv::DiscoveryManager::handleRequest(Request* requestObj)
 {
        _D("handle_request called .. request:%x _instance:%x", requestObj, _instance);
        if ( _instance ) {
-               if ( !strcmp(requestObj->get_subject(), CONV_SUBJECT_DISCOVERY_START) ) {
-                       if ( !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_INTERNET) ||
-                                       !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_BLUETOOTH) ) {
+               if ( !strcmp(requestObj->getSubject(), CONV_SUBJECT_DISCOVERY_START) ) {
+                       if ( !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_INTERNET) ||
+                                       !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_BLUETOOTH) ) {
                                _E("permission denied");
                                requestObj->reply(CONV_ERROR_PERMISSION_DENIED);
                                delete requestObj;
@@ -135,11 +135,11 @@ int conv::DiscoveryManager::handleRequest(request* requestObj)
 
                        discovered_results.clear();
 
-                       for (discovery_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it)
+                       for (discovery_provider_list_t::iterator it = __providerList.begin(); it != __providerList.end(); ++it)
                                // Discovery Provider Starts!!!!
                                (*it)->start();
 
-                       const char* client = requestObj->get_sender();
+                       const char* client = requestObj->getSender();
                        if (client == NULL) {
                                _D("client is empty..");
                                return CONV_ERROR_INVALID_OPERATION;
@@ -147,9 +147,9 @@ int conv::DiscoveryManager::handleRequest(request* requestObj)
                        _D("requestObj info .. client[%s]", client);
 
                        int timeout = 0;
-                       json description = requestObj->get_description();
+                       Json description = requestObj->getDescription();
                        description.get(NULL, "timeout", &timeout);
-                       timeout = checkBoundaryForTimeout(timeout);
+                       timeout = checkBoundaryForTimeOut(timeout);
 
                        request_map_t::iterator map_itr = request_map.find(string(client));
 
@@ -175,18 +175,18 @@ int conv::DiscoveryManager::handleRequest(request* requestObj)
                        param[0] = reinterpret_cast<void*>(new(std::nothrow) string(client));
                        param[1] = reinterpret_cast<void*>(this);
 
-                       int timer_id = reinterpret_cast<int>(conv::util::miscStartTimer(timer_worker, timeout, param));
+                       int timer_id = reinterpret_cast<int>(conv::util::miscStartTimer(__timer_worker, timeout, param));
                        request_timer_map[ string(client) ] = timer_id;
 
                        requestObj->reply(CONV_ERROR_NONE);
-               } else if ( !strcmp(requestObj->get_subject(), CONV_SUBJECT_DISCOVERY_STOP) ){
-                       const char* client = requestObj->get_sender();
+               } else if ( !strcmp(requestObj->getSubject(), CONV_SUBJECT_DISCOVERY_STOP) ){
+                       const char* client = requestObj->getSender();
 
                        if (count_discovery_request <= 0) {
                                _D("discovery is already stopped");
                                requestObj->reply(CONV_ERROR_INVALID_OPERATION);
                        } else {
-                               notify_time_up(client);
+                               notifyTimeOut(client);
                                requestObj->reply(CONV_ERROR_NONE);
                        }
 
@@ -199,29 +199,29 @@ int conv::DiscoveryManager::handleRequest(request* requestObj)
        return CONV_ERROR_INVALID_OPERATION;;
 }
 
-int conv::DiscoveryManager::start_discovery()
+int conv::DiscoveryManager::startDiscovery()
 {
        return CONV_ERROR_NONE;
 }
 
-int conv::DiscoveryManager::stop_discovery()
+int conv::DiscoveryManager::stopDiscovery()
 {
        _D("Stop_Discovery...");
-       for (discovery_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it) {
+       for (discovery_provider_list_t::iterator it = __providerList.begin(); it != __providerList.end(); ++it) {
                (*it)->stop();
        }
        return CONV_ERROR_NONE;
 }
 
-int conv::DiscoveryManager::register_provider(IDiscoveryProvider *provider)
+int conv::DiscoveryManager::registerProvider(IDiscoveryProvider *provider)
 {
        if (!provider) {
                _E("Provider NULL");
                return CONV_ERROR_INVALID_PARAMETER;
        }
 
-       if (provider->set_manager(this) != CONV_ERROR_NONE) {
-               _E("Provider set_manager failed");
+       if (provider->setManager(this) != CONV_ERROR_NONE) {
+               _E("Provider setManager failed");
                delete provider;
                return CONV_ERROR_INVALID_OPERATION;
        }
@@ -232,11 +232,11 @@ int conv::DiscoveryManager::register_provider(IDiscoveryProvider *provider)
                return CONV_ERROR_INVALID_OPERATION;
        }
 
-       provider_list.push_back(provider);
+       __providerList.push_back(provider);
 
        return CONV_ERROR_NONE;
 }
-int conv::DiscoveryManager::convert_device_into_json(conv::IDevice* device_info, json* json_data)
+int conv::DiscoveryManager::convertDeviceIntoJson(conv::IDevice* device_info, Json* json_data)
 {
        json_data->set(NULL, CONV_JSON_DEVICE_ID, device_info->getId());
        json_data->set(NULL, CONV_JSON_DEVICE_NAME, device_info->getName());
@@ -245,13 +245,13 @@ int conv::DiscoveryManager::convert_device_into_json(conv::IDevice* device_info,
        return CONV_ERROR_NONE;
 }
 
-int conv::DiscoveryManager::convert_service_into_json(conv::IService* service_info, json* json_data)
+int conv::DiscoveryManager::convertServiceIntoJson(conv::IService* service_info, Json* json_data)
 {
        string service_info_str = service_info->getServiceInfo();
        _D("Service-2-Json Conversion : %s", service_info_str.c_str());
-       json service_json(service_info_str);
-       json_data->array_append(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_DATA, service_json);
-       json_data->array_append(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_TYPE, service_info->getServiceType());
+       Json service_json(service_info_str);
+       json_data->appendArray(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_DATA, service_json);
+       json_data->appendArray(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_TYPE, service_info->getServiceType());
 
        return CONV_ERROR_NONE;
 }
@@ -264,17 +264,17 @@ static bool serviceComparision(conv::IService* obj, int serviceType)
                return false;
 }
 
-int conv::DiscoveryManager::exclude_services(conv::IDevice* org_device, conv::IDevice* removed_device)
+int conv::DiscoveryManager::excludeServices(conv::IDevice* org_device, conv::IDevice* removed_device)
 {
        int remained_serv_count = 0;
        std::list<IService*> org_serv_list;
        std::list<IService*> removed_serv_list;
 
-       org_device->get_services_list(&org_serv_list);
+       org_device->getServiceList(&org_serv_list);
        _D("[%d] Services in the origin device info[%s]", org_serv_list.size(), org_device->getName().c_str());
        remained_serv_count = org_serv_list.size();
 
-       removed_device->get_services_list(&removed_serv_list);
+       removed_device->getServiceList(&removed_serv_list);
        _D("[%d] Services in the removed device info[%s]", removed_serv_list.size(), removed_device->getName().c_str());
 
        std::list<IService*>::iterator removed_itr = removed_serv_list.begin();
@@ -284,7 +284,7 @@ int conv::DiscoveryManager::exclude_services(conv::IDevice* org_device, conv::ID
                if (org_iter != org_serv_list.end()) {
                        IService* cur_serv = *org_iter;
                        _D("Service[%d],notified as removed one, found in device[%s]", cur_serv->getServiceType(), cur_serv->getName().c_str());
-                       org_device->remove_service(cur_serv);
+                       org_device->removeService(cur_serv);
                        remained_serv_count--;
                }
        }
@@ -294,15 +294,15 @@ int conv::DiscoveryManager::exclude_services(conv::IDevice* org_device, conv::ID
 
 
 // return value : the number of new services
-int conv::DiscoveryManager::merge_exclude_services(conv::IDevice* org_device, conv::IDevice* new_device)
+int conv::DiscoveryManager::mergeExcludeServices(conv::IDevice* org_device, conv::IDevice* new_device)
 {
        int new_serv_count = 0;
        std::list<IService*> org_serv_list;
        std::list<IService*> new_serv_list;
 
-       org_device->get_services_list(&org_serv_list);
+       org_device->getServiceList(&org_serv_list);
        _D("[%d] Services in the origin device info[%s]", org_serv_list.size(), org_device->getName().c_str() );
-       new_device->get_services_list(&new_serv_list);
+       new_device->getServiceList(&new_serv_list);
        _D("[%d] Services in the new device info[%s]", new_serv_list.size(), new_device->getName().c_str() );
 
        std::list<IService*>::iterator new_iter = new_serv_list.begin();
@@ -312,19 +312,19 @@ int conv::DiscoveryManager::merge_exclude_services(conv::IDevice* org_device, co
                        std::find_if(org_serv_list.begin(), org_serv_list.end(), std::bind(serviceComparision, std::placeholders::_1, cur_serv->getServiceType()));
                if (org_iter != org_serv_list.end()) {
                        // already exists in org_device.. means it's not new!.. so remove the service from new!!
-                       new_device->remove_service(cur_serv);
+                       new_device->removeService(cur_serv);
                        _D("Service[%d] has been already found in Device[%s]", cur_serv->getServiceType(), org_device->getName().c_str() );
                } else {
                        _D("New Service[%d] found in Device[%s]", cur_serv->getServiceType(), org_device->getName().c_str() );
                        // add the service into the original device
-                       org_device->add_service(cur_serv);
+                       org_device->addService(cur_serv);
                        new_serv_count++;
                }
        }
        return new_serv_count;
 }
 
-int conv::DiscoveryManager::notify_lost_device(IDevice* disc_device)
+int conv::DiscoveryManager::notifyLostDevice(IDevice* disc_device)
 {
        int num_remained_service = 0;
        // 1. find the device and remove the services included in disc_device from cache (discovered_results)
@@ -332,7 +332,7 @@ int conv::DiscoveryManager::notify_lost_device(IDevice* disc_device)
        itor_disc = discovered_results.find(disc_device->getId());
        if (itor_disc != discovered_results.end()) {
                IDevice* cur_device = itor_disc->second;
-               num_remained_service = exclude_services(cur_device, disc_device);
+               num_remained_service = excludeServices(cur_device, disc_device);
        } else {
                _D("Lost Notify dismissed - No discovered results corresponding to id[%s]", disc_device->getId().c_str());
                return CONV_ERROR_NO_DATA;
@@ -346,10 +346,10 @@ int conv::DiscoveryManager::notify_lost_device(IDevice* disc_device)
                // iterate through request_map for service
                _D("Iterate through request_map to publish..");
                request_map_t::iterator IterPos;
-               json device_json;
-               convert_device_into_json(disc_device, &device_json);
+               Json device_json;
+               convertDeviceIntoJson(disc_device, &device_json);
                for (IterPos = request_map.begin(); IterPos != request_map.end(); ++IterPos) {
-                       request* cur_Req = IterPos->second;
+                       Request* cur_Req = IterPos->second;
                        cur_Req->publish(CONV_DISCOVERY_DEVICE_LOST, device_json);
                }
        }
@@ -357,7 +357,7 @@ int conv::DiscoveryManager::notify_lost_device(IDevice* disc_device)
        return CONV_ERROR_NONE;
 }
 
-int conv::DiscoveryManager::append_discovered_result(conv::IDevice* disc_device)
+int conv::DiscoveryManager::appendDiscoveredResult(conv::IDevice* disc_device)
 {
        conv::IDevice* publish_device_info = NULL;
 
@@ -371,7 +371,7 @@ int conv::DiscoveryManager::append_discovered_result(conv::IDevice* disc_device)
                _D("update discovered device's info [%s]", disc_device->getId().c_str());
                IDevice* cur_device = itor_disc->second;
 
-               int count_new_services = merge_exclude_services(cur_device, disc_device);
+               int count_new_services = mergeExcludeServices(cur_device, disc_device);
                if (count_new_services == 0)
                        return CONV_ERROR_NONE;
        } else {
@@ -380,18 +380,18 @@ int conv::DiscoveryManager::append_discovered_result(conv::IDevice* disc_device)
        }
        publish_device_info = disc_device;
 
-       _D("Convert device_info into json type..");
-       json device_json;
-       convert_device_into_json(publish_device_info, &device_json);
+       _D("Convert device_info into Json type..");
+       Json device_json;
+       convertDeviceIntoJson(publish_device_info, &device_json);
 
-       _D("Convert service info into json type..");
+       _D("Convert service info into Json type..");
        typedef std::list<IService*> serv_list_t;
        serv_list_t serv_list;
-       publish_device_info->get_services_list(&serv_list);
+       publish_device_info->getServiceList(&serv_list);
 
        for (serv_list_t::iterator iterPos = serv_list.begin(); iterPos != serv_list.end(); ++iterPos) {
                IService* cur_serv = *iterPos;
-               convert_service_into_json(cur_serv, &device_json);
+               convertServiceIntoJson(cur_serv, &device_json);
        }
 
        // iterate through request_map for service
@@ -399,7 +399,7 @@ int conv::DiscoveryManager::append_discovered_result(conv::IDevice* disc_device)
        int index = 0;
        request_map_t::iterator IterPos;
        for (IterPos = request_map.begin(); IterPos != request_map.end(); ++IterPos) {
-               request* cur_Req = IterPos->second;
+               Request* cur_Req = IterPos->second;
                cur_Req->publish(CONV_ERROR_NONE, device_json);
 
                index++;
@@ -408,22 +408,7 @@ int conv::DiscoveryManager::append_discovered_result(conv::IDevice* disc_device)
        return CONV_ERROR_NONE;
 }
 
-int conv::DiscoveryManager::set_discovery_filter(request* request_obj)
-{
-       json desc_data = request_obj->get_description();
-       json filter_data;
-       desc_data.get(NULL, "filter", &filter_data);
-       discovery_filter_map.insert(filter_map_t::value_type(request_obj->get_id(), filter_data));
-
-       return CONV_ERROR_NONE;
-}
-
-int conv::DiscoveryManager::isvalid_discovery_on_filter(json& filter_json)
-{
-       return CONV_ERROR_NONE;
-}
-
-int conv::discovery_manager::handleRequest(request* requestObj)
+int conv::discovery_manager::handleRequest(Request* requestObj)
 {
        IF_FAIL_RETURN_TAG(_instance, CONV_ERROR_INVALID_PARAMETER, _E, "Not initialized");
        _instance->handleRequest(requestObj);
index ca40c98..c56abca 100755 (executable)
 
 #include "IManager.h"
 #include "IDiscoveryProvider.h"
-#include "request.h"
+#include "Request.h"
 
 #include "IDevice.h"
 #include "IService.h"
 
 namespace conv {
-       class request;
-       class device;
+       class SmartViewDevice;
 
        class DiscoveryManager : public IManager {
                public:
@@ -40,46 +39,44 @@ namespace conv {
 
                        int init();
                        int release();
-                       int handleRequest(request* requestObj);
+                       int handleRequest(Request* requestObj);
 
                        // discovery_manager aggregates devices with services which have been discovered through the registered discover providers
-                       int append_discovered_result(IDevice* disc_device);
-                       int notify_lost_device(IDevice* disc_device);
-                       int notify_time_up(std::string client);
-                       int stop_discovery();
-                       int start_discovery();
+                       int appendDiscoveredResult(IDevice* disc_device);
+                       int notifyLostDevice(IDevice* disc_device);
+                       int notifyTimeOut(std::string client);
+                       int stopDiscovery();
+                       int startDiscovery();
 
-                       static void timer_worker(void* data);
+                       static void __timer_worker(void* data);
 
                private:
                        int count_discovery_request;
 
 
                        typedef std::list<IDiscoveryProvider*> discovery_provider_list_t;
-                       typedef std::map<string, request*> request_map_t;
-                       typedef std::map<int, json>     filter_map_t;
+                       typedef std::map<string, Request*> request_map_t;
+                       typedef std::map<int, Json>     filter_map_t;
                        typedef std::map<std::string, int>      timer_map_t;
 
-                       int register_provider(IDiscoveryProvider *provider_base);
-                       discovery_provider_list_t provider_list;
+                       int registerProvider(IDiscoveryProvider *discoveryProvider);
+                       discovery_provider_list_t __providerList;
                        request_map_t   request_map;
                        filter_map_t    discovery_filter_map;
                        timer_map_t             request_timer_map;
 
                        // internal function
-                       int convert_service_into_json(conv::IService* service_info, json* json_data);
-                       int convert_device_into_json(conv::IDevice* service_info, json* json_data);
-                       int set_discovery_filter(request* req_obj);
-                       int isvalid_discovery_on_filter(json& filter_json);
-                       int checkBoundaryForTimeout(int givenTimeout);
-                       int merge_exclude_services(conv::IDevice* org_device, conv::IDevice* new_device);
-                       int exclude_services(conv::IDevice* org_device, conv::IDevice* removed_device);
+                       int convertServiceIntoJson(conv::IService* service_info, Json* json_data);
+                       int convertDeviceIntoJson(conv::IDevice* service_info, Json* json_data);
+                       int checkBoundaryForTimeOut(int givenTimeout);
+                       int mergeExcludeServices(conv::IDevice* org_device, conv::IDevice* new_device);
+                       int excludeServices(conv::IDevice* org_device, conv::IDevice* removed_device);
        };
 
        namespace discovery_manager {
-               void set_instance(DiscoveryManager* mgr);
-               int handleRequest(request* requestObj);
-               int set_result(device* device_obj);
+               void setInstance(DiscoveryManager* mgr);
+               int handleRequest(Request* requestObj);
+               int setResult(SmartViewDevice* device_obj);
        };
 }
 
index 38a9b53..7505089 100644 (file)
@@ -27,9 +27,9 @@ namespace conv {
                public:
                        virtual ~IDevice() {}
 
-                       virtual int add_service(IService* service_obj) = 0;
-                       virtual int remove_service(IService* service_obj) = 0;
-                       virtual int get_services_list(std::list<IService*> *list) = 0;
+                       virtual int addService(IService* service_obj) = 0;
+                       virtual int removeService(IService* service_obj) = 0;
+                       virtual int getServiceList(std::list<IService*> *list) = 0;
 
                        virtual string getName() = 0;
                        virtual string getId() = 0;
index b3bc552..4ad78f1 100755 (executable)
@@ -18,7 +18,7 @@
 
 conv::DiscoveryManager* conv::IDiscoveryProvider::_discovery_manager = NULL;
 
-int conv::IDiscoveryProvider::set_manager(DiscoveryManager* discovery_manager)
+int conv::IDiscoveryProvider::setManager(DiscoveryManager* discovery_manager)
 {
        _discovery_manager = discovery_manager;
        return CONV_ERROR_NONE;
index a9cc0cb..c2cdefb 100755 (executable)
@@ -18,7 +18,7 @@
 #define __DISCOVERY_PROVIDER_BASE_H__
 
 #include <string>
-#include "conv_json.h"
+#include "Json.h"
 
 namespace conv {
 
@@ -32,7 +32,7 @@ namespace conv {
                        virtual int start() = 0;
                        virtual int stop() = 0;
 
-                       int set_manager(DiscoveryManager* discovery_manager);
+                       int setManager(DiscoveryManager* discovery_manager);
 
                protected:
                        static DiscoveryManager* _discovery_manager;
index 92470e0..a80d685 100755 (executable)
 #define __CONV_MANAGER_INTERFACE_H__
 
 #include <string>
-#include "conv_json.h"
+#include "Json.h"
 
 namespace conv {
-       class request;
+       class Request;
 
        class IManager {
                public:
                        virtual ~IManager() {}
                        virtual int init() = 0;
                        virtual int release() = 0;
-                       virtual int handleRequest(request* requestObj) = 0;
+                       virtual int handleRequest(Request* requestObj) = 0;
        };      /* class IManager */
 }
 
index bce0530..528ef49 100644 (file)
@@ -18,8 +18,8 @@
 #define __SERVICE_PROVIDER_BASE_H__
 
 #include <string>
-#include "request.h"
-#include "conv_json.h"
+#include "Request.h"
+#include "Json.h"
 
 namespace conv {
        class IServiceProvider {
@@ -28,38 +28,38 @@ namespace conv {
                        virtual int init() = 0;
                        virtual int release() = 0;
 
-                       virtual int start_request(request* request_obj) = 0;
-                       virtual int stop_request(request* request_obj) = 0;
-                       virtual int get_request(request* request_obj) = 0;
-                       virtual int set_request(request* request_obj) = 0;
-                       virtual int register_request(request* request_obj) = 0;
-                       virtual int load_service_info(request* request_obj) = 0;
-                       virtual int get_service_info_for_discovery(json* json_obj) = 0;
-                       int check_activation_state() {
-                               if (_activation_state == 1) {
+                       virtual int startRequest(Request* request_obj) = 0;
+                       virtual int stopRequest(Request* request_obj) = 0;
+                       virtual int readRequest(Request* request_obj) = 0;
+                       virtual int publishRequest(Request* request_obj) = 0;
+                       virtual int registerRequest(Request* request_obj) = 0;
+                       virtual int loadServiceInfo(Request* request_obj) = 0;
+                       virtual int getServiceInfoForDiscovery(Json* json_obj) = 0;
+                       int checkActivationState() {
+                               if (__activationState == 1) {
                                        return CONV_ERROR_NONE;
                                } else {
                                        return CONV_ERROR_INVALID_OPERATION;
                                }
                        }
 
-                       std::string get_type() {
-                               return _type;
+                       std::string getType() {
+                               return __type;
                        }
 
                        std::string get_resource_type() {
-                                       return _resource_type;
+                                       return __resourceType;
                        }
 
                        std::string get_uri() {
-                                       return _uri;
+                                       return __uri;
                        }
 
                protected:
-                       std::string _type;
-                       std::string _resource_type;
-                       std::string _uri;
-                       int _activation_state;
+                       std::string __type;
+                       std::string __resourceType;
+                       std::string __uri;
+                       int __activationState;
        };      /* class IServiceProvider */
 }
 
similarity index 83%
rename from daemon/conv_json.cpp
rename to daemon/Json.cpp
index 64d5355..1a299cf 100755 (executable)
@@ -19,7 +19,7 @@
 #include <locale>
 #include <iomanip>
 #include <json-glib/json-glib.h>
-#include "conv_json.h"
+#include "Json.h"
 
 #define PATH_DELIM     '.'
 #define GVAR_VALUES    "values"
@@ -46,7 +46,7 @@ static std::string double_to_string(double in, int prec)
        return ostr.str();
 }
 
-json::json()
+conv::Json::Json()
 {
        JsonObject *obj = json_object_new();
        IF_FAIL_VOID_TAG(obj, _E, "Json object construction failed");
@@ -61,13 +61,13 @@ json::json()
        json_object_unref(obj);
 }
 
-json::json(const json& j)
+conv::Json::Json(const Json& j)
 {
        json_node = json_node_copy(j.json_node);
        IF_FAIL_VOID_TAG(json_node, _E, "Json object construction failed");
 }
 
-json::json(const char* s)
+conv::Json::Json(const char* s)
 {
        if (s)
                parse(s);
@@ -75,7 +75,7 @@ json::json(const char* s)
                parse(EMPTY_JSON_OBJECT);
 }
 
-json::json(const std::string& s)
+conv::Json::Json(const std::string& s)
 {
        if (s.empty())
                parse(EMPTY_JSON_OBJECT);
@@ -83,12 +83,12 @@ json::json(const std::string& s)
                parse(s.c_str());
 }
 
-json::~json()
+conv::Json::~Json()
 {
        release();
 }
 
-void json::parse(const char* s)
+void conv::Json::parse(const char* s)
 {
        gboolean result;
        JsonParser *parser = NULL;
@@ -111,7 +111,7 @@ CATCH:
                g_object_unref(parser);
 }
 
-void json::release()
+void conv::Json::release()
 {
        if (json_node) {
                json_node_free(json_node);
@@ -119,7 +119,7 @@ void json::release()
        }
 }
 
-json& json::operator=(const json& j)
+conv::Json& conv::Json::operator=(const Json& j)
 {
        release();
        json_node = json_node_copy(j.json_node);
@@ -129,7 +129,7 @@ json& json::operator=(const json& j)
        return *this;
 }
 
-json& json::operator=(const char* s)
+conv::Json& conv::Json::operator=(const char* s)
 {
        release();
        if (s)
@@ -140,7 +140,7 @@ json& json::operator=(const char* s)
        return *this;
 }
 
-json& json::operator=(const std::string& s)
+conv::Json& conv::Json::operator=(const std::string& s)
 {
        release();
        if (s.empty())
@@ -151,17 +151,17 @@ json& json::operator=(const std::string& s)
        return *this;
 }
 
-bool json::operator==(const json& rhs)
+bool conv::Json::operator==(const Json& rhs)
 {
-       return node_equals(json_node, rhs.json_node);
+       return nodeEquals(json_node, rhs.json_node);
 }
 
-bool json::operator!=(const json& rhs)
+bool conv::Json::operator!=(const Json& rhs)
 {
        return !operator==(rhs);
 }
 
-char* json::dup_cstr()
+char* conv::Json::dupCstr()
 {
        IF_FAIL_RETURN_TAG(json_node, NULL, _E, "Json object not initialized");
 
@@ -186,10 +186,10 @@ CATCH:
        return NULL;
 }
 
-std::string json::str()
+std::string conv::Json::str()
 {
        std::string output;
-       char *_s = dup_cstr();
+       char *_s = dupCstr();
        IF_FAIL_RETURN(_s, output = EMPTY_JSON_OBJECT);
 
        output = _s;
@@ -306,7 +306,7 @@ CATCH:
        return NULL;
 }
 
-bool json::set(const char* path, const char* key, json& val)
+bool conv::Json::set(const char* path, const char* key, Json& val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val.json_node, false, _E, "Invalid parameter");
@@ -319,17 +319,17 @@ bool json::set(const char* path, const char* key, json& val)
 
        json_object_set_member(jobj, key, val.json_node);
        val.json_node = NULL;
-       val = json();
+       val = Json();
 
        return true;
 }
 
-bool json::set(const char* path, const char* key, int val)
+bool conv::Json::set(const char* path, const char* key, int val)
 {
        return set(path, key, static_cast<int64_t>(val));
 }
 
-bool json::set(const char* path, const char* key, int64_t val)
+bool conv::Json::set(const char* path, const char* key, int64_t val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -344,7 +344,7 @@ bool json::set(const char* path, const char* key, int64_t val)
        return true;
 }
 
-bool json::set(const char* path, const char* key, double val, int prec)
+bool conv::Json::set(const char* path, const char* key, double val, int prec)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -355,12 +355,12 @@ bool json::set(const char* path, const char* key, double val, int prec)
        if (json_object_has_member(jobj, key))
                json_object_remove_member(jobj, key);
 
-       //NOTE: json-glib causes a precision issue while handling double values
+       //NOTE: Json-glib causes a precision issue while handling double values
        json_object_set_string_member(jobj, key, double_to_string(val, prec).c_str());
        return true;
 }
 
-bool json::set(const char* path, const char* key, std::string val)
+bool conv::Json::set(const char* path, const char* key, std::string val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -375,7 +375,7 @@ bool json::set(const char* path, const char* key, std::string val)
        return true;
 }
 
-bool json::set(const char* path, const char* key, GVariant *val)
+bool conv::Json::set(const char* path, const char* key, GVariant *val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val, false, _E, "Invalid parameter");
@@ -386,14 +386,14 @@ bool json::set(const char* path, const char* key, GVariant *val)
        json_node_t *node = json_gvariant_serialize(val);
        IF_FAIL_RETURN_TAG(node, false, _E, "GVariant manipulation failed");
 
-       json gvar_json;
+       Json gvar_json;
        gvar_json.set(NULL, GVAR_TYPES, type_str);
        json_object_set_member(json_node_get_object(gvar_json.json_node), GVAR_VALUES, node);
 
        return set(path, key, gvar_json);
 }
 
-bool json::get(const char* path, const char* key, json* val)
+bool conv::Json::get(const char* path, const char* key, Json* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val, false, _E, "Invalid parameter");
@@ -431,7 +431,7 @@ static JsonNode* search_value_node(JsonNode* jnode, const char* path, const char
        return node;
 }
 
-bool json::get(const char* path, const char* key, int* val)
+bool conv::Json::get(const char* path, const char* key, int* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val, false, _E, "Invalid parameter");
@@ -446,7 +446,7 @@ bool json::get(const char* path, const char* key, int* val)
        return false;
 }
 
-bool json::get(const char* path, const char* key, int64_t* val)
+bool conv::Json::get(const char* path, const char* key, int64_t* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val, false, _E, "Invalid parameter");
@@ -466,7 +466,7 @@ bool json::get(const char* path, const char* key, int64_t* val)
        return true;
 }
 
-bool json::get(const char* path, const char* key, double* val)
+bool conv::Json::get(const char* path, const char* key, double* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val, false, _E, "Invalid parameter");
@@ -480,7 +480,7 @@ bool json::get(const char* path, const char* key, double* val)
        else if (vtype == G_TYPE_INT64)
                *val = json_node_get_int(node);
        else if (vtype == G_TYPE_STRING)
-               //NOTE: json-glib causes a precision issue while handling double values
+               //NOTE: Json-glib causes a precision issue while handling double values
                *val = string_to_double(json_node_get_string(node));
        else
                return false;
@@ -488,7 +488,7 @@ bool json::get(const char* path, const char* key, double* val)
        return true;
 }
 
-bool json::get(const char* path, const char* key, std::string* val)
+bool conv::Json::get(const char* path, const char* key, std::string* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val, false, _E, "Invalid parameter");
@@ -506,13 +506,13 @@ bool json::get(const char* path, const char* key, std::string* val)
        return true;
 }
 
-bool json::get(const char* path, const char* key, GVariant **val)
+bool conv::Json::get(const char* path, const char* key, GVariant **val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val, false, _E, "Invalid parameter");
 
        bool ret;
-       json gvar_json;
+       Json gvar_json;
        ret = get(path, key, &gvar_json);
        IF_FAIL_RETURN(ret, false);
 
@@ -520,7 +520,7 @@ bool json::get(const char* path, const char* key, GVariant **val)
        ret = gvar_json.get(NULL, GVAR_TYPES, &gvar_types);
        IF_FAIL_RETURN(ret, false);
 
-       json gvar_values;
+       Json gvar_values;
        ret = gvar_json.get(NULL, GVAR_VALUES, &gvar_values);
        IF_FAIL_RETURN(ret, false);
 
@@ -558,7 +558,7 @@ static JsonArray* search_array(JsonNode* jnode, const char* path, const char* ke
        return json_node_get_array(node);
 }
 
-int json::array_get_size(const char* path, const char* key)
+int conv::Json::getArraySize(const char* path, const char* key)
 {
        IF_FAIL_RETURN_TAG(this->json_node, -1, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, -1, _E, "Invalid parameter");
@@ -569,7 +569,7 @@ int json::array_get_size(const char* path, const char* key)
        return json_array_get_length(jarr);
 }
 
-bool json::array_append(const char* path, const char* key, json& val)
+bool conv::Json::appendArray(const char* path, const char* key, Json& val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val.json_node, false, _E, "Invalid parameter");
@@ -579,17 +579,17 @@ bool json::array_append(const char* path, const char* key, json& val)
 
        json_array_add_element(arr, val.json_node);
        val.json_node = NULL;
-       val = json();
+       val = Json();
 
        return true;
 }
 
-bool json::array_append(const char* path, const char* key, int val)
+bool conv::Json::appendArray(const char* path, const char* key, int val)
 {
-       return array_append(path, key, static_cast<int64_t>(val));
+       return appendArray(path, key, static_cast<int64_t>(val));
 }
 
-bool json::array_append(const char* path, const char* key, int64_t val)
+bool conv::Json::appendArray(const char* path, const char* key, int64_t val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -601,7 +601,7 @@ bool json::array_append(const char* path, const char* key, int64_t val)
        return true;
 }
 
-bool json::array_append(const char* path, const char* key, double val, int prec)
+bool conv::Json::appendArray(const char* path, const char* key, double val, int prec)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -609,12 +609,12 @@ bool json::array_append(const char* path, const char* key, double val, int prec)
        JsonArray *arr = search_array(json_node, path, key, true);
        IF_FAIL_RETURN(arr, false);
 
-       //NOTE: json-glib causes a precision issue while handling double values
+       //NOTE: Json-glib causes a precision issue while handling double values
        json_array_add_string_element(arr, double_to_string(val, prec).c_str());
        return true;
 }
 
-bool json::array_append(const char* path, const char* key, std::string val)
+bool conv::Json::appendArray(const char* path, const char* key, std::string val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -640,7 +640,7 @@ static JsonNode* search_array_elem(JsonNode* jnode, const char* path, const char
        return node;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, json& val)
+bool conv::Json::setArrayAt(const char* path, const char* key, int index, Json& val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(val.json_node && key && index >= 0, false, _E, "Invalid parameter");
@@ -655,17 +655,17 @@ bool json::array_set_at(const char* path, const char* key, int index, json& val)
        json_node_set_object(node, obj);
        json_node_free(val.json_node);
        val.json_node = NULL;
-       val = json();
+       val = Json();
 
        return true;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, int val)
+bool conv::Json::setArrayAt(const char* path, const char* key, int index, int val)
 {
-       return array_set_at(path, key, index, static_cast<int64_t>(val));
+       return setArrayAt(path, key, index, static_cast<int64_t>(val));
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, int64_t val)
+bool conv::Json::setArrayAt(const char* path, const char* key, int index, int64_t val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && index >= 0, false, _E, "Invalid parameter");
@@ -679,7 +679,7 @@ bool json::array_set_at(const char* path, const char* key, int index, int64_t va
        return true;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, double val, int prec)
+bool conv::Json::setArrayAt(const char* path, const char* key, int index, double val, int prec)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && index >= 0, false, _E, "Invalid parameter");
@@ -693,7 +693,7 @@ bool json::array_set_at(const char* path, const char* key, int index, double val
        return true;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, std::string val)
+bool conv::Json::setArrayAt(const char* path, const char* key, int index, std::string val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && index >= 0, false, _E, "Invalid parameter");
@@ -707,7 +707,7 @@ bool json::array_set_at(const char* path, const char* key, int index, std::strin
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, json* val)
+bool conv::Json::getArrayElem(const char* path, const char* key, int index, Json* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -726,13 +726,13 @@ bool json::get_array_elem(const char* path, const char* key, int index, json* va
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, int* val)
+bool conv::Json::getArrayElem(const char* path, const char* key, int index, int* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
 
        int64_t v;
-       if (get_array_elem(path, key, index, &v)) {
+       if (getArrayElem(path, key, index, &v)) {
                *val = v;
                return true;
        }
@@ -740,7 +740,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, int* val
        return false;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, int64_t* val)
+bool conv::Json::getArrayElem(const char* path, const char* key, int index, int64_t* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -764,7 +764,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, int64_t*
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, double* val)
+bool conv::Json::getArrayElem(const char* path, const char* key, int index, double* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -781,7 +781,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, double*
        } else if (vtype == G_TYPE_INT64) {
                *val = json_node_get_int(node);
        } else if (vtype == G_TYPE_STRING) {
-               //NOTE: json-glib causes a precision issue while handling double values
+               //NOTE: Json-glib causes a precision issue while handling double values
                *val = string_to_double(json_node_get_string(node));
        } else {
                _E("Type mismatched: %s", key);
@@ -791,7 +791,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, double*
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, std::string* val)
+bool conv::Json::getArrayElem(const char* path, const char* key, int index, std::string* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -812,13 +812,13 @@ bool json::get_array_elem(const char* path, const char* key, int index, std::str
        return true;
 }
 
-bool json::get_member_list(json_node_t* node, std::list<std::string>& list)
+bool conv::Json::getMemberList(json_node_t* node, std::list<std::string>& list)
 {
        IF_FAIL_RETURN(node, false);
        list.clear();
 
        JsonObject *jobj = json_node_get_object(node);
-       IF_FAIL_RETURN_TAG(jobj, false, _E, "Getting json object failed");
+       IF_FAIL_RETURN_TAG(jobj, false, _E, "Getting Json object failed");
 
        GList *members = json_object_get_members(jobj);
        IF_FAIL_RETURN(members, true);
@@ -839,13 +839,13 @@ bool json::get_member_list(json_node_t* node, std::list<std::string>& list)
        return true;
 }
 
-bool json::get_keys(std::list<std::string>* list)
+bool conv::Json::getKeys(std::list<std::string>* list)
 {
        IF_FAIL_RETURN_TAG(list, false, _E, "Invalid parameter");
-       return get_member_list(json_node, *list);
+       return getMemberList(json_node, *list);
 }
 
-bool json::node_equals(json_node_t* lhs, json_node_t* rhs)
+bool conv::Json::nodeEquals(json_node_t* lhs, json_node_t* rhs)
 {
        IF_FAIL_RETURN(lhs && rhs, false);
 
@@ -855,13 +855,13 @@ bool json::node_equals(json_node_t* lhs, json_node_t* rhs)
 
        switch (ltype) {
        case JSON_NODE_VALUE:
-               IF_FAIL_RETURN(value_equals(lhs, rhs), false);
+               IF_FAIL_RETURN(valueEquals(lhs, rhs), false);
                break;
        case JSON_NODE_OBJECT:
-               IF_FAIL_RETURN(object_equals(lhs, rhs), false);
+               IF_FAIL_RETURN(objectEquals(lhs, rhs), false);
                break;
        case JSON_NODE_ARRAY:
-               IF_FAIL_RETURN(array_equals(lhs, rhs), false);
+               IF_FAIL_RETURN(arrayEquals(lhs, rhs), false);
                break;
        default:
                _W("Unsupported type");
@@ -871,7 +871,7 @@ bool json::node_equals(json_node_t* lhs, json_node_t* rhs)
        return true;
 }
 
-bool json::value_equals(json_node_t* lhs, json_node_t* rhs)
+bool conv::Json::valueEquals(json_node_t* lhs, json_node_t* rhs)
 {
        GType ltype = json_node_get_value_type(lhs);
        GType rtype = json_node_get_value_type(rhs);
@@ -890,11 +890,11 @@ bool json::value_equals(json_node_t* lhs, json_node_t* rhs)
        }
 }
 
-bool json::object_equals(json_node_t* lhs, json_node_t* rhs)
+bool conv::Json::objectEquals(json_node_t* lhs, json_node_t* rhs)
 {
        std::list<std::string> lm, rm;
-       IF_FAIL_RETURN(get_member_list(lhs, lm), false);
-       IF_FAIL_RETURN(get_member_list(rhs, rm), false);
+       IF_FAIL_RETURN(getMemberList(lhs, lm), false);
+       IF_FAIL_RETURN(getMemberList(rhs, rm), false);
        IF_FAIL_RETURN(lm.size() == rm.size(), false);
 
        lm.sort();
@@ -909,7 +909,7 @@ bool json::object_equals(json_node_t* lhs, json_node_t* rhs)
 
                json_node_t *lhs_child = json_object_get_member(json_node_get_object(lhs), (*lit).c_str());
                json_node_t *rhs_child = json_object_get_member(json_node_get_object(rhs), (*rit).c_str());
-               IF_FAIL_RETURN(node_equals(lhs_child, rhs_child), false);
+               IF_FAIL_RETURN(nodeEquals(lhs_child, rhs_child), false);
 
                ++lit;
                ++rit;
@@ -918,7 +918,7 @@ bool json::object_equals(json_node_t* lhs, json_node_t* rhs)
        return true;
 }
 
-bool json::array_equals(json_node_t* lhs, json_node_t* rhs)
+bool conv::Json::arrayEquals(json_node_t* lhs, json_node_t* rhs)
 {
        JsonArray *larr = json_node_get_array(lhs);
        JsonArray *rarr = json_node_get_array(rhs);
@@ -929,7 +929,7 @@ bool json::array_equals(json_node_t* lhs, json_node_t* rhs)
        for (int i = 0; i < size; ++i) {
                json_node_t *lhs_child = json_array_get_element(larr, i);
                json_node_t *rhs_child = json_array_get_element(rarr, i);
-               IF_FAIL_RETURN(node_equals(lhs_child, rhs_child), false);
+               IF_FAIL_RETURN(nodeEquals(lhs_child, rhs_child), false);
        }
 
        return true;
diff --git a/daemon/Json.h b/daemon/Json.h
new file mode 100644 (file)
index 0000000..fcbd0a6
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CONV_JSON_H__
+#define __CONV_JSON_H__
+
+#include <sys/types.h>
+#include <glib.h>
+#include <string>
+#include <list>
+#include "Types.h"
+
+#define _J(cmt, jobj) \
+do { \
+       _SD("%s: %s", (cmt), jobj.str().c_str()); \
+} while (0)
+
+#define EMPTY_JSON_OBJECT      "{}"
+#define DEFAULT_PRECISION      3
+
+namespace conv {
+       class Json {
+       private:
+               typedef struct _JsonNode json_node_t;
+               json_node_t *json_node;
+
+               void parse(const char* s);
+               void release();
+
+               /* For Json vs Json comparison */
+               bool getMemberList(json_node_t* node, std::list<std::string>& list);
+               bool nodeEquals(json_node_t* lhs, json_node_t* rhs);
+               bool valueEquals(json_node_t* lhs, json_node_t* rhs);
+               bool objectEquals(json_node_t* lhs, json_node_t* rhs);
+               bool arrayEquals(json_node_t* lhs, json_node_t* rhs);
+
+       public:
+               Json();
+               Json(const char* s);
+               Json(const std::string& s);
+
+               /* This Json(const Json& j) only copies the reference to the underlying Json node.
+                * Therefore, changes applied to a Json object affect the other.
+                * If you need to create a 'real' copy of a Json, which can be manipulated separately,
+                * utilize the str() function, e.g., ctx::Json copy(original.str());
+                */
+               Json(const Json& j);
+
+               ~Json();
+
+               Json& operator=(const char* s);
+               Json& operator=(const std::string& s);
+
+               /* This operator=(const Json& j) only copies the reference to the underlying Json node.
+                * Therefore, changes applied to a Json object affect the other.
+                * If you need to create a 'real' copy of a Json, which can be manipulated separately,
+                * utilize the str() function, e.g., ctx::Json copy = original.str();
+                */
+               Json& operator=(const Json& j);
+
+               bool operator==(const Json& rhs);
+               bool operator!=(const Json& rhs);
+
+               char* dupCstr();
+               std::string str();
+
+               bool getKeys(std::list<std::string>* list);
+
+               bool set(const char* path, const char* key, Json& val);
+               bool set(const char* path, const char* key, int val);
+               bool set(const char* path, const char* key, int64_t val);
+               bool set(const char* path, const char* key, double val, int prec = DEFAULT_PRECISION);
+               bool set(const char* path, const char* key, std::string val);
+               bool set(const char* path, const char* key, GVariant *val);
+
+               bool get(const char* path, const char* key, Json* val);
+               bool get(const char* path, const char* key, int* val);
+               bool get(const char* path, const char* key, int64_t* val);
+               bool get(const char* path, const char* key, double* val);
+               bool get(const char* path, const char* key, std::string* val);
+               bool get(const char* path, const char* key, GVariant **val);
+
+               int getArraySize(const char* path, const char* key);
+
+               bool appendArray(const char* path, const char* key, Json& val);
+               bool appendArray(const char* path, const char* key, int val);
+               bool appendArray(const char* path, const char* key, int64_t val);
+               bool appendArray(const char* path, const char* key, double val, int prec = DEFAULT_PRECISION);
+               bool appendArray(const char* path, const char* key, std::string val);
+
+               bool setArrayAt(const char* path, const char* key, int index, Json& val);
+               bool setArrayAt(const char* path, const char* key, int index, int val);
+               bool setArrayAt(const char* path, const char* key, int index, int64_t val);
+               bool setArrayAt(const char* path, const char* key, int index, double val, int prec = DEFAULT_PRECISION);
+               bool setArrayAt(const char* path, const char* key, int index, std::string val);
+
+               bool getArrayElem(const char* path, const char* key, int index, Json* val);
+               bool getArrayElem(const char* path, const char* key, int index, int* val);
+               bool getArrayElem(const char* path, const char* key, int index, int64_t* val);
+               bool getArrayElem(const char* path, const char* key, int index, double* val);
+               bool getArrayElem(const char* path, const char* key, int index, std::string* val);
+       };
+}
+
+#endif // __CONV_JSON_H__
+
diff --git a/daemon/Request.cpp b/daemon/Request.cpp
new file mode 100755 (executable)
index 0000000..00ae1c1
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include "Types.h"
+#include "Request.h"
+#include "DbusServer.h"
+
+conv::Request::Request(int type, const char* client, int reqId, const char* subj, const char* desc)
+       : __type(type)
+       , __reqId(reqId)
+       , __client(client)
+       , __subject(subj)
+       , __description(desc)
+{
+}
+
+conv::Request::Request(int type,
+               const char *client, int reqId, const char *subj, const char *desc,
+               const char *sender, Credentials *creds, GDBusMethodInvocation *inv)
+       : __type(type)
+       , __reqId(reqId)
+       , __client(client)
+       , __subject(subj)
+       , __description(desc)
+       , __creds(creds)
+       , __sender(sender)
+       , __invocation(inv)
+{
+}
+
+conv::Request::~Request()
+{
+       if ( __creds != NULL ) {
+               delete __creds;
+       }
+}
+
+int conv::Request::getType()
+{
+       return __type;
+}
+
+int conv::Request::getId()
+{
+       return __reqId;
+}
+
+const char* conv::Request::getClient()
+{
+       return __client.c_str();
+}
+
+const char* conv::Request::getSender()
+{
+       return __sender.c_str();
+}
+
+const char* conv::Request::getSubject()
+{
+       return __subject.c_str();
+}
+
+conv::Json& conv::Request::getDescription()
+{
+       return __description;
+}
+
+conv::Credentials* conv::Request::getCreds()
+{
+       return __creds;
+}
+
+bool conv::Request::reply(int error)
+{
+       IF_FAIL_RETURN(__invocation, true);
+
+       _I("Reply %#x", error);
+
+       g_dbus_method_invocation_return_value(__invocation, g_variant_new("(iss)", error, EMPTY_JSON_OBJECT, EMPTY_JSON_OBJECT));
+       __invocation = NULL;
+       _D("Reply done");
+       return true;
+}
+
+bool conv::Request::reply(int error, Json& requestResult)
+{
+       IF_FAIL_RETURN(__invocation, true);
+       IF_FAIL_RETURN(__type != REQ_READ_SYNC, true);
+
+       char *result = requestResult.dupCstr();
+       IF_FAIL_RETURN_TAG(result, false, _E, "Memory allocation failed");
+
+       _I("Reply %#x", error);
+       _SD("Result: %s", result);
+
+       g_dbus_method_invocation_return_value(__invocation, g_variant_new("(iss)", error, result, EMPTY_JSON_OBJECT));
+       __invocation = NULL;
+
+       g_free(result);
+       return true;
+}
+
+bool conv::Request::reply(int error, Json& requestResult, Json& readData)
+{
+       if (__invocation == NULL) {
+               return publish(error, readData);
+       }
+
+       char *result = NULL;
+       char *data = NULL;
+
+       result = requestResult.dupCstr();
+       IF_FAIL_CATCH_TAG(result, _E, "Memory allocation failed");
+
+       data = readData.dupCstr();
+       IF_FAIL_CATCH_TAG(data, _E, "Memory allocation failed");
+
+       _I("Reply %#x", error);
+       _SD("Result: %s", result);
+       _SD("Data: %s", data);
+
+       g_dbus_method_invocation_return_value(__invocation, g_variant_new("(iss)", error, result, data));
+       __invocation = NULL;
+
+       g_free(result);
+       g_free(data);
+       return true;
+
+CATCH:
+       g_free(result);
+       g_free(data);
+       return false;
+}
+
+bool conv::Request::publish(int error, conv::Json& data)
+{
+       char *dataStr = data.dupCstr();
+       IF_FAIL_RETURN_TAG(dataStr, false, _E, "Memory allocation failed");
+
+       _D("info : sendor %s", __sender.c_str());
+       _D("info : reqId %d", __reqId);
+       _D("info : subject %s", __subject.c_str());
+       _D("info : error %d", error);
+       _D("info : data %s", dataStr);
+       _D("info : description %s", __description.str().c_str());
+       _D("publish info : sender[%s] reqId[%d] subject[%s] error[%d] data[%s]"
+                       , __sender.c_str(), __reqId, __subject.c_str(), error, dataStr);
+
+       conv::dbus_server::publish(__sender.c_str(), __reqId, __subject.c_str(), error, dataStr);
+       g_free(dataStr);
+
+       return true;
+}
+
+bool conv::Request::getChannelFromDescription(conv::Json* target)
+{
+       return __description.get(NULL, CONV_JSON_CHANNEL, target);
+}
+
+bool conv::Request::getPayloadFromDescription(conv::Json* target)
+{
+       return __description.get(NULL, CONV_JSON_PAYLOAD, target);
+}
+
+conv::IServiceInfo* conv::Request::getServiceInfo()
+{
+       return __serviceInfo;
+}
+
+conv::ICommunicationInfo* conv::Request::getCommunicationInfo()
+{
+       return __communicationInfo;
+}
+
+void conv::Request::setServiceInfo(conv::IServiceInfo* serviceInfo)
+{
+       __serviceInfo = serviceInfo;
+}
+
+void conv::Request::setCommunicationInfo(conv::ICommunicationInfo* communicationInfo)
+{
+       __communicationInfo = communicationInfo;
+}
similarity index 51%
rename from daemon/request.h
rename to daemon/Request.h
index 6ed712f..5cec2b9 100644 (file)
 #include <string>
 #include <gio/gio.h>
 #include "Types.h"
-#include "conv_json.h"
+#include "Json.h"
 #include "IServiceInfo.h"
 #include "ICommunicationInfo.h"
 #include "access_control/PeerCreds.h"
 
 namespace conv {
-       class request {
+       class Request {
                public:
-                       request(int type, const char *client, int req_id, const char *subj, const char *desc);
-                       request(int type,
-                       const char *client, int req_id, const char *subj, const char *desc,
+                       Request(int type, const char *client, int reqId, const char *subj, const char *desc);
+                       Request(int type,
+                       const char *client, int reqId, const char *subj, const char *desc,
                        const char *sender, Credentials *creds, GDBusMethodInvocation *inv);
-                       ~request();
+                       ~Request();
 
-                       int get_type();
-                       int get_id();
-                       const char *get_client();
-                       const char *get_sender();
-                       const char *get_subject();
-                       json& get_description();
-                       Credentials *get_creds();
+                       int getType();
+                       int getId();
+                       const char *getClient();
+                       const char *getSender();
+                       const char *getSubject();
+                       Json& getDescription();
+                       Credentials *getCreds();
                        bool reply(int error);
-                       bool reply(int error, json &request_result);
-                       bool reply(int error, json &request_result, json &data_read);
-                       bool publish(int error, json &data);
+                       bool reply(int error, Json &requestResult);
+                       bool reply(int error, Json &requestResult, Json &readData);
+                       bool publish(int error, Json &data);
 
-                       bool get_channel_from_description(json* target);
-                       bool get_payload_from_description(json* target);
-                       std::string service_type;
+                       bool getChannelFromDescription(Json* target);
+                       bool getPayloadFromDescription(Json* target);
 
-                       std::string connection_type;
-                       IServiceInfo* service_info;
-                       ICommunicationInfo* communication_info;
+                       IServiceInfo* getServiceInfo();
+                       ICommunicationInfo* getCommunicationInfo();
+                       void setServiceInfo(IServiceInfo* serviceInfo);
+                       void setCommunicationInfo(ICommunicationInfo* communicationInfo);
 
                protected:
-                       int _type;
-                       int _req_id;
-                       std::string _client;
-                       std::string _subject;
-                       json _description;
+                       int __type;
+                       int __reqId;
+                       std::string __client;
+                       std::string __subject;
+                       Json __description;
                        Credentials *__creds;
                        std::string __sender;
                        GDBusMethodInvocation *__invocation;
+
+                       IServiceInfo* __serviceInfo;
+                       ICommunicationInfo* __communicationInfo;
        };
 }
 
index 3f40326..9e93173 100755 (executable)
@@ -39,23 +39,23 @@ int conv::RequestHandler::release()
        return CONV_ERROR_NONE;
 }
 
-int conv::RequestHandler::handleRequest(request* requestObj)
+int conv::RequestHandler::handleRequest(Request* requestObj)
 {
        _D("handleRequest called");
        int result = CONV_ERROR_INVALID_OPERATION;
 
-       switch (requestObj->get_type()) {
+       switch (requestObj->getType()) {
        case REQ_SUBSCRIBE:
                _D("Requested type : REQ_SUBSCRIBE..");
-               if ( !strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_RECV) )
+               if ( !strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_RECV) )
                        result = service_manager::handleRequest(requestObj);
-               else if ( !strcmp(requestObj->get_subject(), CONV_SUBJECT_CONNECTION_START) )
+               else if ( !strcmp(requestObj->getSubject(), CONV_SUBJECT_CONNECTION_START) )
                        result = connection_manager::handleRequest(requestObj);
                break;
        case REQ_UNSUBSCRIBE:
-               if (!strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_RECV) )
+               if (!strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_RECV) )
                        result = service_manager::handleRequest(requestObj);
-               else if ( !strcmp(requestObj->get_subject(), CONV_SUBJECT_CONNECTION_START) )
+               else if ( !strcmp(requestObj->getSubject(), CONV_SUBJECT_CONNECTION_START) )
                        result = connection_manager::handleRequest(requestObj);
                break;
        case REQ_READ:
@@ -64,12 +64,12 @@ int conv::RequestHandler::handleRequest(request* requestObj)
                break;
        case REQ_WRITE:
                _D("Requested type : REQ_WRITE..");
-               if (!strcmp(requestObj->get_subject(), CONV_SUBJECT_DISCOVERY_START) || !strcmp(requestObj->get_subject(), CONV_SUBJECT_DISCOVERY_STOP))
+               if (!strcmp(requestObj->getSubject(), CONV_SUBJECT_DISCOVERY_START) || !strcmp(requestObj->getSubject(), CONV_SUBJECT_DISCOVERY_STOP))
                        return discovery_manager::handleRequest (requestObj);
-               else if ( !strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_START) || !strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_STOP)
-                               || !strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_SET) || !strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_GET))
+               else if ( !strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_START) || !strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_STOP)
+                               || !strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_SET) || !strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_GET))
                        result = service_manager::handleRequest(requestObj);
-               else if ( !strcmp(requestObj->get_subject(), CONV_SUBJECT_CONNECTION_START) || !strcmp(requestObj->get_subject(), CONV_SUBJECT_CONNECTION_STOP) )
+               else if ( !strcmp(requestObj->getSubject(), CONV_SUBJECT_CONNECTION_START) || !strcmp(requestObj->getSubject(), CONV_SUBJECT_CONNECTION_STOP) )
                        result = connection_manager::handleRequest(requestObj);
                break;
        case REQ_SUPPORT:
index 087017e..2cb231e 100644 (file)
@@ -18,7 +18,7 @@
 #define __REQUEST_HANDLER_H__
 
 #include <glib.h>
-#include "request.h"
+#include "Request.h"
 
 namespace conv {
        class RequestHandler {
@@ -29,7 +29,7 @@ namespace conv {
                        int init();
                        int release();
 
-                       int handleRequest(request* requestObj);
+                       int handleRequest(Request* requestObj);
        };
 }
 
index 88a107d..db50bfa 100644 (file)
@@ -53,7 +53,7 @@ void conv::initialize()
        _I("Init Discovery Manager");
        discoveryMgr = new(std::nothrow) conv::DiscoveryManager();
        IF_FAIL_CATCH_TAG(discoveryMgr, _E, "Memory allocation failed");
-       discovery_manager::set_instance(discoveryMgr);
+       discovery_manager::setInstance(discoveryMgr);
        result = discoveryMgr->init();
        IF_FAIL_CATCH_TAG(result == CONV_ERROR_NONE, _E, "Initialization Failed");
 
@@ -74,7 +74,7 @@ void conv::initialize()
        _I("Init Service Manager");
        serviceMgr = new(std::nothrow) conv::ServiceManager();
        IF_FAIL_CATCH_TAG(serviceMgr, _E, "Memory allocation failed");
-       service_manager::set_instance(serviceMgr);
+       service_manager::setInstance(serviceMgr);
        result = serviceMgr->init();
        IF_FAIL_CATCH_TAG(result == CONV_ERROR_NONE, _E, "Initialization Failed");
 
@@ -143,7 +143,7 @@ void conv::release()
 }
 
 
-void conv::sendRequest(request* requestObj)
+void conv::sendRequest(Request* requestObj)
 {
        _D("send_request requestObj:%x request_mg:%x", requestObj, requestMgr);
        if (requestMgr) {
index 186bbfc..06a9eb1 100644 (file)
 
 #define CONV_DAEMON
 #include "Log.h"
-#include "request.h"
+#include "Request.h"
 
 namespace conv {
        void initialize();
        void release();
-       void sendRequest(request* requestObj);
+       void sendRequest(Request* requestObj);
 }
 #endif
index 8b90d64..b0e8f11 100755 (executable)
@@ -34,14 +34,14 @@ conv::ServiceManager::~ServiceManager()
 {
 }
 
-int conv::ServiceManager::handle_vconf_update(keynode_t *node)
+int conv::ServiceManager::handleVconfUpdate(keynode_t *node)
 {
-       activation_state = vconf_keynode_get_int(node);
+       __activationState = vconf_keynode_get_int(node);
 
-       if ( activation_state == 1 ) {
-               register_discovery_info();
+       if ( __activationState == 1 ) {
+               registerDiscoveryInfo();
        } else {
-               unregister_discovery_info();
+               unregisterDiscoveryInfo();
        }
 
        return CONV_ERROR_NONE;
@@ -52,26 +52,26 @@ static void vconf_update_cb(keynode_t *node, void* user_data)
        conv::ServiceManager* instance = static_cast<conv::ServiceManager*>(user_data);
        IF_FAIL_VOID_TAG(instance, _E, "static_cast failed");
 
-       instance->handle_vconf_update(node);
+       instance->handleVconfUpdate(node);
 }
 
 int conv::ServiceManager::init()
 {
-       register_provider(new(std::nothrow) conv::AppCommServiceProvider());
-       register_provider(new(std::nothrow) conv::RemoteAppControlServiceProvider());
+       registerProvider(new(std::nothrow) conv::AppCommServiceProvider());
+       registerProvider(new(std::nothrow) conv::RemoteAppControlServiceProvider());
 
-       int error = vconf_get_int(VCONFKEY_SETAPPL_D2D_CONVERGENCE, &activation_state);
+       int error = vconf_get_int(VCONFKEY_SETAPPL_D2D_CONVERGENCE, &__activationState);
 
        if ( error < 0 ) {
                _E("vconf error (%d)", error);
                // temporary code
-               activation_state = 1;
+               __activationState = 1;
        }
 
-       if ( activation_state == 1 ) {
-               register_discovery_info();
+       if ( __activationState == 1 ) {
+               registerDiscoveryInfo();
        } else {
-               unregister_discovery_info();
+               unregisterDiscoveryInfo();
        }
 
        error = vconf_notify_key_changed(VCONFKEY_SETAPPL_D2D_CONVERGENCE, vconf_update_cb, this);
@@ -82,87 +82,87 @@ int conv::ServiceManager::init()
 
 int conv::ServiceManager::release()
 {
-       unregister_discovery_info();
+       unregisterDiscoveryInfo();
 
-       for (service_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it) {
+       for (ServiceProviderList::iterator it = __providerList.begin(); it != __providerList.end(); ++it) {
                (*it)->release();
        }
 
-       for (service_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it) {
+       for (ServiceProviderList::iterator it = __providerList.begin(); it != __providerList.end(); ++it) {
                delete *it;
        }
 
-       provider_list.clear();
+       __providerList.clear();
 
        return CONV_ERROR_NONE;
 }
 
-int conv::ServiceManager::handleRequest(request* requestObj)
+int conv::ServiceManager::handleRequest(Request* requestObj)
 {
        _D("handle_request called");
        string type;
        int error = CONV_ERROR_INVALID_OPERATION;
-       bool json_return;
+       bool result;
 
-       json description = requestObj->get_description();
-       json_return = description.get(NULL, CONV_JSON_TYPE, &type);
+       Json description = requestObj->getDescription();
+       result = description.get(NULL, CONV_JSON_TYPE, &type);
 
-       IF_FAIL_CATCH_TAG(json_return, _E, "json parse error : no type info");
+       IF_FAIL_CATCH_TAG(result, _E, "json parse error : no type info");
 
-       for (service_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it) {
-               if ( (*it)->get_type().compare(type) == 0 )
+       for (ServiceProviderList::iterator it = __providerList.begin(); it != __providerList.end(); ++it) {
+               if ( (*it)->getType().compare(type) == 0 )
                {
                        _D("found service provider");
-                       error = (*it)->check_activation_state();
+                       error = (*it)->checkActivationState();
                        IF_FAIL_CATCH_TAG(error == CONV_ERROR_NONE, _E, "service provider is not activated");
 
-                       error = (*it)->load_service_info(requestObj);
+                       error = (*it)->loadServiceInfo(requestObj);
                        IF_FAIL_CATCH_TAG(error == CONV_ERROR_NONE, _E, "%d, service_info load error", error);
 
-                       if (!strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_START)) {
-                               if ( !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_INTERNET) ||
-                                               !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_BLUETOOTH) ||
-                                               !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_D2D_DATA_SHARING) )
+                       if (!strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_START)) {
+                               if ( !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_INTERNET) ||
+                                               !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_BLUETOOTH) ||
+                                               !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_D2D_DATA_SHARING) )
                                {
                                        _E("permission denied");
                                        requestObj->reply(CONV_ERROR_PERMISSION_DENIED);
                                        delete requestObj;
                                        return CONV_ERROR_PERMISSION_DENIED;
                                }
-                               error = (*it)->start_request(requestObj);
-                       } else if (!strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_STOP)) {
-                               if ( !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_INTERNET) ||
-                                               !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_BLUETOOTH) )
+                               error = (*it)->startRequest(requestObj);
+                       } else if (!strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_STOP)) {
+                               if ( !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_INTERNET) ||
+                                               !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_BLUETOOTH) )
                                {
                                        _E("permission denied");
                                        requestObj->reply(CONV_ERROR_PERMISSION_DENIED);
                                        delete requestObj;
                                        return CONV_ERROR_PERMISSION_DENIED;
                                }
-                               error = (*it)->stop_request(requestObj);
-                       } else if (!strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_GET))  {
-                               if ( !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_INTERNET) ||
-                                               !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_BLUETOOTH) )
+                               error = (*it)->stopRequest(requestObj);
+                       } else if (!strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_GET))   {
+                               if ( !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_INTERNET) ||
+                                               !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_BLUETOOTH) )
                                {
                                        _E("permission denied");
                                        requestObj->reply(CONV_ERROR_PERMISSION_DENIED);
                                        delete requestObj;
                                        return CONV_ERROR_PERMISSION_DENIED;
                                }
-                               error = (*it)->get_request(requestObj);
-                       } else if (!strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_SET)) {
-                               if ( !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_INTERNET) ||
-                                               !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_BLUETOOTH) ||
-                                               !conv::privilege_manager::isAllowed(requestObj->get_creds(), CONV_PRIVILEGE_D2D_DATA_SHARING) )
+                               error = (*it)->readRequest(requestObj);
+                       } else if (!strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_SET)) {
+                               if ( !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_INTERNET) ||
+                                               !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_BLUETOOTH) ||
+                                               !conv::privilege_manager::isAllowed(requestObj->getCreds(), CONV_PRIVILEGE_D2D_DATA_SHARING) )
                                {
                                        _E("permission denied");
                                        requestObj->reply(CONV_ERROR_PERMISSION_DENIED);
                                        delete requestObj;
                                        return CONV_ERROR_PERMISSION_DENIED;
                                }
-                               error = (*it)->set_request(requestObj);
-                       } else if (!strcmp(requestObj->get_subject(), CONV_SUBJECT_COMMUNICATION_RECV)) {
-                               return (*it)->register_request(requestObj);
+                               error = (*it)->publishRequest(requestObj);
+                       } else if (!strcmp(requestObj->getSubject(), CONV_SUBJECT_COMMUNICATION_RECV)) {
+                               return (*it)->registerRequest(requestObj);
                        }
                        IF_FAIL_CATCH_TAG(error == CONV_ERROR_NONE, _E, "service manager request handle error");
                }
@@ -180,12 +180,12 @@ CATCH:
        return error;
 }
 
-void conv::service_manager::set_instance(conv::ServiceManager* mgr)
+void conv::service_manager::setInstance(conv::ServiceManager* mgr)
 {
        _instance = mgr;
 }
 
-int conv::service_manager::handleRequest(request* requestObj)
+int conv::service_manager::handleRequest(Request* requestObj)
 {
        IF_FAIL_RETURN_TAG(_instance, CONV_ERROR_INVALID_PARAMETER, _E, "Not initialized");
        _instance->handleRequest(requestObj);
@@ -193,14 +193,14 @@ int conv::service_manager::handleRequest(request* requestObj)
        return CONV_ERROR_NONE;
 }
 
-int conv::ServiceManager::register_provider(conv::IServiceProvider *provider)
+int conv::ServiceManager::registerProvider(conv::IServiceProvider *provider)
 {
        if (!provider) {
                _E("Provider NULL");
                return CONV_ERROR_INVALID_PARAMETER;
        }
 
-       if (provider->check_activation_state() == CONV_ERROR_NONE) {
+       if (provider->checkActivationState() == CONV_ERROR_NONE) {
                if (provider->init() != CONV_ERROR_NONE) {
                        _E("Provider initialization failed");
                        delete provider;
@@ -210,7 +210,7 @@ int conv::ServiceManager::register_provider(conv::IServiceProvider *provider)
                _D("provider is not activated. init pending");
        }
 
-       provider_list.push_back(provider);
+       __providerList.push_back(provider);
 
        return CONV_ERROR_NONE;
 }
@@ -288,9 +288,9 @@ static iotcon_representation_h _get_d2d_service_representation(conv::ServiceMana
 #endif
        iotcon_attributes_add_str(attributes, CONV_JSON_DEVICE_TYPE, (char*) device_type.c_str());
 
-       json service_json;
-       instance->get_service_info_for_discovery(&service_json);
-       char* service_json_char = service_json.dup_cstr();
+       conv::Json service_json;
+       instance->getServiceInfoForDiscovery(&service_json);
+       char* service_json_char = service_json.dupCstr();
 
        iotcon_attributes_add_str(attributes, "service_json", service_json_char);
 
@@ -308,14 +308,14 @@ static iotcon_representation_h _get_d2d_service_representation(conv::ServiceMana
        return repr;
 }
 
-int conv::ServiceManager::get_service_info_for_discovery(json* service_json)
+int conv::ServiceManager::getServiceInfoForDiscovery(Json* service_json)
 {
        IF_FAIL_RETURN_TAG(service_json, CONV_ERROR_INVALID_OPERATION, _E, "service_json is NULL");
 
-       for (service_provider_list_t::iterator it = provider_list.begin(); it != provider_list.end(); ++it) {
-               json service_info;
-               if ((*it)->get_service_info_for_discovery(&service_info) == CONV_ERROR_NONE) {
-                       service_json->array_append(NULL, "service_list", service_info);
+       for (ServiceProviderList::iterator it = __providerList.begin(); it != __providerList.end(); ++it) {
+               Json service_info;
+               if ((*it)->getServiceInfoForDiscovery(&service_info) == CONV_ERROR_NONE) {
+                       service_json->appendArray(NULL, "service_list", service_info);
                }
        }
 
@@ -377,7 +377,7 @@ static void iotcon_request_cb(iotcon_resource_h resource, iotcon_request_h reque
        }
 }
 
-int conv::ServiceManager::register_discovery_info()
+int conv::ServiceManager::registerDiscoveryInfo()
 {
        IF_FAIL_RETURN_TAG(iotcon_resource == NULL, CONV_ERROR_INVALID_PARAMETER, _E, "resource for discovery is already registered");
 
@@ -410,7 +410,7 @@ int conv::ServiceManager::register_discovery_info()
        return CONV_ERROR_NONE;
 }
 
-int conv::ServiceManager::unregister_discovery_info()
+int conv::ServiceManager::unregisterDiscoveryInfo()
 {
        IF_FAIL_RETURN_TAG(iotcon_resource != NULL, CONV_ERROR_INVALID_PARAMETER, _E, "resource for discovery is already unregistered");
 
index 6927f70..615b6e3 100644 (file)
@@ -22,7 +22,7 @@
 #include <vector>
 #include <vconf.h>
 #include "IManager.h"
-#include "request.h"
+#include "Request.h"
 #include "IServiceProvider.h"
 
 namespace conv {
@@ -33,25 +33,25 @@ namespace conv {
 
                        int init();
                        int release();
-                       int handleRequest(request* requestObj);
+                       int handleRequest(Request* requestObj);
 
-                       int get_service_info_for_discovery(json* service_json);
-                       int handle_vconf_update(keynode_t *node);
+                       int getServiceInfoForDiscovery(Json* service_json);
+                       int handleVconfUpdate(keynode_t *node);
 
                private:
-                       int activation_state;
+                       int __activationState;
 
-                       typedef std::list<IServiceProvider*> service_provider_list_t;
+                       typedef std::list<IServiceProvider*> ServiceProviderList;
 
-                       int register_provider(IServiceProvider *provider_base);
-                       int register_discovery_info();
-                       int unregister_discovery_info();
-                       service_provider_list_t provider_list;
+                       int registerProvider(IServiceProvider *serviceProvider);
+                       int registerDiscoveryInfo();
+                       int unregisterDiscoveryInfo();
+                       ServiceProviderList __providerList;
        };
 
        namespace service_manager {
-               void set_instance(ServiceManager* mgr);
-               int handleRequest(request* requestObj);
+               void setInstance(ServiceManager* mgr);
+               int handleRequest(Request* requestObj);
        }
 }
 
diff --git a/daemon/conv_json.h b/daemon/conv_json.h
deleted file mode 100644 (file)
index 972d571..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CONV_JSON_H__
-#define __CONV_JSON_H__
-
-#include <sys/types.h>
-#include <glib.h>
-#include <string>
-#include <list>
-#include "Types.h"
-
-#define _J(cmt, jobj) \
-do { \
-       _SD("%s: %s", (cmt), jobj.str().c_str()); \
-} while (0)
-
-#define EMPTY_JSON_OBJECT      "{}"
-#define DEFAULT_PRECISION      3
-
-class json {
-private:
-       typedef struct _JsonNode json_node_t;
-       json_node_t *json_node;
-
-       void parse(const char* s);
-       void release();
-
-       /* For json vs json comparison */
-       bool get_member_list(json_node_t* node, std::list<std::string>& list);
-       bool node_equals(json_node_t* lhs, json_node_t* rhs);
-       bool value_equals(json_node_t* lhs, json_node_t* rhs);
-       bool object_equals(json_node_t* lhs, json_node_t* rhs);
-       bool array_equals(json_node_t* lhs, json_node_t* rhs);
-
-public:
-       json();
-       json(const char* s);
-       json(const std::string& s);
-
-       /* This json(const json& j) only copies the reference to the underlying json node.
-        * Therefore, changes applied to a json object affect the other.
-        * If you need to create a 'real' copy of a json, which can be manipulated separately,
-        * utilize the str() function, e.g., ctx::json copy(original.str());
-        */
-       json(const json& j);
-
-       ~json();
-
-       json& operator=(const char* s);
-       json& operator=(const std::string& s);
-
-       /* This operator=(const json& j) only copies the reference to the underlying json node.
-        * Therefore, changes applied to a json object affect the other.
-        * If you need to create a 'real' copy of a json, which can be manipulated separately,
-        * utilize the str() function, e.g., ctx::json copy = original.str();
-        */
-       json& operator=(const json& j);
-
-       bool operator==(const json& rhs);
-       bool operator!=(const json& rhs);
-
-       char* dup_cstr();
-       std::string str();
-
-       bool get_keys(std::list<std::string>* list);
-
-       bool set(const char* path, const char* key, json& val);
-       bool set(const char* path, const char* key, int val);
-       bool set(const char* path, const char* key, int64_t val);
-       bool set(const char* path, const char* key, double val, int prec = DEFAULT_PRECISION);
-       bool set(const char* path, const char* key, std::string val);
-       bool set(const char* path, const char* key, GVariant *val);
-
-       bool get(const char* path, const char* key, json* val);
-       bool get(const char* path, const char* key, int* val);
-       bool get(const char* path, const char* key, int64_t* val);
-       bool get(const char* path, const char* key, double* val);
-       bool get(const char* path, const char* key, std::string* val);
-       bool get(const char* path, const char* key, GVariant **val);
-
-       int array_get_size(const char* path, const char* key);
-
-       bool array_append(const char* path, const char* key, json& val);
-       bool array_append(const char* path, const char* key, int val);
-       bool array_append(const char* path, const char* key, int64_t val);
-       bool array_append(const char* path, const char* key, double val, int prec = DEFAULT_PRECISION);
-       bool array_append(const char* path, const char* key, std::string val);
-
-       bool array_set_at(const char* path, const char* key, int index, json& val);
-       bool array_set_at(const char* path, const char* key, int index, int val);
-       bool array_set_at(const char* path, const char* key, int index, int64_t val);
-       bool array_set_at(const char* path, const char* key, int index, double val, int prec = DEFAULT_PRECISION);
-       bool array_set_at(const char* path, const char* key, int index, std::string val);
-
-       bool get_array_elem(const char* path, const char* key, int index, json* val);
-       bool get_array_elem(const char* path, const char* key, int index, int* val);
-       bool get_array_elem(const char* path, const char* key, int index, int64_t* val);
-       bool get_array_elem(const char* path, const char* key, int index, double* val);
-       bool get_array_elem(const char* path, const char* key, int index, std::string* val);
-};
-
-#endif // __CONV_JSON_H__
-
index 5f26bac..d03b0ac 100755 (executable)
@@ -20,7 +20,7 @@
 #include <map>
 #include <algorithm>
 #include "iotcon/ResourceHandle.h"
-#include "../conv_json.h"
+#include "../Json.h"
 
 #include "../DiscoveryManager.h"
 #include "iotcon/ServiceAdapter.h"
@@ -89,12 +89,12 @@ static bool response_attributes_cb(iotcon_attributes_h attributes, const char* k
        return true;
 }
 
-int conv::IotconDiscoveryProvider::notice_discovered(IService* service)
+int conv::IotconDiscoveryProvider::notifyDiscovered(IService* service)
 {
        return CONV_ERROR_NONE;
 }
 
-void conv::IotconDiscoveryProvider::_on_response_get(iotcon_remote_resource_h resource,
+void conv::IotconDiscoveryProvider::__on_response_get(iotcon_remote_resource_h resource,
                                                                        iotcon_response_h response, void* user_data)
 {
        _D("On Response Get..");
@@ -112,7 +112,7 @@ void conv::IotconDiscoveryProvider::_on_response_get(iotcon_remote_resource_h re
        iotcon_remote_resource_get_host_address(resource, &resource_host);
 
        // Check if it's already done publishing..
-       string discoveryKey = generateDiscoveryKey(resource_uri_path, resource_host);
+       string discoveryKey = __generate_discovery_key(resource_uri_path, resource_host);
        discovery_complete_list_t::iterator itor;
        _D("Check if key[%s] already exists in complete_list", discoveryKey.c_str());
        itor = find(discovery_complete_list.begin(), discovery_complete_list.end(), discoveryKey);
@@ -137,7 +137,7 @@ void conv::IotconDiscoveryProvider::_on_response_get(iotcon_remote_resource_h re
        ret = iotcon_response_get_result(response, &response_result);
        IF_FAIL_VOID_TAG((ret == IOTCON_ERROR_NONE), _E, "Failed[%d] to get response result", ret);
        IF_FAIL_VOID_TAG((response_result == IOTCON_RESPONSE_OK), _E,
-                       "_on_response_get Response Error[%d]", response_result);
+                       "__on_response_get Response Error[%d]", response_result);
 
        ret = iotcon_response_get_representation(response, &recv_repr);
        IF_FAIL_VOID_TAG((ret == IOTCON_ERROR_NONE), _E, "iotcon_response_get_representation() Fail[%d]", ret);
@@ -155,7 +155,7 @@ void conv::IotconDiscoveryProvider::_on_response_get(iotcon_remote_resource_h re
        char *device_id = NULL, *device_name = NULL, *device_type = NULL, *version = NULL, *service_list = NULL;
        ret = iotcon_attributes_get_str(recv_attributes, "device_id", &device_id);              // device id (ex. bt address)
        IF_FAIL_VOID_TAG((ret == IOTCON_ERROR_NONE), _E, "iotcon_attributes_get_str() Fail[%d]", ret);
-       cur_resource_h.set_device_id(string(device_id));
+       cur_resource_h.setDeviceId(string(device_id));
 
        if ( conv::util::getDeviceId().compare(device_id) == 0 ) {
                _D("the device has found itself..[device_id:%s].. out!", device_id);
@@ -164,11 +164,11 @@ void conv::IotconDiscoveryProvider::_on_response_get(iotcon_remote_resource_h re
 
        ret = iotcon_attributes_get_str(recv_attributes, "device_name", &device_name);
        IF_FAIL_VOID_TAG((ret == IOTCON_ERROR_NONE), _E, "iotcon_attributes_get_str() Fail[%d]", ret);
-       cur_resource_h.set_device_name(string(device_name));
+       cur_resource_h.setDeviceName(string(device_name));
 
        ret = iotcon_attributes_get_str(recv_attributes, "device_type", &device_type);
        IF_FAIL_VOID_TAG((ret == IOTCON_ERROR_NONE), _E, "iotcon_attributes_get_str() Fail[%d]", ret);
-       cur_resource_h.set_device_type(string(device_type));
+       cur_resource_h.setDeviceType(string(device_type));
 
        char* service_json_char = NULL;
        ret = iotcon_attributes_get_str(recv_attributes, "service_json", &service_json_char);
@@ -178,49 +178,49 @@ void conv::IotconDiscoveryProvider::_on_response_get(iotcon_remote_resource_h re
        }
        std::string service_json(service_json_char);
 
-       cur_resource_h.set_services_list(service_json);
-       json service_list_json(service_json);
+       cur_resource_h.setServiceList(service_json);
+       Json service_list_json(service_json);
        _D("on_response : device_id[%s] device_name[%s] device_type[%s] version[%s] service_list[%s]"
                                                                        , device_id, device_name, device_type, version, service_list);
 
        if (_discovery_manager != NULL) {
                DeviceAdapter*  device = new(std::nothrow) DeviceAdapter (cur_resource_h);
 
-               int num_service = service_list_json.array_get_size(NULL, "service_list");
+               int num_service = service_list_json.getArraySize(NULL, "service_list");
                for (int index = 0; index < num_service; index++) {
                        int serv_type_int;
 
-                       json cur_service_json;
-                       bool ret = service_list_json.get_array_elem(NULL, "service_list", index, &cur_service_json);
+                       Json cur_service_json;
+                       bool ret = service_list_json.getArrayElem(NULL, "service_list", index, &cur_service_json);
                        if (ret != true) {
                                _D("json get array elem with service_list error..");
                                continue;
                        }
 
                        ServiceAdapter* serv = new(std::nothrow) ServiceAdapter(cur_resource_h);
-                       json serv_info_json;
+                       Json serv_info_json;
 
                        cur_service_json.get(NULL, CONV_JSON_DISCOVERY_SERVICE_TYPE, &serv_type_int);
                        serv->setServiceType(serv_type_int);
                        cur_service_json.get(NULL, CONV_JSON_DISCOVERY_SERVICE_INFO, &serv_info_json);
                        serv->setServiceInfo(serv_info_json.str());
 
-                       device->add_service(serv);
+                       device->addService(serv);
                }
-               _discovery_manager->append_discovered_result(device);
+               _discovery_manager->appendDiscoveredResult(device);
        }
 
        discovery_complete_list.push_back(discoveryKey);
 }
 
-bool conv::IotconDiscoveryProvider::_get_str_list_cb(int pos, const char* value, void* user_data)
+bool conv::IotconDiscoveryProvider::__get_str_list_cb(int pos, const char* value, void* user_data)
 {
-       json* service_list = (json*) user_data;
-       service_list->array_append(NULL, "services_list", string(value));
+       Json* service_list = (Json*) user_data;
+       service_list->appendArray(NULL, "services_list", string(value));
        return IOTCON_FUNC_CONTINUE;
 }
 
-void conv::IotconDiscoveryProvider::on_received_detail_info(iotcon_remote_resource_h resource, iotcon_error_e error,
+void conv::IotconDiscoveryProvider::__on_received_detail_info(iotcon_remote_resource_h resource, iotcon_error_e error,
                                                                        iotcon_request_type_e request_type, iotcon_response_h response,
                                                                        void* user_data)
 {
@@ -228,7 +228,7 @@ void conv::IotconDiscoveryProvider::on_received_detail_info(iotcon_remote_resour
 
        switch (request_type) {
        case IOTCON_REQUEST_GET :
-               _on_response_get(resource, response, NULL);
+               __on_response_get(resource, response, NULL);
                break;
        case IOTCON_REQUEST_PUT:
        case IOTCON_REQUEST_POST:
@@ -241,12 +241,12 @@ void conv::IotconDiscoveryProvider::on_received_detail_info(iotcon_remote_resour
        }
 }
 
-void conv::IotconDiscoveryProvider::_get_detail_info(iotcon_remote_resource_h resource)
+void conv::IotconDiscoveryProvider::__get_detail_info(iotcon_remote_resource_h resource)
 {
        iotcon_query_h query;
        iotcon_remote_resource_h resource_clone = NULL;
 
-       _D("_get_detail_info called..");
+       _D("__get_detail_info called..");
 
        int ret = iotcon_remote_resource_clone(resource, &resource_clone);
        if (ret != IOTCON_ERROR_NONE) {
@@ -264,7 +264,7 @@ void conv::IotconDiscoveryProvider::_get_detail_info(iotcon_remote_resource_h re
        }
 
        /* send Get Request */
-       ret = iotcon_remote_resource_get(resource_clone, query, on_received_detail_info, NULL);
+       ret = iotcon_remote_resource_get(resource_clone, query, __on_received_detail_info, NULL);
        if (ret != IOTCON_ERROR_NONE) {
                _E("Failed[%d] to get remote resource query", ret);
                iotcon_query_destroy(query);
@@ -272,14 +272,14 @@ void conv::IotconDiscoveryProvider::_get_detail_info(iotcon_remote_resource_h re
        }
 }
 
-string conv::IotconDiscoveryProvider::generateDiscoveryKey(char* uri_path, char* host_address)
+string conv::IotconDiscoveryProvider::__generate_discovery_key(char* uri_path, char* host_address)
 {
        return string(host_address) + string(uri_path);
 }
 
-int conv::IotconDiscoveryProvider::add_iot_resource(iotcon_remote_resource_h resource)
+int conv::IotconDiscoveryProvider::__add_iot_resource(iotcon_remote_resource_h resource)
 {
-       _D("add_iot_resource called..");
+       _D("__add_iot_resource called..");
        ResourceHandle  iot_resource_h;
 
        char* resource_uri_path = NULL;
@@ -302,33 +302,33 @@ int conv::IotconDiscoveryProvider::add_iot_resource(iotcon_remote_resource_h res
 
        ResourceHandle res_handle;
        // uri_path
-       res_handle.set_uri_path(string(resource_uri_path));
+       res_handle.setUriPath(string(resource_uri_path));
        // host_address
-       res_handle.set_host_address(string(resource_host));
+       res_handle.setHostAddress(string(resource_host));
        // resource types
-       iotcon_resource_types_foreach(resource_types, _get_resource_foreach_types, (void*)(&res_handle.get_types()) );
+       iotcon_resource_types_foreach(resource_types, _get_resource_foreach_types, (void*)(&res_handle.getTypes()) );
 
        // Add resource handle into Temp Cache
-       string discovery_key = generateDiscoveryKey(resource_uri_path, resource_host);
+       string discovery_key = __generate_discovery_key(resource_uri_path, resource_host);
        _D("discovery_process_map insertion with key[%s]", discovery_key.c_str());
        discovery_process_map.insert(discovery_process_map_t::value_type(discovery_key, res_handle));
 
        return CONV_ERROR_NONE;
 }
 
-bool conv::IotconDiscoveryProvider::_found_resource(iotcon_remote_resource_h resource, iotcon_error_e result, void *user_data)
+bool conv::IotconDiscoveryProvider::__found_resource(iotcon_remote_resource_h resource, iotcon_error_e result, void *user_data)
 {
-       _D("_found_resource called..");
+       _D("__found_resource called..");
 
        IF_FAIL_RETURN_TAG((resource != NULL), IOTCON_FUNC_STOP, _E, "resource is NULL..");
 
        int ret;
        // add the found resource into Temp cache
-       ret = add_iot_resource(resource);
+       ret = __add_iot_resource(resource);
        IF_FAIL_RETURN_TAG((ret == CONV_ERROR_NONE), IOTCON_FUNC_CONTINUE, _E, "Failed to add iot resource");
 
        // Get additional info from resource
-       _get_detail_info(resource);
+       __get_detail_info(resource);
 
        return IOTCON_FUNC_CONTINUE;
 }
@@ -341,7 +341,7 @@ int conv::IotconDiscoveryProvider::start()
        discovery_process_map.clear();
 
        ret = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_IPV4,
-                       CONV_RESOURCE_TYPE_TIZEN_D2D_SERVICE, false, _found_resource, NULL);
+                       CONV_RESOURCE_TYPE_TIZEN_D2D_SERVICE, false, __found_resource, NULL);
 
        IF_FAIL_RETURN_TAG((ret == 0), CONV_ERROR_INVALID_OPERATION, _E, "failed on iotcon_find_resource[%d]", ret);
 
index 0ab6355..d0e109c 100755 (executable)
@@ -22,7 +22,7 @@
 #include <vector>
 #include <map>
 #include "../IDiscoveryProvider.h"
-#include "../request.h"
+#include "../Request.h"
 
 #include "../IService.h"
 #include "iotcon/ResourceHandle.h"
@@ -31,20 +31,20 @@ namespace conv {
        class IotconDiscoveryProvider : public IDiscoveryProvider  {
                private:
 
-                       static bool _found_resource(iotcon_remote_resource_h resource, iotcon_error_e result,
+                       static bool __found_resource(iotcon_remote_resource_h resource, iotcon_error_e result,
                                                                        void *user_data);
-                       static void _get_detail_info(iotcon_remote_resource_h resource);
+                       static void __get_detail_info(iotcon_remote_resource_h resource);
 
-                       static void on_received_detail_info(iotcon_remote_resource_h resource, iotcon_error_e error,
+                       static void __on_received_detail_info(iotcon_remote_resource_h resource, iotcon_error_e error,
                                                                        iotcon_request_type_e request_type, iotcon_response_h response,
                                                                        void* user_data);
 
-                       static void _on_response_get(iotcon_remote_resource_h resource,
+                       static void __on_response_get(iotcon_remote_resource_h resource,
                                                                        iotcon_response_h response, void* user_data);
 
-                       static int add_iot_resource(iotcon_remote_resource_h resource);
-                       static string generateDiscoveryKey(char* uri_path, char* host_address);
-                       static bool _get_str_list_cb(int pos, const char* value, void* user_data);
+                       static int __add_iot_resource(iotcon_remote_resource_h resource);
+                       static string __generate_discovery_key(char* uri_path, char* host_address);
+                       static bool __get_str_list_cb(int pos, const char* value, void* user_data);
 
                public:
                        IotconDiscoveryProvider();
@@ -56,7 +56,7 @@ namespace conv {
                        int start();
                        int stop();
 
-                       static int notice_discovered(IService* service);
+                       static int notifyDiscovered(IService* service);
        };
 }
 #endif /* __SMARTVIEW_DISCOVERY_PROVIDER_H__ */
index fc6e8a0..906fbbc 100755 (executable)
@@ -17,7 +17,7 @@
 #include "SmartviewDiscoveryProvider.h"
 
 #include "../DiscoveryManager.h"
-#include "../conv_json.h"
+#include "../Json.h"
 
 #include "../Util.h"
 
@@ -51,14 +51,14 @@ class SearchListenerImpl : public SearchListener {
                {
                        _I("onFound on SearchListener.. towards disc_manager:%x", disc_manager);
                        if (disc_provider != NULL) {
-                               disc_provider->notice_discovered(&service, true);
+                               disc_provider->notifyDiscovered(&service, true);
                        }
                }
                void onLost(Service service)
                {
                        _I("onLost on SearchListener");
                        if (disc_provider != NULL) {
-                               disc_provider->notice_discovered(&service, false);
+                               disc_provider->notifyDiscovered(&service, false);
                        }
                }
 };
@@ -123,7 +123,7 @@ int conv::SmartviewDiscoveryProvider::stop()
        return CONV_ERROR_NONE;
 }
 
-conv::device* conv::SmartviewDiscoveryProvider::convert_into_conv_device(Service* smartview_service)
+conv::SmartViewDevice* conv::SmartviewDiscoveryProvider::convertIntoConvDevice(Service* smartview_service)
 {
        string serv_name, serv_version, serv_type, serv_id, serv_uri;
 
@@ -137,14 +137,14 @@ conv::device* conv::SmartviewDiscoveryProvider::convert_into_conv_device(Service
                                                                serv_name.c_str(), serv_version.c_str(), serv_type.c_str(),
                                                                serv_id.c_str(), serv_uri.c_str() );
 
-       conv::device*   device_info = new(std::nothrow) conv::device;
+       conv::SmartViewDevice*  device_info = new(std::nothrow) conv::SmartViewDevice;
        device_info->setId(serv_id);
        device_info->setName(serv_name);
 
        return device_info;
 }
 
-conv::service* conv::SmartviewDiscoveryProvider::convert_into_conv_service(Service* smartview_service)
+conv::SmartViewService* conv::SmartviewDiscoveryProvider::convertIntoConvService(Service* smartview_service)
 {
        string serv_name, serv_version, serv_type, serv_id, serv_uri;
 
@@ -158,14 +158,14 @@ conv::service* conv::SmartviewDiscoveryProvider::convert_into_conv_service(Servi
                                                                serv_name.c_str(), serv_version.c_str(), serv_type.c_str(),
                                                                serv_id.c_str(), serv_uri.c_str() );
 
-       json json_serv_info;
+       Json json_serv_info;
        json_serv_info.set(CONV_JSON_SERVICE_DATA_PATH, CONV_JSON_SERVICE_DATA_URI, serv_uri);
        json_serv_info.set(CONV_JSON_SERVICE_DATA_PATH, CONV_JSON_SERVICE_DATA_ID, serv_id);
        json_serv_info.set(CONV_JSON_SERVICE_DATA_PATH, CONV_JSON_SERVICE_DATA_NAME, serv_name);
        json_serv_info.set(CONV_JSON_SERVICE_DATA_PATH, CONV_JSON_SERVICE_DATA_VERSION, serv_version);
        json_serv_info.set(CONV_JSON_SERVICE_DATA_PATH, CONV_JSON_SERVICE_DATA_TYPE, serv_type);
 
-       conv::service *conv_service = new(std::nothrow) conv::service;
+       conv::SmartViewService *conv_service = new(std::nothrow) conv::SmartViewService;
 
        if ( conv_service == NULL ) {
                _E("conv_service allocation failed");
@@ -183,14 +183,14 @@ conv::service* conv::SmartviewDiscoveryProvider::convert_into_conv_service(Servi
        return conv_service;
 }
 
-int conv::SmartviewDiscoveryProvider::removeFromCache(conv::service* conv_service)
+int conv::SmartviewDiscoveryProvider::removeFromCache(conv::SmartViewService* conv_service)
 {
        string cache_key = conv_service->getUri();
        cache.erase(cache_key);
        return CONV_ERROR_NONE;
 }
 
-int conv::SmartviewDiscoveryProvider::checkExistence(conv::service* conv_service)
+int conv::SmartviewDiscoveryProvider::checkExistence(conv::SmartViewService* conv_service)
 {
        _D("Check Existence : ");
        conv_service->printInfo();
@@ -199,7 +199,7 @@ int conv::SmartviewDiscoveryProvider::checkExistence(conv::service* conv_service
        string cache_key = conv_service->getUri();      // Serivce URI as Map Key
        if (cache.find(cache_key) == cache.end()){
                _D("Flow_service with key[%s] does not exist..so go into the cache", cache_key.c_str());
-               cache.insert(map<string, conv::service*>::value_type(cache_key, conv_service));
+               cache.insert(map<string, conv::SmartViewService*>::value_type(cache_key, conv_service));
                return CONV_ERROR_NONE;
        } else {
                _D("Flow_service with key[%s] already exists..", cache_key.c_str());
@@ -207,17 +207,17 @@ int conv::SmartviewDiscoveryProvider::checkExistence(conv::service* conv_service
        }
 }
 
-int conv::SmartviewDiscoveryProvider::notice_discovered(Service* service, bool bDiscovered)
+int conv::SmartviewDiscoveryProvider::notifyDiscovered(Service* service, bool bDiscovered)
 {
        _D("Notice Discovered called with service[%x]", service);
 
        // Covert MSF-API's Service into D2D Flow's Device n Service
-       conv::device*   conv_device = convert_into_conv_device(service);
+       conv::SmartViewDevice*  conv_device = convertIntoConvDevice(service);
        IF_FAIL_RETURN_TAG((conv_device != NULL), CONV_ERROR_INVALID_PARAMETER, _E, "failed to convert into flow device..");
 
-       conv::service* conv_service = convert_into_conv_service(service);
+       conv::SmartViewService* conv_service = convertIntoConvService(service);
        IF_FAIL_RETURN_TAG((conv_service != NULL), CONV_ERROR_INVALID_PARAMETER, _E, "failed to convert into flow service..");
-       conv_device->add_service(conv_service);
+       conv_device->addService(conv_service);
 
        _D("Success in converting into flow.service[%x] .device[%x]", conv_service, conv_device);
 
@@ -233,7 +233,7 @@ int conv::SmartviewDiscoveryProvider::notice_discovered(Service* service, bool b
                //1. delete it from the cache..
                removeFromCache(conv_service);
                //2. notify
-               _discovery_manager->notify_lost_device(conv_device);
+               _discovery_manager->notifyLostDevice(conv_device);
 
                return CONV_ERROR_NONE;
        } else {
@@ -243,7 +243,7 @@ int conv::SmartviewDiscoveryProvider::notice_discovered(Service* service, bool b
 
                if (!alreadyExisted) {
                        //the discovered one is NEW!!
-                       _discovery_manager->append_discovered_result(conv_device);
+                       _discovery_manager->appendDiscoveredResult(conv_device);
                }
        }
 
index 8bd10bd..73e063c 100755 (executable)
@@ -23,9 +23,9 @@
 #include <map>
 
 #include "../IDiscoveryProvider.h"
-#include "../request.h"
-#include "smartview/service.h"
-#include "smartview/device.h"
+#include "../Request.h"
+#include "smartview/SmartViewService.h"
+#include "smartview/SmartViewDevice.h"
 
 #include "Search.h"
 #include "Service.h"
@@ -43,17 +43,17 @@ namespace conv {
                        int start();
                        int stop();
 
-                       int notice_discovered(Service *service, bool bDiscovered);
+                       int notifyDiscovered(Service *service, bool bDiscovered);
                private:
                        //Service service;
                        Search* search;
 
-                       map <string, conv::service*> cache; // for double check
+                       map <string, conv::SmartViewService*> cache; // for double check
 
-                       conv::service* convert_into_conv_service(Service* smartview_service);
-                       conv::device* convert_into_conv_device(Service* smartview_service);
-                       int checkExistence(conv::service* conv_service);
-                       int removeFromCache(conv::service* conv_service);
+                       conv::SmartViewService* convertIntoConvService(Service* smartview_service);
+                       conv::SmartViewDevice* convertIntoConvDevice(Service* smartview_service);
+                       int checkExistence(conv::SmartViewService* conv_service);
+                       int removeFromCache(conv::SmartViewService* conv_service);
        };
 }
 
index 2216b91..4c46149 100755 (executable)
@@ -64,7 +64,7 @@ bool _cb_discovered_peers_impl(wifi_direct_discovered_peer_info_s* peer, void* u
 
 #if 0 // TODO: make and notice if it's device support d2d
        conv::WifiDirectDiscoveryProvider* disc_provider = (conv::WifiDirectDiscoveryProvider*)user_data;
-       conv::service *conv_service = new(std::nothrow) conv::service;
+       conv::SmartViewService *conv_service = new(std::nothrow) conv::SmartViewService;
 
        conv_service->setName(peer->device_name);
        conv_service->setVersion("0.0");
@@ -72,7 +72,7 @@ bool _cb_discovered_peers_impl(wifi_direct_discovered_peer_info_s* peer, void* u
        conv_service->setId(peer->mac_address);
        conv_service->setUri("");
 
-       disc_provider->notice_discovered(conv_service);
+       disc_provider->notifyDiscovered(conv_service);
 #endif
 
        if (NULL != peer) {
@@ -327,7 +327,7 @@ int conv::WifiDirectDiscoveryProvider::stop()
        return CONV_ERROR_NONE;
 }
 
-int conv::WifiDirectDiscoveryProvider::checkExistence(conv::service* conv_service)
+int conv::WifiDirectDiscoveryProvider::checkExistence(conv::SmartViewService* conv_service)
 {
        // print conv_service Info..
        _D("Check Existence : %s", conv_service->getName().c_str());
@@ -337,7 +337,7 @@ int conv::WifiDirectDiscoveryProvider::checkExistence(conv::service* conv_servic
        string cache_key = conv_service->getId();       // Serivce URI as Map Key..
        if (cache.find(cache_key) == cache.end()) {
                _D("conv_service with key[%s] does not exist..so go into the cache", cache_key.c_str());
-               cache.insert(map<string, conv::service*>::value_type(cache_key, conv_service));
+               cache.insert(map<string, conv::SmartViewService*>::value_type(cache_key, conv_service));
                return CONV_ERROR_NONE;
        } else {
                _D("conv_service with key[%s] already exists..", cache_key.c_str());
@@ -345,7 +345,7 @@ int conv::WifiDirectDiscoveryProvider::checkExistence(conv::service* conv_servic
        }
 }
 
-int conv::WifiDirectDiscoveryProvider::notice_discovered(conv::service* conv_service)
+int conv::WifiDirectDiscoveryProvider::notifyDiscovered(conv::SmartViewService* conv_service)
 {
        _D("Notice Discovered called with service[%x]", conv_service);
 
@@ -356,7 +356,7 @@ int conv::WifiDirectDiscoveryProvider::notice_discovered(conv::service* conv_ser
        if (!alreadyExisted) {
                //the discovered one is NEW!!
                // TO-DO : need to re-write this code
-               //_discovery_manager->append_discovered_result(NULL, conv_service);
+               //_discovery_manager->appendDiscoveredResult(NULL, conv_service);
        }
 
        return CONV_ERROR_NONE;
index ecec981..7ad50d7 100755 (executable)
@@ -23,8 +23,8 @@
 #include <map>
 
 #include "../IDiscoveryProvider.h"
-#include "../request.h"
-#include "smartview/service.h"
+#include "../Request.h"
+#include "smartview/SmartViewService.h"
 
 namespace conv {
        class WifiDirectDiscoveryProvider : public IDiscoveryProvider  {
@@ -38,12 +38,12 @@ namespace conv {
                        int start();
                        int stop();
 
-                       int notice_discovered(conv::service* conv_service);
+                       int notifyDiscovered(conv::SmartViewService* conv_service);
 
                private:
-                       map <string, conv::service*> cache;
+                       map <string, conv::SmartViewService*> cache;
 
-                       int checkExistence(conv::service* conv_service);
+                       int checkExistence(conv::SmartViewService* conv_service);
        };
 }
 #endif /* __BLE_DISCOVERY_PROVIDER_H__ */
index b227839..8ca994e 100755 (executable)
@@ -37,7 +37,7 @@ static bool serviceComparision(conv::IService* obj, int serviceType)
                return false;
 }
 
-int conv::DeviceAdapter::add_service(IService* service_obj)
+int conv::DeviceAdapter::addService(IService* service_obj)
 {
        service_list_t::iterator itr;
        itr = std::find_if(service_list.begin(), service_list.end(), std::bind(serviceComparision, std::placeholders::_1, service_obj->getServiceType()));
@@ -53,7 +53,7 @@ int conv::DeviceAdapter::add_service(IService* service_obj)
        return CONV_ERROR_NONE;
 }
 
-int conv::DeviceAdapter::remove_service(IService* service_obj)
+int conv::DeviceAdapter::removeService(IService* service_obj)
 {
        service_list.remove(service_obj);
        return CONV_ERROR_NONE;
@@ -61,20 +61,20 @@ int conv::DeviceAdapter::remove_service(IService* service_obj)
 
 string conv::DeviceAdapter::getName()
 {
-       return m_resource_h.get_device_name();
+       return m_resource_h.getDeviceName();
 }
 
 string conv::DeviceAdapter::getId()
 {
-       return m_resource_h.get_device_id();
+       return m_resource_h.getDeviceId();
 }
 
 string conv::DeviceAdapter::getAddress()
 {
-       return m_resource_h.get_host_address();
+       return m_resource_h.getHostAddress();
 }
 
-int conv::DeviceAdapter::get_services_list(std::list<IService*> *list)
+int conv::DeviceAdapter::getServiceList(std::list<IService*> *list)
 {
        for (service_list_t::iterator iterPos = service_list.begin(); iterPos != service_list.end(); ++iterPos) {
                list->push_back(*iterPos);
index c7604fb..130bfe4 100644 (file)
@@ -29,9 +29,9 @@ namespace conv {
                        DeviceAdapter(ResourceHandle res_h);
                        ~DeviceAdapter();
 
-                       int add_service(IService* service_obj);
-                       int remove_service(IService* service_obj);
-                       int get_services_list(std::list<IService*> *list);
+                       int addService(IService* service_obj);
+                       int removeService(IService* service_obj);
+                       int getServiceList(std::list<IService*> *list);
                        string getName();
                        string getId();
                        string getAddress();
index 2296abe..bb8b936 100644 (file)
 using namespace std;
 
 
-int conv::ResourceHandle::set_device_id(string dev_id)
+int conv::ResourceHandle::setDeviceId(string dev_id)
 {
        this->device_id = dev_id;
        return CONV_ERROR_NONE;
 }
 
-string conv::ResourceHandle::get_device_id()
+string conv::ResourceHandle::getDeviceId()
 {
        return this->device_id;
 }
 
-int conv::ResourceHandle::set_device_name(string dev_name)
+int conv::ResourceHandle::setDeviceName(string dev_name)
 {
        this->device_name = dev_name;
        return CONV_ERROR_NONE;
 }
 
-string conv::ResourceHandle::get_device_name()
+string conv::ResourceHandle::getDeviceName()
 {
        return device_name;
 }
 
-int conv::ResourceHandle::set_device_type(string dev_type)
+int conv::ResourceHandle::setDeviceType(string dev_type)
 {
        this->device_type = dev_type;
        return CONV_ERROR_NONE;
 }
 
-string conv::ResourceHandle::get_device_type()
+string conv::ResourceHandle::getDeviceType()
 {
        return device_type;
 }
 
-int    conv::ResourceHandle::set_version(string ver)
+int    conv::ResourceHandle::setVersion(string ver)
 {
        this->version = ver;
        return CONV_ERROR_NONE;
 }
 
-string conv::ResourceHandle::get_version()
+string conv::ResourceHandle::getVersion()
 {
        return version;
 }
 
-int    conv::ResourceHandle::set_services_list(string list)
+int    conv::ResourceHandle::setServiceList(string list)
 {
-       this->services_list = json(list);
+       this->services_list = Json(list);
        return CONV_ERROR_NONE;
 }
 
-int conv::ResourceHandle::set_uri_path(string uri_path)
+int conv::ResourceHandle::setUriPath(string uri_path)
 {
        this->uri_path = uri_path;
        return CONV_ERROR_NONE;
 }
 
-string conv::ResourceHandle::get_uri_path()
+string conv::ResourceHandle::getUriPath()
 {
        return uri_path;
 }
 
-int    conv::ResourceHandle::set_host_address(string host_address)
+int    conv::ResourceHandle::setHostAddress(string host_address)
 {
        this->host_address = host_address;
        return CONV_ERROR_NONE;
 }
 
-string conv::ResourceHandle::get_host_address()
+string conv::ResourceHandle::getHostAddress()
 {
        return host_address;
 }
 
-list<string>& conv::ResourceHandle::get_types()
+list<string>& conv::ResourceHandle::getTypes()
 {
        return types;
 }
 
-int    conv::ResourceHandle::add_types(string type)
+int    conv::ResourceHandle::addType(string type)
 {
        types.push_back(type);
        return CONV_ERROR_NONE;
 }
 
-list<string>& conv::ResourceHandle::get_interfaces()
+list<string>& conv::ResourceHandle::getInterfaces()
 {
        return interfaces;
 }
 
-int    conv::ResourceHandle::add_interfaces(string interface)
+int    conv::ResourceHandle::addInterface(string interface)
 {
        interfaces.push_back(interface);
        return CONV_ERROR_NONE;
index a02ab78..93fcfe9 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <list>
 #include <string>
-#include "../../conv_json.h"
+#include "../../Json.h"
 
 using namespace std;
 
@@ -35,27 +35,27 @@ class ResourceHandle {
                string  device_name;
                string  device_type;
                string  version;
-               json    services_list;
+               Json    services_list;
 
        public:
-               int             set_device_id(string dev_id);
-               string  get_device_id();
-               int             set_device_name(string dev_name);
-               string  get_device_name();
-               int             set_device_type(string dev_type);
-               string  get_device_type();
-               int             set_version(string ver);
-               string  get_version();
-               int             set_services_list(string list);
+               int             setDeviceId(string dev_id);
+               string  getDeviceId();
+               int             setDeviceName(string dev_name);
+               string  getDeviceName();
+               int             setDeviceType(string dev_type);
+               string  getDeviceType();
+               int             setVersion(string ver);
+               string  getVersion();
+               int             setServiceList(string list);
 
-               int             set_uri_path(string uri_path);
-               string  get_uri_path();
-               int             set_host_address(string host_address);
-               string  get_host_address();
-               list<string>&   get_types();
-               int             add_types(string type);
-               list<string>&   get_interfaces();
-               int             add_interfaces(string interface);
+               int             setUriPath(string uri_path);
+               string  getUriPath();
+               int             setHostAddress(string host_address);
+               string  getHostAddress();
+               list<string>&   getTypes();
+               int             addType(string type);
+               list<string>&   getInterfaces();
+               int             addInterface(string interface);
 };
 }
 #endif
index 2abdb0d..faba223 100644 (file)
@@ -29,28 +29,28 @@ conv::ServiceAdapter::~ServiceAdapter()
 
 string conv::ServiceAdapter::getName()
 {
-       return m_resource_h.get_device_name();
+       return m_resource_h.getDeviceName();
 }
 
 string conv::ServiceAdapter::getVersion()
 {
-       return m_resource_h.get_version();
+       return m_resource_h.getVersion();
 }
 
 string conv::ServiceAdapter::getType()
 {
-       return m_resource_h.get_device_type();
+       return m_resource_h.getDeviceType();
 }
 
 string conv::ServiceAdapter::getId()
 {
-       return m_resource_h.get_device_id();
+       return m_resource_h.getDeviceId();
 }
 
 string conv::ServiceAdapter::getUri()
 {
-       string uri_path = m_resource_h.get_uri_path();
-       string host_address = m_resource_h.get_host_address();
+       string uri_path = m_resource_h.getUriPath();
+       string host_address = m_resource_h.getHostAddress();
 
        return host_address + uri_path;
 }
@@ -15,7 +15,7 @@
  */
 
 #include <glib.h>
-#include "device.h"
+#include "SmartViewDevice.h"
 #include "Log.h"
 #include "d2d_conv_manager.h"
 #include <algorithm>
 
 using namespace std;
 
-conv::device::device()
+conv::SmartViewDevice::SmartViewDevice()
 {
 }
 
-conv::device::~device()
+conv::SmartViewDevice::~SmartViewDevice()
 {
 }
 
@@ -59,7 +59,7 @@ static bool serviceComparision(conv::IService* obj, int serviceType)
                return false;
 }
 
-int conv::device::add_service(IService* service_obj)
+int conv::SmartViewDevice::addService(IService* service_obj)
 {
        service_list_t::iterator itr;
        itr = std::find_if(service_list.begin(), service_list.end(), std::bind(serviceComparision, std::placeholders::_1, service_obj->getServiceType()));
@@ -75,28 +75,28 @@ int conv::device::add_service(IService* service_obj)
        return CONV_ERROR_NONE;
 }
 
-int conv::device::remove_service(IService* service_obj)
+int conv::SmartViewDevice::removeService(IService* service_obj)
 {
        service_list.remove(service_obj);
        return CONV_ERROR_NONE;
 }
 
-string conv::device::getName()
+string conv::SmartViewDevice::getName()
 {
        return name;
 }
 
-string conv::device::getId()
+string conv::SmartViewDevice::getId()
 {
        return id;
 }
 
-string conv::device::getAddress()
+string conv::SmartViewDevice::getAddress()
 {
        return ip_address;
 }
 
-int conv::device::get_services_list(std::list<IService*> *list)
+int conv::SmartViewDevice::getServiceList(std::list<IService*> *list)
 {
        for (service_list_t::iterator iterPos = service_list.begin(); iterPos != service_list.end(); ++iterPos)
        {
@@ -106,19 +106,19 @@ int conv::device::get_services_list(std::list<IService*> *list)
 }
 
 
-int conv::device::setName(string name)
+int conv::SmartViewDevice::setName(string name)
 {
        this->name = name;
        return CONV_ERROR_NONE;
 }
 
-int conv::device::setId(string id)
+int conv::SmartViewDevice::setId(string id)
 {
        this->id = id;
        return CONV_ERROR_NONE;
 }
 
-int conv::device::setAddress(string id)
+int conv::SmartViewDevice::setAddress(string id)
 {
        ip_address = id;
        return CONV_ERROR_NONE;
similarity index 76%
rename from daemon/discovery_provider/smartview/device.h
rename to daemon/discovery_provider/smartview/SmartViewDevice.h
index bf82074..aa77d88 100755 (executable)
  * limitations under the License.
  */
 
-#ifndef __CONV_DEVICE_H__
-#define __CONV_DEVICE_H__
+#ifndef __CONV_SMART_VIEW_DEVICE_H__
+#define __CONV_SMART_VIEW_DEVICE_H__
 
 #include <string>
 #include <vector>
 #include "../../IService.h"
-#include "../../conv_json.h"
+#include "../../Json.h"
 
 #include "../../IDevice.h"
 
 namespace conv {
-       class device : public IDevice {
+       class SmartViewDevice : public IDevice {
                public:
                        typedef std::list<IService*> service_list_t;
-                       device();
-                       ~device();
+                       SmartViewDevice();
+                       ~SmartViewDevice();
 
                        // functions from IDevice
-                       int add_service(IService* service_obj);
-                       int remove_service(IService* service_obj);
-                       int get_services_list(std::list<IService*> *list);
+                       int addService(IService* service_obj);
+                       int removeService(IService* service_obj);
+                       int getServiceList(std::list<IService*> *list);
                        std::string getName();
                        std::string getId();
                        std::string getAddress();
@@ -55,4 +55,4 @@ namespace conv {
        };
 }
 
-#endif /* End of __CONV_DEVICE_H__ */
+#endif /* End of __CONV_SMART_VIEW_DEVICE_H__ */
  */
 
 #include <glib.h>
-#include "service.h"
+#include "SmartViewService.h"
 
 using namespace std;
 
-conv::service::service()
+conv::SmartViewService::SmartViewService()
 {
 }
 
-conv::service::~service()
+conv::SmartViewService::~SmartViewService()
 {
 }
 
-string conv::service::getName()
+string conv::SmartViewService::getName()
 {
        return service_name;
 }
 
-string conv::service::getVersion()
+string conv::SmartViewService::getVersion()
 {
        return service_version;
 }
 
-string conv::service::getType()
+string conv::SmartViewService::getType()
 {
        return this->type;
 }
 
-string conv::service::getId()
+string conv::SmartViewService::getId()
 {
        return service_id;
 }
 
-string conv::service::getUri()
+string conv::SmartViewService::getUri()
 {
        return service_uri;
 }
 
-int conv::service::getServiceType()
+int conv::SmartViewService::getServiceType()
 {
        return service_type;
 }
 
-string conv::service::getServiceInfo()
+string conv::SmartViewService::getServiceInfo()
 {
        return service_info;
 }
 
-void conv::service::setName(string name)
+void conv::SmartViewService::setName(string name)
 {
        this->service_name = name;
 }
 
-void conv::service::setVersion(string version)
+void conv::SmartViewService::setVersion(string version)
 {
        this->service_version = version;
 }
 
-void conv::service::setType(string type)
+void conv::SmartViewService::setType(string type)
 {
        this->type = type;
 }
 
-void conv::service::setId(string id)
+void conv::SmartViewService::setId(string id)
 {
        this->service_id = id;
 }
 
-void conv::service::setUri(string uri)
+void conv::SmartViewService::setUri(string uri)
 {
        this->service_uri = uri;
 }
 
-void conv::service::setServiceInfo(string service_info)
+void conv::SmartViewService::setServiceInfo(string service_info)
 {
        this->service_info = service_info;
 }
 
-void conv::service::setServiceType(int service_type)
+void conv::SmartViewService::setServiceType(int service_type)
 {
        this->service_type = service_type;
 }
 
-void conv::service::printInfo()
+void conv::SmartViewService::printInfo()
 {
        _D("Flow Service Info : Name[%s] Version[%s] Type[%d] Id[%s] Uri[%s] ",
                        service_name.c_str(), service_version.c_str(), service_type,
  * limitations under the License.
  */
 
-#ifndef __CONV_SERVICE_H__
-#define __CONV_SERVICE_H__
+#ifndef __CONV_SMART_VIEW_SERVICE_H__
+#define __CONV_SMART_VIEW_SERVICE_H__
 
 #include <string>
-#include "../../conv_json.h"
+#include "../../Json.h"
 #include "../../IService.h"
 
 using namespace std;
 
 namespace conv
 {
-       class service : public IService {
+       class SmartViewService : public IService {
                public:
-                       service();
-                       ~service();
+                       SmartViewService();
+                       ~SmartViewService();
 
                        // functions from IService
                        string getName();
@@ -62,4 +62,4 @@ namespace conv
        };
 }
 
-#endif /* End of __CONV_SERVICE_H__ */
+#endif /* End of __CONV_SMART_VIEW_SERVICE_H__ */
diff --git a/daemon/request.cpp b/daemon/request.cpp
deleted file mode 100755 (executable)
index 211e554..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <glib.h>
-#include "Types.h"
-#include "request.h"
-#include "DbusServer.h"
-
-conv::request::request(int type, const char* client, int req_id, const char* subj, const char* desc)
-       : _type(type)
-       , _req_id(req_id)
-       , _client(client)
-       , _subject(subj)
-       , _description(desc)
-{
-}
-
-conv::request::request(int type,
-               const char *client, int req_id, const char *subj, const char *desc,
-               const char *sender, Credentials *creds, GDBusMethodInvocation *inv)
-       :  _type(type)
-       , _req_id(req_id)
-       , _client(client)
-       , _subject(subj)
-       , _description(desc)
-       , __creds(creds)
-       , __sender(sender)
-       , __invocation(inv)
-{
-}
-
-conv::request::~request()
-{
-       if ( __creds != NULL ) {
-               delete __creds;
-       }
-}
-
-int conv::request::get_type()
-{
-       return _type;
-}
-
-int conv::request::get_id()
-{
-       return _req_id;
-}
-
-const char* conv::request::get_client()
-{
-       return _client.c_str();
-}
-
-const char* conv::request::get_sender()
-{
-       return __sender.c_str();
-}
-
-const char* conv::request::get_subject()
-{
-       return _subject.c_str();
-}
-
-json& conv::request::get_description()
-{
-       return _description;
-}
-
-conv::Credentials* conv::request::get_creds()
-{
-       return __creds;
-}
-
-bool conv::request::reply(int error)
-{
-       IF_FAIL_RETURN(__invocation, true);
-
-       _I("Reply %#x", error);
-
-       g_dbus_method_invocation_return_value(__invocation, g_variant_new("(iss)", error, EMPTY_JSON_OBJECT, EMPTY_JSON_OBJECT));
-       __invocation = NULL;
-       _D("Reply done");
-       return true;
-}
-
-bool conv::request::reply(int error, json& request_result)
-{
-       IF_FAIL_RETURN(__invocation, true);
-       IF_FAIL_RETURN(_type != REQ_READ_SYNC, true);
-
-       char *result = request_result.dup_cstr();
-       IF_FAIL_RETURN_TAG(result, false, _E, "Memory allocation failed");
-
-       _I("Reply %#x", error);
-       _SD("Result: %s", result);
-
-       g_dbus_method_invocation_return_value(__invocation, g_variant_new("(iss)", error, result, EMPTY_JSON_OBJECT));
-       __invocation = NULL;
-
-       g_free(result);
-       return true;
-}
-
-bool conv::request::reply(int error, json& request_result, json& data_read)
-{
-       if (__invocation == NULL) {
-               return publish(error, data_read);
-       }
-
-       char *result = NULL;
-       char *data = NULL;
-
-       result = request_result.dup_cstr();
-       IF_FAIL_CATCH_TAG(result, _E, "Memory allocation failed");
-
-       data = data_read.dup_cstr();
-       IF_FAIL_CATCH_TAG(data, _E, "Memory allocation failed");
-
-       _I("Reply %#x", error);
-       _SD("Result: %s", result);
-       _SD("Data: %s", data);
-
-       g_dbus_method_invocation_return_value(__invocation, g_variant_new("(iss)", error, result, data));
-       __invocation = NULL;
-
-       g_free(result);
-       g_free(data);
-       return true;
-
-CATCH:
-       g_free(result);
-       g_free(data);
-       return false;
-}
-
-bool conv::request::publish(int error, json& data)
-{
-       char *data_str = data.dup_cstr();
-       IF_FAIL_RETURN_TAG(data_str, false, _E, "Memory allocation failed");
-
-       _D("info : sendor %s", __sender.c_str());
-       _D("info : req_id %d", _req_id);
-       _D("info : subject %s", _subject.c_str());
-       _D("info : error %d", error);
-       _D("info : data %s", data_str);
-       _D("info : description %s", _description.str().c_str());
-       _D("publish info : sender[%s] req_id[%d] subject[%s] error[%d] data[%s]"
-                       , __sender.c_str(), _req_id, _subject.c_str(), error, data_str);
-
-       conv::dbus_server::publish(__sender.c_str(), _req_id, _subject.c_str(), error, data_str);
-       g_free(data_str);
-
-       return true;
-}
-
-bool conv::request::get_channel_from_description(json* target)
-{
-       return _description.get(NULL, CONV_JSON_CHANNEL, target);
-}
-
-bool conv::request::get_payload_from_description(json* target)
-{
-       return _description.get(NULL, CONV_JSON_PAYLOAD, target);
-}
index 0e1d3d2..04ebd0c 100755 (executable)
@@ -21,7 +21,7 @@
 #include <glib.h>
 #include <vector>
 #include "../IServiceInfo.h"
-#include "../request.h"
+#include "../Request.h"
 #include "Service.h"
 #include "Clients.h"
 #include "Application.h"
@@ -37,7 +37,7 @@ namespace conv {
                                        delete application;
                        }
 
-                       conv::request** request_obj;
+                       conv::Request** request_obj;
                        Channel* application;
                        string uri;
                        string channel_id;
@@ -50,13 +50,13 @@ namespace conv {
 
                                if ((*request_obj) != NULL) {
                                        _D(RED("publishing_response"));
-                                       json result;
-                                       json payload;
-                                       json description;
+                                       Json result;
+                                       Json payload;
+                                       Json description;
 
                                        payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_START);
 
-                                       description = (*request_obj)->get_description();
+                                       description = (*request_obj)->getDescription();
 
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_URI, uri);
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_CHANNEL_ID, channel_id);
@@ -80,13 +80,13 @@ namespace conv {
 
                                if ((*request_obj) != NULL) {
                                        _D(RED("publishing_response"));
-                                       json result;
-                                       json payload;
-                                       json description;
+                                       Json result;
+                                       Json payload;
+                                       Json description;
 
                                        payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_STOP);
 
-                                       description = (*request_obj)->get_description();
+                                       description = (*request_obj)->getDescription();
 
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_URI, uri);
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_CHANNEL_ID, channel_id);
@@ -103,7 +103,7 @@ namespace conv {
                        void onConnect(Client client)
                        {
                                _D("onConnect Called");
-                               publish_response(CONV_ERROR_NONE, CONV_JSON_ON_CONNECT, &client);
+                               publishResponse(CONV_ERROR_NONE, CONV_JSON_ON_CONNECT, &client);
 
                                if (!is_local && application != NULL) {
                                        ((Application*)application)->start();
@@ -114,19 +114,19 @@ namespace conv {
                        void onDisconnect(Client client)
                        {
                                _D("onDisconnect Called");
-                               publish_response(CONV_ERROR_NONE, CONV_JSON_ON_DISCONNECT, &client);
+                               publishResponse(CONV_ERROR_NONE, CONV_JSON_ON_DISCONNECT, &client);
                        }
 
                        void onClientConnect(Client client)
                        {
                                _D("onClientConnect Called");
-                               publish_response(CONV_ERROR_NONE, CONV_JSON_ON_CLIENT_CONNECT, &client);
+                               publishResponse(CONV_ERROR_NONE, CONV_JSON_ON_CLIENT_CONNECT, &client);
                        }
 
                        void onClientDisconnect(Client client)
                        {
                                _D("onClientDisconnect Called");
-                               publish_response(CONV_ERROR_NONE, CONV_JSON_ON_CLIENT_DISCONNECT, &client);
+                               publishResponse(CONV_ERROR_NONE, CONV_JSON_ON_CLIENT_DISCONNECT, &client);
                        }
 
                        void onMessage(Message message)
@@ -135,9 +135,9 @@ namespace conv {
 
                                if ((*request_obj) != NULL) {
                                        _D(RED("publishing_response"));
-                                       json result;
-                                       json message_json;
-                                       json description;
+                                       Json result;
+                                       Json message_json;
+                                       Json description;
 
                                        _D("size %d", message.m_payload_size);
                                        _D("payload %s", message.m_payload);
@@ -147,13 +147,13 @@ namespace conv {
                                        message_json.set(NULL, CONV_JSON_FROM, message.m_from);
                                        string payload_str(reinterpret_cast<const char*>(message.m_payload), message.m_payload_size);
 
-                                       json payload = payload_str;
+                                       Json payload = payload_str;
 
                                        payload.set(NULL, CONV_JSON_PAYLOAD_SIZE, message.m_payload_size);
                                        payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_MESSAGE);
                                        payload.set(NULL, CONV_JSON_MESSAGE, message_json);
 
-                                       description = (*request_obj)->get_description();
+                                       description = (*request_obj)->getDescription();
 
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_URI, uri);
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_CHANNEL_ID, channel_id);
@@ -170,14 +170,14 @@ namespace conv {
 
                                if ((*request_obj) != NULL) {
                                        _D(RED("publishing_response"));
-                                       json result;
-                                       json payload;
-                                       json description;
+                                       Json result;
+                                       Json payload;
+                                       Json description;
 
                                        payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_ERROR);
                                        payload.set(NULL, CONV_JSON_ERROR_MESSAGE, error.get_error_message());
 
-                                       description = (*request_obj)->get_description();
+                                       description = (*request_obj)->getDescription();
 
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_URI, uri);
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_CHANNEL_ID, channel_id);
@@ -194,13 +194,13 @@ namespace conv {
 
                                if ((*request_obj) != NULL) {
                                        _D(RED("publishing_response"));
-                                       json result;
-                                       json payload;
-                                       json description;
+                                       Json result;
+                                       Json payload;
+                                       Json description;
 
                                        payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_PUBLISH);
 
-                                       description = (*request_obj)->get_description();
+                                       description = (*request_obj)->getDescription();
 
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_URI, uri);
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_CHANNEL_ID, channel_id);
@@ -214,17 +214,17 @@ namespace conv {
                                }
                        }
 
-                       void publish_response(int error, string result_type, Client *client)
+                       void publishResponse(int error, string result_type, Client *client)
                        {
                                bool isHost = client->isHost();
                                int connecttime = client->getConnectTime();
 
                                if ((*request_obj) != NULL) {
                                        _D(RED("publishing_response"));
-                                       json result;
-                                       json payload;
-                                       json client_json;
-                                       json description;
+                                       Json result;
+                                       Json payload;
+                                       Json client_json;
+                                       Json description;
 
                                        client_json.set(NULL, CONV_JSON_IS_HOST, isHost);
                                        client_json.set(NULL, CONV_JSON_CONNECT_TIME, connecttime);
@@ -233,7 +233,7 @@ namespace conv {
                                        payload.set(NULL, CONV_JSON_RESULT_TYPE, result_type);
                                        payload.set(NULL, CONV_JSON_CLIENT, client_json);
 
-                                       description = (*request_obj)->get_description();
+                                       description = (*request_obj)->getDescription();
 
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_URI, uri);
                                        description.set(CONV_JSON_CHANNEL, CONV_JSON_CHANNEL_ID, channel_id);
@@ -279,7 +279,7 @@ namespace conv {
                        Service service_obj;
                        bool is_local;
                        bool get_service_result;
-                       conv::request* registered_request;
+                       conv::Request* registered_request;
 
                        application_instance_list_t application_instance_list;
        };
index 74a8724..68f5d33 100755 (executable)
@@ -26,31 +26,31 @@ static void vconf_update_cb(keynode_t *node, void* user_data)
        conv::AppCommServiceProvider* instance = static_cast<conv::AppCommServiceProvider*>(user_data);
        IF_FAIL_VOID_TAG(instance, _E, "static_cast failed");
 
-       instance->handle_vconf_update(node);
+       instance->handleVconfUpdate(node);
 }
 
 conv::AppCommServiceProvider::AppCommServiceProvider()
 {
-       _type = CONV_SERVICE_TYPE_SMARTVIEW_APP_COMMUNICATION;
-       _resource_type = CONV_RESOURCE_TYPE_SMARTVIEW_APP_COMMUNICATION;
-       _uri = CONV_URI_SMARTVIEW_APP_COMMUNICATION;
+       __type = CONV_SERVICE_TYPE_SMARTVIEW_APP_COMMUNICATION;
+       __resourceType = CONV_RESOURCE_TYPE_SMARTVIEW_APP_COMMUNICATION;
+       __uri = CONV_URI_SMARTVIEW_APP_COMMUNICATION;
        if (conv::util::isServiceActivated(CONV_INTERNAL_SERVICE_APP_TO_APP_COMMUNICATION))
-               _activation_state = 1;
+               __activationState = 1;
        else
-               _activation_state = 0;
+               __activationState = 0;
 
        vconf_notify_key_changed(VCONFKEY_SETAPPL_D2D_CONVERGENCE_SERVICE, vconf_update_cb, this);
 }
 
-int conv::AppCommServiceProvider::handle_vconf_update(keynode_t *node)
+int conv::AppCommServiceProvider::handleVconfUpdate(keynode_t *node)
 {
        int current_state = vconf_keynode_get_int(node);
 
        if ((CONV_INTERNAL_SERVICE_APP_TO_APP_COMMUNICATION & current_state) > 0) {
-               _activation_state = 1;
+               __activationState = 1;
                init();
        } else {
-               _activation_state = 0;
+               __activationState = 0;
                release();
        }
 
@@ -73,18 +73,18 @@ int conv::AppCommServiceProvider::release()
        return CONV_ERROR_NONE;
 }
 
-int conv::AppCommServiceProvider::load_service_info(request* request_obj)
+int conv::AppCommServiceProvider::loadServiceInfo(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        string client;
-       conv::client* client_obj = NULL;
+       conv::ClientInfo* client_obj = NULL;
        int is_local = 0;
 
-       json service;
+       Json service;
        string name, version, type, id, uri;
 
-       json description = request_obj->get_description();
+       Json description = request_obj->getDescription();
 
        description.get(NULL, CONV_JSON_SERVICE, &service);
 
@@ -96,7 +96,7 @@ int conv::AppCommServiceProvider::load_service_info(request* request_obj)
 
        description.get(NULL, CONV_JSON_IS_LOCAL, &is_local);
 
-       client = request_obj->get_sender();
+       client = request_obj->getSender();
 
        _D("client id : %s", client.c_str());
        client_obj = conv::client_manager::getClient(client);
@@ -105,7 +105,7 @@ int conv::AppCommServiceProvider::load_service_info(request* request_obj)
        AppCommServiceInfo *svc_info = NULL;
 
        if (is_local == 1) {
-               IServiceInfo* svc_info_base = client_obj->get_service_info(_type, "LOCAL_HOST");
+               IServiceInfo* svc_info_base = client_obj->getServiceInfo(__type, "LOCAL_HOST");
 
                if ( svc_info_base != NULL ) {
                        _D("local service instance already exists");
@@ -121,12 +121,12 @@ int conv::AppCommServiceProvider::load_service_info(request* request_obj)
                        ASSERT_ALLOC(svc_info);
 
                        svc_info->is_local = true;
-                       client_obj->add_service_info(_type, "LOCAL_HOST", (IServiceInfo*)svc_info);
+                       client_obj->addServiceInfo(__type, "LOCAL_HOST", (IServiceInfo*)svc_info);
 
                        _D("MSF service is created");
                }
        } else {
-               IServiceInfo* svc_info_base = client_obj->get_service_info(_type, id);
+               IServiceInfo* svc_info_base = client_obj->getServiceInfo(__type, id);
 
                if ( svc_info_base != NULL ) {
                        _D("service instance already exists");
@@ -145,24 +145,24 @@ int conv::AppCommServiceProvider::load_service_info(request* request_obj)
                        Service::getByURI(uri, 2000, svc_info);
                        IF_FAIL_RETURN_TAG(svc_info->get_service_result == true, CONV_ERROR_INVALID_OPERATION, _E, "getByURI failed");
                        svc_info->is_local = false;
-                       client_obj->add_service_info(_type, id, (IServiceInfo*)svc_info);
+                       client_obj->addServiceInfo(__type, id, (IServiceInfo*)svc_info);
 
                        _D("MSF service is created");
                }
        }
-       request_obj->service_info = svc_info;
+       request_obj->setServiceInfo(svc_info);
        return CONV_ERROR_NONE;
 }
 
-int conv::AppCommServiceProvider::start_request(request* request_obj)
+int conv::AppCommServiceProvider::startRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/start requested");
-       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->service_info);
+       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->getServiceInfo());
 
-       json channel;
-       request_obj->get_channel_from_description(&channel);
+       Json channel;
+       request_obj->getChannelFromDescription(&channel);
 
        string uri, channel_id;
 
@@ -245,15 +245,15 @@ int conv::AppCommServiceProvider::start_request(request* request_obj)
        return CONV_ERROR_NONE;
 }
 
-int conv::AppCommServiceProvider::stop_request(request* request_obj)
+int conv::AppCommServiceProvider::stopRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/stop requested");
-       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->service_info);
+       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->getServiceInfo());
 
-       json channel;
-       request_obj->get_channel_from_description(&channel);
+       Json channel;
+       request_obj->getChannelFromDescription(&channel);
 
        string uri, channel_id;
 
@@ -287,15 +287,15 @@ int conv::AppCommServiceProvider::stop_request(request* request_obj)
 }
 
 
-int conv::AppCommServiceProvider::get_request(request* request_obj)
+int conv::AppCommServiceProvider::readRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/get requested");
-       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->service_info);
+       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->getServiceInfo());
 
-       json channel;
-       request_obj->get_channel_from_description(&channel);
+       Json channel;
+       request_obj->getChannelFromDescription(&channel);
 
        string uri, channel_id;
 
@@ -303,7 +303,7 @@ int conv::AppCommServiceProvider::get_request(request* request_obj)
        channel.get(NULL, CONV_JSON_CHANNEL_ID, &channel_id);
 
        application_instance *app_info = NULL;
-       json result;
+       Json result;
 
        for (application_instance_list_t::iterator iter = svc_info->application_instance_list.begin(); iter != svc_info->application_instance_list.end(); ++iter) {
                _D("iteration");
@@ -316,14 +316,14 @@ int conv::AppCommServiceProvider::get_request(request* request_obj)
 
                                if ( svc_info->registered_request == NULL) {
                                        _D("No callback is registered");
-                                       send_read_response(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
+                                       sendReadResponse(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
 
                                        return CONV_ERROR_INVALID_OPERATION;
                                }
 
                                if (client_list == NULL) {
                                        _D("No clients");
-                                       send_read_response(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_NO_DATA, svc_info->registered_request);
+                                       sendReadResponse(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_NO_DATA, svc_info->registered_request);
 
                                        return CONV_ERROR_NO_DATA;
                                } else {
@@ -335,7 +335,7 @@ int conv::AppCommServiceProvider::get_request(request* request_obj)
                                        _D("clients size = %d", client_list->size());
                                        for (auto cs_itr = cl.begin(); cs_itr != cl.end(); cs_itr++) {
                                                cs_index++;
-                                               json client;
+                                               Json client;
 
                                                client.set(NULL, CONV_JSON_CLIENT_ID, (*cs_itr).getId());
                                                client.set(NULL, CONV_JSON_IS_HOST, (*cs_itr).isHost());
@@ -346,9 +346,9 @@ int conv::AppCommServiceProvider::get_request(request* request_obj)
                                                if (cha != NULL)
                                                        client.set(NULL, CONV_JSON_CHANNEL_URI, cha->getChannelUri(NULL).c_str());
 
-                                               result.array_append(NULL, CONV_JSON_CLIENT_LIST, client);
+                                               result.appendArray(NULL, CONV_JSON_CLIENT_LIST, client);
                                        }
-                                       send_read_response(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_NONE, svc_info->registered_request);
+                                       sendReadResponse(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_NONE, svc_info->registered_request);
 
                                        return CONV_ERROR_NONE;
                                }
@@ -356,18 +356,18 @@ int conv::AppCommServiceProvider::get_request(request* request_obj)
                }
        }
        _D("service is not started");
-       send_read_response(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
+       sendReadResponse(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
 
        return CONV_ERROR_INVALID_OPERATION;
 }
 
-int conv::AppCommServiceProvider::send_read_response(json payload, const char* read_type, conv_error_e error, request* request_obj)
+int conv::AppCommServiceProvider::sendReadResponse(Json payload, const char* read_type, conv_error_e error, Request* request_obj)
 {
        _D(RED("publishing_response"));
        IF_FAIL_RETURN_TAG(request_obj != NULL, CONV_ERROR_INVALID_OPERATION, _E, "listener_cb is not registered");
 
-       json result;
-       json description = request_obj->get_description();
+       Json result;
+       Json description = request_obj->getDescription();
 
        payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_READ);
        payload.set(NULL, CONV_JSON_READ_TYPE, read_type);
@@ -379,15 +379,15 @@ int conv::AppCommServiceProvider::send_read_response(json payload, const char* r
        return CONV_ERROR_NONE;
 }
 
-int conv::AppCommServiceProvider::set_request(request* request_obj)
+int conv::AppCommServiceProvider::publishRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/set requested");
-       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->service_info);
+       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->getServiceInfo());
 
-       json channel;
-       request_obj->get_channel_from_description(&channel);
+       Json channel;
+       request_obj->getChannelFromDescription(&channel);
 
        string uri, channel_id;
 
@@ -400,9 +400,9 @@ int conv::AppCommServiceProvider::set_request(request* request_obj)
                        if ( (*iter)->application != NULL ) {
                                _D("publishing payload");
 
-                               json payload;
+                               Json payload;
 
-                               request_obj->get_payload_from_description(&payload);
+                               request_obj->getPayloadFromDescription(&payload);
 
                                char* message = new(std::nothrow) char[strlen(payload.str().c_str())+1];
                                ASSERT_ALLOC(message);
@@ -426,14 +426,14 @@ int conv::AppCommServiceProvider::set_request(request* request_obj)
        return CONV_ERROR_NONE;
 }
 
-int conv::AppCommServiceProvider::register_request(request* request_obj)
+int conv::AppCommServiceProvider::registerRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/recv requested");
-       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->service_info);
+       AppCommServiceInfo *svc_info = reinterpret_cast<AppCommServiceInfo*>(request_obj->getServiceInfo());
 
-       switch (request_obj->get_type()) {
+       switch (request_obj->getType()) {
        case REQ_SUBSCRIBE:
                if ( svc_info->registered_request != NULL ) {
                        delete svc_info->registered_request;
@@ -456,9 +456,9 @@ int conv::AppCommServiceProvider::register_request(request* request_obj)
        return CONV_ERROR_NONE;
 }
 
-int conv::AppCommServiceProvider::get_service_info_for_discovery(json* json_obj)
+int conv::AppCommServiceProvider::getServiceInfoForDiscovery(Json* json_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_NOT_SUPPORTED, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_NOT_SUPPORTED, _E, "service provider is not activated");
 
        json_obj->set(NULL, CONV_JSON_DISCOVERY_SERVICE_TYPE, CONV_SERVICE_APP_TO_APP_COMMUNICATION);
 
@@ -493,7 +493,7 @@ int conv::AppCommServiceProvider::get_service_info_for_discovery(json* json_obj)
 
                snprintf(uri, sizeof(uri), "http://%s:8001/api/v2/", address);
 
-               json info;
+               Json info;
 
                info.set(NULL, CONV_JSON_SERVICE_DATA_URI, uri);
                info.set(NULL, CONV_JSON_SERVICE_DATA_VERSION, local_service.getVersion());
index ca5560e..89e256d 100644 (file)
@@ -33,18 +33,18 @@ namespace conv {
                        int init();
                        int release();
 
-                       AppCommServiceInfo* get_svc_info(request* request_obj);
-                       int start_request(request* request_obj);
-                       int stop_request(request* request_obj);
-                       int get_request(request* request_obj);
-                       int set_request(request* request_obj);
-                       int register_request(request* request_obj);
-                       int load_service_info(request* request_obj);
-                       int get_service_info_for_discovery(json* json_obj);
-                       int handle_vconf_update(keynode_t *node);
+                       AppCommServiceInfo* get_svc_info(Request* request_obj);
+                       int startRequest(Request* request_obj);
+                       int stopRequest(Request* request_obj);
+                       int readRequest(Request* request_obj);
+                       int publishRequest(Request* request_obj);
+                       int registerRequest(Request* request_obj);
+                       int loadServiceInfo(Request* request_obj);
+                       int getServiceInfoForDiscovery(Json* json_obj);
+                       int handleVconfUpdate(keynode_t *node);
 
                private:
-                       int send_read_response(json payload, const char* read_type, conv_error_e error, request* request_obj);
+                       int sendReadResponse(Json payload, const char* read_type, conv_error_e error, Request* request_obj);
        };
 }
 #endif /* __APP_COMMUNICATION_SERVICE_PROVIDER_H__ */
index ff16790..27b14d7 100644 (file)
@@ -22,7 +22,7 @@
 #include <vector>
 #include "../IServiceInfo.h"
 #include "../IotconCommunicationInfo.h"
-#include "../request.h"
+#include "../Request.h"
 #include <iotcon.h>
 
 namespace conv {
@@ -47,7 +47,7 @@ namespace conv {
                        std::string device_id;
                        std::string device_name;
                        std::string device_address;
-                       request* registered_request;
+                       Request* registered_request;
                        IotconCommunicationInfo iotcon_info_obj;
        };
 
index bb6db96..6f29d10 100755 (executable)
@@ -30,7 +30,7 @@ struct app_control_cb_info_s {
 
 struct response_cb_info_s {
        int req_id;
-       conv::request* request_obj;
+       conv::Request* request_obj;
 };
 
 static int get_req_id()
@@ -52,19 +52,19 @@ static void vconf_update_cb(keynode_t *node, void* user_data)
        conv::RemoteAppControlServiceProvider* instance = static_cast<conv::RemoteAppControlServiceProvider*>(user_data);
        IF_FAIL_VOID_TAG(instance, _E, "static_cast failed");
 
-       instance->handle_vconf_update(node);
+       instance->handleVconfUpdate(node);
 }
 
 conv::RemoteAppControlServiceProvider::RemoteAppControlServiceProvider()
 {
-       _type = CONV_SERVICE_TYPE_REMOTE_APP_CONTROL;
-       _resource_type = CONV_RESOURCE_TYPE_REMOTE_APP_CONTROL;
-       _uri = CONV_URI_REMOTE_APP_CONTROL;
+       __type = CONV_SERVICE_TYPE_REMOTE_APP_CONTROL;
+       __resourceType = CONV_RESOURCE_TYPE_REMOTE_APP_CONTROL;
+       __uri = CONV_URI_REMOTE_APP_CONTROL;
        iotcon_resource = NULL;
        if (conv::util::isServiceActivated(CONV_INTERNAL_SERVICE_REMOTE_APP_CONTROL))
-               _activation_state = 1;
+               __activationState = 1;
        else
-               _activation_state = 0;
+               __activationState = 0;
 
        vconf_notify_key_changed(VCONFKEY_SETAPPL_D2D_CONVERGENCE_SERVICE, vconf_update_cb, this);
 }
@@ -75,15 +75,15 @@ conv::RemoteAppControlServiceProvider::~RemoteAppControlServiceProvider()
        response_cb_map.clear();
 }
 
-int conv::RemoteAppControlServiceProvider::handle_vconf_update(keynode_t *node)
+int conv::RemoteAppControlServiceProvider::handleVconfUpdate(keynode_t *node)
 {
        int current_state = vconf_keynode_get_int(node);
 
        if ((CONV_INTERNAL_SERVICE_REMOTE_APP_CONTROL & current_state) > 0) {
-               _activation_state = 1;
+               __activationState = 1;
                init();
        } else {
-               _activation_state = 0;
+               __activationState = 0;
                release();
        }
 
@@ -243,7 +243,7 @@ static int handle_request(iotcon_representation_h rep, iotcon_request_h request)
        return CONV_ERROR_NONE;
 }
 
-void conv::RemoteAppControlServiceProvider::iotcon_request_cb(iotcon_resource_h resource, iotcon_request_h request, void *user_data)
+void conv::RemoteAppControlServiceProvider::__iotcon_request_cb(iotcon_resource_h resource, iotcon_request_h request, void *user_data)
 {
        _D("request cb called");
 
@@ -304,7 +304,7 @@ int conv::RemoteAppControlServiceProvider::init()
                error = iotcon_resource_types_create(&resource_types);
                IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "rt creation failed");
 
-               iotcon_resource_types_add(resource_types, _resource_type.c_str());
+               iotcon_resource_types_add(resource_types, __resourceType.c_str());
 
                error = iotcon_resource_interfaces_create(&resource_ifaces);
 
@@ -313,7 +313,7 @@ int conv::RemoteAppControlServiceProvider::init()
                iotcon_resource_interfaces_add(resource_ifaces, IOTCON_INTERFACE_DEFAULT);
 
 
-               error = iotcon_resource_create(CONV_URI_REMOTE_APP_CONTROL, resource_types, resource_ifaces, properties, iotcon_request_cb, NULL, &iotcon_resource);
+               error = iotcon_resource_create(CONV_URI_REMOTE_APP_CONTROL, resource_types, resource_ifaces, properties, __iotcon_request_cb, NULL, &iotcon_resource);
                IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "resource creation failed");
 
                iotcon_resource_types_destroy(resource_types);
@@ -341,23 +341,23 @@ int conv::RemoteAppControlServiceProvider::release()
        return CONV_ERROR_NONE;
 }
 
-int conv::RemoteAppControlServiceProvider::start_request(request* request_obj)
+int conv::RemoteAppControlServiceProvider::startRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/start requested");
        int error;
-       json result;
+       Json result;
 
        int properties;
        iotcon_resource_interfaces_h resource_ifaces = NULL;
        iotcon_resource_types_h resource_types = NULL;
 
-       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->service_info);
+       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->getServiceInfo());
 
        if (svc_info->iotcon_info_obj.iotcon_resource_handle != NULL) {
                _D("already started");
-               send_response(result, CONV_JSON_ON_START, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
+               sendResponse(result, CONV_JSON_ON_START, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
                return CONV_ERROR_INVALID_OPERATION;
        }
 
@@ -384,18 +384,18 @@ int conv::RemoteAppControlServiceProvider::start_request(request* request_obj)
        iotcon_resource_types_destroy(resource_types);
        iotcon_resource_interfaces_destroy(resource_ifaces);
 
-       send_response(result, CONV_JSON_ON_START, CONV_ERROR_NONE, svc_info->registered_request);
+       sendResponse(result, CONV_JSON_ON_START, CONV_ERROR_NONE, svc_info->registered_request);
 
        return CONV_ERROR_NONE;
 }
 
-int conv::RemoteAppControlServiceProvider::send_response(json payload, const char* request_type, conv_error_e error, request* request_obj)
+int conv::RemoteAppControlServiceProvider::sendResponse(Json payload, const char* request_type, conv_error_e error, Request* request_obj)
 {
        _D(RED("publishing_response"));
        IF_FAIL_RETURN_TAG(request_obj != NULL, CONV_ERROR_INVALID_OPERATION, _E, "listener_cb is not registered");
 
-       json result;
-       json description = request_obj->get_description();
+       Json result;
+       Json description = request_obj->getDescription();
 
        payload.set(NULL, CONV_JSON_RESULT_TYPE, request_type);
 
@@ -406,31 +406,31 @@ int conv::RemoteAppControlServiceProvider::send_response(json payload, const cha
        return CONV_ERROR_NONE;
 }
 
-int conv::RemoteAppControlServiceProvider::stop_request(request* request_obj)
+int conv::RemoteAppControlServiceProvider::stopRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/stop requested");
-       json result;
+       Json result;
 
-       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->service_info);
+       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->getServiceInfo());
 
        if (svc_info->iotcon_info_obj.iotcon_resource_handle == NULL) {
                _D("not even started");
-               send_response(result, CONV_JSON_ON_STOP, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
+               sendResponse(result, CONV_JSON_ON_STOP, CONV_ERROR_INVALID_OPERATION, svc_info->registered_request);
                return CONV_ERROR_INVALID_OPERATION;
        }
 
        iotcon_remote_resource_destroy(svc_info->iotcon_info_obj.iotcon_resource_handle);
        svc_info->iotcon_info_obj.iotcon_resource_handle = NULL;
-       send_response(result, CONV_JSON_ON_STOP, CONV_ERROR_NONE, svc_info->registered_request);
+       sendResponse(result, CONV_JSON_ON_STOP, CONV_ERROR_NONE, svc_info->registered_request);
 
        return CONV_ERROR_NONE;
 }
 
-int conv::RemoteAppControlServiceProvider::get_request(request* request_obj)
+int conv::RemoteAppControlServiceProvider::readRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        return CONV_ERROR_NONE;
 }
@@ -476,16 +476,16 @@ static void on_response(iotcon_remote_resource_h resource, iotcon_error_e err,
 
        _D(RED("publishing_response"));
        if (cb_info.request_obj) {
-               json result;
-               json payload;
-               json description;
+               conv::Json result;
+               conv::Json payload;
+               conv::Json description;
 
                if (cb_info.request_obj == NULL) {
                        _E("listener_cb is not registered");
                } else {
                        payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_PUBLISH);
                        payload.set(NULL, CONV_JSON_APP_CONTROL, appctl_char);
-                       result.set(NULL, CONV_JSON_DESCRIPTION, cb_info.request_obj->get_description());
+                       result.set(NULL, CONV_JSON_DESCRIPTION, cb_info.request_obj->getDescription());
                        result.set(NULL, CONV_JSON_PAYLOAD, payload);
 
                        cb_info.request_obj->publish(CONV_ERROR_NONE, result);
@@ -495,20 +495,20 @@ static void on_response(iotcon_remote_resource_h resource, iotcon_error_e err,
        response_cb_map.erase(find_iter);
 }
 
-int conv::RemoteAppControlServiceProvider::set_request(request* request_obj)
+int conv::RemoteAppControlServiceProvider::publishRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
-       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->service_info);
+       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->getServiceInfo());
        int error;
 
-       request_obj->communication_info = &(svc_info->iotcon_info_obj);
+       request_obj->setCommunicationInfo(&(svc_info->iotcon_info_obj));
 
        iotcon_representation_h representation;
        iotcon_representation_create(&representation);
 
-       json payload;
-       request_obj->get_payload_from_description(&payload);
+       Json payload;
+       request_obj->getPayloadFromDescription(&payload);
 
        string app_control;
        int reply;
@@ -542,21 +542,21 @@ int conv::RemoteAppControlServiceProvider::set_request(request* request_obj)
        IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "iotcon_remote_resource_put failed");
 
        if (reply != 1) {
-               json result;
-               send_response(result, CONV_JSON_ON_PUBLISH, CONV_ERROR_NONE, svc_info->registered_request);
+               Json result;
+               sendResponse(result, CONV_JSON_ON_PUBLISH, CONV_ERROR_NONE, svc_info->registered_request);
        }
 
        return CONV_ERROR_NONE;
 }
 
-int conv::RemoteAppControlServiceProvider::register_request(request* request_obj)
+int conv::RemoteAppControlServiceProvider::registerRequest(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        _D("communcation/recv requested");
-       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->service_info);
+       RemoteAppControlServiceInfo *svc_info = reinterpret_cast<RemoteAppControlServiceInfo*>(request_obj->getServiceInfo());
 
-       switch (request_obj->get_type()) {
+       switch (request_obj->getType()) {
        case REQ_SUBSCRIBE:
                if (svc_info->registered_request != NULL) {
                        delete svc_info->registered_request;
@@ -581,21 +581,21 @@ int conv::RemoteAppControlServiceProvider::register_request(request* request_obj
 }
 
 
-int conv::RemoteAppControlServiceProvider::load_service_info(request* request_obj)
+int conv::RemoteAppControlServiceProvider::loadServiceInfo(Request* request_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_INVALID_OPERATION, _E, "service provider is not activated");
 
        string client;
-       conv::client* client_obj = NULL;
+       conv::ClientInfo* client_obj = NULL;
 
-       client = request_obj->get_sender();
+       client = request_obj->getSender();
        _D("client id : %s", client.c_str());
        client_obj = conv::client_manager::getClient(client);
        IF_FAIL_RETURN_TAG(client_obj, CONV_ERROR_OUT_OF_MEMORY, _E, "client info alloc failed");
 
-       json description = request_obj->get_description();
-       json service;
-       json device;
+       Json description = request_obj->getDescription();
+       Json service;
+       Json device;
 
        string device_id;
        string device_name;
@@ -612,7 +612,7 @@ int conv::RemoteAppControlServiceProvider::load_service_info(request* request_ob
        device.get(NULL, CONV_JSON_DEVICE_ADDRESS, &device_address);
 
        RemoteAppControlServiceInfo *svc_info = NULL;
-       IServiceInfo* svc_info_base = client_obj->get_service_info(_type, device_id);
+       IServiceInfo* svc_info_base = client_obj->getServiceInfo(__type, device_id);
 
        if (svc_info_base != NULL) {
                _D("service instance already exists");
@@ -634,27 +634,27 @@ int conv::RemoteAppControlServiceProvider::load_service_info(request* request_ob
 
                svc_info->iotcon_info_obj.address = device_address;
                svc_info->iotcon_info_obj.uri = CONV_URI_REMOTE_APP_CONTROL;
-               svc_info->iotcon_info_obj.resource_type = _resource_type;
+               svc_info->iotcon_info_obj.resource_type = __resourceType;
 
                //save service info
-               client_obj->add_service_info(_type, device_id, (IServiceInfo*)svc_info);
+               client_obj->addServiceInfo(__type, device_id, (IServiceInfo*)svc_info);
 
                _D("remote app control service is created");
        }
 
-       request_obj->service_info = svc_info;
+       request_obj->setServiceInfo(svc_info);
        return CONV_ERROR_NONE;
 }
 
-int conv::RemoteAppControlServiceProvider::get_service_info_for_discovery(json* json_obj)
+int conv::RemoteAppControlServiceProvider::getServiceInfoForDiscovery(Json* json_obj)
 {
-       IF_FAIL_RETURN_TAG(_activation_state == 1, CONV_ERROR_NOT_SUPPORTED, _E, "service provider is not activated");
+       IF_FAIL_RETURN_TAG(__activationState == 1, CONV_ERROR_NOT_SUPPORTED, _E, "service provider is not activated");
 
        json_obj->set(NULL, CONV_JSON_DISCOVERY_SERVICE_TYPE, CONV_SERVICE_REMOTE_APP_CONTROL);
 
        // set data for service handle
-       json info;
-       info.set(NULL, CONV_SERVICE_ID, _uri);
+       Json info;
+       info.set(NULL, CONV_SERVICE_ID, __uri);
        info.set(NULL, CONV_SERVICE_VERSION, "1.0");
 
        json_obj->set(NULL, CONV_JSON_DISCOVERY_SERVICE_INFO, info);
index 5c6efdb..cbe7db2 100644 (file)
@@ -33,20 +33,20 @@ namespace conv {
                        int init();
                        int release();
 
-                       int start_request(request* request_obj);
-                       int stop_request(request* request_obj);
-                       int get_request(request* request_obj);
-                       int set_request(request* request_obj);
-                       int register_request(request* request_obj);
-                       int load_service_info(request* request_obj);
-                       int get_service_info_for_discovery(json* json_obj);
-                       int handle_vconf_update(keynode_t *node);
+                       int startRequest(Request* request_obj);
+                       int stopRequest(Request* request_obj);
+                       int readRequest(Request* request_obj);
+                       int publishRequest(Request* request_obj);
+                       int registerRequest(Request* request_obj);
+                       int loadServiceInfo(Request* request_obj);
+                       int getServiceInfoForDiscovery(Json* json_obj);
+                       int handleVconfUpdate(keynode_t *node);
 
                private:
                        iotcon_resource_h iotcon_resource;
-                       int send_response(json payload, const char* request_type, conv_error_e error, request* request_obj);
+                       int sendResponse(Json payload, const char* request_type, conv_error_e error, Request* request_obj);
 
-                       static void iotcon_request_cb(iotcon_resource_h resource, iotcon_request_h request, void *user_data);
+                       static void __iotcon_request_cb(iotcon_resource_h resource, iotcon_request_h request, void *user_data);
        };
 }
 #endif /* __REMOTE_APP_CONTROL_SERVICE_PROVIDER_H__ */
index 2ab80f7..d5aa0ca 100755 (executable)
@@ -205,7 +205,7 @@ EXTAPI int conv_device_foreach_service(conv_device_h handle, conv_service_foreac
        std::string strval;
 
        int service_count = 0;
-       service_count = json_data.array_get_size(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_DATA);       // json data..
+       service_count = json_data.getArraySize(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_DATA); // json data..
 
        for (int index =0; index < service_count; index++) {
                _conv_service_handle* service = new(std::nothrow) _conv_service_handle();
@@ -215,8 +215,8 @@ EXTAPI int conv_device_foreach_service(conv_device_h handle, conv_service_foreac
                json json_service;
                std::string version, type, uri;
                conv_service_e service_type;
-               json_data.get_array_elem(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_DATA, index, &json_service);
-               json_data.get_array_elem(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_TYPE, index, (int*)&service_type);
+               json_data.getArrayElem(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_DATA, index, &json_service);
+               json_data.getArrayElem(CONV_JSON_SERVICE_PATH, CONV_JSON_SERVICE_TYPE, index, (int*)&service_type);
 
                service->jservice = json_service;
                service->service_type = service_type;
index d8c82c8..e98aaf8 100755 (executable)
@@ -72,7 +72,7 @@ EXTAPI int conv_channel_get_string(conv_channel_h handle, const char* key, char*
        ASSERT_NOT_NULL(value);
 
        std::list<std::string> key_list;
-       handle->jchannel.get_keys(&key_list);
+       handle->jchannel.getKeys(&key_list);
        IF_FAIL_RETURN_TAG(key_list.size() > 0, CONV_ERROR_NO_DATA, _E, "No data");
 
        // Check Invalid record key
index cfb0945..f19c77c 100755 (executable)
@@ -154,7 +154,7 @@ json& json::operator=(const std::string& s)
 
 bool json::operator==(const json& rhs)
 {
-       return node_equals(json_node, rhs.json_node);
+       return nodeEquals(json_node, rhs.json_node);
 }
 
 bool json::operator!=(const json& rhs)
@@ -162,7 +162,7 @@ bool json::operator!=(const json& rhs)
        return !operator==(rhs);
 }
 
-char* json::dup_cstr()
+char* json::dupCstr()
 {
        IF_FAIL_RETURN_TAG(json_node, NULL, _E, "Json object not initialized");
 
@@ -190,7 +190,7 @@ CATCH:
 std::string json::str()
 {
        std::string output;
-       char *_s = dup_cstr();
+       char *_s = dupCstr();
        IF_FAIL_RETURN(_s, output = EMPTY_JSON_OBJECT);
 
        output = _s;
@@ -573,7 +573,7 @@ static JsonArray* search_array(JsonNode* jnode, const char* path, const char* ke
        return json_node_get_array(node);
 }
 
-int json::array_get_size(const char* path, const char* key)
+int json::getArraySize(const char* path, const char* key)
 {
        IF_FAIL_RETURN_TAG(this->json_node, -1, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, -1, _E, "Invalid parameter");
@@ -584,7 +584,7 @@ int json::array_get_size(const char* path, const char* key)
        return json_array_get_length(jarr);
 }
 
-bool json::array_append(const char* path, const char* key, json& val)
+bool json::appendArray(const char* path, const char* key, json& val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val.json_node, false, _E, "Invalid parameter");
@@ -599,12 +599,12 @@ bool json::array_append(const char* path, const char* key, json& val)
        return true;
 }
 
-bool json::array_append(const char* path, const char* key, int val)
+bool json::appendArray(const char* path, const char* key, int val)
 {
-       return array_append(path, key, static_cast<int64_t>(val));
+       return appendArray(path, key, static_cast<int64_t>(val));
 }
 
-bool json::array_append(const char* path, const char* key, int64_t val)
+bool json::appendArray(const char* path, const char* key, int64_t val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -616,7 +616,7 @@ bool json::array_append(const char* path, const char* key, int64_t val)
        return true;
 }
 
-bool json::array_append(const char* path, const char* key, double val, int prec)
+bool json::appendArray(const char* path, const char* key, double val, int prec)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -629,7 +629,7 @@ bool json::array_append(const char* path, const char* key, double val, int prec)
        return true;
 }
 
-bool json::array_append(const char* path, const char* key, std::string val)
+bool json::appendArray(const char* path, const char* key, std::string val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key, false, _E, "Invalid parameter");
@@ -655,7 +655,7 @@ static JsonNode* search_array_elem(JsonNode* jnode, const char* path, const char
        return node;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, json& val)
+bool json::setArrayAt(const char* path, const char* key, int index, json& val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(val.json_node && key && index >= 0, false, _E, "Invalid parameter");
@@ -675,12 +675,12 @@ bool json::array_set_at(const char* path, const char* key, int index, json& val)
        return true;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, int val)
+bool json::setArrayAt(const char* path, const char* key, int index, int val)
 {
-       return array_set_at(path, key, index, static_cast<int64_t>(val));
+       return setArrayAt(path, key, index, static_cast<int64_t>(val));
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, int64_t val)
+bool json::setArrayAt(const char* path, const char* key, int index, int64_t val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && index >= 0, false, _E, "Invalid parameter");
@@ -694,7 +694,7 @@ bool json::array_set_at(const char* path, const char* key, int index, int64_t va
        return true;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, double val, int prec)
+bool json::setArrayAt(const char* path, const char* key, int index, double val, int prec)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && index >= 0, false, _E, "Invalid parameter");
@@ -708,7 +708,7 @@ bool json::array_set_at(const char* path, const char* key, int index, double val
        return true;
 }
 
-bool json::array_set_at(const char* path, const char* key, int index, std::string val)
+bool json::setArrayAt(const char* path, const char* key, int index, std::string val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && index >= 0, false, _E, "Invalid parameter");
@@ -722,7 +722,7 @@ bool json::array_set_at(const char* path, const char* key, int index, std::strin
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, json* val)
+bool json::getArrayElem(const char* path, const char* key, int index, json* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -741,13 +741,13 @@ bool json::get_array_elem(const char* path, const char* key, int index, json* va
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, int* val)
+bool json::getArrayElem(const char* path, const char* key, int index, int* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
 
        int64_t v;
-       if (get_array_elem(path, key, index, &v)) {
+       if (getArrayElem(path, key, index, &v)) {
                *val = v;
                return true;
        }
@@ -755,7 +755,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, int* val
        return false;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, int64_t* val)
+bool json::getArrayElem(const char* path, const char* key, int index, int64_t* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -779,7 +779,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, int64_t*
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, double* val)
+bool json::getArrayElem(const char* path, const char* key, int index, double* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -806,7 +806,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, double*
        return true;
 }
 
-bool json::get_array_elem(const char* path, const char* key, int index, std::string* val)
+bool json::getArrayElem(const char* path, const char* key, int index, std::string* val)
 {
        IF_FAIL_RETURN_TAG(this->json_node, false, _E, "Json object not initialized");
        IF_FAIL_RETURN_TAG(key && val && index >= 0, false, _E, "Invalid parameter");
@@ -827,7 +827,7 @@ bool json::get_array_elem(const char* path, const char* key, int index, std::str
        return true;
 }
 
-bool json::get_member_list(json_node_t* node, std::list<std::string>& list)
+bool json::getMemberList(json_node_t* node, std::list<std::string>& list)
 {
        IF_FAIL_RETURN(node, false);
        list.clear();
@@ -854,13 +854,13 @@ bool json::get_member_list(json_node_t* node, std::list<std::string>& list)
        return true;
 }
 
-bool json::get_keys(std::list<std::string>* list)
+bool json::getKeys(std::list<std::string>* list)
 {
        IF_FAIL_RETURN_TAG(list, false, _E, "Invalid parameter");
-       return get_member_list(json_node, *list);
+       return getMemberList(json_node, *list);
 }
 
-bool json::node_equals(json_node_t* lhs, json_node_t* rhs)
+bool json::nodeEquals(json_node_t* lhs, json_node_t* rhs)
 {
        IF_FAIL_RETURN(lhs && rhs, false);
 
@@ -870,13 +870,13 @@ bool json::node_equals(json_node_t* lhs, json_node_t* rhs)
 
        switch (ltype) {
        case JSON_NODE_VALUE:
-               IF_FAIL_RETURN(value_equals(lhs, rhs), false);
+               IF_FAIL_RETURN(valueEquals(lhs, rhs), false);
                break;
        case JSON_NODE_OBJECT:
-               IF_FAIL_RETURN(object_equals(lhs, rhs), false);
+               IF_FAIL_RETURN(objectEquals(lhs, rhs), false);
                break;
        case JSON_NODE_ARRAY:
-               IF_FAIL_RETURN(array_equals(lhs, rhs), false);
+               IF_FAIL_RETURN(arrayEquals(lhs, rhs), false);
                break;
        default:
                _W("Unsupported type");
@@ -886,7 +886,7 @@ bool json::node_equals(json_node_t* lhs, json_node_t* rhs)
        return true;
 }
 
-bool json::value_equals(json_node_t* lhs, json_node_t* rhs)
+bool json::valueEquals(json_node_t* lhs, json_node_t* rhs)
 {
        GType ltype = json_node_get_value_type(lhs);
        GType rtype = json_node_get_value_type(rhs);
@@ -905,11 +905,11 @@ bool json::value_equals(json_node_t* lhs, json_node_t* rhs)
        }
 }
 
-bool json::object_equals(json_node_t* lhs, json_node_t* rhs)
+bool json::objectEquals(json_node_t* lhs, json_node_t* rhs)
 {
        std::list<std::string> lm, rm;
-       IF_FAIL_RETURN(get_member_list(lhs, lm), false);
-       IF_FAIL_RETURN(get_member_list(rhs, rm), false);
+       IF_FAIL_RETURN(getMemberList(lhs, lm), false);
+       IF_FAIL_RETURN(getMemberList(rhs, rm), false);
        IF_FAIL_RETURN(lm.size() == rm.size(), false);
 
        lm.sort();
@@ -924,7 +924,7 @@ bool json::object_equals(json_node_t* lhs, json_node_t* rhs)
 
                json_node_t *lhs_child = json_object_get_member(json_node_get_object(lhs), (*lit).c_str());
                json_node_t *rhs_child = json_object_get_member(json_node_get_object(rhs), (*rit).c_str());
-               IF_FAIL_RETURN(node_equals(lhs_child, rhs_child), false);
+               IF_FAIL_RETURN(nodeEquals(lhs_child, rhs_child), false);
 
                ++lit;
                ++rit;
@@ -933,7 +933,7 @@ bool json::object_equals(json_node_t* lhs, json_node_t* rhs)
        return true;
 }
 
-bool json::array_equals(json_node_t* lhs, json_node_t* rhs)
+bool json::arrayEquals(json_node_t* lhs, json_node_t* rhs)
 {
        JsonArray *larr = json_node_get_array(lhs);
        JsonArray *rarr = json_node_get_array(rhs);
@@ -944,7 +944,7 @@ bool json::array_equals(json_node_t* lhs, json_node_t* rhs)
        for (int i = 0; i < size; ++i) {
                json_node_t *lhs_child = json_array_get_element(larr, i);
                json_node_t *rhs_child = json_array_get_element(rarr, i);
-               IF_FAIL_RETURN(node_equals(lhs_child, rhs_child), false);
+               IF_FAIL_RETURN(nodeEquals(lhs_child, rhs_child), false);
        }
 
        return true;
index 75a1cf6..ae5fe00 100644 (file)
@@ -40,11 +40,11 @@ private:
        void release();
 
        /* For json vs json comparison */
-       bool get_member_list(json_node_t* node, std::list<std::string>& list);
-       bool node_equals(json_node_t* lhs, json_node_t* rhs);
-       bool value_equals(json_node_t* lhs, json_node_t* rhs);
-       bool object_equals(json_node_t* lhs, json_node_t* rhs);
-       bool array_equals(json_node_t* lhs, json_node_t* rhs);
+       bool getMemberList(json_node_t* node, std::list<std::string>& list);
+       bool nodeEquals(json_node_t* lhs, json_node_t* rhs);
+       bool valueEquals(json_node_t* lhs, json_node_t* rhs);
+       bool objectEquals(json_node_t* lhs, json_node_t* rhs);
+       bool arrayEquals(json_node_t* lhs, json_node_t* rhs);
 
 public:
        json();
@@ -73,10 +73,10 @@ public:
        bool operator==(const json& rhs);
        bool operator!=(const json& rhs);
 
-       char* dup_cstr();
+       char* dupCstr();
        std::string str();
 
-       bool get_keys(std::list<std::string>* list);
+       bool getKeys(std::list<std::string>* list);
 
        bool set(const char* path, const char* key, json& val);
        bool set(const char* path, const char* key, int val);
@@ -94,25 +94,25 @@ public:
 
        bool remove(const char* path, const char* key);
 
-       int array_get_size(const char* path, const char* key);
-
-       bool array_append(const char* path, const char* key, json& val);
-       bool array_append(const char* path, const char* key, int val);
-       bool array_append(const char* path, const char* key, int64_t val);
-       bool array_append(const char* path, const char* key, double val, int prec = DEFAULT_PRECISION);
-       bool array_append(const char* path, const char* key, std::string val);
-
-       bool array_set_at(const char* path, const char* key, int index, json& val);
-       bool array_set_at(const char* path, const char* key, int index, int val);
-       bool array_set_at(const char* path, const char* key, int index, int64_t val);
-       bool array_set_at(const char* path, const char* key, int index, double val, int prec = DEFAULT_PRECISION);
-       bool array_set_at(const char* path, const char* key, int index, std::string val);
-
-       bool get_array_elem(const char* path, const char* key, int index, json* val);
-       bool get_array_elem(const char* path, const char* key, int index, int* val);
-       bool get_array_elem(const char* path, const char* key, int index, int64_t* val);
-       bool get_array_elem(const char* path, const char* key, int index, double* val);
-       bool get_array_elem(const char* path, const char* key, int index, std::string* val);
+       int getArraySize(const char* path, const char* key);
+
+       bool appendArray(const char* path, const char* key, json& val);
+       bool appendArray(const char* path, const char* key, int val);
+       bool appendArray(const char* path, const char* key, int64_t val);
+       bool appendArray(const char* path, const char* key, double val, int prec = DEFAULT_PRECISION);
+       bool appendArray(const char* path, const char* key, std::string val);
+
+       bool setArrayAt(const char* path, const char* key, int index, json& val);
+       bool setArrayAt(const char* path, const char* key, int index, int val);
+       bool setArrayAt(const char* path, const char* key, int index, int64_t val);
+       bool setArrayAt(const char* path, const char* key, int index, double val, int prec = DEFAULT_PRECISION);
+       bool setArrayAt(const char* path, const char* key, int index, std::string val);
+
+       bool getArrayElem(const char* path, const char* key, int index, json* val);
+       bool getArrayElem(const char* path, const char* key, int index, int* val);
+       bool getArrayElem(const char* path, const char* key, int index, int64_t* val);
+       bool getArrayElem(const char* path, const char* key, int index, double* val);
+       bool getArrayElem(const char* path, const char* key, int index, std::string* val);
 };
 
 #endif // __CONV_LIB_JSON_H__
index c4e682c..aa8332c 100755 (executable)
@@ -74,7 +74,7 @@ EXTAPI int conv_payload_get_string(conv_payload_h handle, const char* key, char*
        ASSERT_NOT_NULL(value);
 
        std::list<std::string> key_list;
-       handle->jpayload.get_keys(&key_list);
+       handle->jpayload.getKeys(&key_list);
        IF_FAIL_RETURN_TAG(key_list.size() > 0, CONV_ERROR_NO_DATA, _E, "No data");
 
        // Check Invalid record key
@@ -120,7 +120,7 @@ EXTAPI int conv_payload_get_app_control(conv_payload_h handle, const char* key,
        int ret;
 
        std::list<std::string> key_list;
-       handle->jpayload.get_keys(&key_list);
+       handle->jpayload.getKeys(&key_list);
        IF_FAIL_RETURN_TAG(key_list.size() > 0, CONV_ERROR_NO_DATA, _E, "No data");
 
        // Check Invalid record key
@@ -167,7 +167,7 @@ EXTAPI int conv_payload_get_byte(conv_payload_h handle, const char* key, int* le
        ASSERT_NOT_NULL(value);
 
        std::list<std::string> key_list;
-       handle->jpayload.get_keys(&key_list);
+       handle->jpayload.getKeys(&key_list);
        IF_FAIL_RETURN_TAG(key_list.size() > 0, CONV_ERROR_NO_DATA, _E, "No data");
 
        // Check Invalid record key