[Bluetooth][OTP-Client] Handle GATT operations for OTP
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
index 1dac034..3eab8cb 100644 (file)
@@ -81,6 +81,11 @@ extern "C" {
 #define BLUETOOTH_TDS_DATA_LENGTH_MAX  239 /**< This specifies maximum AD data length: 0xEF */
 #define BLUETOOTH_TDS_CONTROL_POINT_PARAM_LENGTH_MAX   500 /**< TDS Control Point parameter Max length */
 
+/*
+ * < This defines the maximum size of OTP server directory name
+ */
+#define BLUETOOTH_MAX_OTP_SERVER_DIR_NAME 100
+
 /**
  * This is Bluetooth error code
  */
@@ -197,7 +202,15 @@ extern "C" {
 #define BLUETOOTH_ERROR_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3d
 #define BLUETOOTH_ERROR_CONNECTION_FAILED_TO_BE_ESTABLISHED    0x3e
 
-
+/*
+ * Bluetooth OTP error codes
+ */
+#define BLUETOOTH_ERROR_INVALID_DIRECTORY 0x01
+#define BLUETOOTH_ERROR_NO_OBJECTS_FOUND 0x02
+#define BLUETOOTH_ERROR_WRITE_REQUEST_REJECTED 0x80
+#define BLUETOOTH_ERROR_OBJECT_NOT_SELECTED 0x81
+#define BLUETOOTH_ERROR_CONCURRENCY_LIMIT_EXCEEDED 0x82
+#define BLUETOOTH_ERROR_OBJECT_NAME_EXISITS 0x83
 
 /**
 * Device disconnect reason
@@ -225,6 +238,15 @@ typedef enum {
 } bluetooth_device_address_type_t;
 
 /**
+ * This is BD Address type defined in kernel BT header
+ */
+typedef enum {
+       BLUETOOTH_BDADDR_BREDR = 0x00,
+       BLUETOOTH_BDADDR_LE_PUBLIC = 0x01,
+       BLUETOOTH_BDADDR_LE_RANDOM = 0x02
+} bluetooth_bdaddr_type_e;
+
+/**
  * This is Bluetooth version
  */
 typedef struct {
@@ -484,6 +506,15 @@ typedef struct {
 } bluetooth_tds_transport_data_info_t;
 
 /**
+* Structure to hold the OTP response data from remote OTP server
+*/
+typedef struct {
+       char *handle;      /**< Handle */
+       int data_length;                        /**< Data length */
+       char *data;                             /**< Read data */
+} bluetooth_otp_resp_info_t;
+
+/**
 * Advertising parameters
 */
 typedef struct {
@@ -798,6 +829,10 @@ typedef enum {
        BLUETOOTH_EVENT_TDS_ACTIVATION_RESULT,        /** TDS Activation Result */
        BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED,    /** TDS CCCD enabled event */
        BLUETOOTH_EVENT_TDS_ACTIVATION_INDICATION,    /** TDS Activation Indication from Provider */
+
+       BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED,       /* OTP Server Status **/
+       BLUETOOTH_EVENT_OTP_READ_CHAR_VAL,      /* OTP Read Value Response */
+       BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED,       /* OTP Notification Enabled Response */
 } bluetooth_event_type_t;
 
  /**
@@ -5074,6 +5109,7 @@ int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
 /**
  * @fn int bluetooth_oob_add_remote_data(
  *                     const bluetooth_device_address_t *remote_device_address,
+ *                     bluetooth_bdaddr_type_e address_type,
  *                     bt_oob_data_t *oob_data)
  * @brief Add/updated the remote device  Hash and Randmizer.
  *
@@ -5085,6 +5121,7 @@ int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
  *
  * @exception  None
  * @param[in] remote_device_address - Remote device address
+  *          address_type - bdaddr type
  *           remote_oob_data - Ponter to Hash and Randomizer oob data structure
  *
  * @remark     None
@@ -5093,6 +5130,7 @@ int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
 
 int bluetooth_oob_add_remote_data(
                   const bluetooth_device_address_t *remote_device_address,
+                  bluetooth_bdaddr_type_e address_type,
                   bt_oob_data_t *remote_oob_data);
 
 
@@ -7509,6 +7547,44 @@ int bluetooth_tds_activate_control_point(const bluetooth_device_address_t *devic
                                                unsigned char *buf, int length);
 
 /**
+ * @fn int bluetooth_otp_server_init(const char *directory);
+ *
+ * @brief Starts OTP server.
+ *
+ * This function is a synchronous call.
+ *
+ * @return
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] None
+ *
+ * @remark     None
+ */
+int bluetooth_otp_server_init(const char *directory);
+
+/**
+ * @fn int bluetooth_otp_server_deinit();
+ *
+ * @brief Stops OTP server.
+ *
+ * This function is a synchronous call.
+ *
+ * @return
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] None
+ *
+ * @remark     None
+ */
+int bluetooth_otp_server_deinit();
+
+int bluetooth_otp_enable_notification(const char *handle);
+
+int bluetooth_otp_read_characteristic_value(const char *handle);
+
+/**
  * @}
  */