From: Piotr Dabrowski Date: Wed, 16 Nov 2016 16:29:02 +0000 (+0100) Subject: [bluetooth] pushMessage X-Git-Tag: submit/tizen_3.0/20161208.051813~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd96c7fe50be01dea3817335bd08d5e9dfc18eef;p=platform%2Fcore%2Fapi%2Fbluetooth.git [bluetooth] pushMessage Change-Id: I23ea4c2e620fd03d90f95b0693780c898332aae3 --- diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index ce62351..9de7dde 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -159,11 +159,7 @@ typedef enum { BT_EVENT_MAP_CLIENT_LIST_FILTER_FIELDS, /**< MAP - get filter field list callback */ BT_EVENT_MAP_CLIENT_LIST_MESSAGES, /**< MAP - listMessages event*/ BT_EVENT_MAP_CLIENT_GET_MESSAGE, /**< MAP - getMessage event*/ - BT_EVENT_MAP_CLIENT_444, /**< MAP client 444 */ - BT_EVENT_MAP_CLIENT_555, /**< MAP client 555 */ - BT_EVENT_MAP_CLIENT_666, /**< MAP client 666 */ - BT_EVENT_MAP_CLIENT_777, /**< MAP client 777 */ - BT_EVENT_MAP_CLIENT_888, /**< MAP client 888 */ + BT_EVENT_MAP_CLIENT_PUSH_MESSAGE, /**< MAP - pushMessage event*/ BT_EVENT_MAX } bt_event_e; diff --git a/include/mobile/bluetooth_internal.h b/include/mobile/bluetooth_internal.h index 9174bd9..cd71232 100644 --- a/include/mobile/bluetooth_internal.h +++ b/include/mobile/bluetooth_internal.h @@ -1707,7 +1707,8 @@ int bt_map_client_push_message( const char* source_file, const char* folder, bt_map_client_push_message_args_h args, - bt_map_client_push_message_cb callback + bt_map_client_push_message_cb callback, + void* user_data ); /** @@ -1774,6 +1775,26 @@ void bt_map_client_list_messages_filter_destroy( bt_map_client_list_messages_filter_h *filter ); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE + * @brief Creates a List Messages filter. + * @since_tizen 3.0 + * @param[in] args Arguments structure handle + */ +void bt_map_client_push_message_args_create( + bt_map_client_push_message_args_h *args +); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE + * @brief Destroys a Push Messages arguments structure. + * @since_tizen 3.0 + * @param[in] args Arguments structure handle + */ +void bt_map_client_push_message_args_destroy( + bt_map_client_push_message_args_h *args +); + /** * @internal * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE diff --git a/include/wearable/bluetooth_internal.h b/include/wearable/bluetooth_internal.h index 2b6d057..b80fb61 100644 --- a/include/wearable/bluetooth_internal.h +++ b/include/wearable/bluetooth_internal.h @@ -1677,7 +1677,8 @@ int bt_map_client_push_message( const char* source_file, const char* folder, bt_map_client_push_message_args_h args, - bt_map_client_push_message_cb callback + bt_map_client_push_message_cb callback, + void* user_data ); /** @@ -1744,6 +1745,26 @@ void bt_map_client_list_messages_filter_destroy( bt_map_client_list_messages_filter_h *filter ); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE + * @brief Creates a List Messages filter. + * @since_tizen 3.0 + * @param[in] args Arguments structure handle + */ +void bt_map_client_push_message_args_create( + bt_map_client_push_message_args_h *args +); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE + * @brief Destroys a Push Messages arguments structure. + * @since_tizen 3.0 + * @param[in] args Arguments structure handle + */ +void bt_map_client_push_message_args_destroy( + bt_map_client_push_message_args_h *args +); + /** * @internal * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 101b6a5..050a947 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -1514,11 +1514,13 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us param->result, res, user_data); break; - /// TODO MAP place for your case 4 - /// TODO MAP place for your case 5 - /// TODO MAP place for your case 6 - /// TODO MAP place for your case 7 - /// TODO MAP place for your case 8 + case BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_COMPLETE: + BT_INFO("BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_COMPLETE event"); + + ((bt_map_client_push_message_cb)bt_event_slot_container[event_index].callback)( + param->result, + bt_event_slot_container[event_index].user_data); + break; case BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED: BT_INFO("BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED"); @@ -3099,11 +3101,8 @@ static int __bt_get_cb_index(int event) return BT_EVENT_MAP_CLIENT_LIST_MESSAGES; case BLUETOOTH_EVENT_MAP_GET_MESSAGE_COMPLETE: return BT_EVENT_MAP_CLIENT_GET_MESSAGE; - /// TODO MAP place for your case 4 - /// TODO MAP place for your case 5 - /// TODO MAP place for your case 6 - /// TODO MAP place for your case 7 - /// TODO MAP place for your case 8 + case BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_COMPLETE: + return BT_EVENT_MAP_CLIENT_PUSH_MESSAGE; case BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED: case BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED: return BT_EVENT_NAP_CONNECTION_STATE_CHANGED; diff --git a/src/bluetooth-map-client.c b/src/bluetooth-map-client.c index 0e6518e..0f8c63b 100644 --- a/src/bluetooth-map-client.c +++ b/src/bluetooth-map-client.c @@ -291,10 +291,37 @@ int bt_map_client_push_message( const char* source_file, const char* folder, bt_map_client_push_message_args_h args, - bt_map_client_push_message_cb callback) + bt_map_client_push_message_cb callback, + void *user_data) { - /* TODO: MAP */ - return BT_ERROR_NONE; + LOGE("Entered bt_map_client_get_message"); + + //BT_CHECK_MAP_CLIENT_SUPPORT(); + BT_CHECK_INIT_STATUS(); + BT_CHECK_MAP_CLIENT_INIT_STATUS(); + BT_CHECK_INPUT_PARAMETER(handle); + BT_CHECK_INPUT_PARAMETER(source_file); + BT_CHECK_INPUT_PARAMETER(folder); + BT_CHECK_INPUT_PARAMETER(args); + + bt_map_client_session_info_s* session = (bt_map_client_session_info_s*)handle; + + int error_code = _bt_get_error_code( + bluetooth_map_client_push_message( + session, + source_file, + folder, + (bt_map_client_push_message_args_t*) args + ) + ); + if (error_code != BT_ERROR_NONE) { + BT_ERR("bluetooth_map_client_push_message %s(0x%08x)", + _bt_convert_error_to_string(error_code), error_code); + } else { + _bt_set_cb(BT_EVENT_MAP_CLIENT_PUSH_MESSAGE, callback, user_data); + } + + return error_code; } int bt_map_client_get_message( @@ -369,3 +396,19 @@ void bt_map_client_list_messages_filter_destroy( free(*filter); *filter = NULL; } + +void bt_map_client_push_message_args_create( + bt_map_client_push_message_args_h *args) +{ + (*args) = malloc(sizeof(bt_map_client_push_message_args_s)); + (*args)->is_transparent = -1; + (*args)->is_retry = -1; + (*args)->charset = NULL; +} + +void bt_map_client_push_message_args_destroy( + bt_map_client_push_message_args_h *args) +{ + free(*args); + *args = NULL; +}