[bluetooth-frwk] API defines 47/102847/2
authorPiotr Dabrowski <p.dabrowski2@samsung.com>
Wed, 26 Oct 2016 15:46:50 +0000 (17:46 +0200)
committerPyun DoHyun <dh79.pyun@samsung.com>
Thu, 8 Dec 2016 00:19:22 +0000 (16:19 -0800)
Change-Id: I908dc6e6410c91c8c4b6b483658b796d0e2ccfb9

bt-api/bt-map-client.c
bt-api/bt-request-sender.c
bt-service/bt-request-handler.c
bt-service/bt-service-map-client.c
bt-service/include/bt-service-map-client.h
include/bluetooth-api.h
include/bt-internal-types.h

index 6c6b3de..a476881 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <string.h>
+#include <stdbool.h>
 
 #include "bluetooth-api.h"
 #include "bt-internal-types.h"
@@ -28,9 +29,9 @@
 #include "bt-dpm.h"
 #endif
 
-BT_EXPORT_API int bluetooth_map_init(void)
+BT_EXPORT_API int bluetooth_map_client_init(void)
 {
-       BT_DBG("bluetooth_map_init");
+       BT_DBG("bluetooth_map_client_init");
        bt_user_info_t *user_info;
 
        user_info = _bt_get_user_data(BT_COMMON);
@@ -39,15 +40,17 @@ BT_EXPORT_API int bluetooth_map_init(void)
        return _bt_register_event(BT_MAP_CLIENT_EVENT, user_info->cb, user_info->user_data);
 }
 
-BT_EXPORT_API int bluetooth_map_deinit(void)
+BT_EXPORT_API int bluetooth_map_client_deinit(void)
 {
-       BT_DBG("bluetooth_map_deinit");
+       BT_DBG("bluetooth_map_client_deinit");
        return _bt_unregister_event(BT_MAP_CLIENT_EVENT);
 }
 
