Move GATT Server APIs header to bluetooth.h 98/72198/21
authorHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 31 May 2016 07:07:04 +0000 (16:07 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Fri, 17 Jun 2016 01:44:48 +0000 (10:44 +0900)
- modify the api version
- modify the func description
- modify the callback function name
- modify the typos
- add the return type for privilege APIs

Change-Id: I25489e0815ea2bdbded9473c8bd3b9727a099747
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
16 files changed:
include/bluetooth_private.h
include/mobile/bluetooth.h
include/mobile/bluetooth_internal.h
include/mobile/bluetooth_type.h
include/mobile/bluetooth_type_internal.h
include/tv/bluetooth.h
include/tv/bluetooth_internal.h
include/tv/bluetooth_type.h
include/tv/bluetooth_type_internal.h
include/wearable/bluetooth.h
include/wearable/bluetooth_internal.h
include/wearable/bluetooth_type.h
include/wearable/bluetooth_type_internal.h
src/bluetooth-common.c
src/bluetooth-gatt.c
test/bt_unit_test.c

index 2ac8b06579758673ad8a3add6176d09f27a27f50..1407f6cf12f7e8a37bc3ab72d06b344434585cae 100644 (file)
@@ -68,7 +68,7 @@ typedef enum {
        BT_EVENT_OPP_PUSH_REQUESTED, /**< OPP push is requested */
        BT_EVENT_OPP_SERVER_TRANSFER_PROGRESS, /**< OPP transfer progress */
        BT_EVENT_OPP_SERVER_TRANSFER_FINISHED, /**< OPP transfer is completed */
-       BT_EVENT_OPP_CLIENT_PUSH_RESPONSED, /**< OPP client connection is reponsed */
+       BT_EVENT_OPP_CLIENT_PUSH_RESPONSED, /**< OPP client connection is responsed */
        BT_EVENT_OPP_CLIENT_PUSH_PROGRESS, /**< OPP client push progress */
        BT_EVENT_OPP_CLIENT_PUSH_FINISHED, /**< OPP client push is finished */
        BT_EVENT_PAN_CONNECTION_STATE_CHANGED, /**< PAN connection change */
@@ -300,7 +300,7 @@ typedef struct {
        bt_gatt_server_notification_sent_cb notified_cb;
        void *notified_user_data;
 
-       bt_gatt_server_notification_state_change_cb notification_changed_cb;
+       bt_gatt_server_characteristic_notification_state_changed_cb notification_changed_cb;
        void *notification_changed_user_data;
 
        int value_length;
index 0143324ed74bde80f6e76695df6acb707fd81291..19145af7f17adf19f182effc15d63911ca88782f 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdbool.h>
 #include <tizen_error.h>
 
-#include "bluetooth_type.h"
+#include <bluetooth_type.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -3744,7 +3744,7 @@ int bt_gatt_unset_characteristic_changed_cb(void);
 /**
  * @deprecated Deprecated since 2.3.1. Use bt_gatt_client_set_characteristic_value_changed_cb instead.
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Watches all the characteristic value changes of the service
+ * @brief  Watches all the characteristic value changes of the service.
  * @since_tizen 2.3
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3764,7 +3764,7 @@ int bt_gatt_watch_characteristic_changes(bt_gatt_attribute_h service);
 /**
  * @deprecated Deprecated since 2.3.1. Use bt_gatt_client_unset_characteristic_value_changed_cb instead.
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Remove watching of all the characteristic value changes of the service
+ * @brief  Remove watching of all the characteristic value changes of the service.
  * @since_tizen 2.3
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3891,7 +3891,7 @@ int bt_gatt_destroy_attribute_handle(bt_gatt_attribute_h handle);
 /**
  * @deprecated Deprecated since 2.3.1. Use gatt_client_read_value instead.
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Reads the value of characteristic from remote device
+ * @brief  Reads the value of characteristic from remote device.
  * @since_tizen 2.3
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3939,7 +3939,7 @@ int bt_gatt_discover_characteristic_descriptor(bt_gatt_attribute_h characteristi
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks @a value must be released using free(). \n
@@ -3958,7 +3958,7 @@ int bt_gatt_get_value(bt_gatt_h gatt_handle, char **value, int *value_length);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle as an integer type
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle as an integer type.
  * @since_tizen 2.3.1
  *
  * @remarks This function returns a locally saved value in @a gatt_handle. \n
@@ -3979,7 +3979,7 @@ int bt_gatt_get_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle as a float type
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle as a float type.
  * @since_tizen 2.3.1
  *
  * @remarks This function returns a locally saved value in @a gatt_handle. \n
@@ -4000,7 +4000,7 @@ int bt_gatt_get_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -4020,7 +4020,7 @@ int bt_gatt_set_value(bt_gatt_h gatt_handle, const char *value, int value_length
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle using a integer type's value
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle using a integer type's value.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -4042,7 +4042,7 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle using a float type's value
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle using a float type's value.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -4065,7 +4065,7 @@ int bt_gatt_set_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the UUID of a service, characteristic or descriptor's GATT handle
+ * @brief  Gets the UUID of a service, characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks @a uuid must be released using free(). \n
@@ -4082,7 +4082,7 @@ int bt_gatt_get_uuid(bt_gatt_h gatt_handle, char **uuid);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the type of GATT handle
+ * @brief  Gets the type of GATT handle.
  * @since_tizen 2.3.1
  *
  * @param[in] gatt_handle The GATT handle
@@ -4096,7 +4096,7 @@ int bt_gatt_get_type(bt_gatt_h gatt_handle, bt_gatt_type_e *gatt_type);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the GATT client handle which the specified service belongs to
+ * @brief  Gets the GATT client handle which the specified service belongs to.
  * @since_tizen 2.3.1
  *
  * @remark This function doesn't allocate new memory for GATT client handle.
@@ -4116,7 +4116,7 @@ int bt_gatt_service_get_client(bt_gatt_h service, bt_gatt_client_h *client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a characteristic's GATT handle which has specific UUID
+ * @brief  Gets a characteristic's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4137,7 +4137,7 @@ int bt_gatt_service_get_characteristic(bt_gatt_h service, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each characteristic that belongs to the specified service
+ * @brief  Invokes @a callback function on each characteristic that belongs to the specified service.
  * @since_tizen 2.3.1
  *
  * @param[in] service The service's GATT handle
@@ -4155,7 +4155,7 @@ int bt_gatt_service_foreach_characteristics(bt_gatt_h service,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets an included service's GATT handle which has specific UUID
+ * @brief  Gets an included service's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4176,7 +4176,7 @@ int bt_gatt_service_get_included_service(bt_gatt_h service, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each included service that belongs to the specified service
+ * @brief  Invokes @a callback function on each included service that belongs to the specified service.
  * @since_tizen 2.3.1
  *
  * @param[in] service The service's GATT handle
@@ -4194,7 +4194,7 @@ int bt_gatt_service_foreach_included_services(bt_gatt_h service,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the service's GATT handle which the specified characteristic belongs to
+ * @brief  Gets the service's GATT handle which the specified characteristic belongs to.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4211,7 +4211,7 @@ int bt_gatt_characteristic_get_service(bt_gatt_h characteristic, bt_gatt_h *serv
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the properties which a characteristic's GATT handle has
+ * @brief  Gets the properties which a characteristic's GATT handle has.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4227,7 +4227,7 @@ int bt_gatt_characteristic_get_properties(bt_gatt_h characteristic, int *propert
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Gets the write type of the specified characteristic
+ * @brief Gets the write type of the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4244,7 +4244,7 @@ int bt_gatt_characteristic_get_write_type(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the write type of the specified characteristic
+ * @brief  Updates the write type of the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4262,7 +4262,7 @@ int bt_gatt_characteristic_set_write_type(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a descriptor's GATT handle which has specific UUID
+ * @brief  Gets a descriptor's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4283,7 +4283,7 @@ int bt_gatt_characteristic_get_descriptor(bt_gatt_h characteristic, const char *
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each descriptor that belongs to the specified characteristic
+ * @brief  Invokes @a callback function on each descriptor that belongs to the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4301,7 +4301,7 @@ int bt_gatt_characteristic_foreach_descriptors(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the characteristic's GATT handle which the specified descriptor belongs to
+ * @brief  Gets the characteristic's GATT handle which the specified descriptor belongs to.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4318,7 +4318,7 @@ int bt_gatt_descriptor_get_characteristic(bt_gatt_h descriptor, bt_gatt_h *chara
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT client handle
+ * @brief  Creates the GATT client handle.
  * @since_tizen 2.3.1
  *
  * @remark The GATT client handle must be freed by bt_gatt_client_destroy() after use
@@ -4338,7 +4338,7 @@ int bt_gatt_client_create(const char *remote_address, bt_gatt_client_h *client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Destroys the GATT client's handle
+ * @brief  Destroys the GATT client's handle.
  * @since_tizen 2.3.1
  *
  * @remark All related service, characteristic and descriptor's GATT handles are freed also
@@ -4355,7 +4355,7 @@ int bt_gatt_client_destroy(bt_gatt_client_h client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the address of remote device
+ * @brief  Gets the address of remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] client The created GATT client's handle
@@ -4372,7 +4372,7 @@ int bt_gatt_client_get_remote_address(bt_gatt_client_h client,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Reads the value of a characteristic or descriptor from the remote device asynchronously
+ * @brief  Reads the value of a characteristic or descriptor from the remote device asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -4398,7 +4398,7 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Writes the value of a characteristic or descriptor to the remote device asynchronously
+ * @brief  Writes the value of a characteristic or descriptor to the remote device asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -4428,7 +4428,7 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when the characteristic value is changed on the remote device
+ * @brief  Registers a callback function to be invoked when the characteristic value is changed on the remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4449,7 +4449,7 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters a callback function to be invoked when the characteristic value is changed on the remote device
+ * @brief  Unregisters a callback function to be invoked when the characteristic value is changed on the remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle, whose value change will not be informed
@@ -4465,7 +4465,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a service's GATT handle which has specific UUID
+ * @brief  Gets a service's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4473,7 +4473,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi
  * If there are multiple services which have same UUID, only the first matched one will be returned.
  *
  * @param[in] client The GATT client's handle
- * @param[in] uuid The serivce's GATT handle which has this UUID will be returned if it exists
+ * @param[in] uuid The service's GATT handle which has this UUID will be returned if it exists
  * @param[out] service The service's GATT handle which has @a uuid if it exists
  * @return  0 on success, otherwise a negative error value
  * @retval #BT_ERROR_NONE Successful
@@ -4486,7 +4486,7 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each service that belongs to the specified GATT client
+ * @brief  Invokes @a callback function on each service that belongs to the specified GATT client.
  * @since_tizen 2.3.1
  *
  * @param[in] client The GATT client's handle
@@ -4598,6 +4598,531 @@ int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb
  */
 int bt_gatt_unset_connection_state_changed_cb(void);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of service.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of service
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ */
+int bt_gatt_service_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of characteristic.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of characteristic
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ */
+int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of descriptor.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of descriptor
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_create()
+ */
+int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the permissions which a characteristic's GATT handle has.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ *
+ * @param[in] gatt_handle The handle of a characteristic
+ * @param[out] permissions The permissions which a characteristic's GATT handle has
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_permission_e
+ */
+int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the permissions which a descriptor's GATT handle has.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ *
+ * @param[in] gatt_handle The handle of a descriptor
+ * @param[out] permissions The permissions which a descriptor's GATT handle has
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_create()
+ * @see bt_gatt_permission_e
+ */
+int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT service.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a service should be destroyed by using bt_gatt_service_destroy()
+ *
+ * @param[in] uuid The UUID of the service
+ * @param[in] type The type of the service
+ * @param[out] service The GATT handle of the created service
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_destroy()
+ */
+int bt_gatt_service_create(const char *uuid, bt_gatt_service_type_e type,
+                          bt_gatt_h *service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a characteristic to a specified service.
+ * @since_tizen 3.0
+ *
+ * @param[in] service The service's GATT handle
+ * @param[in] characteristic The characteristic's GATT handle to be added
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_characteristic_create()
+ */
+int bt_gatt_service_add_characteristic(bt_gatt_h service,
+                                       bt_gatt_h characteristic);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a service to a specified service as included service.
+ * @since_tizen 3.0
+ *
+ * @param[in] service The service's GATT handle
+ * @param[in] included_service The service's GATT handle to be added as included service
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ */
+int bt_gatt_service_add_included_service(bt_gatt_h service,
+                                       bt_gatt_h included_service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the GATT server handle to which the specified service belongs.
+ * @since_tizen 3.0
+ *
+ * @remarks The returned Server handle must not be freed by application.
+ *
+ * @param[in] service The service's GATT handle
+ * @param[out] server The GATT server handle to which @a service belongs
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT characteristic.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ * @remarks The @a properties can be one or more values of #bt_gatt_property_e, combined with bitwise 'or'.
+ * @remarks The @a characteristic should be destroyed by using bt_gatt_characteristic_destroy().
+ *
+ * @param[in] uuid The UUID of the characteristic
+ * @param[in] permissions the permissions of the characteristic
+ * @param[in] properties The properties of the characteristic
+ * @param[in] Value The value(byte stream) of the characteristic
+ * @param[in] value_length The length of @a value
+ * @param[out] characteristic The GATT handle of the created characteristic
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_destroy()
+ */
+int bt_gatt_characteristic_create(const char *uuid, int permissions,
+                               int properties, const char *value, int value_length,
+                               bt_gatt_h *characteristic);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a descriptor to a specified characteristic.
+ * @since_tizen 3.0
+ *
+ * @param[in] characteristic The GATT handle of the characteristic
+ * @param[in] descriptor The descriptor's GATT handle to be added
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_descriptor_create()
+ */
+int bt_gatt_characteristic_add_descriptor(bt_gatt_h characteristic,
+                                       bt_gatt_h descriptor);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT characteristic descriptor.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ * @remarks The @a descriptor should be destroyed by using bt_gatt_descriptor_destroy().
+ *
+ * @param[in] uuid The UUID of the descriptor
+ * @param[in] permissions The permissions of the descriptor
+ * @param[in] value The value(byte stream) associated with the descriptor
+ * @param[in] value_length The length of @a value
+ * @param[out] descriptor The GATT handle of the created characteristic descriptor
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_destroy()
+ */
+int bt_gatt_descriptor_create(const char *uuid, int permissions,
+                               const char *value, int value_length,
+                               bt_gatt_h *descriptor);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Initializes the GATT Server.
+ * @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_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @see        bt_gatt_server_deinitialize()
+ */
+int bt_gatt_server_initialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief DeInitializes the GATT server.
+ * @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_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @see        bt_gatt_server_initialize()
+ */
+int bt_gatt_server_deinitialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT server's handle.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a server handle should be destroyed by using bt_gatt_server_destroy()
+ *
+ * @param[out] server The GATT server's handle
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_destroy()
+ */
+int bt_gatt_server_create(bt_gatt_server_h *server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Destroys the GATT server's handle.
+ * @since_tizen 3.0
+ *
+ * @remarks All registered services to GATT server are unregistered
+ *
+ * @param[in] server The GATT server's handle
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ */
+int bt_gatt_server_destroy(bt_gatt_server_h server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client).
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_read_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_read_value_requested_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED     Not supported
+ *
+ * @see bt_gatt_server_characteristic_notification_state_changed_cb()
+ */
+int bt_gatt_server_set_characteristic_notification_state_change_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_characteristic_notification_state_changed_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_write_value_requested_cb()
+ */
+int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_write_value_requested_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a specified service to the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @param[in] service The service, which needs to be registered in @a server
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_ALREADY_DONE Operation is already done
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_start()
+ * @see bt_gatt_server_unregister_service()
+ */
+int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Unregisters a specified service from the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @param[in] service The service, which needs to be unregistered from @a server
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_SERVICE_NOT_FOUND  Service not found
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_server_unregister_service(bt_gatt_server_h server, bt_gatt_h service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Unregisters all services from the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_server_unregister_all_services(bt_gatt_server_h server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers the application along with the GATT services of the application it is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_ALREADY_DONE Operation is already done
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_initialize()
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_unregister_service()
+ */
+int bt_gatt_server_start(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Sends a response to the remote device as a result of a read/write request.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @remarks Until this function is called, a read/write request is not finished.
+ *
+ * @param[in] request_id The identification of a read/write request
+ * @param[in] request_type The request type for read/write
+ * @param[in] offset The offset from where a value is read
+ * @param[in] resp_status The application error if any occurred or BT_ERROR_NONE for successful.
+ * @param[in] value The value to be sent. It will be sent from @a offset. If it is NULL, a requested GATT handle's value will be sent from @a offset.
+ * @param[in] value_length Value Length
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_read_value_requested_cb()
+ */
+int bt_gatt_server_send_response(int request_id, bluetooth_gatt_att_request_type_e request_type,
+                       int offset, int resp_status, char *value, int value_length);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor.
+ * @since_tizen 3.0
+ *
+ * @param[in] characteristic The characteristic which has a changed value
+ * @param[in] callback The function to be invoked on each remote device when a sending operation is done
+ * @param[in] device_address Remote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled.
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_notification_sent_cb()
+ */
+int bt_gatt_server_notify_characteristic_changed_value(bt_gatt_h characteristic,
+                               bt_gatt_server_notification_sent_cb callback,
+                               const char *device_address, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets a service's GATT handle which has specific UUID.
+ * @since_tizen 3.0
+ *
+ * @remark The returned GATT handle must not be freed by application.
+ * It will be freed when an associated server is destroyed by bt_gatt_server_destroy().
+ * If there are multiple services which have same UUID, only the first matched one will be returned.
+ *
+ * @param[in] server The GATT server's handle
+ * @param[in] uuid The service's GATT handle which has this UUID will be returned if it exists
+ * @param[out] service The service's GATT handle which has @a uuid if it exists
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NO_DATA  No data available
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ */
+int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid,
+                               bt_gatt_h *service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Invokes @a callback function on each service that belongs to the specified GATT server.
+ * @since_tizen 3.0
+ *
+ * @param[in] server The GATT server's handle
+ * @param[in] callback The function to be invoked on each service
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_foreach_cb()
+ */
+int bt_gatt_server_foreach_services(bt_gatt_server_h server,
+               bt_gatt_foreach_cb callback, void *user_data);
+
 /**
  * @}
  */
index ed6ce9379ec61bc0ce2e6ac3f9cd792809f5a3ce..dc406df04bb5083a16c165360d90453cafeb468c 100644 (file)
@@ -1752,105 +1752,9 @@ int bt_a2dp_set_content_protection(bool status);
 int bt_gatt_get_uuid_specification_name(const char *uuid, char **name);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of service, characteristic or descriptor
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of service
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- */
-int bt_gatt_service_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of characteristic
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- */
-int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of descriptor
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a characteristic's GATT handle has
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of a characteristic
- * @param[out] permissions The permissions which a characteristic's GATT handle has.
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_permission_e
- */
-int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a descriptor's GATT handle has
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of a descriptor
- * @param[out] permissions The permissions which a descriptor's GATT handle has.
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_descriptor_create()
- * @see bt_gatt_permission_e
- */
-int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the permissions which a characteristic or descriptor's GATT handle has
- * @since_tizen 2.4
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Updates the permissions which a characteristic or descriptor's GATT handle has.
+ * @since_tizen 3.0
  *
  * @param[in] gatt_handle The handle of a characteristic or descriptor
  * @param[in] permissions The permissions to be updated
@@ -1866,122 +1770,9 @@ int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
 int bt_gatt_set_permissions(bt_gatt_h gatt_handle, int permissions);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT service
- * @since_tizen 2.4
- *
- * @param[in] uuid The UUID of the service
- * @param[in] type The type of the service
- * @param[out] service The GATT handle of the created service
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_service_create(const char *uuid, bt_gatt_service_type_e type,
-                          bt_gatt_h *service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a characteristic to a specified service
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[in] characteristic The characteristic's GATT handle to be added
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- * @see bt_gatt_characteristic_create()
- */
-int bt_gatt_service_add_characteristic(bt_gatt_h service,
-                                       bt_gatt_h characteristic);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a service to a specified service as included service
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[in] included_service The service's GATT handle to be added as included service
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- */
-int bt_gatt_service_add_included_service(bt_gatt_h service,
-                                       bt_gatt_h included_service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the GATT server handle to which the specified service belongs
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[out] server The GATT server handle to which @a service belongs
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_create()
- * @see bt_gatt_service_create()
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT characteristic
- * @since_tizen 2.4
- *
- * @param[in] uuid The UUID of the characteristic
- * @param[in] permissions the permissions of the characteristic
- * @param[in] properties The properties of the characteristic
- * @param[in] Value The value(byte stream) of the characteristic
- * @param[in] value_length The length of @a value
- * @param[out] characteristic The GATT handle of the created characteristic
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_characteristic_create(const char *uuid, int permissions,
-                               int properties, const char *value, int value_length,
-                               bt_gatt_h *characteristic);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a descriptor to a specified characteristic
- * @since_tizen 2.4
- *
- * @param[in] characteristic The GATT handle of the characteristic
- * @param[in] descriptor The descriptor's GATT handle to be added
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_characteristic_add_descriptor(bt_gatt_h characteristic,
-                                       bt_gatt_h descriptor);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the properties which a characteristic's GATT handle has
- * @since_tizen 2.4
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Updates the properties which a characteristic's GATT handle has.
+ * @since_tizen 3.0
  *
  * @param[in] characteristic The characteristic's GATT handle
  * @param[in] properties The properties to be updated
@@ -1996,307 +1787,20 @@ int bt_gatt_characteristic_set_properties(bt_gatt_h characteristic, int properti
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT characteristic descriptor
+ * @brief Destroys the GATT handle
  * @since_tizen 2.4
  *
- * @param[in] uuid The UUID of the descriptor
- * @param[in] permissions The permissions of the descriptor
- * @param[in] value The value(byte stream) associated with the descriptor
- * @param[in] value_length The length of @a value
- * @param[out] descriptor The GATT handle of the created characteristic descriptor
+ * @param[in] gatt_handle The handle of service, characteristic or descriptor
  * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_descriptor_create(const char *uuid, int permissions,
-                               const char *value, int value_length,
-                               bt_gatt_h *descriptor);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Initializes the GATT Server
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value.
  * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see        bt_gatt_server_deinitialize()
- */
-int bt_gatt_server_initialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief DeInitializes the GATT server
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE      Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see        bt_gatt_server_initialize()
- */
-int bt_gatt_server_deinitialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT server's handle
- * @since_tizen 2.4
- *
- * @param[out] server The GATT server's handle
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_destroy()
- */
-int bt_gatt_server_create(bt_gatt_server_h *server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Destroys the GATT server's handle
- * @since_tizen 2.4
- *
- * @remarks All registered services to GATT server are unregistered
- *
- * @param[in] server The GATT server's handle
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_create()
- */
-int bt_gatt_server_destroy(bt_gatt_server_h server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client)
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_read_value_requested_cb()
- * @see bt_gatt_server_send_response()
- */
-int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_read_value_requested_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED     Not supported
- *
- * @see bt_gatt_server_notification_state_change_cb()
- */
-int bt_gatt_server_set_notification_state_change_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_notification_state_change_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_write_value_requested_cb()
- */
-int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_write_value_requested_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a specified service to the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] server The GATT server that local device is hosting
- * @param[in] service The service, which needs to be registered in @a server
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE Operation is already done
  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
  *
- * @see bt_gatt_server_create()
  * @see bt_gatt_service_create()
- * @see bt_gatt_server_start()
- * @see bt_gatt_server_unregister_service()
- */
-int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters a specified service from the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server that local device is hosting
- * @param[in] service The service, which needs to be unregistered from @a server
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_SERVICE_NOT_FOUND  Service not found
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_server_unregister_service(bt_gatt_server_h server, bt_gatt_h service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters all services from the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server that local device is hosting
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_server_unregister_all_services(bt_gatt_server_h server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers the applciation along with the GATT services of the aplciation it is hosting
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE Operation is already done
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @see bt_gatt_server_initialize()
- * @see bt_gatt_server_create()
- * @see bt_gatt_service_create()
- * @see bt_gatt_server_unregister_service()
- */
-int bt_gatt_server_start(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Sends a response to the remote device as a result of a read request
- * @since_tizen 2.4
- *
- * @remarks Until this function is called, a read request is not finished.
- *
- * @param[in] request_id The identification of a read/write request
- * @param[in] request_type The request type for read/write.
- * @param[in] offset The offset from where a value is read
- * @param[in] resp_status The applciation error if any occured or BT_ERROR_NONE for successful.
- * @param[in] value The value to be sent. It will be sent from @a offset. If it is NULL, a requested GATT handle's value will be sent from @a offset.
- * @param[in] value_length Value Length
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_read_value_requested_cb()
- */
-int bt_gatt_server_send_response(int request_id, int request_type,
-                       int offset, int resp_status, char *value, int value_length);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor
- * @since_tizen 2.4
- *
- * @param[in] characteristic The characteristic which has a changed value
- * @param[in] need_confirm If it is true, an indication is sent. If it is false, a notification is sent.
- * @param[in] callback The function to be invoked on each remote device when a sending operation is done
- * @param[in] device_address Remote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled.
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_notification_sent_cb()
- */
-int bt_gatt_server_notify(bt_gatt_h characteristic, bool need_confirm,
-                               bt_gatt_server_notification_sent_cb callback,
-                               const char *device_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a service's GATT handle which has specific UUID
- * @since_tizen 2.4
- *
- * @remark The returned GATT handle must not be freed by application.
- * It will be freed when an associated server is destroyed by bt_gatt_server_destroy().
- * If there are multiple services which have same UUID, only the first matched one will be returned.
- *
- * @param[in] server The GATT server's handle
- * @param[in] uuid The serivce's GATT handle which has this UUID will be returned if it exists
- * @param[out] service The service's GATT handle which has @a uuid if it exists
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NO_DATA  No data available
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- */
-int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid,
-                               bt_gatt_h *service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each service that belongs to the specified GATT server
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server's handle
- * @param[in] callback The function to be invoked on each service
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_foreach_cb()
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_descriptor_create()
  */
-int bt_gatt_server_foreach_services(bt_gatt_server_h server,
-               bt_gatt_foreach_cb callback, void *user_data);
+int bt_gatt_destroy(bt_gatt_h gatt_handle);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
index ccddfb756f31f1db47ac0d76e35c5961114e45ac..43ca3539375d898115abeba751d100a2f730b502 100644 (file)
@@ -627,7 +627,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the integer type for GATT handle's value
+ * @brief  Enumerations of the integer type for GATT handle's value.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -641,7 +641,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the float type for GATT handle's value
+ * @brief  Enumerations of the float type for GATT handle's value.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -651,7 +651,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the write type
+ * @brief  Enumerations of the write type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -661,7 +661,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the GATT handle's type
+ * @brief  Enumerations of the GATT handle's type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -672,7 +672,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the service type
+ * @brief  Enumerations of the service type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -682,7 +682,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the characteristic's property
+ * @brief  Enumerations of the characteristic's property.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -696,9 +696,33 @@ typedef enum {
        BT_GATT_PROPERTY_EXTENDED_PROPERTIES = 0x80,  /**< Extended properties */
 } bt_gatt_property_e;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Enumerations of the attribute's permission.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_GATT_PERMISSION_READ = 0x01,  /**< Read permission */
+       BT_GATT_PERMISSION_WRITE = 0x02,  /**< Write permission */
+       BT_GATT_PERMISSION_ENCRYPTION = 0x04,  /**< Encryption permission */
+       BT_GATT_PERMISSION_AUTHENTICATION = 0x08,  /**< Authentication permission */
+       BT_GATT_PERMISSION_AUTHORIZATION = 0x10,  /**< Authorization permission */
+       BT_GATT_PERMISSION_NONE = 0x20,  /**< None */
+} bt_gatt_permission_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Enumerations of the remote device request types for attributes
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BLUETOOTH_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
+       BLUETOOTH_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
+} bluetooth_gatt_att_request_type_e;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief  Enumerations for the types of PAN(Personal Area Networking) service
+ * @brief  Enumerations for the types of PAN(Personal Area Networking) service.
  * @since_tizen 2.3
  */
 typedef enum {
@@ -707,7 +731,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle to control Bluetooth LE advertising
+ * @brief The handle to control Bluetooth LE advertising.
  * @since_tizen 2.3
  */
 typedef void *bt_advertiser_h;
@@ -715,28 +739,35 @@ typedef void *bt_advertiser_h;
 /**
  * @deprecated Deprecated since 2.3.1. Use bt_gatt_h instead.
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  The attribute handle of GATT(Generic Attribute Profile)
+ * @brief  The attribute handle of GATT(Generic Attribute Profile).
  * @since_tizen 2.3
  */
 typedef void *bt_gatt_attribute_h;
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a service, characteristic or descriptor
+ * @brief The handle of a service, characteristic or descriptor.
  * @since_tizen 2.3.1
  */
 typedef void *bt_gatt_h;
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a GATT client which is associated with a remote device
+ * @brief The handle of a GATT client which is associated with a remote device.
  * @since_tizen 2.3.1
  */
 typedef void *bt_gatt_client_h;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief The handle of a GATT server.
+ * @since_tizen 3.0
+ */
+typedef void *bt_gatt_server_h;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  The handle of calls state
+ * @brief  The handle of calls state.
  * @since_tizen 2.3
  */
 typedef void *bt_call_list_h;
@@ -818,7 +849,7 @@ typedef struct {
 /**
  * @deprecated Deprecated since 2.3.1
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Structure of advertising parameters
+ * @brief Structure of advertising parameters.
  * @since_tizen 2.3
  *
  * @see bt_adapter_le_advertising_state_changed_cb()
@@ -835,7 +866,7 @@ typedef struct {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief LE service data structure
+ * @brief LE service data structure.
  * @since_tizen 2.3.1
  *
  * @see bt_adapter_le_get_scan_result_service_data()
@@ -1672,7 +1703,7 @@ typedef void (*bt_gatt_client_request_completed_cb) (int result,
  * @brief  Called when a value of a watched characteristic's GATT handle has been changed
  * @since_tizen 2.3.1
  *
- * @remarks After this function is returned, a changed vlaue is automatically
+ * @remarks After this function is returned, a changed value is automatically
  * applied to @a characteristic. Before that, @a characteristic has an old value.
  *
  * @param[in] characteristic The characteristic's GATT handle of which value change is informed. It has an old value.
@@ -1705,6 +1736,108 @@ typedef void (*bt_gatt_client_characteristic_value_changed_cb) (bt_gatt_h charac
  */
 typedef void (*bt_gatt_connection_state_changed_cb)(int result, bool connected, const char *remote_address, void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when a value of a characteristic or descriptor's GATT handle has been changed.
+ * @since_tizen 3.0
+ *
+ * @details For finishing the request, call the function #bt_gatt_server_send_response in callback.
+ *
+ * @remarks After this function is returned, a changed value is automatically
+ * applied to @a gatt_handle. Before that, @a gatt_handle has an old value.
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ * @remarks The @a value must not be freed by application.
+ *
+ * @param[in] remote_address The address of the remote device which requests a change
+ * @param[in] request_id The identification of this request. It will be used to send a response.
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic or descriptor's GATT handle which has an old value
+ * @param[in] offset The requested offset from where the @a gatt_handle value will be updated
+ * @param[in] value The new value
+ * @param[in] len The length of @a value
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_write_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+typedef void (*bt_gatt_server_write_value_requested_cb) (const char *remote_address,
+                               int request_id, bt_gatt_server_h server,
+                               bt_gatt_h gatt_handle, int offset,
+                               const char *value, int len, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the remote device requests to read a value on a GATT server.
+ * @since_tizen 3.0
+ *
+ * @details For finishing the request, call the function #bt_gatt_server_send_response in callback.
+ *
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ *
+ * @param[in] remote_address The address of the requesting remote device
+ * @param[in] request_id The identification of this request. It will be used to send a response.
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic or descriptor's GATT handle to be read
+ * @param[in] offset The requested offset from where the GATT handle's value is read
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_read_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+typedef void (*bt_gatt_server_read_value_requested_cb) (const char *remote_address,
+               int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle,
+               int offset, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the remote device enables or disables the Notification/Indication for particular characteristics.
+ * @since_tizen 3.0
+ *
+ * @details By using this callback function, server can know notification state.
+ *
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ *
+ * @param[in] notify Indicates whether the Notification/Indication is enabled or not
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic's GATT handle to be read
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_read_value_requested_cb()
+ */
+typedef void (*bt_gatt_server_characteristic_notification_state_changed_cb) (bool notify,
+                       bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the sending notification / indication is done.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a characteristic must not be freed by application.
+ *
+ * @remarks In case of an indication, once a confirmation is received from the remote device this callback will be called. \n
+ * This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD). \n
+ * For the last remote device, @a completed will be set as true.
+ *
+ * @param[in] result The result of a sending operation
+ * @param[in] remote_address The address of the remote device
+ * @param[in] server The GATT server handle
+ * @param[in] characteristic The characteristic's GATT handle
+ * @param[in] completed If this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false.
+ * @param[in] user_data The user data passed from the requesting function
+ *
+ * @see bt_gatt_server_notify_characteristic_changed_value()
+ */
+typedef void (*bt_gatt_server_notification_sent_cb) (int result,
+               const char *remote_address, bt_gatt_server_h server,
+               bt_gatt_h characteristic, bool completed, void *user_data);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
  * @brief  Called when the connection state is changed.
index 3c594127af1e4728c270216d0ad319dd3e6ea1bb..877572a00cecb308dd201295fd187f2aac6a9d54 100644 (file)
@@ -154,20 +154,6 @@ typedef enum {
 typedef void (*bt_adapter_manufacturer_data_changed_cb) (char *data,
                int len, void *user_data);
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the attribute's permission
- * @since_tizen 2.4
- */
-typedef enum {
-       BT_GATT_PERMISSION_READ = 0x01,
-       BT_GATT_PERMISSION_WRITE = 0x02,
-       BT_GATT_PERMISSION_ENCRYPTION = 0x04,
-       BT_GATT_PERMISSION_AUTHENTICATION = 0x08,
-       BT_GATT_PERMISSION_AUTHORIZATION = 0x10,
-       BT_GATT_PERMISSION_NONE = 0x20,
-} bt_gatt_permission_e;
-
 /**
 * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
 * @brief DPM BT allowance state
@@ -224,92 +210,6 @@ typedef enum {
  */
 typedef void *bt_scan_filter_h;
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a GATT server
- * @since_tizen 2.4
- */
-typedef void *bt_gatt_server_h;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when a value of a characteristic or descriptor's GATT handle has been changed
- * @since_tizen 2.4
- *
- * @remarks After this function is returned, a changed vlaue is automatically
- * applied to @a gatt_handle. Before that, @a gatt_handle has an old value.
- *
- * @param[in] remote_address The address of the remote device which requests a change
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic or descriptor's GATT handle which has an old value
- * @param[in] request_id The identification of this request. It will be used to send a reponse.
- * @param[in] offset The requested offset from where the @a gatt_handle value will be updated
- * @param[in] value The new value
- * @param[in] len The length of @a value
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_write_value_requested_cb()
- */
-typedef void (*bt_gatt_server_write_value_requested_cb) (char *remote_address,
-                               int request_id, bt_gatt_server_h server,
-                               bt_gatt_h gatt_handle, int offset,
-                               char *value, int len, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the remote device requests to read a value on a GATT server
- * @since_tizen 2.4
- *
- * @param[in] remote_address The address of the requesting remote device
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic or descriptor's GATT handle to be read
- * @param[in] request_id The identification of this request. It will be used to send a reponse.
- * @param[in] offset The requested offset from where the GATT handle's value is read
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_read_value_requested_cb()
- * @see bt_gatt_server_send_response()
- */
-typedef void (*bt_gatt_server_read_value_requested_cb) (char *remote_address,
-               int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle,
-               int offset, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the remote device enables or disables the Notification/Indication for particular characteristics.
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic's GATT handle to be read
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_read_value_requested_cb()
- */
-typedef void (*bt_gatt_server_notification_state_change_cb) (bool notify,
-                       bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the sending notification / indication is done
- * @since_tizen 2.4
- *
- * @remarks In case of an indication, once a confirmation is received from the remote device this callback will be called. \n
- * This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD). \n
- * For the last remote device, @a completed will be set as true.
- *
- * @param[in] result The result of a sending operation
- * @param[in] remote_address The address of the remote device
- * @param[in] server The GATT server handle
- * @param[in] characteristic The characteristic's GATT handle
- * @param[in] completed If this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false.
- * @param[in] user_data The user data passed from the requesting function
- *
- * @see bt_gatt_server_notify()
- */
-typedef void (*bt_gatt_server_notification_sent_cb) (int result,
-               char *remote_address, bt_gatt_server_h server,
-               bt_gatt_h characteristic, bool completed, void *user_data);
-
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Device LE connection update structure.
@@ -322,7 +222,6 @@ typedef struct {
        unsigned int time_out;   /**< Supervision timeout (msec) */
 } bt_le_conn_update_s;
 
-
 /**
  * Structure to DPM device list
  */
index f38f5e23e481721721bec117bd47cdc9d634e29b..b73ac44d35ae21486efe47ca68c93e5113305971 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdbool.h>
 #include <tizen_error.h>
 
-#include "bluetooth_type.h"
+#include <bluetooth_type.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -3746,7 +3746,7 @@ int bt_gatt_unset_characteristic_changed_cb(void);
 /**
  * @deprecated Deprecated since 2.3.1. Use bt_gatt_client_set_characteristic_value_changed_cb instead.
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Watches all the characteristic value changes of the service
+ * @brief  Watches all the characteristic value changes of the service.
  * @since_tizen 2.3
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3766,7 +3766,7 @@ int bt_gatt_watch_characteristic_changes(bt_gatt_attribute_h service);
 /**
  * @deprecated Deprecated since 2.3.1. Use bt_gatt_client_unset_characteristic_value_changed_cb instead.
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Remove watching of all the characteristic value changes of the service
+ * @brief  Remove watching of all the characteristic value changes of the service.
  * @since_tizen 2.3
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3894,7 +3894,7 @@ int bt_gatt_destroy_attribute_handle(bt_gatt_attribute_h handle);
 /**
  * @deprecated Deprecated since 2.3.1. Use gatt_client_read_value instead.
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Reads the value of characteristic from remote device
+ * @brief  Reads the value of characteristic from remote device.
  * @since_tizen 2.3
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3942,7 +3942,7 @@ int bt_gatt_discover_characteristic_descriptor(bt_gatt_attribute_h characteristi
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks @a value must be released using free(). \n
@@ -3961,7 +3961,7 @@ int bt_gatt_get_value(bt_gatt_h gatt_handle, char **value, int *value_length);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle as an integer type
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle as an integer type.
  * @since_tizen 2.3.1
  *
  * @remarks This function returns a locally saved value in @a gatt_handle. \n
@@ -3982,7 +3982,7 @@ int bt_gatt_get_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle as a float type
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle as a float type.
  * @since_tizen 2.3.1
  *
  * @remarks This function returns a locally saved value in @a gatt_handle. \n
@@ -4003,7 +4003,7 @@ int bt_gatt_get_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -4023,7 +4023,7 @@ int bt_gatt_set_value(bt_gatt_h gatt_handle, const char *value, int value_length
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle using a integer type's value
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle using a integer type's value.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -4045,7 +4045,7 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle using a float type's value
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle using a float type's value.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -4068,7 +4068,7 @@ int bt_gatt_set_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the UUID of a service, characteristic or descriptor's GATT handle
+ * @brief  Gets the UUID of a service, characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks @a uuid must be released using free(). \n
@@ -4085,7 +4085,7 @@ int bt_gatt_get_uuid(bt_gatt_h gatt_handle, char **uuid);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the type of GATT handle
+ * @brief  Gets the type of GATT handle.
  * @since_tizen 2.3.1
  *
  * @param[in] gatt_handle The GATT handle
@@ -4099,7 +4099,7 @@ int bt_gatt_get_type(bt_gatt_h gatt_handle, bt_gatt_type_e *gatt_type);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the GATT client handle which the specified service belongs to
+ * @brief  Gets the GATT client handle which the specified service belongs to.
  * @since_tizen 2.3.1
  *
  * @remark This function doesn't allocate new memory for GATT client handle.
@@ -4119,7 +4119,7 @@ int bt_gatt_service_get_client(bt_gatt_h service, bt_gatt_client_h *client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a characteristic's GATT handle which has specific UUID
+ * @brief  Gets a characteristic's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4140,7 +4140,7 @@ int bt_gatt_service_get_characteristic(bt_gatt_h service, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each characteristic that belongs to the specified service
+ * @brief  Invokes @a callback function on each characteristic that belongs to the specified service.
  * @since_tizen 2.3.1
  *
  * @param[in] service The service's GATT handle
@@ -4158,7 +4158,7 @@ int bt_gatt_service_foreach_characteristics(bt_gatt_h service,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets an included service's GATT handle which has specific UUID
+ * @brief  Gets an included service's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4179,7 +4179,7 @@ int bt_gatt_service_get_included_service(bt_gatt_h service, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each included service that belongs to the specified service
+ * @brief  Invokes @a callback function on each included service that belongs to the specified service.
  * @since_tizen 2.3.1
  *
  * @param[in] service The service's GATT handle
@@ -4197,7 +4197,7 @@ int bt_gatt_service_foreach_included_services(bt_gatt_h service,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the service's GATT handle which the specified characteristic belongs to
+ * @brief  Gets the service's GATT handle which the specified characteristic belongs to.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4214,7 +4214,7 @@ int bt_gatt_characteristic_get_service(bt_gatt_h characteristic, bt_gatt_h *serv
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the properties which a characteristic's GATT handle has
+ * @brief  Gets the properties which a characteristic's GATT handle has.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4230,7 +4230,7 @@ int bt_gatt_characteristic_get_properties(bt_gatt_h characteristic, int *propert
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Gets the write type of the specified characteristic
+ * @brief Gets the write type of the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4247,7 +4247,7 @@ int bt_gatt_characteristic_get_write_type(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the write type of the specified characteristic
+ * @brief  Updates the write type of the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4265,7 +4265,7 @@ int bt_gatt_characteristic_set_write_type(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a descriptor's GATT handle which has specific UUID
+ * @brief  Gets a descriptor's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4286,7 +4286,7 @@ int bt_gatt_characteristic_get_descriptor(bt_gatt_h characteristic, const char *
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each descriptor that belongs to the specified characteristic
+ * @brief  Invokes @a callback function on each descriptor that belongs to the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4304,7 +4304,7 @@ int bt_gatt_characteristic_foreach_descriptors(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the characteristic's GATT handle which the specified descriptor belongs to
+ * @brief  Gets the characteristic's GATT handle which the specified descriptor belongs to.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4321,7 +4321,7 @@ int bt_gatt_descriptor_get_characteristic(bt_gatt_h descriptor, bt_gatt_h *chara
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT client handle
+ * @brief  Creates the GATT client handle.
  * @since_tizen 2.3.1
  *
  * @remark The GATT client handle must be freed by bt_gatt_client_destroy() after use
@@ -4341,7 +4341,7 @@ int bt_gatt_client_create(const char *remote_address, bt_gatt_client_h *client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Destroys the GATT client's handle
+ * @brief  Destroys the GATT client's handle.
  * @since_tizen 2.3.1
  *
  * @remark All related service, characteristic and descriptor's GATT handles are freed also
@@ -4358,7 +4358,7 @@ int bt_gatt_client_destroy(bt_gatt_client_h client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the address of remote device
+ * @brief  Gets the address of remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] client The created GATT client's handle
@@ -4375,7 +4375,7 @@ int bt_gatt_client_get_remote_address(bt_gatt_client_h client,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Reads the value of a characteristic or descriptor from the remote device asynchronously
+ * @brief  Reads the value of a characteristic or descriptor from the remote device asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -4401,7 +4401,7 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Writes the value of a characteristic or descriptor to the remote device asynchronously
+ * @brief  Writes the value of a characteristic or descriptor to the remote device asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -4431,7 +4431,7 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when the characteristic value is changed on the remote device
+ * @brief  Registers a callback function to be invoked when the characteristic value is changed on the remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -4452,7 +4452,7 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters a callback function to be invoked when the characteristic value is changed on the remote device
+ * @brief  Unregisters a callback function to be invoked when the characteristic value is changed on the remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle, whose value change will not be informed
@@ -4468,7 +4468,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a service's GATT handle which has specific UUID
+ * @brief  Gets a service's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -4476,7 +4476,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi
  * If there are multiple services which have same UUID, only the first matched one will be returned.
  *
  * @param[in] client The GATT client's handle
- * @param[in] uuid The serivce's GATT handle which has this UUID will be returned if it exists
+ * @param[in] uuid The service's GATT handle which has this UUID will be returned if it exists
  * @param[out] service The service's GATT handle which has @a uuid if it exists
  * @return  0 on success, otherwise a negative error value
  * @retval #BT_ERROR_NONE Successful
@@ -4489,7 +4489,7 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each service that belongs to the specified GATT client
+ * @brief  Invokes @a callback function on each service that belongs to the specified GATT client.
  * @since_tizen 2.3.1
  *
  * @param[in] client The GATT client's handle
@@ -4601,6 +4601,529 @@ int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb
  */
 int bt_gatt_unset_connection_state_changed_cb(void);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of service.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of service
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ */
+int bt_gatt_service_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of characteristic.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of characteristic
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ */
+int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of descriptor.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of descriptor
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_create()
+ */
+int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the permissions which a characteristic's GATT handle has.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ *
+ * @param[in] gatt_handle The handle of a characteristic
+ * @param[out] permissions The permissions which a characteristic's GATT handle has
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_permission_e
+ */
+int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the permissions which a descriptor's GATT handle has.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ *
+ * @param[in] gatt_handle The handle of a descriptor
+ * @param[out] permissions The permissions which a descriptor's GATT handle has
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_create()
+ * @see bt_gatt_permission_e
+ */
+int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT service.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a service should be destroyed by using bt_gatt_service_destroy()
+ *
+ * @param[in] uuid The UUID of the service
+ * @param[in] type The type of the service
+ * @param[out] service The GATT handle of the created service
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_destroy()
+ */
+int bt_gatt_service_create(const char *uuid, bt_gatt_service_type_e type,
+                          bt_gatt_h *service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a characteristic to a specified service.
+ * @since_tizen 3.0
+ *
+ * @param[in] service The service's GATT handle
+ * @param[in] characteristic The characteristic's GATT handle to be added
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_characteristic_create()
+ */
+int bt_gatt_service_add_characteristic(bt_gatt_h service,
+                                       bt_gatt_h characteristic);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a service to a specified service as included service.
+ * @since_tizen 3.0
+ *
+ * @param[in] service The service's GATT handle
+ * @param[in] included_service The service's GATT handle to be added as included service
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ */
+int bt_gatt_service_add_included_service(bt_gatt_h service,
+                                       bt_gatt_h included_service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the GATT server handle to which the specified service belongs.
+ * @since_tizen 3.0
+ *
+ * @remarks The returned Server handle must not be freed by application.
+ *
+ * @param[in] service The service's GATT handle
+ * @param[out] server The GATT server handle to which @a service belongs
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT characteristic.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ * @remarks The @a properties can be one or more values of #bt_gatt_property_e, combined with bitwise 'or'.
+ * @remarks The @a characteristic should be destroyed by using bt_gatt_characteristic_destroy().
+ *
+ * @param[in] uuid The UUID of the characteristic
+ * @param[in] permissions the permissions of the characteristic
+ * @param[in] properties The properties of the characteristic
+ * @param[in] Value The value(byte stream) of the characteristic
+ * @param[in] value_length The length of @a value
+ * @param[out] characteristic The GATT handle of the created characteristic
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_destroy()
+ */
+int bt_gatt_characteristic_create(const char *uuid, int permissions,
+                               int properties, const char *value, int value_length,
+                               bt_gatt_h *characteristic);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a descriptor to a specified characteristic.
+ * @since_tizen 3.0
+ *
+ * @param[in] characteristic The GATT handle of the characteristic
+ * @param[in] descriptor The descriptor's GATT handle to be added
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_descriptor_create()
+ */
+int bt_gatt_characteristic_add_descriptor(bt_gatt_h characteristic,
+                                       bt_gatt_h descriptor);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT characteristic descriptor.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ * @remarks The @a descriptor should be destroyed by using bt_gatt_descriptor_destroy()
+ *
+ * @param[in] uuid The UUID of the descriptor
+ * @param[in] permissions The permissions of the descriptor
+ * @param[in] value The value(byte stream) associated with the descriptor
+ * @param[in] value_length The length of @a value
+ * @param[out] descriptor The GATT handle of the created characteristic descriptor
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_destroy()
+ */
+int bt_gatt_descriptor_create(const char *uuid, int permissions,
+                               const char *value, int value_length,
+                               bt_gatt_h *descriptor);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Initializes the GATT Server.
+ * @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_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @see        bt_gatt_server_deinitialize()
+ */
+int bt_gatt_server_initialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief DeInitializes the GATT server.
+ * @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_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @see        bt_gatt_server_initialize()
+ */
+int bt_gatt_server_deinitialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT server's handle.
+ * @since_tizen 3.0
+ *
+ * @param[out] server The GATT server's handle
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_destroy()
+ */
+int bt_gatt_server_create(bt_gatt_server_h *server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Destroys the GATT server's handle.
+ * @since_tizen 3.0
+ *
+ * @remarks All registered services to GATT server are unregistered
+ *
+ * @param[in] server The GATT server's handle
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ */
+int bt_gatt_server_destroy(bt_gatt_server_h server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client).
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_read_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_read_value_requested_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED     Not supported
+ *
+ * @see bt_gatt_server_characteristic_notification_state_changed_cb()
+ */
+int bt_gatt_server_set_characteristic_notification_state_change_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_characteristic_notification_state_changed_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_write_value_requested_cb()
+ */
+int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_write_value_requested_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a specified service to the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @param[in] service The service, which needs to be registered in @a server
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_ALREADY_DONE Operation is already done
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_start()
+ * @see bt_gatt_server_unregister_service()
+ */
+int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Unregisters a specified service from the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @param[in] service The service, which needs to be unregistered from @a server
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_SERVICE_NOT_FOUND  Service not found
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_server_unregister_service(bt_gatt_server_h server, bt_gatt_h service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Unregisters all services from the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_server_unregister_all_services(bt_gatt_server_h server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers the application along with the GATT services of the application it is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_ALREADY_DONE Operation is already done
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_initialize()
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_unregister_service()
+ */
+int bt_gatt_server_start(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Sends a response to the remote device as a result of a read/write request.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @remarks Until this function is called, a read/write request is not finished.
+ *
+ * @param[in] request_id The identification of a read/write request
+ * @param[in] request_type The request type for read/write
+ * @param[in] offset The offset from where a value is read
+ * @param[in] resp_status The application error if any occurred or BT_ERROR_NONE for successful.
+ * @param[in] value The value to be sent. It will be sent from @a offset. If it is NULL, a requested GATT handle's value will be sent from @a offset.
+ * @param[in] value_length Value Length
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_read_value_requested_cb()
+ */
+int bt_gatt_server_send_response(int request_id, bluetooth_gatt_att_request_type_e request_type,
+                       int offset, int resp_status, char *value, int value_length);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor.
+ * @since_tizen 3.0
+ *
+ * @param[in] characteristic The characteristic which has a changed value
+ * @param[in] callback The function to be invoked on each remote device when a sending operation is done
+ * @param[in] device_address Remote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled.
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_notification_sent_cb()
+ */
+int bt_gatt_server_notify_characteristic_changed_value(bt_gatt_h characteristic,
+                               bt_gatt_server_notification_sent_cb callback,
+                               const char *device_address, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets a service's GATT handle which has specific UUID.
+ * @since_tizen 3.0
+ *
+ * @remark The returned GATT handle must not be freed by application.
+ * It will be freed when an associated server is destroyed by bt_gatt_server_destroy().
+ * If there are multiple services which have same UUID, only the first matched one will be returned.
+ *
+ * @param[in] server The GATT server's handle
+ * @param[in] uuid The service's GATT handle which has this UUID will be returned if it exists
+ * @param[out] service The service's GATT handle which has @a uuid if it exists
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NO_DATA  No data available
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ */
+int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid,
+                               bt_gatt_h *service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Invokes @a callback function on each service that belongs to the specified GATT server.
+ * @since_tizen 3.0
+ *
+ * @param[in] server The GATT server's handle
+ * @param[in] callback The function to be invoked on each service
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_foreach_cb()
+ */
+int bt_gatt_server_foreach_services(bt_gatt_server_h server,
+               bt_gatt_foreach_cb callback, void *user_data);
+
 /**
  * @}
  */
index cedf9dcbe59ba3bf28850b8ab8acc991e80e57c0..f393187f6e611fcf78932d77b22185f25a05d81d 100644 (file)
@@ -1752,105 +1752,9 @@ int bt_a2dp_set_content_protection(bool status);
 int bt_gatt_get_uuid_specification_name(const char *uuid, char **name);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of service, characteristic or descriptor
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of service
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- */
-int bt_gatt_service_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of characteristic
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- */
-int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of descriptor
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a characteristic's GATT handle has
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of a characteristic
- * @param[out] permissions The permissions which a characteristic's GATT handle has.
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_permission_e
- */
-int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a descriptor's GATT handle has
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of a descriptor
- * @param[out] permissions The permissions which a descriptor's GATT handle has.
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_descriptor_create()
- * @see bt_gatt_permission_e
- */
-int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the permissions which a characteristic or descriptor's GATT handle has
- * @since_tizen 2.4
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Updates the permissions which a characteristic or descriptor's GATT handle has.
+ * @since_tizen 3.0
  *
  * @param[in] gatt_handle The handle of a characteristic or descriptor
  * @param[in] permissions The permissions to be updated
@@ -1866,122 +1770,9 @@ int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
 int bt_gatt_set_permissions(bt_gatt_h gatt_handle, int permissions);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT service
- * @since_tizen 2.4
- *
- * @param[in] uuid The UUID of the service
- * @param[in] type The type of the service
- * @param[out] service The GATT handle of the created service
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_service_create(const char *uuid, bt_gatt_service_type_e type,
-                          bt_gatt_h *service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a characteristic to a specified service
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[in] characteristic The characteristic's GATT handle to be added
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- * @see bt_gatt_characteristic_create()
- */
-int bt_gatt_service_add_characteristic(bt_gatt_h service,
-                                       bt_gatt_h characteristic);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a service to a specified service as included service
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[in] included_service The service's GATT handle to be added as included service
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- */
-int bt_gatt_service_add_included_service(bt_gatt_h service,
-                                       bt_gatt_h included_service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the GATT server handle to which the specified service belongs
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[out] server The GATT server handle to which @a service belongs
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_create()
- * @see bt_gatt_service_create()
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT characteristic
- * @since_tizen 2.4
- *
- * @param[in] uuid The UUID of the characteristic
- * @param[in] permissions the permissions of the characteristic
- * @param[in] properties The properties of the characteristic
- * @param[in] Value The value(byte stream) of the characteristic
- * @param[in] value_length The length of @a value
- * @param[out] characteristic The GATT handle of the created characteristic
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_characteristic_create(const char *uuid, int permissions,
-                               int properties, const char *value, int value_length,
-                               bt_gatt_h *characteristic);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a descriptor to a specified characteristic
- * @since_tizen 2.4
- *
- * @param[in] characteristic The GATT handle of the characteristic
- * @param[in] descriptor The descriptor's GATT handle to be added
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_characteristic_add_descriptor(bt_gatt_h characteristic,
-                                       bt_gatt_h descriptor);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the properties which a characteristic's GATT handle has
- * @since_tizen 2.4
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Updates the properties which a characteristic's GATT handle has.
+ * @since_tizen 3.0
  *
  * @param[in] characteristic The characteristic's GATT handle
  * @param[in] properties The properties to be updated
@@ -1996,307 +1787,20 @@ int bt_gatt_characteristic_set_properties(bt_gatt_h characteristic, int properti
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT characteristic descriptor
+ * @brief Destroys the GATT handle
  * @since_tizen 2.4
  *
- * @param[in] uuid The UUID of the descriptor
- * @param[in] permissions The permissions of the descriptor
- * @param[in] value The value(byte stream) associated with the descriptor
- * @param[in] value_length The length of @a value
- * @param[out] descriptor The GATT handle of the created characteristic descriptor
+ * @param[in] gatt_handle The handle of service, characteristic or descriptor
  * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_descriptor_create(const char *uuid, int permissions,
-                               const char *value, int value_length,
-                               bt_gatt_h *descriptor);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Initializes the GATT Server
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value.
  * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see        bt_gatt_server_deinitialize()
- */
-int bt_gatt_server_initialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief DeInitializes the GATT server
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE      Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see        bt_gatt_server_initialize()
- */
-int bt_gatt_server_deinitialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT server's handle
- * @since_tizen 2.4
- *
- * @param[out] server The GATT server's handle
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_destroy()
- */
-int bt_gatt_server_create(bt_gatt_server_h *server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Destroys the GATT server's handle
- * @since_tizen 2.4
- *
- * @remarks All registered services to GATT server are unregistered
- *
- * @param[in] server The GATT server's handle
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_create()
- */
-int bt_gatt_server_destroy(bt_gatt_server_h server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client)
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_read_value_requested_cb()
- * @see bt_gatt_server_send_response()
- */
-int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_read_value_requested_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED     Not supported
- *
- * @see bt_gatt_server_notification_state_change_cb()
- */
-int bt_gatt_server_set_notification_state_change_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_notification_state_change_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_write_value_requested_cb()
- */
-int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_write_value_requested_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a specified service to the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] server The GATT server that local device is hosting
- * @param[in] service The service, which needs to be registered in @a server
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE Operation is already done
  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
  *
- * @see bt_gatt_server_create()
  * @see bt_gatt_service_create()
- * @see bt_gatt_server_start()
- * @see bt_gatt_server_unregister_service()
- */
-int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters a specified service from the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server that local device is hosting
- * @param[in] service The service, which needs to be unregistered from @a server
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_SERVICE_NOT_FOUND  Service not found
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_server_unregister_service(bt_gatt_server_h server, bt_gatt_h service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters all services from the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server that local device is hosting
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_server_unregister_all_services(bt_gatt_server_h server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers the applciation along with the GATT services of the aplciation it is hosting
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE Operation is already done
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @see bt_gatt_server_initialize()
- * @see bt_gatt_server_create()
- * @see bt_gatt_service_create()
- * @see bt_gatt_server_unregister_service()
- */
-int bt_gatt_server_start(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Sends a response to the remote device as a result of a read request
- * @since_tizen 2.4
- *
- * @remarks Until this function is called, a read request is not finished.
- *
- * @param[in] request_id The identification of a read/write request
- * @param[in] request_type The request type for read/write.
- * @param[in] offset The offset from where a value is read
- * @param[in] resp_status The applciation error if any occured or BT_ERROR_NONE for successful.
- * @param[in] value The value to be sent. It will be sent from @a offset. If it is NULL, a requested GATT handle's value will be sent from @a offset.
- * @param[in] value_length Value Length
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_read_value_requested_cb()
- */
-int bt_gatt_server_send_response(int request_id, int request_type,
-                       int offset, int resp_status, char *value, int value_length);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor
- * @since_tizen 2.4
- *
- * @param[in] characteristic The characteristic which has a changed value
- * @param[in] need_confirm If it is true, an indication is sent. If it is false, a notification is sent.
- * @param[in] callback The function to be invoked on each remote device when a sending operation is done
- * @param[in] device_address Remote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled.
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_notification_sent_cb()
- */
-int bt_gatt_server_notify(bt_gatt_h characteristic, bool need_confirm,
-                               bt_gatt_server_notification_sent_cb callback,
-                               const char *device_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a service's GATT handle which has specific UUID
- * @since_tizen 2.4
- *
- * @remark The returned GATT handle must not be freed by application.
- * It will be freed when an associated server is destroyed by bt_gatt_server_destroy().
- * If there are multiple services which have same UUID, only the first matched one will be returned.
- *
- * @param[in] server The GATT server's handle
- * @param[in] uuid The serivce's GATT handle which has this UUID will be returned if it exists
- * @param[out] service The service's GATT handle which has @a uuid if it exists
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NO_DATA  No data available
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- */
-int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid,
-                               bt_gatt_h *service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each service that belongs to the specified GATT server
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server's handle
- * @param[in] callback The function to be invoked on each service
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_foreach_cb()
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_descriptor_create()
  */
-int bt_gatt_server_foreach_services(bt_gatt_server_h server,
-               bt_gatt_foreach_cb callback, void *user_data);
+int bt_gatt_destroy(bt_gatt_h gatt_handle);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
index 9da5a01a95bdb9bd55da10ab978dbd4dc527193e..f005951751eeae163185b8e4267a9a933d1db9d2 100644 (file)
@@ -627,7 +627,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the integer type for GATT handle's value
+ * @brief  Enumerations of the integer type for GATT handle's value.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -641,7 +641,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the float type for GATT handle's value
+ * @brief  Enumerations of the float type for GATT handle's value.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -651,7 +651,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the write type
+ * @brief  Enumerations of the write type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -661,7 +661,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the GATT handle's type
+ * @brief  Enumerations of the GATT handle's type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -672,7 +672,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the service type
+ * @brief  Enumerations of the service type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -682,7 +682,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the characteristic's property
+ * @brief  Enumerations of the characteristic's property.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -696,9 +696,33 @@ typedef enum {
        BT_GATT_PROPERTY_EXTENDED_PROPERTIES = 0x80,  /**< Extended properties */
 } bt_gatt_property_e;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Enumerations of the attribute's permission.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_GATT_PERMISSION_READ = 0x01,  /**< Read permission */
+       BT_GATT_PERMISSION_WRITE = 0x02,  /**< Write permission */
+       BT_GATT_PERMISSION_ENCRYPTION = 0x04,  /**< Encryption permission */
+       BT_GATT_PERMISSION_AUTHENTICATION = 0x08,  /**< Authentication permission */
+       BT_GATT_PERMISSION_AUTHORIZATION = 0x10,  /**< Authorization permission */
+       BT_GATT_PERMISSION_NONE = 0x20,  /**< None */
+} bt_gatt_permission_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Enumerations of the remote device request types for attributes
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BLUETOOTH_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
+       BLUETOOTH_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
+} bluetooth_gatt_att_request_type_e;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief  Enumerations for the types of PAN(Personal Area Networking) service
+ * @brief  Enumerations for the types of PAN(Personal Area Networking) service.
  * @since_tizen 2.3
  */
 typedef enum {
@@ -707,7 +731,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle to control Bluetooth LE advertising
+ * @brief The handle to control Bluetooth LE advertising.
  * @since_tizen 2.3
  */
 typedef void *bt_advertiser_h;
@@ -715,28 +739,35 @@ typedef void *bt_advertiser_h;
 /**
  * @deprecated Deprecated since 2.3.1. Use bt_gatt_h instead.
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  The attribute handle of GATT(Generic Attribute Profile)
+ * @brief  The attribute handle of GATT(Generic Attribute Profile).
  * @since_tizen 2.3
  */
 typedef void *bt_gatt_attribute_h;
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a service, characteristic or descriptor
+ * @brief The handle of a service, characteristic or descriptor.
  * @since_tizen 2.3.1
  */
 typedef void *bt_gatt_h;
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a GATT client which is associated with a remote device
+ * @brief The handle of a GATT client which is associated with a remote device.
  * @since_tizen 2.3.1
  */
 typedef void *bt_gatt_client_h;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief The handle of a GATT server.
+ * @since_tizen 3.0
+ */
+typedef void *bt_gatt_server_h;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  The handle of calls state
+ * @brief  The handle of calls state.
  * @since_tizen 2.3
  */
 typedef void *bt_call_list_h;
@@ -818,7 +849,7 @@ typedef struct {
 /**
  * @deprecated Deprecated since 2.3.1
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Structure of advertising parameters
+ * @brief Structure of advertising parameters.
  * @since_tizen 2.3
  *
  * @see bt_adapter_le_advertising_state_changed_cb()
@@ -835,7 +866,7 @@ typedef struct {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief LE service data structure
+ * @brief LE service data structure.
  * @since_tizen 2.3.1
  *
  * @see bt_adapter_le_get_scan_result_service_data()
@@ -1674,7 +1705,7 @@ typedef void (*bt_gatt_client_request_completed_cb) (int result,
  * @brief  Called when a value of a watched characteristic's GATT handle has been changed
  * @since_tizen 2.3.1
  *
- * @remarks After this function is returned, a changed vlaue is automatically
+ * @remarks After this function is returned, a changed value is automatically
  * applied to @a characteristic. Before that, @a characteristic has an old value.
  *
  * @param[in] characteristic The characteristic's GATT handle of which value change is informed. It has an old value.
@@ -1707,6 +1738,108 @@ typedef void (*bt_gatt_client_characteristic_value_changed_cb) (bt_gatt_h charac
  */
 typedef void (*bt_gatt_connection_state_changed_cb)(int result, bool connected, const char *remote_address, void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when a value of a characteristic or descriptor's GATT handle has been changed.
+ * @since_tizen 3.0
+ *
+ * @details For finishing the request, call the function #bt_gatt_server_send_response in callback.
+ *
+ * @remarks After this function is returned, a changed value is automatically
+ * applied to @a gatt_handle. Before that, @a gatt_handle has an old value.
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ * @remarks The @a value must not be freed by application.
+ *
+ * @param[in] remote_address The address of the remote device which requests a change
+ * @param[in] request_id The identification of this request. It will be used to send a response.
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic or descriptor's GATT handle which has an old value
+ * @param[in] offset The requested offset from where the @a gatt_handle value will be updated
+ * @param[in] value The new value
+ * @param[in] len The length of @a value
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_write_value_requested_cb()a
+ * @see bt_gatt_server_send_response()
+ */
+typedef void (*bt_gatt_server_write_value_requested_cb) (const char *remote_address,
+                               int request_id, bt_gatt_server_h server,
+                               bt_gatt_h gatt_handle, int offset,
+                               const char *value, int len, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the remote device requests to read a value on a GATT server.
+ * @since_tizen 3.0
+ *
+ * @details For finishing the request, call the function #bt_gatt_server_send_response in callback.
+ *
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ *
+ * @param[in] remote_address The address of the requesting remote device
+ * @param[in] request_id The identification of this request. It will be used to send a response.
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic or descriptor's GATT handle to be read
+ * @param[in] offset The requested offset from where the GATT handle's value is read
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_read_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+typedef void (*bt_gatt_server_read_value_requested_cb) (const char *remote_address,
+               int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle,
+               int offset, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the remote device enables or disables the Notification/Indication for particular characteristics.
+ * @since_tizen 3.0
+ *
+ * @details By using this callback function, server can know notification state.
+ *
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ *
+ * @param[in] notify Indicates whether the Notification/Indication is enabled or not
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic's GATT handle to be read
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_read_value_requested_cb()
+ */
+typedef void (*bt_gatt_server_characteristic_notification_state_changed_cb) (bool notify,
+                       bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the sending notification / indication is done.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a characteristic must not be freed by application.
+ *
+ * @remarks In case of an indication, once a confirmation is received from the remote device this callback will be called. \n
+ * This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD). \n
+ * For the last remote device, @a completed will be set as true.
+ *
+ * @param[in] result The result of a sending operation
+ * @param[in] remote_address The address of the remote device
+ * @param[in] server The GATT server handle
+ * @param[in] characteristic The characteristic's GATT handle
+ * @param[in] completed If this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false.
+ * @param[in] user_data The user data passed from the requesting function
+ *
+ * @see bt_gatt_server_notify_characteristic_changed_value()
+ */
+typedef void (*bt_gatt_server_notification_sent_cb) (int result,
+               const char *remote_address, bt_gatt_server_h server,
+               bt_gatt_h characteristic, bool completed, void *user_data);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
  * @brief  Called when the connection state is changed.
index 85159c4da6679740b51bced55bf29bc04fb5b562..e3872b705de1c48c97422cea837e1d8f2186f4fa 100644 (file)
@@ -154,20 +154,6 @@ typedef enum {
 typedef void (*bt_adapter_manufacturer_data_changed_cb) (char *data,
                int len, void *user_data);
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the attribute's permission
- * @since_tizen 2.4
- */
-typedef enum {
-       BT_GATT_PERMISSION_READ = 0x01,
-       BT_GATT_PERMISSION_WRITE = 0x02,
-       BT_GATT_PERMISSION_ENCRYPTION = 0x04,
-       BT_GATT_PERMISSION_AUTHENTICATION = 0x08,
-       BT_GATT_PERMISSION_AUTHORIZATION = 0x10,
-       BT_GATT_PERMISSION_NONE = 0x20,
-} bt_gatt_permission_e;
-
 /**
 * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
 * @brief DPM BT allowance state
@@ -224,92 +210,6 @@ typedef enum {
  */
 typedef void *bt_scan_filter_h;
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a GATT server
- * @since_tizen 2.4
- */
-typedef void *bt_gatt_server_h;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when a value of a characteristic or descriptor's GATT handle has been changed
- * @since_tizen 2.4
- *
- * @remarks After this function is returned, a changed vlaue is automatically
- * applied to @a gatt_handle. Before that, @a gatt_handle has an old value.
- *
- * @param[in] remote_address The address of the remote device which requests a change
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic or descriptor's GATT handle which has an old value
- * @param[in] request_id The identification of this request. It will be used to send a reponse.
- * @param[in] offset The requested offset from where the @a gatt_handle value will be updated
- * @param[in] value The new value
- * @param[in] len The length of @a value
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_write_value_requested_cb()
- */
-typedef void (*bt_gatt_server_write_value_requested_cb) (char *remote_address,
-                               int request_id, bt_gatt_server_h server,
-                               bt_gatt_h gatt_handle, int offset,
-                               char *value, int len, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the remote device requests to read a value on a GATT server
- * @since_tizen 2.4
- *
- * @param[in] remote_address The address of the requesting remote device
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic or descriptor's GATT handle to be read
- * @param[in] request_id The identification of this request. It will be used to send a reponse.
- * @param[in] offset The requested offset from where the GATT handle's value is read
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_read_value_requested_cb()
- * @see bt_gatt_server_send_response()
- */
-typedef void (*bt_gatt_server_read_value_requested_cb) (char *remote_address,
-               int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle,
-               int offset, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the remote device enables or disables the Notification/Indication for particular characteristics.
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic's GATT handle to be read
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_read_value_requested_cb()
- */
-typedef void (*bt_gatt_server_notification_state_change_cb) (bool notify,
-                       bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the sending notification / indication is done
- * @since_tizen 2.4
- *
- * @remarks In case of an indication, once a confirmation is received from the remote device this callback will be called. \n
- * This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD). \n
- * For the last remote device, @a completed will be set as true.
- *
- * @param[in] result The result of a sending operation
- * @param[in] remote_address The address of the remote device
- * @param[in] server The GATT server handle
- * @param[in] characteristic The characteristic's GATT handle
- * @param[in] completed If this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false.
- * @param[in] user_data The user data passed from the requesting function
- *
- * @see bt_gatt_server_notify()
- */
-typedef void (*bt_gatt_server_notification_sent_cb) (int result,
-               char *remote_address, bt_gatt_server_h server,
-               bt_gatt_h characteristic, bool completed, void *user_data);
-
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Device LE connection update structure.
@@ -322,7 +222,6 @@ typedef struct {
        unsigned int time_out;   /**< Supervision timeout (msec) */
 } bt_le_conn_update_s;
 
-
 /**
  * Structure to DPM device list
  */
index 1bb867be29aa74d14a9dc5217d29d9ebe79e4471..03a8dcbe7b0ae1bea288939a54ebe661bcebca3b 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdbool.h>
 #include <tizen_error.h>
 
-#include "bluetooth_type.h"
+#include <bluetooth_type.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -3385,7 +3385,7 @@ int bt_hdp_unset_data_received_cb(void);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks @a value must be released using free(). \n
@@ -3404,7 +3404,7 @@ int bt_gatt_get_value(bt_gatt_h gatt_handle, char **value, int *value_length);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle as an integer type
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle as an integer type.
  * @since_tizen 2.3.1
  *
  * @remarks This function returns a locally saved value in @a gatt_handle. \n
@@ -3425,7 +3425,7 @@ int bt_gatt_get_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the value of a characteristic or descriptor's GATT handle as a float type
+ * @brief  Gets the value of a characteristic or descriptor's GATT handle as a float type.
  * @since_tizen 2.3.1
  *
  * @remarks This function returns a locally saved value in @a gatt_handle. \n
@@ -3446,7 +3446,7 @@ int bt_gatt_get_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -3466,7 +3466,7 @@ int bt_gatt_set_value(bt_gatt_h gatt_handle, const char *value, int value_length
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle using a integer type's value
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle using a integer type's value.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -3488,7 +3488,7 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the value of a characteristic or descriptor's GATT handle using a float type's value
+ * @brief  Updates the value of a characteristic or descriptor's GATT handle using a float type's value.
  * @since_tizen 2.3.1
  *
  * @remarks This function updates a value of @a gatt_handle locally. \n
@@ -3511,7 +3511,7 @@ int bt_gatt_set_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the UUID of a service, characteristic or descriptor's GATT handle
+ * @brief  Gets the UUID of a service, characteristic or descriptor's GATT handle.
  * @since_tizen 2.3.1
  *
  * @remarks @a uuid must be released using free(). \n
@@ -3528,7 +3528,7 @@ int bt_gatt_get_uuid(bt_gatt_h gatt_handle, char **uuid);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the type of GATT handle
+ * @brief  Gets the type of GATT handle.
  * @since_tizen 2.3.1
  *
  * @param[in] gatt_handle The GATT handle
@@ -3542,7 +3542,7 @@ int bt_gatt_get_type(bt_gatt_h gatt_handle, bt_gatt_type_e *gatt_type);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the GATT client handle which the specified service belongs to
+ * @brief  Gets the GATT client handle which the specified service belongs to.
  * @since_tizen 2.3.1
  *
  * @remark This function doesn't allocate new memory for GATT client handle.
@@ -3562,7 +3562,7 @@ int bt_gatt_service_get_client(bt_gatt_h service, bt_gatt_client_h *client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a characteristic's GATT handle which has specific UUID
+ * @brief  Gets a characteristic's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -3583,7 +3583,7 @@ int bt_gatt_service_get_characteristic(bt_gatt_h service, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each characteristic that belongs to the specified service
+ * @brief  Invokes @a callback function on each characteristic that belongs to the specified service.
  * @since_tizen 2.3.1
  *
  * @param[in] service The service's GATT handle
@@ -3601,7 +3601,7 @@ int bt_gatt_service_foreach_characteristics(bt_gatt_h service,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets an included service's GATT handle which has specific UUID
+ * @brief  Gets an included service's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -3622,7 +3622,7 @@ int bt_gatt_service_get_included_service(bt_gatt_h service, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each included service that belongs to the specified service
+ * @brief  Invokes @a callback function on each included service that belongs to the specified service.
  * @since_tizen 2.3.1
  *
  * @param[in] service The service's GATT handle
@@ -3640,7 +3640,7 @@ int bt_gatt_service_foreach_included_services(bt_gatt_h service,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the service's GATT handle which the specified characteristic belongs to
+ * @brief  Gets the service's GATT handle which the specified characteristic belongs to.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -3657,7 +3657,7 @@ int bt_gatt_characteristic_get_service(bt_gatt_h characteristic, bt_gatt_h *serv
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the properties which a characteristic's GATT handle has
+ * @brief  Gets the properties which a characteristic's GATT handle has.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -3673,7 +3673,7 @@ int bt_gatt_characteristic_get_properties(bt_gatt_h characteristic, int *propert
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Gets the write type of the specified characteristic
+ * @brief Gets the write type of the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -3690,7 +3690,7 @@ int bt_gatt_characteristic_get_write_type(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the write type of the specified characteristic
+ * @brief  Updates the write type of the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -3708,7 +3708,7 @@ int bt_gatt_characteristic_set_write_type(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a descriptor's GATT handle which has specific UUID
+ * @brief  Gets a descriptor's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -3729,7 +3729,7 @@ int bt_gatt_characteristic_get_descriptor(bt_gatt_h characteristic, const char *
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each descriptor that belongs to the specified characteristic
+ * @brief  Invokes @a callback function on each descriptor that belongs to the specified characteristic.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -3747,7 +3747,7 @@ int bt_gatt_characteristic_foreach_descriptors(bt_gatt_h characteristic,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the characteristic's GATT handle which the specified descriptor belongs to
+ * @brief  Gets the characteristic's GATT handle which the specified descriptor belongs to.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -3764,7 +3764,7 @@ int bt_gatt_descriptor_get_characteristic(bt_gatt_h descriptor, bt_gatt_h *chara
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT client handle
+ * @brief  Creates the GATT client handle.
  * @since_tizen 2.3.1
  *
  * @remark The GATT client handle must be freed by bt_gatt_client_destroy() after use
@@ -3784,7 +3784,7 @@ int bt_gatt_client_create(const char *remote_address, bt_gatt_client_h *client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Destroys the GATT client's handle
+ * @brief  Destroys the GATT client's handle.
  * @since_tizen 2.3.1
  *
  * @remark All related service, characteristic and descriptor's GATT handles are freed also
@@ -3801,7 +3801,7 @@ int bt_gatt_client_destroy(bt_gatt_client_h client);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the address of remote device
+ * @brief  Gets the address of remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] client The created GATT client's handle
@@ -3818,7 +3818,7 @@ int bt_gatt_client_get_remote_address(bt_gatt_client_h client,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Reads the value of a characteristic or descriptor from the remote device asynchronously
+ * @brief  Reads the value of a characteristic or descriptor from the remote device asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3844,7 +3844,7 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Writes the value of a characteristic or descriptor to the remote device asynchronously
+ * @brief  Writes the value of a characteristic or descriptor to the remote device asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
  * @privilege %http://tizen.org/privilege/bluetooth
@@ -3874,7 +3874,7 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when the characteristic value is changed on the remote device
+ * @brief  Registers a callback function to be invoked when the characteristic value is changed on the remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle
@@ -3895,7 +3895,7 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic,
 
 /**
  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters a callback function to be invoked when the characteristic value is changed on the remote device
+ * @brief  Unregisters a callback function to be invoked when the characteristic value is changed on the remote device.
  * @since_tizen 2.3.1
  *
  * @param[in] characteristic The characteristic's GATT handle, whose value change will not be informed
@@ -3911,7 +3911,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a service's GATT handle which has specific UUID
+ * @brief  Gets a service's GATT handle which has specific UUID.
  * @since_tizen 2.3.1
  *
  * @remark The returned GATT handle must not be freed by application.
@@ -3919,7 +3919,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi
  * If there are multiple services which have same UUID, only the first matched one will be returned.
  *
  * @param[in] client The GATT client's handle
- * @param[in] uuid The serivce's GATT handle which has this UUID will be returned if it exists
+ * @param[in] uuid The service's GATT handle which has this UUID will be returned if it exists
  * @param[out] service The service's GATT handle which has @a uuid if it exists
  * @return  0 on success, otherwise a negative error value
  * @retval #BT_ERROR_NONE Successful
@@ -3932,7 +3932,7 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid,
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each service that belongs to the specified GATT client
+ * @brief  Invokes @a callback function on each service that belongs to the specified GATT client.
  * @since_tizen 2.3.1
  *
  * @param[in] client The GATT client's handle
@@ -4044,6 +4044,531 @@ int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb
  */
 int bt_gatt_unset_connection_state_changed_cb(void);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of service.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of service
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ */
+int bt_gatt_service_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of characteristic.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of characteristic
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ */
+int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Destroys the GATT handle of descriptor.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The handle of descriptor
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_create()
+ */
+int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the permissions which a characteristic's GATT handle has.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ *
+ * @param[in] gatt_handle The handle of a characteristic
+ * @param[out] permissions The permissions which a characteristic's GATT handle has
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_permission_e
+ */
+int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the permissions which a descriptor's GATT handle has.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ *
+ * @param[in] gatt_handle The handle of a descriptor
+ * @param[out] permissions The permissions which a descriptor's GATT handle has
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_create()
+ * @see bt_gatt_permission_e
+ */
+int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT service.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a service should be destroyed by using bt_gatt_service_destroy()
+ *
+ * @param[in] uuid The UUID of the service
+ * @param[in] type The type of the service
+ * @param[out] service The GATT handle of the created service
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_destroy()
+ */
+int bt_gatt_service_create(const char *uuid, bt_gatt_service_type_e type,
+                          bt_gatt_h *service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a characteristic to a specified service.
+ * @since_tizen 3.0
+ *
+ * @param[in] service The service's GATT handle
+ * @param[in] characteristic The characteristic's GATT handle to be added
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_characteristic_create()
+ */
+int bt_gatt_service_add_characteristic(bt_gatt_h service,
+                                       bt_gatt_h characteristic);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a service to a specified service as included service.
+ * @since_tizen 3.0
+ *
+ * @param[in] service The service's GATT handle
+ * @param[in] included_service The service's GATT handle to be added as included service
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_service_create()
+ */
+int bt_gatt_service_add_included_service(bt_gatt_h service,
+                                       bt_gatt_h included_service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets the GATT server handle to which the specified service belongs.
+ * @since_tizen 3.0
+ *
+ * @remarks The returned Server handle must not be freed by application.
+ *
+ * @param[in] service The service's GATT handle
+ * @param[out] server The GATT server handle to which @a service belongs
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT characteristic.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ * @remarks The @a properties can be one or more values of #bt_gatt_property_e, combined with bitwise 'or'.
+ * @remarks The @a characteristic should be destroyed by using bt_gatt_characteristic_destroy().
+ *
+ * @param[in] uuid The UUID of the characteristic
+ * @param[in] permissions the permissions of the characteristic
+ * @param[in] properties The properties of the characteristic
+ * @param[in] Value The value(byte stream) of the characteristic
+ * @param[in] value_length The length of @a value
+ * @param[out] characteristic The GATT handle of the created characteristic
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_destroy()
+ */
+int bt_gatt_characteristic_create(const char *uuid, int permissions,
+                               int properties, const char *value, int value_length,
+                               bt_gatt_h *characteristic);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Adds a descriptor to a specified characteristic.
+ * @since_tizen 3.0
+ *
+ * @param[in] characteristic The GATT handle of the characteristic
+ * @param[in] descriptor The descriptor's GATT handle to be added
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_descriptor_create()
+ */
+int bt_gatt_characteristic_add_descriptor(bt_gatt_h characteristic,
+                                       bt_gatt_h descriptor);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT characteristic descriptor.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a permissions can be one or more values of #bt_gatt_permissions_e, combined with bitwise 'or'.
+ * @remarks The @a descriptor should be destroyed by using bt_gatt_descriptor_destroy().
+ *
+ * @param[in] uuid The UUID of the descriptor
+ * @param[in] permissions The permissions of the descriptor
+ * @param[in] value The value(byte stream) associated with the descriptor
+ * @param[in] value_length The length of @a value
+ * @param[out] descriptor The GATT handle of the created characteristic descriptor
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_descriptor_destroy()
+ */
+int bt_gatt_descriptor_create(const char *uuid, int permissions,
+                               const char *value, int value_length,
+                               bt_gatt_h *descriptor);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief Initializes the GATT Server.
+ * @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_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @see        bt_gatt_server_deinitialize()
+ */
+int bt_gatt_server_initialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief DeInitializes the GATT server.
+ * @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_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ * @see        bt_gatt_server_initialize()
+ */
+int bt_gatt_server_deinitialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Creates the GATT server's handle.
+ * @since_tizen 3.0
+ *
+ * @param[out] server The GATT server's handle
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_destroy()
+ */
+int bt_gatt_server_create(bt_gatt_server_h *server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Destroys the GATT server's handle.
+ * @since_tizen 3.0
+ *
+ * @remarks All registered services to GATT server are unregistered
+ *
+ * @param[in] server The GATT server's handle
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ */
+int bt_gatt_server_destroy(bt_gatt_server_h server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client).
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_read_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_read_value_requested_cb callback,
+                               void *user_data);
+
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED     Not supported
+ *
+ * @see bt_gatt_server_characteristic_notification_state_changed_cb()
+ */
+int bt_gatt_server_set_characteristic_notification_state_change_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_characteristic_notification_state_changed_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request.
+ * @since_tizen 3.0
+ *
+ * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
+ * @param[in] callback The callback to be invoked
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_write_value_requested_cb()
+ */
+int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle,
+                               bt_gatt_server_write_value_requested_cb callback,
+                               void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers a specified service to the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @param[in] service The service, which needs to be registered in @a server
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_ALREADY_DONE Operation is already done
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_start()
+ * @see bt_gatt_server_unregister_service()
+ */
+int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Unregisters a specified service from the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @param[in] service The service, which needs to be unregistered from @a server
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_SERVICE_NOT_FOUND  Service not found
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_server_unregister_service(bt_gatt_server_h server, bt_gatt_h service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Unregisters all services from the specified GATT server that the local device is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] server The GATT server that local device is hosting
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_register_service()
+ */
+int bt_gatt_server_unregister_all_services(bt_gatt_server_h server);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Registers the application along with the GATT services of the application it is hosting.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_ALREADY_DONE Operation is already done
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_initialize()
+ * @see bt_gatt_server_create()
+ * @see bt_gatt_service_create()
+ * @see bt_gatt_server_unregister_service()
+ */
+int bt_gatt_server_start(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Sends a response to the remote device as a result of a read/write request.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @remarks Until this function is called, a read/write request is not finished.
+ *
+ * @param[in] request_id The identification of a read/write request
+ * @param[in] request_type The request type for read/write
+ * @param[in] offset The offset from where a value is read
+ * @param[in] resp_status The application error if any occurred or BT_ERROR_NONE for successful.
+ * @param[in] value The value to be sent. It will be sent from @a offset. If it is NULL, a requested GATT handle's value will be sent from @a offset.
+ * @param[in] value_length Value Length
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_read_value_requested_cb()
+ */
+int bt_gatt_server_send_response(int request_id, bluetooth_gatt_att_request_type_e request_type,
+                       int offset, int resp_status, char *value, int value_length);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor.
+ * @since_tizen 3.0
+ *
+ * @param[in] characteristic The characteristic which has a changed value
+ * @param[in] callback The function to be invoked on each remote device when a sending operation is done
+ * @param[in] device_address Remote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled.
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_server_notification_sent_cb()
+ */
+int bt_gatt_server_notify_characteristic_changed_value(bt_gatt_h characteristic,
+                               bt_gatt_server_notification_sent_cb callback,
+                               const char *device_address, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Gets a service's GATT handle which has specific UUID.
+ * @since_tizen 3.0
+ *
+ * @remark The returned GATT handle must not be freed by application.
+ * It will be freed when an associated server is destroyed by bt_gatt_server_destroy().
+ * If there are multiple services which have same UUID, only the first matched one will be returned.
+ *
+ * @param[in] server The GATT server's handle
+ * @param[in] uuid The service's GATT handle which has this UUID will be returned if it exists
+ * @param[out] service The service's GATT handle which has @a uuid if it exists
+ * @return  0 on success, otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NO_DATA  No data available
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ */
+int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid,
+                               bt_gatt_h *service);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Invokes @a callback function on each service that belongs to the specified GATT server.
+ * @since_tizen 3.0
+ *
+ * @param[in] server The GATT server's handle
+ * @param[in] callback The function to be invoked on each service
+ * @param[in] user_data The user data to be passed to @a callback function
+ * @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_SUPPORTED  Not supported
+ *
+ * @see bt_gatt_foreach_cb()
+ */
+int bt_gatt_server_foreach_services(bt_gatt_server_h server,
+               bt_gatt_foreach_cb callback, void *user_data);
+
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
  * @brief Initializes the Bluetooth PBAP Client.
index 8815bf3beba40795730b7a9246e899288959deda..7f6946a3b6b94d5e2d90e7709faccb510ee1aeef 100644 (file)
@@ -2098,105 +2098,9 @@ int bt_hf_free_call_status_info_list(GSList *call_list);
 int bt_gatt_get_uuid_specification_name(const char *uuid, char **name);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of service, characteristic or descriptor
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of service
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- */
-int bt_gatt_service_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of characteristic
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- */
-int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Destroys the GATT handle
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of descriptor
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a characteristic's GATT handle has
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of a characteristic
- * @param[out] permissions The permissions which a characteristic's GATT handle has.
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_permission_e
- */
-int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a descriptor's GATT handle has
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The handle of a descriptor
- * @param[out] permissions The permissions which a descriptor's GATT handle has.
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_descriptor_create()
- * @see bt_gatt_permission_e
- */
-int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the permissions which a characteristic or descriptor's GATT handle has
- * @since_tizen 2.4
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Updates the permissions which a characteristic or descriptor's GATT handle has.
+ * @since_tizen 3.0
  *
  * @param[in] gatt_handle The handle of a characteristic or descriptor
  * @param[in] permissions The permissions to be updated
@@ -2212,122 +2116,9 @@ int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
 int bt_gatt_set_permissions(bt_gatt_h gatt_handle, int permissions);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT service
- * @since_tizen 2.4
- *
- * @param[in] uuid The UUID of the service
- * @param[in] type The type of the service
- * @param[out] service The GATT handle of the created service
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_service_create(const char *uuid, bt_gatt_service_type_e type,
-                          bt_gatt_h *service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a characteristic to a specified service
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[in] characteristic The characteristic's GATT handle to be added
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- * @see bt_gatt_characteristic_create()
- */
-int bt_gatt_service_add_characteristic(bt_gatt_h service,
-                                       bt_gatt_h characteristic);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a service to a specified service as included service
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[in] included_service The service's GATT handle to be added as included service
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_service_create()
- */
-int bt_gatt_service_add_included_service(bt_gatt_h service,
-                                       bt_gatt_h included_service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the GATT server handle to which the specified service belongs
- * @since_tizen 2.4
- *
- * @param[in] service The service's GATT handle
- * @param[out] server The GATT server handle to which @a service belongs
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_create()
- * @see bt_gatt_service_create()
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT characteristic
- * @since_tizen 2.4
- *
- * @param[in] uuid The UUID of the characteristic
- * @param[in] permissions the permissions of the characteristic
- * @param[in] properties The properties of the characteristic
- * @param[in] Value The value(byte stream) of the characteristic
- * @param[in] value_length The length of @a value
- * @param[out] characteristic The GATT handle of the created characteristic
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_characteristic_create(const char *uuid, int permissions,
-                               int properties, const char *value, int value_length,
-                               bt_gatt_h *characteristic);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Adds a descriptor to a specified characteristic
- * @since_tizen 2.4
- *
- * @param[in] characteristic The GATT handle of the characteristic
- * @param[in] descriptor The descriptor's GATT handle to be added
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_characteristic_create()
- * @see bt_gatt_descriptor_create()
- */
-int bt_gatt_characteristic_add_descriptor(bt_gatt_h characteristic,
-                                       bt_gatt_h descriptor);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Updates the properties which a characteristic's GATT handle has
- * @since_tizen 2.4
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Updates the properties which a characteristic's GATT handle has.
+ * @since_tizen 3.0
  *
  * @param[in] characteristic The characteristic's GATT handle
  * @param[in] properties The properties to be updated
@@ -2342,308 +2133,20 @@ int bt_gatt_characteristic_set_properties(bt_gatt_h characteristic, int properti
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT characteristic descriptor
+ * @brief Destroys the GATT handle
  * @since_tizen 2.4
  *
- * @param[in] uuid The UUID of the descriptor
- * @param[in] permissions The permissions of the descriptor
- * @param[in] value The value(byte stream) associated with the descriptor
- * @param[in] value_length The length of @a value
- * @param[out] descriptor The GATT handle of the created characteristic descriptor
+ * @param[in] gatt_handle The handle of service, characteristic or descriptor
  * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_destroy()
- */
-int bt_gatt_descriptor_create(const char *uuid, int permissions,
-                               const char *value, int value_length,
-                               bt_gatt_h *descriptor);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief Initializes the GATT Server
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value.
  * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see        bt_gatt_server_deinitialize()
- */
-int bt_gatt_server_initialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief DeInitializes the GATT server
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE      Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre        The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- * @see        bt_gatt_server_initialize()
- */
-int bt_gatt_server_deinitialize(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Creates the GATT server's handle
- * @since_tizen 2.4
- *
- * @param[out] server The GATT server's handle
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_destroy()
- */
-int bt_gatt_server_create(bt_gatt_server_h *server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Destroys the GATT server's handle
- * @since_tizen 2.4
- *
- * @remarks All registered services to GATT server are unregistered
- *
- * @param[in] server The GATT server's handle
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_create()
- */
-int bt_gatt_server_destroy(bt_gatt_server_h server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client)
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_read_value_requested_cb()
- * @see bt_gatt_server_send_response()
- */
-int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_read_value_requested_cb callback,
-                               void *user_data);
-
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED     Not supported
- *
- * @see bt_gatt_server_notification_state_change_cb()
- */
-int bt_gatt_server_set_notification_state_change_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_notification_state_change_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request
- * @since_tizen 2.4
- *
- * @param[in] gatt_handle The GATT handle of a characteristic or descriptor
- * @param[in] callback The callback to be invoked
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_write_value_requested_cb()
- */
-int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle,
-                               bt_gatt_server_write_value_requested_cb callback,
-                               void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers a specified service to the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- * @privlevel public
- * @privilege %http://tizen.org/privilege/bluetooth
- *
- * @param[in] server The GATT server that local device is hosting
- * @param[in] service The service, which needs to be registered in @a server
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE Operation is already done
  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
  *
- * @see bt_gatt_server_create()
  * @see bt_gatt_service_create()
- * @see bt_gatt_server_start()
- * @see bt_gatt_server_unregister_service()
- */
-int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters a specified service from the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server that local device is hosting
- * @param[in] service The service, which needs to be unregistered from @a server
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_SERVICE_NOT_FOUND  Service not found
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_server_unregister_service(bt_gatt_server_h server, bt_gatt_h service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Unregisters all services from the specified GATT server that the local device is hosting
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server that local device is hosting
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_register_service()
- */
-int bt_gatt_server_unregister_all_services(bt_gatt_server_h server);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Registers the applciation along with the GATT services of the aplciation it is hosting
- * @since_tizen 2.4
- *
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_ALREADY_DONE Operation is already done
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @see bt_gatt_server_initialize()
- * @see bt_gatt_server_create()
- * @see bt_gatt_service_create()
- * @see bt_gatt_server_unregister_service()
- */
-int bt_gatt_server_start(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Sends a response to the remote device as a result of a read request
- * @since_tizen 2.4
- *
- * @remarks Until this function is called, a read request is not finished.
- *
- * @param[in] request_id The identification of a read/write request
- * @param[in] request_type The request type for read/write.
- * @param[in] offset The offset from where a value is read
- * @param[in] resp_status The applciation error if any occured or BT_ERROR_NONE for successful.
- * @param[in] value The value to be sent. It will be sent from @a offset. If it is NULL, a requested GATT handle's value will be sent from @a offset.
- * @param[in] value_length Value Length
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_read_value_requested_cb()
- */
-int bt_gatt_server_send_response(int request_id, int request_type,
-                       int offset, int resp_status, char *value, int value_length);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor
- * @since_tizen 2.4
- *
- * @param[in] characteristic The characteristic which has a changed value
- * @param[in] need_confirm If it is true, an indication is sent. If it is false, a notification is sent.
- * @param[in] callback The function to be invoked on each remote device when a sending operation is done
- * @param[in] device_address Remote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled.
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_server_notification_sent_cb()
- */
-int bt_gatt_server_notify(bt_gatt_h characteristic, bool need_confirm,
-                               bt_gatt_server_notification_sent_cb callback,
-                               const char *device_address, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets a service's GATT handle which has specific UUID
- * @since_tizen 2.4
- *
- * @remark The returned GATT handle must not be freed by application.
- * It will be freed when an associated server is destroyed by bt_gatt_server_destroy().
- * If there are multiple services which have same UUID, only the first matched one will be returned.
- *
- * @param[in] server The GATT server's handle
- * @param[in] uuid The serivce's GATT handle which has this UUID will be returned if it exists
- * @param[out] service The service's GATT handle which has @a uuid if it exists
- * @return  0 on success, otherwise a negative error value
- * @retval #BT_ERROR_NONE Successful
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NO_DATA  No data available
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- */
-int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid,
-                               bt_gatt_h *service);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Invokes @a callback function on each service that belongs to the specified GATT server
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server's handle
- * @param[in] callback The function to be invoked on each service
- * @param[in] user_data The user data to be passed to @a callback function
- * @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_SUPPORTED  Not supported
- *
- * @see bt_gatt_foreach_cb()
+ * @see bt_gatt_characteristic_create()
+ * @see bt_gatt_descriptor_create()
  */
-int bt_gatt_server_foreach_services(bt_gatt_server_h server,
-               bt_gatt_foreach_cb callback, void *user_data);
+int bt_gatt_destroy(bt_gatt_h gatt_handle);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
index c7538f9353c86c3a358b276e80d0fbbad6a02cac..658981de5996e0edc753301819dc165f3eb4c5d3 100644 (file)
@@ -626,7 +626,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the integer type for GATT handle's value
+ * @brief  Enumerations of the integer type for GATT handle's value.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -640,7 +640,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the float type for GATT handle's value
+ * @brief  Enumerations of the float type for GATT handle's value.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -650,7 +650,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the write type
+ * @brief  Enumerations of the write type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -660,7 +660,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the GATT handle's type
+ * @brief  Enumerations of the GATT handle's type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -671,7 +671,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the service type
+ * @brief  Enumerations of the service type.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -681,7 +681,7 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the characteristic's property
+ * @brief  Enumerations of the characteristic's property.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -695,9 +695,33 @@ typedef enum {
        BT_GATT_PROPERTY_EXTENDED_PROPERTIES = 0x80,  /**< Extended properties */
 } bt_gatt_property_e;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Enumerations of the attribute's permission.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_GATT_PERMISSION_READ = 0x01,  /**< Read permission*/
+       BT_GATT_PERMISSION_WRITE = 0x02,  /**< Write permission */
+       BT_GATT_PERMISSION_ENCRYPTION = 0x04,  /**< Encryption permission */
+       BT_GATT_PERMISSION_AUTHENTICATION = 0x08,  /**< Authentication permission */
+       BT_GATT_PERMISSION_AUTHORIZATION = 0x10,  /**< Authorization permission */
+       BT_GATT_PERMISSION_NONE = 0x20,  /**< None */
+} bt_gatt_permission_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Enumerations of the remote device request types for attributes
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BLUETOOTH_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
+       BLUETOOTH_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
+} bluetooth_gatt_att_request_type_e;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
- * @brief  Enumerations for the types of PAN(Personal Area Networking) service
+ * @brief  Enumerations for the types of PAN(Personal Area Networking) service.
  * @since_tizen 2.3.1
  */
 typedef enum {
@@ -761,28 +785,35 @@ typedef enum {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle to control Bluetooth LE advertising
+ * @brief The handle to control Bluetooth LE advertising.
  * @since_tizen 2.3.1
  */
 typedef void *bt_advertiser_h;
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a service, characteristic or descriptor
+ * @brief The handle of a service, characteristic or descriptor.
  * @since_tizen 2.3.1
  */
 typedef void *bt_gatt_h;
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a GATT client which is associated with a remote device
+ * @brief The handle of a GATT client which is associated with a remote device.
  * @since_tizen 2.3.1
  */
 typedef void *bt_gatt_client_h;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief The handle of a GATT server.
+ * @since_tizen 3.0
+ */
+typedef void *bt_gatt_server_h;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
- * @brief  The handle of calls state
+ * @brief  The handle of calls state.
  * @since_tizen 2.3.1
  */
 typedef void *bt_call_list_h;
@@ -844,7 +875,7 @@ typedef struct {
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief LE service data structure
+ * @brief LE service data structure.
  * @since_tizen 2.3.1
  *
  * @see bt_adapter_le_get_scan_result_service_data()
@@ -1547,7 +1578,7 @@ typedef void (*bt_gatt_client_request_completed_cb) (int result,
  * @brief  Called when a value of a watched characteristic's GATT handle has been changed
  * @since_tizen 2.3.1
  *
- * @remarks After this function is returned, a changed vlaue is automatically
+ * @remarks After this function is returned, a changed value is automatically
  * applied to @a characteristic. Before that, @a characteristic has an old value.
  *
  * @param[in] characteristic The characteristic's GATT handle of which value change is informed. It has an old value.
@@ -1580,6 +1611,108 @@ typedef void (*bt_gatt_client_characteristic_value_changed_cb) (bt_gatt_h charac
  */
 typedef void (*bt_gatt_connection_state_changed_cb)(int result, bool connected, const char *remote_address, void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when a value of a characteristic or descriptor's GATT handle has been changed.
+ * @since_tizen 3.0
+ *
+ * @details For finishing the request, call the function #bt_gatt_server_send_response in callback.
+ *
+ * @remarks After this function is returned, a changed value is automatically
+ * applied to @a gatt_handle. Before that, @a gatt_handle has an old value.
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ * @remarks The @a value must not be freed by application.
+ *
+ * @param[in] remote_address The address of the remote device which requests a change
+ * @param[in] request_id The identification of this request. It will be used to send a response.
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic or descriptor's GATT handle which has an old value
+ * @param[in] offset The requested offset from where the @a gatt_handle value will be updated
+ * @param[in] value The new value
+ * @param[in] len The length of @a value
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_write_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+typedef void (*bt_gatt_server_write_value_requested_cb) (const char *remote_address,
+                               int request_id, bt_gatt_server_h server,
+                               bt_gatt_h gatt_handle, int offset,
+                               const char *value, int len, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the remote device requests to read a value on a GATT server.
+ * @since_tizen 3.0
+ *
+ * @details For finishing the request, call the function #bt_gatt_server_send_response in callback.
+ *
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ *
+ * @param[in] remote_address The address of the requesting remote device
+ * @param[in] request_id The identification of this request. It will be used to send a response.
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic or descriptor's GATT handle to be read
+ * @param[in] offset The requested offset from where the GATT handle's value is read
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_read_value_requested_cb()
+ * @see bt_gatt_server_send_response()
+ */
+typedef void (*bt_gatt_server_read_value_requested_cb) (const char *remote_address,
+               int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle,
+               int offset, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the remote device enables or disables the Notification/Indication for particular characteristics.
+ * @since_tizen 3.0
+ *
+ * @details By using this callback function, server can know notification state.
+ *
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a gatt_handle must not be freed by application.
+ *
+ * @param[in] notify Indicates whether the Notification/Indication is enabled or not
+ * @param[in] server The GATT server handle
+ * @param[in] gatt_handle The characteristic's GATT handle to be read
+ * @param[in] user_data The user data passed from the registration function
+ *
+ * @see bt_gatt_server_set_read_value_requested_cb()
+ */
+typedef void (*bt_gatt_server_characteristic_notification_state_changed_cb) (bool notify,
+                       bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE
+ * @brief  Called when the sending notification / indication is done.
+ * @since_tizen 3.0
+ *
+ * @remarks The @a remote_address must not be freed by application.
+ * @remarks The @a server must not be freed by application.
+ * @remarks The @a characteristic must not be freed by application.
+ *
+ * @remarks In case of an indication, once a confirmation is received from the remote device this callback will be called. \n
+ * This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD). \n
+ * For the last remote device, @a completed will be set as true.
+ *
+ * @param[in] result The result of a sending operation
+ * @param[in] remote_address The address of the remote device
+ * @param[in] server The GATT server handle
+ * @param[in] characteristic The characteristic's GATT handle
+ * @param[in] completed If this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false.
+ * @param[in] user_data The user data passed from the requesting function
+ *
+ * @see bt_gatt_server_notify_characteristic_changed_value()
+ */
+typedef void (*bt_gatt_server_notification_sent_cb) (int result,
+               const char *remote_address, bt_gatt_server_h server,
+               bt_gatt_h characteristic, bool completed, void *user_data);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
  * @brief  Called when the connection state is changed.
index eef15ed1300a6e9d2a45008ca4d8b826d1ed1150..a596b0bb71319d00c3e263429f560bc96cbb7e63 100644 (file)
@@ -295,20 +295,6 @@ typedef void (*bt_hf_speaker_gain_changed_cb) (int gain, void *user_data);
  */
 typedef void (*bt_hf_call_status_updated_event_cb) (GSList *call_info_list, void *user_data);
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Enumerations of the attribute's permission
- * @since_tizen 2.4
- */
-typedef enum {
-       BT_GATT_PERMISSION_READ = 0x01,
-       BT_GATT_PERMISSION_WRITE = 0x02,
-       BT_GATT_PERMISSION_ENCRYPTION = 0x04,
-       BT_GATT_PERMISSION_AUTHENTICATION = 0x08,
-       BT_GATT_PERMISSION_AUTHORIZATION = 0x10,
-       BT_GATT_PERMISSION_NONE = 0x20,
-} bt_gatt_permission_e;
-
 /**
 * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
 * @brief DPM BT allowance state
@@ -365,92 +351,6 @@ typedef enum {
  */
 typedef void *bt_scan_filter_h;
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle of a GATT server
- * @since_tizen 2.4
- */
-typedef void *bt_gatt_server_h;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when a value of a characteristic or descriptor's GATT handle has been changed
- * @since_tizen 2.4
- *
- * @remarks After this function is returned, a changed vlaue is automatically
- * applied to @a gatt_handle. Before that, @a gatt_handle has an old value.
- *
- * @param[in] remote_address The address of the remote device which requests a change
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic or descriptor's GATT handle which has an old value
- * @param[in] request_id The identification of this request. It will be used to send a reponse.
- * @param[in] offset The requested offset from where the @a gatt_handle value will be updated
- * @param[in] value The new value
- * @param[in] len The length of @a value
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_write_value_requested_cb()
- */
-typedef void (*bt_gatt_server_write_value_requested_cb) (char *remote_address,
-                               int request_id, bt_gatt_server_h server,
-                               bt_gatt_h gatt_handle, int offset,
-                               char *value, int len, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the remote device requests to read a value on a GATT server
- * @since_tizen 2.4
- *
- * @param[in] remote_address The address of the requesting remote device
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic or descriptor's GATT handle to be read
- * @param[in] request_id The identification of this request. It will be used to send a reponse.
- * @param[in] offset The requested offset from where the GATT handle's value is read
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_read_value_requested_cb()
- * @see bt_gatt_server_send_response()
- */
-typedef void (*bt_gatt_server_read_value_requested_cb) (char *remote_address,
-               int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle,
-               int offset, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the remote device enables or disables the Notification/Indication for particular characteristics.
- * @since_tizen 2.4
- *
- * @param[in] server The GATT server handle
- * @param[in] gatt_handle The characteristic's GATT handle to be read
- * @param[in] user_data The user data passed from the registration function
- *
- * @see bt_gatt_server_set_read_value_requested_cb()
- */
-typedef void (*bt_gatt_server_notification_state_change_cb) (bool notify,
-                       bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Called when the sending notification / indication is done
- * @since_tizen 2.4
- *
- * @remarks In case of an indication, once a confirmation is received from the remote device this callback will be called. \n
- * This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD). \n
- * For the last remote device, @a completed will be set as true.
- *
- * @param[in] result The result of a sending operation
- * @param[in] remote_address The address of the remote device
- * @param[in] server The GATT server handle
- * @param[in] characteristic The characteristic's GATT handle
- * @param[in] completed If this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false.
- * @param[in] user_data The user data passed from the requesting function
- *
- * @see bt_gatt_server_notify()
- */
-typedef void (*bt_gatt_server_notification_sent_cb) (int result,
-               char *remote_address, bt_gatt_server_h server,
-               bt_gatt_h characteristic, bool completed, void *user_data);
-
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Device LE connection update structure.
@@ -463,7 +363,6 @@ typedef struct {
        unsigned int time_out;   /**< Supervision timeout (msec) */
 } bt_le_conn_update_s;
 
-
 /**
  * Structure to DPM device list
  */
index b1ee0c339427b1eb01c13885a89a5032ef7be636..77453b87358c41e091065686987a4311fe129d0c 100644 (file)
@@ -591,7 +591,7 @@ static bt_gatt_server_write_value_requested_cb __bt_gatt_attribute_get_value_cha
        return NULL;
 }
 
-static bt_gatt_server_notification_state_change_cb __bt_gatt_attribute_get_notification_change_cb(
+static bt_gatt_server_characteristic_notification_state_changed_cb __bt_gatt_attribute_get_notification_change_cb(
                                        bt_gatt_h service, bt_gatt_h attribute, void **user_data)
 {
        gchar *svc_path = (gchar *)service;
@@ -1700,7 +1700,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
        }
        case BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED: {
                bt_gatt_char_notify_change_t *value_change = param->param_data;
-               bt_gatt_server_notification_state_change_cb cb;
+               bt_gatt_server_characteristic_notification_state_changed_cb cb;
                void *user_data = NULL;
                cb = __bt_gatt_attribute_get_notification_change_cb(value_change->service_handle,
                                                value_change->att_handle, &user_data);
index e510ab3b1a744a0148e31cadbfedef1c1db56d70..cfbdf2ae6e37155247f6c952f60ae578f3e2ba8f 100644 (file)
@@ -2135,8 +2135,8 @@ int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
        return BT_ERROR_NONE;
 }
 
-int bt_gatt_server_set_notification_state_change_cb(bt_gatt_h gatt_handle,
-                       bt_gatt_server_notification_state_change_cb callback,
+int bt_gatt_server_set_characteristic_notification_state_change_cb(bt_gatt_h gatt_handle,
+                       bt_gatt_server_characteristic_notification_state_changed_cb callback,
                        void *user_data)
 {
        bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)gatt_handle;
@@ -2291,6 +2291,8 @@ int bt_gatt_server_start(void)
 {
        int ret = BT_ERROR_NONE;
 
+       BT_CHECK_GATT_SUPPORT();
+
        if (!is_gatt_server_started) {
                ret = bluetooth_gatt_register_application();
 
@@ -2306,7 +2308,7 @@ int bt_gatt_server_start(void)
        return ret;
 }
 
-int bt_gatt_server_send_response(int request_id, int request_type,
+int bt_gatt_server_send_response(int request_id, bluetooth_gatt_att_request_type_e request_type,
                int offset, int resp_status, char *value, int value_length)
 {
        int ret = BT_ERROR_NONE;
@@ -2325,7 +2327,7 @@ int bt_gatt_server_send_response(int request_id, int request_type,
        return ret;
 }
 
-int bt_gatt_server_notify(bt_gatt_h characteristic, bool need_confirm,
+int bt_gatt_server_notify_characteristic_changed_value(bt_gatt_h characteristic,
                                bt_gatt_server_notification_sent_cb callback,
                                const char *device_address, void *user_data)
 {
index 363c1281a2c361ed872ed1aae370ef7e3fd9c0ac..79d59f9694c6da73012590e00ce5675bc7795aa9 100644 (file)
@@ -1497,7 +1497,7 @@ static void __bt_adapter_le_scan_result_cb(
 }
 
 void __bt_gatt_server_read_value_requested_cb(
-       char *remote_address, int request_id,
+       const char *remote_address, int request_id,
        bt_gatt_server_h server, bt_gatt_h gatt_handle,
        int offset, void *user_data)
 {
@@ -2341,7 +2341,7 @@ void __bt_HP_client_cp_req_status_changed_cb(bt_gatt_h chr,
 }
 
 void __bt_gatt_server_notification_sent_cb(int result,
-       char *remote_address, bt_gatt_server_h server,
+       const char *remote_address, bt_gatt_server_h server,
        bt_gatt_h characteristic, bool completed, void *user_data)
 {
        TC_PRT("result [%s]", __bt_get_error_message(result));
@@ -2350,10 +2350,10 @@ void __bt_gatt_server_notification_sent_cb(int result,
        TC_PRT("characteristic : %p", characteristic);
 }
 
-void __bt_gatt_server_write_value_requested_cb(char *remote_address,
+void __bt_gatt_server_write_value_requested_cb(const char *remote_address,
                                int request_id, bt_gatt_server_h server,
                                bt_gatt_h gatt_handle, int offset,
-                               char *value, int len, void *user_data)
+                               const char *value, int len, void *user_data)
 {
        int i, resp_status =  BT_ERROR_NONE;
        TC_PRT("remote_address : %s", remote_address);
@@ -5872,7 +5872,7 @@ int test_input_callback(void *data)
 
                        bt_gatt_server_set_read_value_requested_cb(characteristic,
                                __bt_gatt_server_read_value_requested_cb, NULL);
-                       bt_gatt_server_set_notification_state_change_cb(characteristic,
+                       bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic,
                                __bt_gatt_server_notification_state_change_cb, NULL);
                        ret = bt_gatt_service_add_characteristic(service, characteristic);
                        TC_PRT("bt_gatt_service_add_characteristic : %s\n", __bt_get_error_message(ret));
@@ -5904,7 +5904,7 @@ int test_input_callback(void *data)
                        TC_PRT("Value[%d], returns %s\n", char_value[0], __bt_get_error_message(ret));
 
                        /* notify only client remote_addr */
-                       ret = bt_gatt_server_notify(battery_h.chr, true,
+                       ret = bt_gatt_server_notify_characteristic_changed_value(battery_h.chr,
                                __bt_gatt_server_notification_sent_cb,
                                remote_addr, NULL);
                        TC_PRT("bt_gatt_server_notify : %s\n", __bt_get_error_message(ret));
@@ -5942,7 +5942,7 @@ int test_input_callback(void *data)
 
                        bt_gatt_server_set_read_value_requested_cb(characteristic,
                                __bt_gatt_server_read_value_requested_cb, NULL);
-                       bt_gatt_server_set_notification_state_change_cb(characteristic,
+                       bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic,
                                __bt_gatt_server_notification_state_change_cb, NULL);
                        ret = bt_gatt_service_add_characteristic(service, characteristic);
                        TC_PRT("bt_gatt_service_add_characteristic : %s\n", __bt_get_error_message(ret));
@@ -5988,8 +5988,8 @@ int test_input_callback(void *data)
                                char_value, __bt_get_error_message(ret));
 
                        /* Notify all client devices */
-                       ret = bt_gatt_server_notify(heart_rate_h.chr,
-                               true, __bt_gatt_server_notification_sent_cb,
+                       ret = bt_gatt_server_notify_characteristic_changed_value(heart_rate_h.chr,
+                               __bt_gatt_server_notification_sent_cb,
                                NULL, NULL);
                        TC_PRT("bt_gatt_server_notify : %s\n", __bt_get_error_message(ret));
 
@@ -6025,7 +6025,7 @@ int test_input_callback(void *data)
 
                        bt_gatt_server_set_read_value_requested_cb(characteristic,
                                __bt_gatt_server_read_value_requested_cb, NULL);
-                       bt_gatt_server_set_notification_state_change_cb(characteristic,
+                       bt_gatt_server_set_characteristic_notification_state_change_cb(characteristic,
                                __bt_gatt_server_notification_state_change_cb, NULL);
                        ret = bt_gatt_service_add_characteristic(service, characteristic);
                        TC_PRT("bt_gatt_service_add_characteristic : %s\n", __bt_get_error_message(ret));
@@ -6056,7 +6056,7 @@ int test_input_callback(void *data)
                        TC_PRT("bt_gatt_set_value(value : 1.23) : %s\n", __bt_get_error_message(ret));
 
                        /* notify only client remote_addr */
-                       ret = bt_gatt_server_notify(thermometer_h.chr, true,
+                       ret = bt_gatt_server_notify_characteristic_changed_value(thermometer_h.chr,
                                __bt_gatt_server_notification_sent_cb, remote_addr, NULL);
                        TC_PRT("bt_gatt_server_notify : %s\n", __bt_get_error_message(ret));