typedef vector<application_instance*> application_instance_list_t;
// service information to handle app-to-app service with specific device 'id'
- class app_comm_service_info : public service_info_base {
+ class app_comm_service_info : public service_info_base, public Result_Base {
public:
- ~app_comm_service_info()
+ void onSuccess(Service service)
{
- if (service_obj != NULL) {
- delete service_obj;
- }
+ _D("getByUri : service name : %s", service.getName().c_str() ? service.getName().c_str() : "name is NULL");
+ service_obj = service;
+ get_service_result = true;
+ }
+
+ void onError(Error)
+ {
+ _D("getByUri Error");
+ get_service_result = false;
+ }
+ ~app_comm_service_info()
+ {
if (registered_request != NULL) {
delete registered_request;
}
}
}
std::string id;
- Service* service_obj;
+ Service service_obj;
bool is_local;
+ bool get_service_result;
conv::request* registered_request;
application_instance_list_t application_instance_list;
ASSERT_ALLOC(svc_info);
_D("uri : %s", uri.c_str());
- svc_info->service_obj = new(std::nothrow) Service(id, version, name, type, uri);
- ASSERT_ALLOC(svc_info->service_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, (service_info_base*)svc_info);
svc_info->application_instance_list.push_back(app_info);
} else {
_D("COMMUNCATION_START : uri : %s, channel_id : %s", uri.c_str(), channel_id.c_str());
- Application* application = new(std::nothrow) Application(svc_info->service_obj, uri, channel_id);
+ Application* application = new(std::nothrow) Application(&(svc_info->service_obj), uri, channel_id);
ASSERT_ALLOC(application);
// add listeners