From: nazib.ullah Date: Mon, 17 Oct 2016 08:53:22 +0000 (+0600) Subject: [TBT][tizen_3.0_mobile][d2d modules updated] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F92532%2F1;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tizen_3.0_mobile][d2d modules updated] Change-Id: Ic68e28440c559b70988a2ee2393b00fb4701d1f4 --- diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index 31fd3b7..609dc9d 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk index cae175e..2f21497 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk differ diff --git a/tbtcoreapp/src/model/tbt-list.c b/tbtcoreapp/src/model/tbt-list.c index 9adad80..c402166 100644 --- a/tbtcoreapp/src/model/tbt-list.c +++ b/tbtcoreapp/src/model/tbt-list.c @@ -2065,12 +2065,10 @@ static tbt_info tbtapps[] = .parent = "D2D Convergence", .apptype = TBT_APP_D2D_CLIENT, .icon_name = "dummy", - .info = "1. Connect D2D Server to Same WiFi Network.
" + .info = "1. Connect D2D Server to Same WiFi Network.
" "2. Run D2D server module of TBT.
" - "3. A list of two elements http://192.168.43.54:8001/api/v2/ and /tizen/remote-app-control will be shown
" - "4. Select /tizen/remote-app-control first. Then cortbt_uiapp will be launch in D2D Server.
" - "5. Select http://192.168.43.54:8001/api/v2/ then Connect will be shown in D2D Server and Publish will be shown in D2D Client.
" - "6. Select Publish on Client side and GoodNews Received will be shown in D2D Server.", + "3. /tizen/remote-app-control will be shown
" + "4. Select /tizen/remote-app-control. Then cortbt_uiapp will be launch in D2D Server.
", .result = 0 }, #endif @@ -2080,9 +2078,9 @@ static tbt_info tbtapps[] = .parent = "D2D Convergence", .apptype = TBT_APP_D2D_SERVER, .icon_name = "dummy", - .info = "1. Connect D2D Client to Same WiFi Network.
" + .info = "1. Connect D2D Client to Same WiFi Network.
" "2. Run D2D Server Module from TBT again.
" - "3. Server Ready Message will be shown", + "3. Server Ready Message will be shown", .result = 0 }, #endif diff --git a/tbtcoreapp/src/view/tbt-d2d-view.c b/tbtcoreapp/src/view/tbt-d2d-view.c index abf9315..0374d8d 100644 --- a/tbtcoreapp/src/view/tbt-d2d-view.c +++ b/tbtcoreapp/src/view/tbt-d2d-view.c @@ -15,12 +15,10 @@ *******************************************************************************/ /** * @file tbt-d2d-view.c - * @brief covers locationn retrieval - * starts location service using d2d method and continuously updates the current location + * @brief covers d2d convergence apis * - * @author golam kayes(g.kayes@samsung.com) and salman rahman(salman.ran) - * @date October, 2014 - * @bug location manager does not start in device + * @author A. B. M. Nazibullah(nazib.ullah@samsung.com) + * @date October, 2016 * @credit * */ @@ -43,9 +41,6 @@ struct _d2d_view Evas_Object *server_list; Evas_Object *client_msg_list; conv_h gl_conv_h; - conv_service_h service_handle; - conv_channel_h channel_handle; - conv_payload_h payld_handle; conv_device_h selected_device; }; @@ -57,18 +52,13 @@ typedef struct _service_data{ static Evas_Object *found_device_list; static Evas_Object *service_list; static Evas_Object *app_comm_menu_list; -static bool is_app_control_tested; static void _app_destroy_cb(void* this); -static void _conv_service_listener_cb(conv_service_h service_handle, conv_channel_h channel_handle, conv_error_e error, conv_payload_h payload, void* user_data); -static void make_service(d2d_view *this); static void discovery_cb(conv_device_h device, int result, void* user_data); -static int app_communication_menu(conv_service_h service_handle, void* data); static void device_selected_cb(void *data, Evas_Object *obj, void *event_info); static void message_listener(conv_service_h handle, conv_channel_h channel, int error, conv_payload_h result, void* user_data); static void start_discovery_cb(void *data, Evas_Object *obj, void *event_info); -static void _conv_service_connected_cb(conv_service_h service_handle, conv_error_e error, conv_payload_h result, void* user_data); /** * @function d2d_view_add @@ -83,7 +73,6 @@ d2d_view *d2d_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *i RETVM_IF(NULL == tbt_info, NULL, "tbt_info is null"); RETVM_IF(NULL == item, NULL, "item is NULL"); - is_app_control_tested = false; d2d_view *this = NULL; this = calloc(1, sizeof(d2d_view)); @@ -123,7 +112,6 @@ d2d_view *d2d_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *i } else if (tbt_info->apptype == TBT_APP_D2D_SERVER) { - make_service(this); this->client_msg_list = elm_list_add(this->view->layout); elm_list_mode_set(this->client_msg_list, ELM_LIST_COMPRESS); elm_list_item_append(this->client_msg_list, "Ready", NULL, NULL, NULL, NULL); @@ -137,12 +125,6 @@ d2d_view *d2d_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *i } -static void _conv_service_connected_cb(conv_service_h service_handle, conv_error_e error, conv_payload_h result, void* user_data) -{ - DBG("_conv_service_connected_cb"); -} - - /** * @function get_d2d_error * @since_tizen 3.0 @@ -195,7 +177,9 @@ static int app_control_start(conv_service_h service_handle, void* data) service_data *s_data = (service_data*) data; s_data->service_handle = service_handle; ret = conv_service_set_listener_cb(service_handle, message_listener, (void*)s_data); - DBG("conv_service_set_listener_cb failed with error : %s", get_d2d_error(ret)); + RETVM_IF(ret != CONV_ERROR_NONE,0,"conv_service_set_listener_cb failed with error : %s", get_d2d_error(ret)); + ret = conv_service_read(service_handle, NULL, NULL); + RETVM_IF(ret != CONV_ERROR_NONE,0,"conv_service_read failed with error : %s", get_d2d_error(ret)); ret = conv_service_start(service_handle, NULL, NULL); RETVM_IF(ret != CONV_ERROR_NONE,0, "conv_service_start failed with error : %s", get_d2d_error(ret)); @@ -210,9 +194,7 @@ static void service_selected_cb(void *data, Evas_Object *obj, void *event_info) RETM_IF(NULL==s_data, "s_data is NULL"); - conv_service_e e = 0; - d2d_view* this = s_data->view; - + conv_service_e e = CONV_SERVICE_NONE; if(s_data->service_handle == NULL) { @@ -221,6 +203,7 @@ static void service_selected_cb(void *data, Evas_Object *obj, void *event_info) conv_service_h service_handle =s_data->service_handle; + int ret = conv_service_get_type(service_handle, &e); RETM_IF(ret != CONV_ERROR_NONE, "conv_service_get_type failed with error : %s", get_d2d_error(ret)); @@ -228,8 +211,6 @@ static void service_selected_cb(void *data, Evas_Object *obj, void *event_info) { case CONV_SERVICE_APP_TO_APP_COMMUNICATION : DBG("CONV_SERVICE_APP_TO_APP_COMMUNICATION"); - ret = app_communication_menu(service_handle, this); - RETM_IF(ret != CONV_ERROR_NONE, "app_communication_menu failed with error : %s", get_d2d_error(ret)); break; case CONV_SERVICE_REMOTE_APP_CONTROL : @@ -242,118 +223,25 @@ static void service_selected_cb(void *data, Evas_Object *obj, void *event_info) break; default : - DBG( "DTOD_TEST default"); + DBG( "UNKNOWN_SERVICE"); break; } } - - -static void publish_cb(void *data, Evas_Object *obj, void *event_info) -{ - - DBG("publish_cb"); - - conv_service_h service_handle = (conv_service_h)data; - conv_channel_h channel_handle; - conv_payload_h payload_handle; - - int ret = conv_channel_create(&channel_handle); - DBG("conv_channel_create : %s", get_d2d_error(ret)); - ret = conv_channel_set_string(channel_handle, "uri", "org.tizen.tbtcoreapp"); - DBG("conv_channel_set_string : %s", get_d2d_error(ret)); - ret = conv_channel_set_string(channel_handle, "channel_id", "tbtcoreapp"); - DBG("conv_channel_set_string : %s", get_d2d_error(ret)); - ret = conv_payload_create(&payload_handle); - DBG("conv_payload_create : %s", get_d2d_error(ret)); - ret = conv_payload_set_string(payload_handle, "payload_type", "GoodNews"); - DBG("conv_payload_set_string : %s", get_d2d_error(ret)); - ret = conv_service_publish(service_handle, channel_handle, payload_handle); - DBG("conv_service_publish : %s", get_d2d_error(ret)); - ret = conv_service_read(service_handle, channel_handle, payload_handle); - DBG("conv_service_read : %s", get_d2d_error(ret)); - - sleep(3); - - ret = conv_service_stop(service_handle, NULL, NULL); - DBG("conv_service_stop : %s", get_d2d_error(ret)); - - DBG("conv_payload_destroy called..\n"); - ret = conv_payload_destroy(payload_handle); - DBG("conv_payload_destroy : %s", get_d2d_error(ret)); -} - -static void read_cb(void *data, Evas_Object *obj, void *event_info) -{ - conv_service_h service_handle = (conv_service_h)data; - conv_channel_h channel_handle; - conv_payload_h payload_handle; - - int ret = conv_channel_create(&channel_handle); - ret = conv_channel_set_string(channel_handle, "uri", "org.tizen.tbtcoreapp"); - ret = conv_channel_set_string(channel_handle, "channel_id", "tbtcoreapp"); - ret = conv_payload_create(&payload_handle); - - //To-do: implementation for "Read" API -// ret = conv_service_read(service_handle, channel_handle, payload_handle); -// DBG("conv_service_read : %s", get_d2d_error(ret)); -} - -static void app_launch_cb(void *data, Evas_Object *obj, void *event_info) -{ - DBG("app_launch_cb"); - - conv_service_h service_handle = (conv_service_h)data; - conv_channel_h channel_handle; - conv_payload_h payload_handle; - int ret; - - ret = conv_channel_create(&channel_handle); - DBG("conv_channel_create : %s", get_d2d_error(ret)); - ret = conv_channel_create(&channel_handle); - DBG("conv_channel_create : %s", get_d2d_error(ret)); - ret = conv_channel_set_string(channel_handle, "uri", "org.tizen.tbtcoreapp"); - DBG("conv_channel_set_string : %s", get_d2d_error(ret)); - ret = conv_channel_set_string(channel_handle, "channel_id", "tbtcoreapp"); - DBG("conv_channel_set_string : %s", get_d2d_error(ret)); - ret = conv_payload_create(&payload_handle); - DBG("conv_payload_create : %s", get_d2d_error(ret)); - - //To-do: implementation for service_start API with app launch - -} - - static void message_listener(conv_service_h handle, conv_channel_h channel, int error, conv_payload_h result, void* user_data) { DBG("message_listener"); char* test; service_data* s_data = (service_data*) user_data; - d2d_view* this = (d2d_view*)s_data->view; - conv_service_h listner_handle = (conv_service_h)s_data->service_handle; conv_payload_get_string(result, "result_type", &test); int ret; DBG("result_type : %s", test); - if (!strcmp(test, "onConnect")) - { - DBG("==== Connected ===="); -// elm_list_item_append(app_comm_menu_list, "App Launch", NULL, NULL, app_launch_cb, listner_handle); -// elm_list_item_append(app_comm_menu_list, "Read", NULL, NULL, read_cb, listner_handle); - - elm_list_item_append(app_comm_menu_list, "Publish", NULL, NULL, publish_cb, listner_handle); - elm_list_go(app_comm_menu_list); - elm_object_part_content_set(this->view->layout, "list_container", app_comm_menu_list); - } - - if (!strcmp(test, "onStart")) { - DBG("==== ON-START ===="); - is_app_control_tested = true; conv_payload_h payload_handle; ret = conv_payload_create(&payload_handle); @@ -375,63 +263,24 @@ static void message_listener(conv_service_h handle, conv_channel_h channel, int ret = conv_service_stop(s_data->service_handle, NULL, NULL); RETM_IF(ret != CONV_ERROR_NONE, "conv_service_stop failed with error : %s", get_d2d_error(ret)); - DBG("conv_payload_destroy called..\n"); + DBG("conv_payload_destroy called.."); ret = conv_payload_destroy(payload_handle); RETM_IF(ret != CONV_ERROR_NONE, "conv_payload_destroy failed with error : %s", get_d2d_error(ret)); - } - - // + ret = conv_service_destroy(s_data->service_handle); + RETM_IF(ret != CONV_ERROR_NONE, "conv_service_destroy failed with error : %s", get_d2d_error(ret)); -} - -static int app_communication_menu(conv_service_h service_handle, void* data) -{ - conv_channel_h channel_handle; - d2d_view* this = (d2d_view*) data; - - DBG( "app_communication_start"); - - if(!is_app_control_tested) - { - DBG("Test app-control first"); - Evas_Object* popup = ui_utils_popup_add(this->view->layout, "Test app-control first"); - evas_object_show(popup); - return 0; } - int ret = conv_channel_create(&channel_handle); - RETVM_IF(ret != CONV_ERROR_NONE, ret, "conv_channel_create failed with error : %s", get_d2d_error(ret)); - - ret = conv_channel_set_string(channel_handle, "uri", "org.tizen.tbtcoreapp"); - RETVM_IF(ret != CONV_ERROR_NONE, ret, "conv_channel_set_string failed with error : %s", get_d2d_error(ret)); - - ret = conv_channel_set_string(channel_handle, "channel_id", "tbtcoreapp"); - RETVM_IF(ret != CONV_ERROR_NONE, ret, "conv_channel_set_string failed with error : %s", get_d2d_error(ret)); - - service_data* s_data = (service_data*)malloc(sizeof(service_data)); - s_data->view = this; - s_data->service_handle = service_handle; - - ret = conv_service_set_listener_cb(service_handle, message_listener, s_data); - RETVM_IF(ret != CONV_ERROR_NONE, ret, "conv_service_set_listener_cb failed with error : %s", get_d2d_error(ret)); - - ret = conv_service_connect(service_handle, _conv_service_connected_cb, this); - DBG( "conv_service_connect: %s", get_d2d_error(ret)); - - ret = conv_service_start(service_handle, channel_handle, NULL); - RETVM_IF(ret != CONV_ERROR_NONE, ret, "conv_service_start failed with error : %s", get_d2d_error(ret)); - - DBG( "app_communication_end"); - return 0; } + static void service_foreach_cb(conv_service_h service_handle, void *user_data) { conv_service_e e; d2d_view* this = (d2d_view*) user_data; - DBG( "Service----------------------------\n"); + DBG( "service_foreach_cb"); service_data* s_data = (service_data*)malloc(sizeof(service_data)); s_data->view = this; @@ -463,9 +312,6 @@ static void service_foreach_cb(conv_service_h service_handle, void *user_data) elm_list_go(service_list); elm_object_part_content_set(this->view->layout, "list_container", service_list); - conv_channel_h channel_h; - ret = conv_channel_create(&channel_h); - RETM_IF(ret != CONV_ERROR_NONE, "conv_channel_create failed with error : %s", get_d2d_error(ret)); } static void device_selected_cb(void *data, Evas_Object *obj, void *event_info) @@ -490,15 +336,15 @@ static void discovery_cb(conv_device_h device, int result, void* user_data) d2d_view* this = (d2d_view*) user_data; DBG("Inside server discovery cb."); int ret = conv_device_get_property_string(device, CONV_DEVICE_ID, &value); - //RETM_IF(ret != CONV_ERROR_NONE, "conv_device_get_property_string failed with error : %s", get_d2d_error(ret)); + DBG("conv_device_get_property_string failed with error : %s", get_d2d_error(ret)); DBG("device id = %s", value); ret = conv_device_get_property_string(device, CONV_DEVICE_NAME, &device_name); - //RETM_IF(ret != CONV_ERROR_NONE, "conv_device_get_property_string failed with error : %s", get_d2d_error(ret)); + DBG("conv_device_get_property_string failed with error : %s", get_d2d_error(ret)); DBG("device name = %s", device_name); ret = conv_device_get_property_string(device, CONV_DEVICE_TYPE, &value); - //RETM_IF(ret != CONV_ERROR_NONE, "conv_device_get_property_string failed with error : %s", get_d2d_error(ret)); + DBG("conv_device_get_property_string failed with error : %s", get_d2d_error(ret)); DBG( "device TYPE = %s", value); this->selected_device = device; @@ -510,74 +356,8 @@ static void discovery_cb(conv_device_h device, int result, void* user_data) elm_object_part_content_set(this->view->layout, "list_container", found_device_list); } - //DBG("Device----------------------------"); } -static void make_service(d2d_view *this) -{ - int ret = conv_service_create(&this->service_handle); - RETM_IF(ret != CONV_ERROR_NONE, "conv_service_create failed with error : %s", get_d2d_error(ret)); - - ret = conv_channel_create(&this->channel_handle); - RETM_IF(ret != CONV_ERROR_NONE, "conv_channel_create failed with error : %s", get_d2d_error(ret)); - - ret = conv_channel_set_string(this->channel_handle, "uri", "org.tizen.tbtcoreapp"); - RETM_IF(ret != CONV_ERROR_NONE, "conv_channel_set_string failed with error : %s", get_d2d_error(ret)); - - ret = conv_channel_set_string(this->channel_handle, "channel_id", "tbtcoreapp"); - RETM_IF(ret != CONV_ERROR_NONE, "conv_channel_set_string failed with error : %s", get_d2d_error(ret)); - - ret = conv_payload_create(&this->payld_handle); - RETM_IF(ret != CONV_ERROR_NONE, "conv_payload_create failed with error : %s", get_d2d_error(ret)); - - ret = conv_service_set_type(this->service_handle, CONV_SERVICE_APP_TO_APP_COMMUNICATION); - RETM_IF(ret != CONV_ERROR_NONE, "conv_service_set_type failed with error : %s", get_d2d_error(ret)); - - ret = conv_service_set_property_string(this->service_handle, CONV_SERVICE_ID, "test_app"); - RETM_IF(ret != CONV_ERROR_NONE, "conv_service_set_property_string failed with error : %s", get_d2d_error(ret)); - - ret = conv_service_set_property_string(this->service_handle, CONV_SERVICE_VERSION, "1.0"); - RETM_IF(ret != CONV_ERROR_NONE, "conv_service_set_property_string failed with error : %s", get_d2d_error(ret)); - - ret = conv_service_set_listener_cb(this->service_handle, _conv_service_listener_cb, (void *)this); - RETM_IF(ret != CONV_ERROR_NONE, "conv_service_set_listener_cb failed with error : %s", get_d2d_error(ret)); - - ret = conv_service_start(this->service_handle, this->channel_handle, this->payld_handle); - RETM_IF(ret != CONV_ERROR_NONE, "conv_service_start failed with error : %s", get_d2d_error(ret)); -} - - -static void _conv_service_listener_cb(conv_service_h service_handle, conv_channel_h channel_handle, conv_error_e error, conv_payload_h payload, void* user_data) -{ - char* test; - char* payload_type; - - d2d_view* this = (d2d_view*) user_data; - - DBG("callback for service.."); - conv_payload_get_string(payload, "result_type", &test); - - DBG( "result type : %s", test); - - if (!strcmp(test, "onClientConnect")) - { - elm_list_item_append(this->client_msg_list, "Client Connected", NULL, NULL, NULL, NULL); - elm_list_go(this->client_msg_list); - } - if (!strcmp(test, "onMessage")) - { - int ret = conv_payload_get_string(payload, "payload_type", &payload_type); - RETM_IF(ret != CONV_ERROR_NONE, "conv_payload_get_string failed with error: %s", get_d2d_error(ret)); - - strcat(payload_type, " Received"); - elm_list_item_append(this->client_msg_list, payload_type, NULL, NULL, NULL, NULL); - elm_list_go(this->client_msg_list); - - DBG("payload_type : %s", payload_type); - DBG( "==== Received ===="); - - } -} /** * @function _app_destroy_cb