-BT_EXPORT_API int bluetooth_map_create_session(bt_map_session_info_s* session) {
-       BT_DBG("bluetooth_map_create_session");
-       int result = 0;
+BT_EXPORT_API int bluetooth_map_client_create_session(
+       bt_map_client_session_info_s *session)
+{
+       BT_DBG("bluetooth_map_client_create_session");
+       int result = BLUETOOTH_ERROR_INTERNAL;
 
        BT_CHECK_ENABLED(return);
        BT_CHECK_PARAMETER(session->remote_address, return);
@@ -73,9 +76,11 @@ BT_EXPORT_API int bluetooth_map_create_session(bt_map_session_info_s* session) {
        return result;
 }
 
-BT_EXPORT_API int bluetooth_map_destroy_session(bt_map_session_info_s* session) {
-       BT_DBG("bluetooth_map_destroy_session");
-       int result = 0;
+BT_EXPORT_API int bluetooth_map_client_destroy_session(
+       bt_map_client_session_info_s *session)
+{
+       BT_DBG("bluetooth_map_client_destroy_session");
+       int result = BLUETOOTH_ERROR_INTERNAL;
 
        BT_CHECK_ENABLED(return);
        BT_CHECK_PARAMETER(session->session_path, return);
@@ -98,12 +103,12 @@ BT_EXPORT_API int bluetooth_map_destroy_session(bt_map_session_info_s* session)
        return result;
 }
 
-BT_EXPORT_API int bluetooth_map_set_folder(
-       bt_map_session_info_s* session,
-       const charname)
+BT_EXPORT_API int bluetooth_map_client_set_folder(
+       bt_map_client_session_info_s *session,
+       const char *name)
 {
-       BT_DBG("bluetooth_map_set_folder");
-       int result;
+       BT_DBG("bluetooth_map_client_set_folder");
+       int result = BLUETOOTH_ERROR_INTERNAL;
 
        BT_CHECK_ENABLED(return);
        BT_CHECK_PARAMETER(session->session_path, return);
@@ -119,7 +124,7 @@ BT_EXPORT_API int bluetooth_map_set_folder(
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
        if (result != BLUETOOTH_ERROR_NONE) {
-               BT_ERR("bluetooth_map_set_folder failed");
+               BT_ERR("bluetooth_map_client_set_folder failed");
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
@@ -128,10 +133,47 @@ BT_EXPORT_API int bluetooth_map_set_folder(
        return result;
 }
 
-BT_EXPORT_API int bluetooth_map_update_inbox(bt_map_session_info_s* session)
+BT_EXPORT_API int bluetooth_map_client_list_folders(
+    bt_map_client_session_info_s *session,
+    GVariant *filter)
+{
+    BT_DBG("bluetooth_map_client_list_folders");
+    int result = BLUETOOTH_ERROR_INTERNAL;
+
+    /* TODO: MAP */
+
+    return result;
+}
+
+BT_EXPORT_API int bluetooth_map_client_list_filter_fields(
+    bt_map_client_session_info_s *session)
+{
+    BT_DBG("bluetooth_map_client_list_filter_fields");
+    int result = BLUETOOTH_ERROR_INTERNAL;
+
+    /* TODO: MAP */
+
+    return result;
+}
+
+BT_EXPORT_API int bluetooth_map_client_list_messages(
+    bt_map_client_session_info_s *session,
+    const char *folder,
+    GVariant *filter)
+{
+    BT_DBG("bluetooth_map_client_list_messages");
+    int result = BLUETOOTH_ERROR_INTERNAL;
+
+    /* TODO: MAP */
+
+    return result;
+}
+
+BT_EXPORT_API int bluetooth_map_client_update_inbox(
+    bt_map_client_session_info_s *session)
 {
-       BT_DBG("bluetooth_map_update_inbox");
-       int result;
+       BT_DBG("bluetooth_map_client_update_inbox");
+       int result = BLUETOOTH_ERROR_INTERNAL;
 
        BT_CHECK_ENABLED(return);
        BT_CHECK_PARAMETER(session->session_path, return);
@@ -145,7 +187,7 @@ BT_EXPORT_API int bluetooth_map_update_inbox(bt_map_session_info_s* session)
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
        if (result != BLUETOOTH_ERROR_NONE) {
-               BT_ERR("bluetooth_map_update_inbox failed");
+               BT_ERR("bluetooth_map_client_update_inbox failed");
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
@@ -154,4 +196,30 @@ BT_EXPORT_API int bluetooth_map_update_inbox(bt_map_session_info_s* session)
        return result;
 }
 
-/* TODO: MAP API */
+BT_EXPORT_API int bluetooth_map_client_push_message(
+    bt_map_client_session_info_s *session,
+    const char *source_file,
+    const char *folder,
+    GVariant *args)
+{
+    BT_DBG("bluetooth_map_client_push_message");
+    int result = BLUETOOTH_ERROR_INTERNAL;
+
+    /* TODO: MAP */
+
+    return result;
+}
+
+BT_EXPORT_API int bluetooth_map_client_get_message(
+    bt_map_client_session_info_s *session,
+    const char *message_object_name,
+    const char *target_file,
+    bool attachment)
+{
+    BT_DBG("bluetooth_map_client_get_message");
+    int result = BLUETOOTH_ERROR_INTERNAL;
+
+    /* TODO: MAP */
+
+    return result;
+}
index c0d05b0..be6ab8d 100644 (file)
@@ -315,9 +315,12 @@ static void __send_request_cb(GDBusProxy *proxy,
                                request_id = g_array_index(out_param1, int, 0);
                                BT_DBG("request_id : %d", request_id);
                                _bt_add_push_request_id(request_id);
-                       } else if (cb_data->service_function == BT_MAP_XXX) {
-                               /* TODO: MAP service functions */
                        }
+                       /* TODO: MAP service functions:
+                       else if (cb_data->service_function == BT_MAP_XXX) {
+
+                       }
+                       */
 
                        goto done;
                }
index 3273b2a..eb92aa5 100644 (file)
@@ -2265,7 +2265,7 @@ int __bt_obexd_request(int function_name,
        case BT_MAP_CREATE_SESSION: {
                BT_DBG("BT_MAP_CREATE_SESSION");
                char *address = (char *)g_variant_get_data(in_param1);
-               charsession_id = NULL;
+               char *session_id = NULL;
                result = _bt_create_session_sync(address, &session_id);
                if (result == BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, session_id, strlen(session_id)+1);
@@ -2280,7 +2280,6 @@ int __bt_obexd_request(int function_name,
                if (result == BLUETOOTH_ERROR_NONE) {
                        BT_DBG("successfully destroyed session");
                }
-               free(session_id);
                break;
        }
 
@@ -2292,24 +2291,58 @@ int __bt_obexd_request(int function_name,
                break;
        }
 
+       case BT_MAP_LIST_FOLDERS: {
+               BT_DBG("BT_MAP_LIST_FOLDERS");
+
+               /* TODO: MAP */
+
+               result = BLUETOOTH_ERROR_NOT_SUPPORT;
+               break;
+       }
+
+       case BT_MAP_LIST_FILTER_FIELDS: {
+               BT_DBG("BT_MAP_LIST_FILTER_FIELDS");
+
+               /* TODO: MAP */
+
+               result = BLUETOOTH_ERROR_NOT_SUPPORT;
+               break;
+       }
+
+       case BT_MAP_LIST_MESSAGES: {
+               BT_DBG("BT_MAP_LIST_MESSAGES");
+
+               /* TODO: MAP */
+
+               result = BLUETOOTH_ERROR_NOT_SUPPORT;
+               break;
+       }
+
        case BT_MAP_UPDATE_INBOX: {
                BT_DBG("BT_MAP_UPDATE_INBOX");
-
                char* session_id = (char *)g_variant_get_data(in_param1);
-
                result = _bt_map_client_update_inbox(session_id);
-               free(session_id);
                break;
        }
 
-       case BT_MAP_LIST_FOLDERS: {
-               BT_DBG("BT_MAP_LIST_FOLDERS");
+       case BT_MAP_PUSH_MESSAGE: {
+               BT_DBG("BT_MAP_PUSH_MESSAGE");
+
+               /* TODO: MAP */
+
+               result = BLUETOOTH_ERROR_NOT_SUPPORT;
+               break;
+       }
+
+       case BT_MAP_GET_MESSAGE: {
+               BT_DBG("BT_MAP_GET_MESSAGE");
+
+               /* TODO: MAP */
 
                result = BLUETOOTH_ERROR_NOT_SUPPORT;
                break;
        }
 
-       /* TODO: MAP? MAP functions, see above */
        case BT_OBEX_SERVER_ALLOCATE: {
                int app_pid;
                gboolean is_native;
index 3ebba02..3eac5c5 100644 (file)
@@ -230,7 +230,7 @@ static int __bt_opp_client_start_XXXXXXXXXX(int request_id, char *address
        /* TODO: MAP */
 }
 
-int _bt_create_session_sync(char* address, char** session_id)
+int _bt_create_session_sync(const char* address, char** session_id)
 {
        BT_DBG("Entered SERVICE create session");
        GDBusConnection *g_conn;
@@ -285,7 +285,7 @@ int _bt_create_session_sync(char* address, char** session_id)
        return BLUETOOTH_ERROR_NONE;
 }
 
-int _bt_destroy_session_sync(char* session_id)
+int _bt_destroy_session_sync(const char* session_id)
 {
        BT_DBG("Entered SERVICE destroy session with id: \"%s\"", session_id);
        GDBusConnection *g_conn;
@@ -324,7 +324,7 @@ int _bt_destroy_session_sync(char* session_id)
        return BLUETOOTH_ERROR_NONE;
 }
 
-int _bt_map_client_set_folder(char* session_id, const char* name)
+int _bt_map_client_set_folder(const char* session_id, const char* name)
 {
        BT_DBG("+");
 
@@ -366,7 +366,43 @@ int _bt_map_client_set_folder(char* session_id, const char* name)
        return BLUETOOTH_ERROR_NONE;
 }
 
-int _bt_map_client_update_inbox(char* session_id)
+int _bt_map_client_list_folders(const char* session_id, GVariant *filter)
+{
+       BT_DBG("+");
+
+       /* TODO: MAP */
+
+       BT_DBG("-");
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_map_client_list_filter_fields(const char* session_id)
+{
+       BT_DBG("+");
+
+       /* TODO: MAP */
+
+       BT_DBG("-");
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_map_client_list_messages(
+               const char* session_id,
+               const char* folder,
+               GVariant *filter)
+{
+       BT_DBG("+");
+
+       /* TODO: MAP */
+
+       BT_DBG("-");
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_map_client_update_inbox(const char* session_id)
 {
        BT_DBG("+");
 
@@ -408,4 +444,33 @@ int _bt_map_client_update_inbox(char* session_id)
 
        return BLUETOOTH_ERROR_NONE;
 }
-/* TODO: MAP */
+
+int _bt_map_client_push_message(
+               const char* session_id,
+               const char* source_file,
+               const char* folder,
+               GVariant *args)
+{
+       BT_DBG("+");
+
+       /* TODO: MAP */
+
+       BT_DBG("-");
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_map_client_get_message(
+               const char* session_id,
+               const char* message_object_name,
+               const char* target_file,
+               bool attachment)
+{
+       BT_DBG("+");
+
+       /* TODO: MAP */
+
+       BT_DBG("-");
+
+       return BLUETOOTH_ERROR_NONE;
+}
index d14f690..4f6e133 100644 (file)
@@ -61,12 +61,26 @@ typedef struct {
 
 } bt_session_data_t; /* TODO: "session"? */
 
-
-int _bt_create_session_sync(char* address, char** session_id);
-int _bt_destroy_session_sync(char* session_id);
-int _bt_map_client_set_folder(char* session_id, const char* name);
-int _bt_map_client_update_inbox(char* session_id);
-/* TODO: MAP */
+int _bt_create_session_sync(const char* address, char** session_id);
+int _bt_destroy_session_sync(const char* session_id);
+int _bt_map_client_set_folder(const char* session_id, const char* name);
+int _bt_map_client_list_folders(const char* session_id, GVariant *filter);
+int _bt_map_client_list_filter_fields(const char* session_id);
+int _bt_map_client_list_messages(
+               const char* session_id,
+               const char* folder,
+               GVariant *filter);
+int _bt_map_client_update_inbox(const char* session_id);
+int _bt_map_client_push_message(
+               const char* session_id,
+               const char* source_file,
+               const char* folder,
+               GVariant *args);
+int _bt_map_client_get_message(
+               const char* session_id,
+               const char* message_object_name,
+               const char* target_file,
+               bool attachment);
 
 #ifdef __cplusplus
 }
index 92bc51a..e7a6951 100644 (file)
@@ -19,6 +19,7 @@
 #define _BLUETOOTH_API_H_
 
 #include <stdlib.h>
+#include <stdbool.h>
 #include <unistd.h>
 #include <glib.h>
 
@@ -1790,12 +1791,10 @@ 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;
 
 /**
  * Callback pointer type
@@ -4824,7 +4823,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,71 +4838,57 @@ int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
  * @exception   None
  *
  * @remark       None
- * @see          bluetooth_map_deinit
- */
-int bluetooth_map_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_create_session(bt_map_session_info_s* s);
-
- int bluetooth_map_destroy_session(bt_map_session_info_s* session);
-
- /**
-  * @fn int bluetooth_map_set_folder(const char *name)
-  * @brief Request set folder.
-  *
-  * 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_INTERNAL - Update inbox failed \n
-  *
-  * @exception   None
-  * @param[in]   name   Folder name.
-  * @param[in]   remote_address   The remote device Bd address.
-  * @remark      None
-  */
-  int bluetooth_map_set_folder(
-        bt_map_session_info_s* session,
-        const char *name
-  );
-
-/**
- * @fn int bluetooth_map_update_inbox(void)
- * @brief Request remote to update its inbox.
- *
- * 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_INTERNAL - Update inbox failed \n
- *
- * @exception   None
- * @param[in]  session   Information about session.
- * @remark       None
- */
- int bluetooth_map_update_inbox(bt_map_session_info_s* session);
-
- /* TODO: MAP, see above */
+ * @see          bluetooth_map_client_deinit
+ */
+int bluetooth_map_client_init(void);
+
+int bluetooth_map_client_deinit(void);
+
+int bluetooth_map_client_create_session(
+   bt_map_client_session_info_s *session
+);
+
+int bluetooth_map_client_destroy_session(
+    bt_map_client_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,
+    GVariant *filter
+);
+
+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,
+    GVariant *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,
+    GVariant *args
+);
+
+int bluetooth_map_client_get_message(
+    bt_map_client_session_info_s *session,
+    const char *message_object_name,
+    const char *target_file,
+    bool attachment
+);
 
 
 /**
index 297b4bd..d9eb63a 100644 (file)
@@ -259,10 +259,13 @@ typedef enum {
        BT_OPP_GET_TRANSFER_PROGRESS,
        BT_MAP_CREATE_SESSION = BT_FUNC_MAP_BASE,
        BT_MAP_DESTROY_SESSION,
-       BT_MAP_UPDATE_INBOX,
-       BT_MAP_LIST_FOLDERS,
        BT_MAP_SET_FOLDER,
-       BT_MAP_XXX, /* TODO: MAP */
+       BT_MAP_LIST_FOLDERS,
+       BT_MAP_LIST_FILTER_FIELDS,
+       BT_MAP_LIST_MESSAGES,
+       BT_MAP_UPDATE_INBOX,
+       BT_MAP_PUSH_MESSAGE,
+       BT_MAP_GET_MESSAGE,
        BT_OBEX_SERVER_ALLOCATE,
        BT_OBEX_SERVER_DEALLOCATE,
        BT_OBEX_SERVER_IS_ACTIVATED,