bt_gatt_client_request_completed_cb cb;
} bt_gatt_client_cb_data_s;
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Attribute protocol MTU change information structure.
- * @since_tizen 3.0
- *
- * @see bt_device_att_mtu_changed_cb()
- */
-typedef struct {
- char *remote_address; /**< The address of remote device */
- unsigned int mtu; /** < MTU value */
- unsigned int status; /** < request status*/
-} bt_device_att_mtu_info_s;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
- * @brief Called when the connection state is changed.
- * @since_tizen 2.3.1
- *
- * @param[in] connected The connection status: (@c true = connected, @c false = disconnected)
- * @param[in] conn_info The connection information
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_device_set_connection_state_changed_cb()
- * @see bt_device_unset_connection_state_changed_cb()
- */
-typedef void (*bt_device_att_mtu_changed_cb)(int result, bt_device_att_mtu_info_s *mtu_info, void *user_data);
-
/**
* @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
* @brief Called when RSSI monitoring is enabled.
*/
int bt_device_get_profile_restricted(const char *device_address, bt_restricted_profile_t profile, int *restricted);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Request to change ATT MTU value
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ * @param[in] mtu New MTU value to be changed
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ */
+int bt_device_request_att_mtu(const char *remote_address, unsigned int mtu);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Gets the ATT MTU value set for a connection
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ * @param[ot] mtu MTU value set for a connection
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ */
+int bt_device_get_att_mtu(const char *remote_address, unsigned int *mtu);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Registers a callback function to be invoked when the ATT MTU is changed.
+ * @since_tizen 3.0
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @post bt_device_connection_state_changed_cb() will be invoked.
+ * @see bt_initialize()
+ * @see bt_device_unset_att_mtu_changed_cb()
+ */
+int bt_device_set_att_mtu_changed_cb(bt_device_att_mtu_changed_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Unregisters the callback function to be invoked when the ATT MTU is changed.
+ * @since_tizen 3.0
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ * @see bt_device_set_att_mtu_changed_cb()
+ */
+int bt_device_unset_att_mtu_changed_cb(void);
+
/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
typedef void (*bt_device_trusted_profiles_cb)
(int result, char *remote_address, int trusted_profile, bool supported, bool trusted, void *user_data);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Attribute protocol MTU change information structure.
+ * @since_tizen 3.0
+ *
+ * @see bt_device_att_mtu_changed_cb()
+ */
+typedef struct {
+ char *remote_address; /**< The address of remote device */
+ unsigned int mtu; /** < MTU value */
+ unsigned int status; /** < request status*/
+} bt_device_att_mtu_info_s;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Called when the connection state is changed.
+ * @since_tizen 3.0
+ *
+ * @param[in] connected The connection status: (@c true = connected, @c false = disconnected)
+ * @param[in] conn_info The connection information
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_device_set_connection_state_changed_cb()
+ * @see bt_device_unset_connection_state_changed_cb()
+ */
+typedef void (*bt_device_att_mtu_changed_cb)(int result, bt_device_att_mtu_info_s *mtu_info, void *user_data);
/**
* @internal
*/
int bt_device_get_profile_restricted(const char *device_address, bt_restricted_profile_t profile, int *restricted);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Request to change ATT MTU value
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ * @param[in] mtu New MTU value to be changed
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ */
+int bt_device_request_att_mtu(const char *remote_address, unsigned int mtu);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Gets the ATT MTU value set for a connection
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ * @param[ot] mtu MTU value set for a connection
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ */
+int bt_device_get_att_mtu(const char *remote_address, unsigned int *mtu);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Registers a callback function to be invoked when the ATT MTU is changed.
+ * @since_tizen 3.0
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @post bt_device_connection_state_changed_cb() will be invoked.
+ * @see bt_initialize()
+ * @see bt_device_unset_att_mtu_changed_cb()
+ */
+int bt_device_set_att_mtu_changed_cb(bt_device_att_mtu_changed_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Unregisters the callback function to be invoked when the ATT MTU is changed.
+ * @since_tizen 3.0
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ * @see bt_device_set_att_mtu_changed_cb()
+ */
+int bt_device_unset_att_mtu_changed_cb(void);
+
/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
typedef void (*bt_device_trusted_profiles_cb)
(int result, char *remote_address, int trusted_profile, bool supported, bool trusted, void *user_data);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Attribute protocol MTU change information structure.
+ * @since_tizen 3.0
+ *
+ * @see bt_device_att_mtu_changed_cb()
+ */
+typedef struct {
+ char *remote_address; /**< The address of remote device */
+ unsigned int mtu; /** < MTU value */
+ unsigned int status; /** < request status*/
+} bt_device_att_mtu_info_s;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Called when the connection state is changed.
+ * @since_tizen 3.0
+ *
+ * @param[in] connected The connection status: (@c true = connected, @c false = disconnected)
+ * @param[in] conn_info The connection information
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_device_set_connection_state_changed_cb()
+ * @see bt_device_unset_connection_state_changed_cb()
+ */
+typedef void (*bt_device_att_mtu_changed_cb)(int result, bt_device_att_mtu_info_s *mtu_info, void *user_data);
/**
* @internal
*/
int bt_device_get_profile_restricted(const char *device_address, bt_restricted_profile_t profile, int *restricted);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Request to change ATT MTU value
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ * @param[in] mtu New MTU value to be changed
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ */
+int bt_device_request_att_mtu(const char *remote_address, unsigned int mtu);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Gets the ATT MTU value set for a connection
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ * @param[ot] mtu MTU value set for a connection
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ */
+int bt_device_get_att_mtu(const char *remote_address, unsigned int *mtu);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Registers a callback function to be invoked when the ATT MTU is changed.
+ * @since_tizen 3.0
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @post bt_device_connection_state_changed_cb() will be invoked.
+ * @see bt_initialize()
+ * @see bt_device_unset_att_mtu_changed_cb()
+ */
+int bt_device_set_att_mtu_changed_cb(bt_device_att_mtu_changed_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Unregisters the callback function to be invoked when the ATT MTU is changed.
+ * @since_tizen 3.0
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ * @see bt_device_set_att_mtu_changed_cb()
+ */
+int bt_device_unset_att_mtu_changed_cb(void);
+
/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
typedef void (*bt_device_trusted_profiles_cb)
(int result, char *remote_address, int trusted_profile, bool supported, bool trusted, void *user_data);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Attribute protocol MTU change information structure.
+ * @since_tizen 3.0
+ *
+ * @see bt_device_att_mtu_changed_cb()
+ */
+typedef struct {
+ char *remote_address; /**< The address of remote device */
+ unsigned int mtu; /** < MTU value */
+ unsigned int status; /** < request status*/
+} bt_device_att_mtu_info_s;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Called when the connection state is changed.
+ * @since_tizen 3.0
+ *
+ * @param[in] connected The connection status: (@c true = connected, @c false = disconnected)
+ * @param[in] conn_info The connection information
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_device_set_connection_state_changed_cb()
+ * @see bt_device_unset_connection_state_changed_cb()
+ */
+typedef void (*bt_device_att_mtu_changed_cb)(int result, bt_device_att_mtu_info_s *mtu_info, void *user_data);
+
/**
* @internal
* @brief IPSP Init state changed callback
, BT_UNIT_TEST_FUNCTION_DEVICE_CREATE_BOND_BY_TYPE},
{"bt_device_destroy_bond"
, BT_UNIT_TEST_FUNCTION_DEVICE_DESTROY_BOND},
+ {"bt_device_request_att_mtu"
+ , BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU},
+ {"bt_device_set_att_mtu_changed_cb"
+ , BT_UNIT_TEST_FUNCTION_DEVICE_SET_REQUEST_ATT_MTU_CHANGED_CB},
+ {"bt_device_unset_att_mtu_changed_cb"
+ , BT_UNIT_TEST_FUNCTION_DEVICE_UNSET_REQUEST_ATT_MTU_CHANGED_CB},
+ {"bt_device_get_att_mtu"
+ , BT_UNIT_TEST_FUNCTION_DEVICE_GET_ATT_MTU},
{"bt_device_le_set_data_length"
, BT_UNIT_TEST_FUNCTION_LE_DEVICE_SET_DATA_LENGTH},
{"bt_device_le_data_length_changed_cb"
TC_PRT("disconnection reason [%d]", conn_info->disconn_reason);
}
+void __bt_device_att_mtu_changed_cb(int result, bt_device_att_mtu_info_s *mtu_info, void *user_data)
+{
+ TC_PRT("__bt_device_att_mtu_changed_cb");
+
+ if (result != BT_ERROR_NONE) {
+ TC_PRT("Callback: Request ATT MTU failed.");
+ TC_PRT("result: %s", __bt_get_error_message(result));
+ }
+
+ if (mtu_info) {
+ TC_PRT("status [%d]", mtu_info->status);
+ TC_PRT("address [%s]", mtu_info->remote_address);
+ TC_PRT("MTU [%d]", mtu_info->mtu);
+ }
+}
+
+
bool __bt_device_connected_profile(bt_profile_e profile, void *user_data)
{
TC_PRT("__bt_device_connected_profile [%d]", profile);
break;
}
+ case BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char*) * g_test_param.param_count);
+ param_type = "int(1, 2, 10, ...., 512)";
+ }
+
+ if (param_index > 0) {
+ g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
+ strcpy(g_test_param.params[param_index - 1], param);
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+
+ TC_PRT("Input param(%d) : %s", param_index + 1, param_type);
+ param_index++;
+
+ break;
+ }
+
default:
TC_PRT("There is no param to set\n");
need_to_set_params = false;
break;
}
+ case BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU: {
+ unsigned int mtu = 512; /* MAX MTU Value */
+
+ if (g_test_param.param_count > 0) {
+ mtu = atoi(g_test_param.params[0]);
+
+ __bt_free_test_param(&g_test_param);
+ }
+ ret = bt_device_request_att_mtu(remote_addr, mtu);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DEVICE_GET_ATT_MTU: {
+ unsigned int mtu = 0;
+ ret = bt_device_get_att_mtu(remote_addr, &mtu);
+ TC_PRT("returns %s, MTU %d\n", __bt_get_error_message(ret), mtu);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DEVICE_SET_REQUEST_ATT_MTU_CHANGED_CB: {
+ ret = bt_device_set_att_mtu_changed_cb(__bt_device_att_mtu_changed_cb, NULL);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DEVICE_UNSET_REQUEST_ATT_MTU_CHANGED_CB: {
+ ret = bt_device_unset_att_mtu_changed_cb();
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
need_to_set_params = true;
TC_PRT("Select the function again");
BT_UNIT_TEST_FUNCTION_DEVICE_DISABLE_RSSI_MONITOR,
BT_UNIT_TEST_FUNCTION_DEVICE_GET_RSSI_STRENGTH,
BT_UNIT_TEST_FUNCTION_DEVICE_GET_CONNECTION_STATE,
+ BT_UNIT_TEST_FUNCTION_DEVICE_REQUEST_ATT_MTU,
+ BT_UNIT_TEST_FUNCTION_DEVICE_SET_REQUEST_ATT_MTU_CHANGED_CB,
+ BT_UNIT_TEST_FUNCTION_DEVICE_UNSET_REQUEST_ATT_MTU_CHANGED_CB,
+ BT_UNIT_TEST_FUNCTION_DEVICE_GET_ATT_MTU,
BT_UNIT_TEST_FUNCTION_SOCKET_CREATE_RFCOMM = 1,
BT_UNIT_TEST_FUNCTION_SOCKET_DESTROY_RFCOMM,
BT_UNIT_TEST_FUNCTION_SOCKET_LISTEN_AND_ACCEPT_RFCOMM,