Add MAP client function definitions for TV profile 59/103259/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 8 Dec 2016 00:35:15 +0000 (09:35 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 8 Dec 2016 00:36:00 +0000 (09:36 +0900)
Change-Id: I87c64f665e3d988baaca5b74ee6992332f861b38
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
include/tv/bluetooth_internal.h
include/tv/bluetooth_type_internal.h

index 32218e5ed3a290db4c059dca239619d25ad2ae54..cd712320fb33d9aa9462bda04a1e10dab7ee8a7a 100644 (file)
@@ -1521,6 +1521,280 @@ int bt_opp_server_initialize(const char *destination, bt_opp_server_push_request
 int bt_opp_get_transfer_progress(bt_opp_transfer_type_t transfer_type,
                int transfer_id, unsigned char *progress);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Initializes the Bluetooth MAP client.
+ * @since_tizen 3.0
+ * @remarks This function must be called before Bluetooth MAP client starts. \n
+ * You must free all resources of the Bluetooth service by calling bt_map_client_deinitialize()
+ * if Bluetooth MAP service is no longer needed.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @see  bt_map_client_deinitialize()
+ * @see  bt_map_client_create_session()
+ */
+int bt_map_client_initialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Deinitializes the Bluetooth MAP client.
+ * @since_tizen 2.3
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @see  bt_map_client_initialize()
+ * @see  bt_map_client_destroy_session()
+ */
+int bt_map_client_deinitialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Creates a new OBEX session.
+ * @since_tizen 3.0
+ * @param[in] remote_address Bluetooh address of the remote device (00:00:00:00:00:00)
+ * @param[in] handle Pointer to the output session info structure handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @see  bt_map_client_destroy_session()
+ * @see  bt_map_client_initialize()
+ */
+int bt_map_client_create_session(
+    const char* remote_address,
+    bt_map_client_session_info_h* handle
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Destroys an OBEX session.
+ * @since_tizen 3.0
+ * @param[in] handle Session info structure handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @see  bt_map_client_create_session()
+ * @see  bt_map_client_deinitialize()
+ */
+int bt_map_client_destroy_session(
+    bt_map_client_session_info_h handle
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Sets folder.
+ * @since_tizen 3.0
+ * @param[in] handle Session info structure handle
+ * @param[in] folder Folder name
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @see  bt_map_client_set_folder()
+ */
+int bt_map_client_set_folder(
+    bt_map_client_session_info_h handle,
+    const char *name
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Lists folders.
+ * @since_tizen 3.0
+ * @param[in] handle Session handle
+ * @param[in] filter Filter
+ * @param[in] callback Callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ */
+int bt_map_client_list_folders(
+    bt_map_client_session_info_h handle,
+    bt_map_client_list_folders_filter_h filter,
+    bt_map_client_list_folders_cb callback,
+    void* user_data
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Lists filter fields.
+ * @since_tizen 3.0
+ * @param[in] handle Session handle
+ * @param[in] callback Callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ */
+int bt_map_client_list_filter_fields(
+    bt_map_client_session_info_h handle,
+    bt_map_client_list_filter_fields_cb callback,
+    void *user_data
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Lists messages.
+ * @since_tizen 3.0
+ * @param[in] handle Session handle
+ * @param[in] folder Folder name
+ * @param[in] filter Filter
+ * @param[in] callback Callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ */
+int bt_map_client_list_messages(
+    bt_map_client_session_info_h handle,
+    const char* folder,
+    bt_map_client_list_messages_filter_h filter,
+    bt_map_client_list_messages_cb callback,
+    void *user_data
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Requests remote to update its inbox.
+ * @since_tizen 3.0
+ * @param[in] handle Session handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ */
+int bt_map_client_update_inbox(
+    bt_map_client_session_info_h handle
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Pushes message.
+ * @since_tizen 3.0
+ * @param[in] handle Session handle
+ * @param[in] source_file Source file path
+ * @param[in] folder Folder name
+ * @param[in] args Args: Transparent, Retry, Charset
+ * @param[in] callback Callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ */
+int bt_map_client_push_message(
+    bt_map_client_session_info_h handle,
+    const char* source_file,
+    const char* folder,
+    bt_map_client_push_message_args_h args,
+    bt_map_client_push_message_cb callback,
+    void* user_data
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Gets message.
+ * @since_tizen 3.0
+ * @param[in] handle Session handle
+ * @param[in] message_object Message object handle
+ * @param[in] target_file Target file path
+ * @param[in] attachment With attachment?
+ * @param[in] callback Callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ */
+int bt_map_client_get_message(
+    bt_map_client_session_info_h handle,
+    const bt_map_client_message_object_h message_object,
+    const char* target_file,
+    bool attachment,
+    bt_map_client_get_message_cb callback,
+    void* user_data
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Creates a List Folders filter.
+ * @since_tizen 3.0
+ * @param[in] filter Filter handle
+ */
+void bt_map_client_list_folders_filter_create(
+    bt_map_client_list_folders_filter_h *filter
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Destroys a List Messages filter.
+ * @since_tizen 3.0
+ * @param[in] filter Filter handle
+ */
+void bt_map_client_list_folders_filter_destroy(
+    bt_map_client_list_folders_filter_h *filter
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Creates a List Messages filter.
+ * @since_tizen 3.0
+ * @param[in] filter Filter handle
+ */
+void bt_map_client_list_messages_filter_create(
+    bt_map_client_list_messages_filter_h *filter
+);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief Destroys a List Messages filter.
+ * @since_tizen 3.0
+ * @param[in] filter Filter handle
+ */
+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
index a85066742760c36972a3ef88428f54d2249e7be5..fbd1b019c23819d5042cf69e94c670f4c91f4514 100644 (file)
@@ -23,6 +23,9 @@ extern "C"
 {
 #endif /* __cplusplus */
 
+/* This variable will be added into bt_service_class_t in tizen 4.0 */
+#define BT_SC_MAP_SERVICE_MASK 0x00800000 /**< MAP service class */
+
 /**
  * @file bluetooth_type_internal.h
  */
@@ -93,6 +96,102 @@ typedef enum {
        BT_TRANSFER_OUTBOUND,       /**< Outbound Transfer Type */
 } bt_opp_transfer_type_t;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
+ * @brief
+ * @since_tizen 3.0
+ */
+typedef void* bt_map_client_session_info_h;
+
+typedef void* bt_map_client_message_object_h;
+
+typedef struct {
+       int16_t offset;
+       int16_t max_count;
+} bt_map_client_list_folders_filter_s;
+
+typedef struct {
+       int16_t offset;
+       int16_t max_count;
+       int8_t subject_length;
+       char *fields;
+       char *types;
+       char *period_begin;
+       char *period_end;
+       int is_read;
+       char *recipient;
+       char *sender;
+       int is_priority;
+} bt_map_client_list_messages_filter_s;
+
+typedef struct {
+       bt_map_client_message_object_h message_object;
+       char *folder;
+       char *subject;
+       char *timestamp;
+       char *sender;
+       char *sender_address;
+       char *reply_to;
+       char *recipient;
+       char *recipient_address;
+       char *type;
+       int64_t size;
+       int is_text;
+       char *status;
+       int64_t attachment_size;
+       int is_priority;
+       int is_read;
+       int is_sent;
+       int is_protected;
+} bt_map_client_message_item_s;
+
+typedef struct {
+       int is_transparent;
+       int is_retry;
+       char *charset;
+} bt_map_client_push_message_args_s;
+
+typedef struct {
+       char *file_path;
+// TODO: maybe some additional fields could be supported
+//     char *folder;
+//     char *subject;
+//     char *timestamp;
+//     char *sender;
+//     char *sender_address;
+//     char *reply_to;
+//     char *recipient;
+//     char *recipient_address;
+//     char *type;
+//     int64_t size;
+//     char *status;
+//     int is_priority;
+//     int is_read;
+//     int is_deleted;
+//     int is_sent;
+//     int is_protected;
+} bt_map_client_message_s;
+
+typedef bt_map_client_list_folders_filter_s* bt_map_client_list_folders_filter_h;
+
+typedef bt_map_client_list_messages_filter_s* bt_map_client_list_messages_filter_h;
+
+typedef bt_map_client_message_item_s* bt_map_client_message_item_h;
+
+typedef bt_map_client_push_message_args_s* bt_map_client_push_message_args_h;
+
+typedef bt_map_client_message_s* bt_map_client_message_h;
+
+typedef void (*bt_map_client_list_folders_cb)(int result, char **folders, int count, void *user_data);
+
+typedef void (*bt_map_client_list_filter_fields_cb)(int result, char **filter_fields, int count, void *user_data);
+
+typedef void (*bt_map_client_list_messages_cb)(int result, bt_map_client_message_item_s *messages, int count, void *user_data);
+
+typedef void (*bt_map_client_push_message_cb)(int result, void *user_data);
+
+typedef void (*bt_map_client_get_message_cb)(int result, bt_map_client_message_h message, void *user_data);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
  * @brief  Called when the connectable state changes.