[bluetooth-frwk] pushMessage
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
index 80e38d3..624abb0 100644 (file)
@@ -19,6 +19,7 @@
 #define _BLUETOOTH_API_H_
 
 #include <stdlib.h>
+#include <stdbool.h>
 #include <unistd.h>
 #include <glib.h>
 
@@ -35,6 +36,7 @@ extern "C" {
  * @{
  */
 
+#define BLUETOOTH_ADDRESS_STRING_LENGTH                17 /**< This specifies bluetooth device address length (AA:BB:CC:DD:EE:FF) */
 #define BLUETOOTH_ADDRESS_LENGTH               6 /**< This specifies bluetooth device address length */
 #define BLUETOOTH_VERSION_LENGTH_MAX           30 /**< This specifies bluetooth device version length */
 #define BLUETOOTH_INTERFACE_NAME_LENGTH                16
@@ -509,6 +511,8 @@ typedef struct {
                                                                /**< Base ID for AVRCP events */
 #define BLUETOOTH_EVENT_IPSP_BASE ((int)(BLUETOOTH_EVENT_AVRCP_CONTROL_BASE + 0x0020))
                                                                /**< Base ID for IPSP events */
+#define BLUETOOTH_EVENT_MAP_BASE  ((int)(BLUETOOTH_EVENT_IPSP_BASE + 0x0020))
+                                                               /**< Base ID for MAP events */
 
 /**
  * Bluetooth event type
@@ -531,7 +535,6 @@ typedef enum {
        BLUETOOTH_EVENT_LE_DISCOVERY_STARTED,           /**< Bluetooth event LE discovery started */
        BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED,  /**< Bluetooth event LE discovery finished */
        BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND,     /**< Bluetooth event remote deice found (LE dev) */
-       BLUETOOTH_EVENT_REMOTE_IBEACON_DEVICE_FOUND,    /**< Bluetooth event remote ibeacon device found (iBeacon LE dev) */
        BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/
        BLUETOOTH_EVENT_BONDING_FINISHED,           /**< Bluetooth event bonding completed */
        BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED,      /**< Bluetooth event bonding removed */
@@ -589,6 +592,29 @@ typedef enum {
        BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,  /* OPC Transfer progress event */
        BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,  /* OPC Transfer Complete event */
 
+       BLUETOOTH_EVENT_MAP_CONNECTED = BLUETOOTH_EVENT_MAP_BASE,
+       BLUETOOTH_EVENT_MAP_DISCONNECTED,
+       /*
+       BLUETOOTH_EVENT_MAP_SET_FOLDER_COMPLETE,
+       BLUETOOTH_EVENT_MAP_SET_FOLDER_INVALID_ARGUMENTS,
+       BLUETOOTH_EVENT_MAP_SET_FOLDER_FAILED,
+       BLUETOOTH_EVENT_MAP_UPDATE_INBOX_COMPLETE,
+       BLUETOOTH_EVENT_MAP_UPDATE_INBOX_FAILED,
+       */
+       BLUETOOTH_EVENT_MAP_LIST_FOLDERS_COMPLETE,
+       BLUETOOTH_EVENT_MAP_LIST_FOLDERS_INVALID_ARGUMENTS,
+       BLUETOOTH_EVENT_MAP_LIST_FOLDERS_FAILED,
+       BLUETOOTH_EVENT_MAP_LIST_MESSAGES_COMPLETE,
+       BLUETOOTH_EVENT_MAP_LIST_MESSAGES_INVALID_ARGUMENTS,
+       BLUETOOTH_EVENT_MAP_LIST_MESSAGES_FAILED,
+       BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_COMPLETE,
+       BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_INVALID_ARGUMENTS,
+       BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_FAILED,
+       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*/
        BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED,   /* Obex Server transfer started event*/
@@ -696,6 +722,7 @@ typedef enum {
        BLUETOOTH_EVENT_IPSP_DISCONNECTED, /**< IPSP Disconnected event */
        BLUETOOTH_EVENT_IPSP_INTERFACE_INFO, /** IPSP BT Interface Info after connection */
        BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED,  /** LE data length values changed */
+       BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED, /** Proximity property changed */
 } bluetooth_event_type_t;
 
  /**
@@ -709,6 +736,7 @@ typedef enum {
        BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103),                  /**<DUN*/
        BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104),      /**<OBEX IR MC SYNC*/
        BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105),     /**<OPP*/
+       BLUETOOTH_OBEX_MESSAGE_ACCESS_SERVICE_UUID = ((unsigned short)0x1134),  /**<MAP*/
        BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106),           /**<FTP*/
        BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107),            /**<IRMC SYNC COMMAND*/
        BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108),                   /**<HS*/
