[bluetooth-frwk] pushMessage
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
index 25f2ca0..624abb0 100644 (file)
@@ -19,6 +19,7 @@
 #define _BLUETOOTH_API_H_
 
 #include <stdlib.h>
+#include <stdbool.h>
 #include <unistd.h>
 #include <glib.h>
 
@@ -612,6 +613,7 @@ typedef enum {
        BLUETOOTH_EVENT_MAP_GET_MESSAGE_COMPLETE,
        BLUETOOTH_EVENT_MAP_GET_MESSAGE_INVALID_ARGUMENTS,
        BLUETOOTH_EVENT_MAP_GET_MESSAGE_FAILED,
+       BLUETOOTH_EVENT_MAP_LIST_FILTER_FIELD_COMPLETE,
 
        BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE = BLUETOOTH_EVENT_OBEX_SERVER_BASE,
                                                                /* Obex server authorize event*/
@@ -1275,6 +1277,13 @@ typedef struct {
 } bt_opc_transfer_info_t;
 
 /* TODO: MAP client structures, see above */
+/**
+ * Stucture to Map filter fields
+ */
+typedef struct {
+       char **fields;
+       int size;
+} bt_map_list_filter_fields_info_t;
 
 /* Obex Server transfer type */
 #define TRANSFER_PUT "PUT"
@@ -1790,12 +1799,92 @@ typedef struct {
        char if_name[16];
 } bt_ipsp_connection_info_t;
 
-
-/* TODO MAP structures */
 typedef struct {
        char* session_path;
        char* remote_address;
-} bt_map_session_info_s;
+} bt_map_client_session_info_s;
+
+typedef char* bt_map_client_message_object_t;
+
+typedef struct {
+       int16_t offset;
+       int16_t max_count;
+} bt_map_client_list_folders_filter_t;
+
+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_t;
+
+typedef struct {
+       bt_map_client_message_object_t 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_t;
+
+typedef struct {
+       int is_transparent;
+       int is_retry;
+       char *charset;
+} bt_map_client_push_message_args_t;
+
+typedef struct {
+       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_t;
+
+typedef struct {
+       char **names; // holding %size null-terminated folder names
+       int64_t size;
+} bt_map_client_folders_s;
+
+typedef struct {
+       bt_map_client_message_item_t *message_items;
+       int64_t size;
+} bt_map_client_message_items_s;
+
+typedef struct {
+       const char* target_file;
+       void* user_data;
+} bt_get_message_callback_data;
 
 /**
  * Callback pointer type
@@ -4824,7 +4913,7 @@ int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
 
 
 /**
- * @fn int bluetooth_map_init(void)
+ * @fn int bluetooth_map_client_init(void)
  * @brief Initialize MAP client.
  *
  * This function is a synchronous call.
@@ -4839,38 +4928,35 @@ int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
  * @exception   None
  *
  * @remark       None
- * @see          bluetooth_map_deinit
+ * @see          bluetooth_map_client_deinit
  */
-int bluetooth_map_init(void);
+int bluetooth_map_client_init(void);
 
-/**
- * @fn int bluetooth_map_deinit(void)
- * @brief Deinitialize MAP client.
- *
- * This function is a synchronous call.
- * No event corresponding to this api
- *
- * @return   BLUETOOTH_ERROR_NONE  - Success \n
- *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
- *              BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
- *
- * @exception   None
- *
- * @remark       None
- * @see          bluetooth_map_init
- */
- int bluetooth_map_deinit(void);
+int bluetooth_map_client_deinit(void);
+
+int bluetooth_map_client_create_session(
+   bt_map_client_session_info_s *session
+);
 
- int bluetooth_map_create_session(bt_map_session_info_s* s);
+int bluetooth_map_client_destroy_session(
+    bt_map_client_session_info_s *session
+);
 
- int bluetooth_map_destroy_session(bt_map_session_info_s* session);
+int bluetooth_map_client_set_folder(
+    bt_map_client_session_info_s *session,
+    const char *name
+);
+
+int bluetooth_map_client_list_folders(
+    bt_map_client_session_info_s *session,
+    bt_map_client_list_folders_filter_t *filter
+);
 
 /**
- * @fn int bluetooth_map_update_inbox(void)
- * @brief Request remote to update its inbox.
+ * @fn int bluetooth_map_client_list_filter_fields(bt_map_session_info_s* session)
+ * @brief Return all available fields that can be used in Fields filter.
  *
- * This function is a synchronous call.
- * No event corresponding to this api
+ * This function is a asynchronous call.
  *
  * @return   BLUETOOTH_ERROR_NONE  - Success \n
  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
@@ -4880,9 +4966,33 @@ int bluetooth_map_init(void);
  * @param[in]  session   Information about session.
  * @remark       None
  */
- int bluetooth_map_update_inbox(bt_map_session_info_s* session);
-
- /* TODO: MAP, see above */
+int bluetooth_map_client_list_filter_fields(
+    bt_map_client_session_info_s *session
+);
+
+int bluetooth_map_client_list_messages(
+    bt_map_client_session_info_s *session,
+    const char *folder,
+    bt_map_client_list_messages_filter_t *filter
+);
+
+int bluetooth_map_client_update_inbox(
+    bt_map_client_session_info_s *session
+);
+
+int bluetooth_map_client_push_message(
+    bt_map_client_session_info_s *session,
+    const char *source_file,
+    const char *folder,
+    bt_map_client_push_message_args_t *args
+);
+
+int bluetooth_map_client_get_message(
+    bt_map_client_session_info_s *session,
+    const bt_map_client_message_object_t message_object,
+    const char *target_file,
+    bool attachment
+);
 
 
 /**