*/
#define BLUETOOTH_MAX_OTP_SERVER_DIR_NAME 100
+#define BLUETOOTH_OTP_CHARC_VAL_MAX_LENGTH 500 /**< OTP Characteristics Value Max length */
+
/**
* This is Bluetooth error code
*/
#define BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION ((int)BLUETOOTH_ERROR_BASE - 0x28)
/**< Device Policy Restricted */
+/**
+* Error codes for ATT Error response *
+*/
+#define BLUETOOTH_ATT_ERROR_INTERNAL -1
+#define BLUETOOTH_ATT_ERROR_NONE 0x00
+#define BLUETOOTH_ATT_ERROR_INVALID_HANDLE 0x01
+#define BLUETOOTH_ATT_ERROR_READ_NOT_PERMITTED 0x02
+#define BLUETOOTH_ATT_ERROR_WRITE_NOT_PERMITTED 0x03
+#define BLUETOOTH_ATT_ERROR_INVALID_PDU 0x04
+#define BLUETOOTH_ATT_ERROR_AUTHENTICATION 0x05
+#define BLUETOOTH_ATT_ERROR_REQUEST_NOT_SUPPORTED 0x06
+#define BLUETOOTH_ATT_ERROR_INVALID_OFFSET 0x07
+#define BLUETOOTH_ATT_ERROR_AUTHORIZATION 0x08
+#define BLUETOOTH_ATT_ERROR_PREPARE_QUEUE_FULL 0x09
+#define BLUETOOTH_ATT_ERROR_ATTRIBUTE_NOT_FOUND 0x0A
+#define BLUETOOTH_ATT_ERROR_ATTRIBUTE_NOT_LONG 0x0B
+#define BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0C
+#define BLUETOOTH_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN 0x0D
+#define BLUETOOTH_ATT_ERROR_UNLIKELY 0x0E
+#define BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION 0x0F
+#define BLUETOOTH_ATT_ERROR_UNSUPPORTED_GROUP_TYPE 0x10
+#define BLUETOOTH_ATT_ERROR_INSUFFICIENT_RESOURCES 0x11
+/* Common profile error codes */
+#define BLUETOOTH_ATT_ERROR_WRITE_REQUEST_REJECTED 0xFC
+#define BLUETOOTH_ATT_ERROR_CCCD_IMPROPERLY_CONFIGURED 0xFD
+#define BLUETOOTH_ATT_ERROR_PROCEDURE_ALREADY_IN_PROGRESS 0xFE
+#define BLUETOOTH_ATT_ERROR_OUT_OF_RANGE 0xFF
+
+/*
+ * Bluetooth ATT error codes specific to OTP
+ */
+#define BLUETOOTH_OTP_ERROR_WRITE_REQUEST_REJECTED 0x80
+#define BLUETOOTH_OTP_ERROR_OBJECT_NOT_SELECTED 0x81
+#define BLUETOOTH_OTP_ERROR_CONCURRENCY_LIMIT_EXCEEDED 0x82
+#define BLUETOOTH_OTP_ERROR_OBJECT_NAME_EXISTS 0x83
+
+/*
+ * Bluetooth OTP error codes
+ * TODO: Check error code conflict
+ */
+#define BLUETOOTH_ERROR_INVALID_DIRECTORY 0x01
+#define BLUETOOTH_ERROR_NO_OBJECTS_FOUND 0x02
/**
* Device disconnection reasons; received from stack
#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
*/
} bluetooth_tds_transport_data_info_t;
/**
+* OTP Characteristics Value
+*/
+typedef struct {
+ int length; /**< Characteristics value length */
+ guint8 data[BLUETOOTH_OTP_CHARC_VAL_MAX_LENGTH]; /**< Characteristics data */
+} bluetooth_otp_charc_data_t;
+
+/**
* Structure to hold the OTP response data from remote OTP server
*/
typedef struct {
} bluetooth_otp_resp_info_t;
/**
+* Structure to hold the OTC Channel Info
+*/
+typedef struct {
+ gboolean connected; /**< Connection Status */
+ int fd; /**< Fd */
+ char *address; /**< Remote address */
+} bluetooth_otc_info_t;
+
+/**
* Advertising parameters
*/
typedef struct {
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_OTP_WRITE_CHAR_VAL, /* OTP Write Value Response */
+ BLUETOOTH_EVENT_OTP_INDICATION, /* OTP Indication */
+ BLUETOOTH_EVENT_OTC_STATE_CHANGED, /* OTC Connection State Changed Event */
} bluetooth_event_type_t;
/**
HTYPE_TRANS_GET_PROTOCOL,
HTYPE_TRANS_SET_PROTOCOL,
HTYPE_TRANS_DATA,
- HTYPE_TRANS_UNKNOWN
+ HTYPE_TRANS_UNKNOWN,
+ HTYPE_TRANS_GET_IDLE = 0xF0,
+ HTYPE_TRANS_SET_IDLE = 0xF1,
} bt_hid_header_type_t;
/**
} bt_gatt_indicate_confirm_t;
/**
+ * Structure for GATT response data
+ */
+typedef struct {
+ guint8 *value;
+ guint32 len;
+ gpointer user_data;
+} bt_gatt_resp_data_t;
+
+/**
* Structure to RSSI Signal Strength Alert
*/
TRUSTED_PROFILE_PBAP = 1,
TRUSTED_PROFILE_MAP,
TRUSTED_PROFILE_SAP,
+ TRUSTED_PROFILE_HFP_HF,
+ TRUSTED_PROFILE_A2DP,
TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
} bluetooth_trusted_profile_t;
/**
- * Restricted Profile types
- */
-typedef enum {
- RESTRICTED_PROFILE_HFP_HS = 1,
- RESTRICTED_PROFILE_A2DP,
-} bluetooth_restricted_profile_t;
-
-/**
* Structure for LE data length change params
*/
typedef struct {
int bluetooth_enable_adapter_le(void);
int bluetooth_disable_adapter_le(void);
+int bluetooth_get_uuid_name(const char *uuid, char **name);
/**
* @fn int bluetooth_reset_adapter(void)
int profile, int *trust);
/**
- * @fn int bluetooth_set_profile_restricted(const bluetooth_device_address_t *device_address, int profile, int restricted)
- * @brief Sets a profile restricted connection for a device
- *
- * This function is used to Set a profile as restricted for a device
- *
- * This function is a synchronous call.
- *
- * @param[in] device_address a device address of remote bluetooth device
- * @param[in] profile profile which is to be set as restricted[1-HFP_HS, 2-A2DP]
- * @param[in] restricted to set as restricted or not[1-restricted 0-permitted]
- *
- * @return BLUETOOTH_ERROR_NONE - Success \n
- * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
- * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
- * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
- *
- * @remark None
- */
-int bluetooth_set_profile_restricted(
- const bluetooth_device_address_t *device_address,
- int profile, int restricted);
-
-/**
- * @fn int bluetooth_get_profile_restricted(const bluetooth_device_address_t *device_address, int profile, int *restricted)
- * @brief Gets a restricted connection state
- *
- * This function is used to Get a profile is restricted or not for a device
- *
- * This function is a synchronous call.
- *
- * @param[in] device_address a device address of remote bluetooth device
- * @param[in] profile profile whose restricted status is needed[1-HFP_HS, 2-A2DP]
- * @param[out] restricted profile is set as restricted or not[1-restricted 0-permitted]
- *
- * @return BLUETOOTH_ERROR_NONE - Success \n
- * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
- * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
- * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
- *
- * @remark None
- */
-int bluetooth_get_profile_restricted(
- const bluetooth_device_address_t *device_address,
- int profile, int *restricted);
-
-/**
* @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
* @brief Get the visibility mode
*
bt_gatt_service_property_t *service);
/**
- * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
+ * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name)
*
* @brief Register to GATT based service to receive value change notification/indication.
*
*
* @exception None
* @param[in] service_handle - Handle for remote service.
+ * @param[in] service_name - Friednly name of service uuid.
*
* @remark None
* @see None
*/
-int bluetooth_gatt_watch_characteristics(const char *service_handle);
+int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name);
/**
* @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
* @see None
*/
int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
- const guint8 *value, int length, guint8 write_type);
+ const guint8 *value, int length,
+ guint8 write_type, gpointer app_data);
/**
* @remark None
* @see None
*/
-int bluetooth_gatt_read_characteristic_value(const char *char_handle);
+int bluetooth_gatt_read_characteristic_value(const char *char_handle, gpointer app_data);
/**
* @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
* @remark None
* @see None
*/
-int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
+int bluetooth_gatt_read_descriptor_value(const char *desc_handle, gpointer app_data);
/**
* @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
* @see None
*/
int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
- const guint8 *value, int length);
+ const guint8 *value, int length, gpointer app_data);
/* @fn int bluetooth_gatt_init(void)
*
*/
int bluetooth_otp_server_deinit();
+/**
+ * @fn int bluetooth_otp_enable_notification(const char *handle);
+ *
+ * @brief Enable notification for remote OACP & OLCP characteristics.
+ *
+ * This function is a synchronous call.
+ *
+ * @return
+ *
+ * @exception None
+ * @param[in] None
+ * @param[out] None
+ *
+ * @remark None
+ */
int bluetooth_otp_enable_notification(const char *handle);
+/**
+ * @fn int bluetooth_otp_write_characteristics_value( const char *handle,
+ * unsigned char *buf, int length);
+ *
+ * @brief Write value on remote characteristics.
+ *
+ * This function is a synchronous call.
+ *
+ * @return
+ *
+ * @exception None
+ * @param[in] None
+ * @param[out] None
+ *
+ * @remark None
+ */
+int bluetooth_otp_write_characteristics_value(const char *handle,
+ unsigned char *buf, int length);
+
+/**
+ * @fn int bluetooth_otp_read_characteristic_value(const char *handle);
+ *
+ * @brief Read value for remote characteristics.
+ *
+ * This function is a synchronous call.
+ *
+ * @return
+ *
+ * @exception None
+ * @param[in] None
+ * @param[out] None
+ *
+ * @remark None
+ */
int bluetooth_otp_read_characteristic_value(const char *handle);
/**
+ * @fn int bluetooth_otp_connect_otc(const bluetooth_device_address_t *device_address);
+ *
+ * @brief Read value for remote characteristics.
+ *
+ * This function is a synchronous call.
+ *
+ * @return
+ *
+ * @exception None
+ * @param[in] None
+ * @param[out] None
+ *
+ * @remark None
+ */
+int bluetooth_otp_connect_otc(const bluetooth_device_address_t *device_address);
+
+/**
+ * @fn int bluetooth_otp_disconnect_otc(const bluetooth_device_address_t *device_address);
+ *
+ * @brief Read value for remote characteristics.
+ *
+ * This function is a synchronous call.
+ *
+ * @return
+ *
+ * @exception None
+ * @param[in] None
+ * @param[out] None
+ *
+ * @remark None
+ */
+int bluetooth_otp_disconnect_otc(const bluetooth_device_address_t *device_address);
+
+/**
* @}
*/