@@ -1010,20 +1038,6 @@ typedef struct {
 } bluetooth_le_device_info_t;
 
 typedef struct {
-       bluetooth_device_address_t device_address;      /**< device address */
-       int addr_type;                  /**< address type*/
-       int rssi;                       /**< received strength signal*/
-       int adv_type;
-       int company_id;         /** <Company ID> */
-       int ibeacon_type;       /** <iBeacon type> */
-       int major_id;           /** <Major ID> */
-       int minor_id;           /** <Minor ID> */
-       int measured_power; /** <Measured Power value for proximity> */
-       int uuid_len;           /** <uuid string len> */
-       char uuid[BLUETOOTH_UUID_STRING_MAX];   /** <customr/specific UUID> */
-} bluetooth_ibeacon_device_info_t;
-
-typedef struct {
        int slot_id;
        bluetooth_le_scan_filter_feature_t added_features;              /**< added features */
        bluetooth_device_address_t device_address;                      /**< device address */
@@ -1262,6 +1276,15 @@ typedef struct {
        int percentage;
 } 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"
 #define TRANSFER_GET "GET"
@@ -1413,7 +1436,7 @@ typedef struct {
        char *service_handle;
        char *address;
        guint16 offset;
-       guint8 req_id;
+       guint req_id;
 } bt_gatt_read_req_t;
 
 /**
@@ -1423,7 +1446,8 @@ typedef struct {
        char *att_handle;
        char *service_handle;
        char *address;
-       guint8 req_id;
+       guint req_id;
+       gboolean response_needed;
        guint16 offset;
        guint8 *att_value;
        guint32 val_len;
@@ -1654,6 +1678,15 @@ typedef struct {
        guint16 max_rx_time;
 } bt_le_data_length_params_t;
 
+/**
+ * Structure for proximity property change params
+ */
+typedef struct {
+       bluetooth_device_address_t device_address;
+       int role;
+       int service_type;
+       int alert_lvl;
+} bt_pxp_property_changed_params_t;
 
  /**
  * @brief DPM BT allowance state
@@ -1766,6 +1799,93 @@ typedef struct {
        char if_name[16];
 } bt_ipsp_connection_info_t;
 
+typedef struct {
+       char* session_path;
+       char* remote_address;
+} 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
  */
@@ -4793,6 +4913,89 @@ int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
 
 
 /**
+ * @fn int bluetooth_map_client_init(void)
+ * @brief Initialize 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_INTERNAL - Internal Error \n
+ *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
+ *              BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
+ *
+ * @exception   None
+ *
+ * @remark       None
+ * @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,
+    bt_map_client_list_folders_filter_t *filter
+);
+
+/**
+ * @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 asynchronous call.
+ *
+ * @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_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
+);
+
+
+/**
  * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
  * @brief Read the local Hash and Randmizer.
  *
@@ -6160,7 +6363,6 @@ int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
 
 int bluetooth_set_passkey_notification(gboolean enable);
 
-#ifdef TIZEN_DPM_VCONF_ENABLE
 /**
  * @fn int bluetooth_dpm_is_mode_allowed(void);
  *
@@ -6178,7 +6380,6 @@ int bluetooth_set_passkey_notification(gboolean enable);
  * @remark     None
  */
 int bluetooth_dpm_is_mode_allowed(void);
-#endif
 
 /**
  * @fn int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value);
@@ -6906,10 +7107,10 @@ int bluetooth_dpm_set_data_transfer_state(bt_dpm_status_t value);
 int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value);
 
 /**
- * @fn int bluetooth_set_proximity_property(const bluetooth_device_address_t *device_address,
+ * @fn int bluetooth_proximity_monitor_set_property(const bluetooth_device_address_t *device_address,
  *                                             bluetooth_pxp_poperty_t property, int value);
  *
- * @brief Sets the Proximity alert level/properties.
+ * @brief Sets the Proximity alert level/properties for monitor role.
  *
  * This function is a synchronous call.
  *
@@ -6926,14 +7127,14 @@ int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value);
  *
  * @remark     None
  */
-int bluetooth_set_proximity_property(const bluetooth_device_address_t *device_address,
+int bluetooth_proximity_monitor_set_property(const bluetooth_device_address_t *device_address,
                                                        bluetooth_pxp_poperty_t property, int value);
 
 /**
- * @fn int bluetooth_get_proximity_property(const bluetooth_device_address_t *device_address,
+ * @fn int bluetooth_proximity_monitor_get_property(const bluetooth_device_address_t *device_address,
  *                                             bluetooth_pxp_poperty_t property, int *value);
  *
- * @brief Reads the Proximity alert level/properties.
+ * @brief Reads the Proximity alert level/properties for monitor role.
  *
  * This function is a synchronous call.
  *
@@ -6949,21 +7150,21 @@ int bluetooth_set_proximity_property(const bluetooth_device_address_t *device_ad
  *
  * @remark     None
  */
-int bluetooth_get_proximity_property(const bluetooth_device_address_t *device_address,
+int bluetooth_proximity_monitor_get_property(const bluetooth_device_address_t *device_address,
                                                        bluetooth_pxp_poperty_t property, int *value);
 
 /**
- * @fn int bluetooth_get_proximity_supported_services(const bluetooth_device_address_t *device_address,
+ * @fn int bluetooth_proximity_monitor_get_supported_services(const bluetooth_device_address_t *device_address,
  *                                             int *services_supported);
  *
- * @brief Reads the Proximity profile supported properties/services.
+ * @brief Reads the Proximity Monitor profile supported properties/services.
  *
  * This function is a synchronous call.
  *
- * @return   BLUETOOTH_ERROR_NONE - Success \n
- *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
- *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
- *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ *                              BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ *                              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
  *
  * @exception  None
  * @param[in] device_address remote device address
@@ -6971,8 +7172,64 @@ int bluetooth_get_proximity_property(const bluetooth_device_address_t *device_ad
  *
  * @remark     None
  */
-int bluetooth_get_proximity_supported_services(const bluetooth_device_address_t *device_address,
+int bluetooth_proximity_monitor_get_supported_services(const bluetooth_device_address_t *device_address,
                                                        int *services_supported);
+
+/**
+ * @fn int bluetooth_proximity_reporter_register();
+ *
+ * @brief Register all proximity related services in BlueZ.
+ *
+ * This function is a synchronous call.
+ *
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                      BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ *
+ * @exception  None
+ *
+ * @remark     None
+ */
+int bluetooth_proximity_reporter_register(void);
+
+/**
+ * @fn int bluetooth_proximity_reporter_unregister();
+ *
+ * @brief Unregister all proximity related services in BlueZ.
+ *
+ * This function is a synchronous call.
+ *
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                      BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ *
+ * @exception  None
+ *
+ * @remark     None
+ */
+int bluetooth_proximity_reporter_unregister(void);
+
+/**
+ * @fn int bluetooth_proximity_reporter_get_property(const bluetooth_device_address_t *device_address,
+ *                                             bluetooth_pxp_poperty_t property, int *value);
+ *
+ * @brief Reads the Proximity alert level/properties for reporter role.
+ *
+ * This function is a synchronous call.
+ *
+ * @return      BLUETOOTH_ERROR_NONE - Success \n
+ *                              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
+ *                              BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
+ *                              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
+ *
+ * @exception  None
+ * @param[in] device_address remote device address
+ * @param[in] property proximity profile property
+ * @param[out] value alert level/property value
+ *
+ * @remark     None
+ */
+int bluetooth_proximity_reporter_get_property(const bluetooth_device_address_t *device_address,
+                                                       bluetooth_pxp_poperty_t property, int *value);
+
 /**
  * @}
  */