*/
#include <string.h>
+#include <stdbool.h>
#include "bluetooth-api.h"
#include "bt-internal-types.h"
#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);
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);
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);
return result;
}
-BT_EXPORT_API int bluetooth_map_set_folder(
- bt_map_session_info_s* session,
- const char* name)
+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);
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;
}
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);
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;
}
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;
+}
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;
}
case BT_MAP_CREATE_SESSION: {
BT_DBG("BT_MAP_CREATE_SESSION");
char *address = (char *)g_variant_get_data(in_param1);
- char* session_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);
if (result == BLUETOOTH_ERROR_NONE) {
BT_DBG("successfully destroyed session");
}
- free(session_id);
break;
}
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;
/* 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;
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;
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("+");
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("+");
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;
+}
} 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
}
#define _BLUETOOTH_API_H_
#include <stdlib.h>
+#include <stdbool.h>
#include <unistd.h>
#include <glib.h>
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
/**
- * @fn int bluetooth_map_init(void)
+ * @fn int bluetooth_map_client_init(void)
* @brief Initialize MAP client.
*
* This function is a synchronous call.
* @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
+);
/**
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,