From: DoHyun Pyun Date: Thu, 19 Oct 2017 02:35:40 +0000 (+0900) Subject: Add new bluetooth features (OOB, GATT Server / Client) X-Git-Tag: submit/tizen/20171206.015028~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F162510%2F1;p=platform%2Fcore%2Fapi%2Fbluetooth.git Add new bluetooth features (OOB, GATT Server / Client) Total 3 features are added related with OOB, GATT Server, and GATT Client. tizen.org/feature/network.bluetooth.oob tizen.org/feature/network.bluetooth.le.gatt.server tizen.org/feature/network.bluetooth.le.gatt.client Change-Id: Ie1e8ac313158218ac8c34ad2b866a20e25420a1b Signed-off-by: DoHyun Pyun --- diff --git a/doc/bluetooth_doc.h b/doc/bluetooth_doc.h index b5194e4..3ff9fc9 100644 --- a/doc/bluetooth_doc.h +++ b/doc/bluetooth_doc.h @@ -793,7 +793,7 @@ /** * @defgroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE Bluetooth GATT - * @brief Bluetooth GATT(Generic Attribute Profile) API provides functions for discovering, reading and modifying attributes. + * @brief Bluetooth GATT (Generic Attribute Profile) API provides common functions for GATT client and GATT server. * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE * * @section CAPI_NETWORK_BLUETOOTH_GATT_MODULE_HEADER Required Header @@ -803,12 +803,13 @@ * Two roles are defined for devices that implement GATT. * The @a Server is the device that accepts incoming commands and requests from the client and sends responses, indications and notifications to a client. * The @a Client is the device that initiates commands and requests towards the server and can receive responses, indications and notifications sent by the server. - * This API supports the @a Client role in GATT. \n + * This API supports both @a Server role and @a Client role in GATT. \n * Bluetooth stack architecture has been changed. Thus, GATT APIs defined in Tizen 2.3 are deprecated and new GATT client APIs are defined. * * @section CAPI_NETWORK_BLUETOOTH_GATT_MODULE_FEATURE Related Features * This API is related with the following features:\n - * - http://tizen.org/feature/network.bluetooth.le\n + * - http://tizen.org/feature/network.bluetooth.le.gatt.server\n + * - http://tizen.org/feature/network.bluetooth.le.gatt.client\n * * It is recommended to design feature related codes in your application for reliability.\n * @@ -822,10 +823,10 @@ /** * @defgroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE Bluetooth GATT Server - * @brief Bluetooth GATT(Generic Attribute Profile) API provides functions for modifying attributes and registering services, characteristics and descriptors. - * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE + * @brief Bluetooth GATT (Generic Attribute Profile) Server API provides functions for modifying attributes and registering services, characteristics and descriptors. + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * - * @section CAPI_NETWORK_BLUETOOTH_GATT_MODULE_HEADER Required Header + * @section CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE_HEADER Required Header * \#include * * @section CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE_OVERVIEW Overview @@ -834,8 +835,9 @@ * The @a Client is the device that initiates commands and requests towards a server and can receive responses, indications and notifications sent by the server. * * @section CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE_FEATURE Related Features + * This API supports both @a Server role in GATT. \n * This API is related with the following features:\n - * - http://tizen.org/feature/network.bluetooth.le\n + * - http://tizen.org/feature/network.bluetooth.le.gatt.server\n * * It is recommended to create an application with regard to features, to increase reliability.\n * @@ -847,6 +849,34 @@ * */ +/** + * @defgroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE Bluetooth GATT Client + * @brief Bluetooth GATT (Generic Attribute Profile) Client API provides functions for discovering attributes and registering services, characteristics and descriptors of the remote device. + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * + * @section CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE_OVERVIEW Overview + * Two roles are defined for devices that implement GATT. + * The @a Server is the device that accepts incoming commands and requests from a client and sends responses, indications and notifications to the client. + * The @a Client is the device that initiates commands and requests towards a server and can receive responses, indications and notifications sent by the server. + * + * @section CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE_FEATURE Related Features + * This API supports both @a Client role in GATT. \n + * This API is related with the following features:\n + * - http://tizen.org/feature/network.bluetooth.le.gatt.client\n + * + * It is recommended to create your application with regard to features, to increase reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, and control your application's actions accordingly.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on using features in your application can be found from Feature Element. + * + */ + /** * @defgroup CAPI_NETWORK_BLUETOOTH_IPSP_MODULE Bluetooth IPSP * @brief Bluetooth IPSP(Internet Protocol Support Profile) API provides functions for supporting of exchanging IPv6 packets between devices over the BLE transport. @@ -903,4 +933,30 @@ * */ +/** + * @defgroup CAPI_NETWORK_BLUETOOTH_OOB_MODULE Bluetooth OOB + * @brief Bluetooth OOB (Out of Band) API provides functions for exchanging some information used in the pairing process. + * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE + * + * @section CAPI_NETWORK_BLUETOOTH_OOB_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_NETWORK_BLUETOOTH_OOB_MODULE_OVERVIEW Overview + * This set of functions is used for exchanging the hash key and randomizer. + * This API uses an external means of communication, such as near-field communication (NFC) to exchange some information used in the pairing process. + * + * @section CAPI_NETWORK_BLUETOOTH_HDP_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.bluetooth.oob\n + * + * It is recommended to use features in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, and control your application's actions accordingly.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature Element. + * + */ + #endif /* __TIZEN_NETWORK_BLUETOOTH_DOC_H__ */ diff --git a/include/bluetooth.h b/include/bluetooth.h index 27f8548..b97342a 100644 --- a/include/bluetooth.h +++ b/include/bluetooth.h @@ -613,7 +613,7 @@ int bt_adapter_set_device_discovery_state_changed_cb(bt_adapter_device_discovery int bt_adapter_unset_device_discovery_state_changed_cb(void); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_OOB_MODULE * @brief Get the Hash and Randmoizer value, synchronously. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @@ -637,7 +637,7 @@ int bt_adapter_get_local_oob_data(unsigned char **hash, unsigned char **randomiz int *hash_len, int *randomizer_len); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_OOB_MODULE * @brief Sets the Hash and Randmoizer value, synchronously. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @privlevel public @@ -666,7 +666,7 @@ int bt_adapter_set_remote_oob_data(const char *remote_address, int hash_len, int randomizer_len); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_OOB_MODULE * @brief Gets the Hash and Randmoizer value, synchronously. * @since_tizen 3.0 * @privlevel public @@ -700,7 +700,7 @@ int bt_adapter_get_local_oob_ext_data(unsigned char **hash192, unsigned char **r int *hash256_len, int *randomizer256_len); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_OOB_MODULE * @brief Sets the Hash and Randmoizer value, synchronously. * @since_tizen 3.0 * @privlevel public @@ -735,7 +735,7 @@ int bt_adapter_set_remote_oob_ext_data(const char *remote_address, int hash256_len, int randomizer256_len); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_OOB_MODULE * @brief Deletes the Hash and Randomizer value, synchronously. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @privlevel public @@ -4594,7 +4594,7 @@ int bt_gatt_get_uuid(bt_gatt_h gatt_handle, char **uuid); int bt_gatt_get_type(bt_gatt_h gatt_handle, bt_gatt_type_e *gatt_type); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Gets the GATT client handle which the specified service belongs to. * @since_tizen 2.3.1 * @@ -4816,7 +4816,7 @@ int bt_gatt_characteristic_foreach_descriptors(bt_gatt_h characteristic, int bt_gatt_descriptor_get_characteristic(bt_gatt_h descriptor, bt_gatt_h *characteristic); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Creates the GATT client handle. * @since_tizen 2.3.1 * @@ -4836,7 +4836,7 @@ int bt_gatt_descriptor_get_characteristic(bt_gatt_h descriptor, bt_gatt_h *chara int bt_gatt_client_create(const char *remote_address, bt_gatt_client_h *client); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Destroys the GATT client's handle. * @since_tizen 2.3.1 * @@ -4853,7 +4853,7 @@ int bt_gatt_client_create(const char *remote_address, bt_gatt_client_h *client); int bt_gatt_client_destroy(bt_gatt_client_h client); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Gets the address of remote device. * @since_tizen 2.3.1 * @@ -4870,7 +4870,7 @@ int bt_gatt_client_get_remote_address(bt_gatt_client_h client, char **remote_address); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Reads the value of a characteristic or descriptor from the remote device asynchronously. * @since_tizen 2.3.1 * @privlevel public @@ -4896,7 +4896,7 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, bt_gatt_client_request_completed_cb callback, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Writes the value of a characteristic or descriptor to the remote device asynchronously. * @since_tizen 2.3.1 * @privlevel public @@ -4926,7 +4926,7 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, bt_gatt_client_request_completed_cb callback, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Requests a change of the ATT MTU value. * @since_tizen 4.0 * @privlevel public @@ -4948,7 +4948,7 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, int bt_gatt_client_request_att_mtu_change(bt_gatt_client_h client, unsigned int mtu); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Gets the ATT MTU value set for a connection. * @since_tizen 4.0 * @@ -4967,7 +4967,7 @@ int bt_gatt_client_request_att_mtu_change(bt_gatt_client_h client, unsigned int int bt_gatt_client_get_att_mtu(bt_gatt_client_h client, unsigned int *mtu); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Registers a callback function to be invoked when the ATT MTU is changed. * @since_tizen 4.0 * @param[in] client The created GATT client's handle @@ -4988,7 +4988,7 @@ int bt_gatt_client_get_att_mtu(bt_gatt_client_h client, unsigned int *mtu); int bt_gatt_client_set_att_mtu_changed_cb(bt_gatt_client_h client, bt_gatt_client_att_mtu_changed_cb callback, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Unregisters the callback function to be invoked when the ATT MTU is changed. * @since_tizen 4.0 * @param[in] client The created GATT client's handle @@ -5005,7 +5005,7 @@ int bt_gatt_client_set_att_mtu_changed_cb(bt_gatt_client_h client, bt_gatt_clien int bt_gatt_client_unset_att_mtu_changed_cb(bt_gatt_client_h client); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Registers a callback function to be invoked when the characteristic value is changed on the remote device. * @since_tizen 2.3.1 * @@ -5026,7 +5026,7 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Unregisters a callback function to be invoked when the characteristic value is changed on the remote device. * @since_tizen 2.3.1 * @@ -5042,7 +5042,7 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic, int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristic); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Gets a service's GATT handle which has specific UUID. * @since_tizen 2.3.1 * @@ -5063,7 +5063,7 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid, bt_gatt_h *service); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Invokes @a callback function on each service that belongs to the specified GATT client. * @since_tizen 2.3.1 * @@ -5081,7 +5081,7 @@ int bt_gatt_client_foreach_services(bt_gatt_client_h client, bt_gatt_foreach_cb callback, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Registers a callback function to be invoked when service is changed from a remote device(GATT server). * @since_tizen 3.0 * @@ -5099,7 +5099,7 @@ int bt_gatt_client_set_service_changed_cb(bt_gatt_client_h client, bt_gatt_client_service_changed_cb callback, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Unregisters a callback function * @since_tizen 3.0 * @@ -5114,7 +5114,7 @@ int bt_gatt_client_set_service_changed_cb(bt_gatt_client_h client, int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Connect to a specific LE based service on a remote bluetooth device address, asynchronously. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @privlevel public @@ -5147,7 +5147,7 @@ int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client); int bt_gatt_connect(const char *address, bool auto_connect); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Disconnect to LE connection with the given remote Bluetooth device address, asynchronously. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @privlevel public @@ -5176,7 +5176,7 @@ int bt_gatt_connect(const char *address, bool auto_connect); int bt_gatt_disconnect(const char *address); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Registers a callback function that will be invoked when the connection state is changed. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @@ -5195,7 +5195,7 @@ int bt_gatt_disconnect(const char *address); int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb callback, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Unregisters a callback function that will be invoked when the connection state is changed. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @@ -5255,7 +5255,7 @@ int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle); int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Gets the permissions which a characteristic's GATT handle has. * @since_tizen 3.0 * @@ -5274,7 +5274,7 @@ int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle); int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Gets the permissions which a descriptor's GATT handle has. * @since_tizen 3.0 * @@ -5369,7 +5369,7 @@ int bt_gatt_service_add_included_service(bt_gatt_h service, int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Creates the GATT characteristic. * @since_tizen 3.0 * @@ -5414,7 +5414,7 @@ int bt_gatt_characteristic_add_descriptor(bt_gatt_h characteristic, bt_gatt_h descriptor); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Creates the GATT characteristic descriptor. * @since_tizen 3.0 * diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 3290c4c..39b02c7 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -537,6 +537,9 @@ typedef void (*bt_adapter_passkey_notification_cb)(const char *remote_address, c #define BT_FEATURE_MAP "tizen.org/feature/network.bluetooth.map" #define BT_FEATURE_TETHERING "tizen.org/feature/network.tethering.bluetooth" #define BT_FEATURE_PBAP_CLIENT "tizen.org/feature/network.bluetooth.phonebook.client" +#define BT_FEATURE_OOB "tizen.org/feature/network.bluetooth.oob" +#define BT_FEATURE_GATT_SERVER "tizen.org/feature/network.bluetooth.le.gatt.server" +#define BT_FEATURE_GATT_CLIENT "tizen.org/feature/network.bluetooth.le.gatt.client" #define BT_CHECK_SUPPORTED_FEATURE(feature_name) \ do { \ diff --git a/include/bluetooth_type.h b/include/bluetooth_type.h index 8f298f1..d69849f 100644 --- a/include/bluetooth_type.h +++ b/include/bluetooth_type.h @@ -759,7 +759,7 @@ typedef enum { } bt_gatt_property_e; /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Enumerations of gatt server's service changing mode. * @since_tizen 3.0 */ @@ -769,7 +769,7 @@ typedef enum { } bt_gatt_client_service_change_type_e; /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Enumerations of the attribute's permission. * @since_tizen 3.0 */ @@ -884,7 +884,7 @@ typedef void *bt_gatt_attribute_h; typedef void *bt_gatt_h; /** - * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief The handle of a GATT client which is associated with a remote device. * @since_tizen 2.3.1 */ @@ -1860,7 +1860,7 @@ typedef bool (*bt_gatt_foreach_cb) (int total, int index, bt_gatt_h gatt_handle, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Attribute protocol MTU change information structure. * @since_tizen 4.0 * @@ -1873,7 +1873,7 @@ typedef struct { } bt_gatt_client_att_mtu_info_s; /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Called when the ATT MTU value is changed. * @since_tizen 4.0 * @@ -1892,7 +1892,7 @@ typedef void (*bt_gatt_client_att_mtu_changed_cb)(bt_gatt_client_h client, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Called when the client request(e.g. read / write) has been completed * @since_tizen 2.3.1 * @@ -1907,7 +1907,7 @@ typedef void (*bt_gatt_client_request_completed_cb) (int result, bt_gatt_h request_handle, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Called when a value of a watched characteristic's GATT handle has been changed * @since_tizen 2.3.1 * @@ -1925,7 +1925,7 @@ typedef void (*bt_gatt_client_characteristic_value_changed_cb) (bt_gatt_h charac char *value, int len, void *user_data); /** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_CLIENT_MODULE * @brief Called when a service of a remote GATT server has been changed. * @since_tizen 3.0 * diff --git a/src/bluetooth-adapter.c b/src/bluetooth-adapter.c index 002a089..aadf776 100644 --- a/src/bluetooth-adapter.c +++ b/src/bluetooth-adapter.c @@ -1058,7 +1058,7 @@ int bt_adapter_get_local_oob_data(unsigned char **hash, { int ret = BT_ERROR_NONE; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OOB); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(hash); BT_CHECK_INPUT_PARAMETER(randomizer); @@ -1090,7 +1090,7 @@ int bt_adapter_set_remote_oob_data(const char *remote_address, bt_oob_data_t oob_data = { {0},}; int len; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OOB); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); /* LCOV_EXCL_START */ @@ -1127,7 +1127,7 @@ int bt_adapter_get_local_oob_ext_data(unsigned char **hash192, unsigned char **r { int ret = BT_ERROR_NONE; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OOB); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(hash192); BT_CHECK_INPUT_PARAMETER(randomizer192); @@ -1183,7 +1183,7 @@ int bt_adapter_set_remote_oob_ext_data(const char *remote_address, bt_oob_data_t oob_data = { {0},}; int len; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OOB); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); @@ -1236,7 +1236,7 @@ int bt_adapter_le_set_remote_oob_ext_data(const char *remote_address, bluetooth_bdaddr_type_e addr_type = BLUETOOTH_BDADDR_LE_PUBLIC; int len; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OOB); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); @@ -1274,7 +1274,7 @@ int bt_adapter_remove_remote_oob_data(const char *remote_address) int ret = BT_ERROR_NONE; bluetooth_device_address_t addr_hex = { {0,} }; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OOB); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index b39ea42..4a0a7a1 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -46,8 +46,20 @@ static void __bt_gatt_free_service(bt_gatt_h gatt_handle); #define BT_CHECK_GATT_SUPPORT() \ { \ - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); \ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE); \ + BT_CHECK_SUPPORTED_FEATURES(BT_FEATURE_GATT_SERVER, BT_FEATURE_GATT_CLIENT); \ +} + +#define BT_CHECK_GATT_SERVER_SUPPORT() \ +{ \ + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE); \ + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_GATT_SERVER); \ +} + +#define BT_CHECK_GATT_CLIENT_SUPPORT() \ +{ \ + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE); \ + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_GATT_CLIENT); \ } #define BT_CHECK_GATT_SERVER_INIT_STATUS() { \ @@ -825,7 +837,7 @@ int bt_gatt_connect(const char *address, bool auto_connect) int ret; bluetooth_device_address_t bd_addr = { {0,} }; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(address); _bt_convert_address_to_hex(&bd_addr, address); @@ -844,7 +856,7 @@ int bt_gatt_disconnect(const char *address) int ret; bluetooth_device_address_t bd_addr = { {0,} }; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(address); _bt_convert_address_to_hex(&bd_addr, address); @@ -860,7 +872,7 @@ int bt_gatt_disconnect(const char *address) int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb callback, void *user_data) { - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(callback); _bt_set_cb(BT_EVENT_GATT_CONNECTION_STATUS, callback, user_data); @@ -870,7 +882,7 @@ int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb int bt_gatt_unset_connection_state_changed_cb(void) { - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); _bt_unset_cb(BT_EVENT_GATT_CONNECTION_STATUS); return BT_ERROR_NONE; @@ -1175,7 +1187,7 @@ int bt_gatt_characteristic_destroy(bt_gatt_h gatt_handle) { bt_gatt_common_s *handle = (bt_gatt_common_s *)gatt_handle; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); @@ -1193,7 +1205,7 @@ int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle) { bt_gatt_common_s *handle = (bt_gatt_common_s *)gatt_handle; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); @@ -1867,7 +1879,7 @@ int bt_gatt_service_get_server(bt_gatt_h service, bt_gatt_server_h *server) { bt_gatt_service_s *svc = (bt_gatt_service_s *)service; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(service); @@ -1892,7 +1904,7 @@ int bt_gatt_service_get_client(bt_gatt_h service, bt_gatt_client_h *client) { bt_gatt_service_s *svc = (bt_gatt_service_s *)service; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(service); @@ -2500,7 +2512,7 @@ int bt_gatt_server_create(bt_gatt_server_h *server) { bt_gatt_server_s *serv = NULL; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(server); @@ -2524,7 +2536,7 @@ int bt_gatt_server_destroy(bt_gatt_server_h server) { bt_gatt_server_s *serv = (bt_gatt_server_s *)server; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(server); @@ -2543,7 +2555,7 @@ int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle, bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)gatt_handle; bt_gatt_descriptor_s *desc = (bt_gatt_descriptor_s*)gatt_handle; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); @@ -2571,7 +2583,7 @@ int bt_gatt_server_set_characteristic_notification_state_change_cb(bt_gatt_h gat { bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)gatt_handle; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); @@ -2592,7 +2604,7 @@ int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service) bt_gatt_service_s *svc = (bt_gatt_service_s *)service; GSList *char_l; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(server); @@ -2684,7 +2696,7 @@ int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service) bt_gatt_service_s *svc = (bt_gatt_service_s *)service; GSList *char_l; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(server); @@ -2772,7 +2784,7 @@ int bt_gatt_server_unregister_service(bt_gatt_server_h server, bt_gatt_server_s *serv = (bt_gatt_server_s *)server; bt_gatt_service_s *svc = (bt_gatt_service_s *)service; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(server); @@ -2794,7 +2806,7 @@ int bt_gatt_server_unregister_all_services(bt_gatt_server_h server) bt_gatt_server_s *serv = (bt_gatt_server_s*)server; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(server); @@ -2816,7 +2828,7 @@ int bt_gatt_server_start(void) { int ret = BT_ERROR_NONE; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); @@ -2865,7 +2877,7 @@ int bt_gatt_server_send_response(int request_id, bt_gatt_att_request_type_e requ int offset, int resp_status, char *value, int value_length) { int ret = BT_ERROR_NONE; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); if (request_type == BT_GATT_REQUEST_TYPE_READ && @@ -2919,7 +2931,7 @@ int bt_gatt_server_notify_characteristic_changed_value(bt_gatt_h characteristic, bluetooth_device_address_t addr_hex = { {0,} }; int ret = BT_ERROR_NONE; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(characteristic); @@ -3026,7 +3038,7 @@ int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle, bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)gatt_handle; bt_gatt_descriptor_s *desc = (bt_gatt_descriptor_s*)gatt_handle; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); @@ -3053,7 +3065,7 @@ int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid, bt_gatt_h gatt_handle = NULL; int ret; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); @@ -3080,7 +3092,7 @@ int bt_gatt_server_foreach_services(bt_gatt_server_h server, int total = 0; int index = 1; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_SERVER_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_GATT_SERVER_INIT_STATUS(); @@ -3104,7 +3116,7 @@ int bt_gatt_client_create(const char *remote_address, bt_gatt_client_h *client) bool connected = false; GSList *l; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); /* LCOV_EXCL_START */ @@ -3161,7 +3173,7 @@ int bt_gatt_client_destroy(bt_gatt_client_h client) { bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); /* LCOV_EXCL_START */ @@ -3185,7 +3197,7 @@ int bt_gatt_client_get_remote_address(bt_gatt_client_h client, { bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); /* LCOV_EXCL_START */ BT_CHECK_INPUT_PARAMETER(remote_address); @@ -3306,7 +3318,7 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, int ret = BT_ERROR_NONE; bt_gatt_common_s *c = (bt_gatt_common_s *)gatt_handle; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); BT_CHECK_INPUT_PARAMETER(callback); /* LCOV_EXCL_START */ @@ -3358,7 +3370,7 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, bt_gatt_property_e write_prop = BT_GATT_PROPERTY_WRITE; int ret = BT_ERROR_NONE; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); /* LCOV_EXCL_START */ @@ -3500,7 +3512,7 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic, char *name = NULL; bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)characteristic; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(characteristic); BT_CHECK_INPUT_PARAMETER(callback); @@ -3535,7 +3547,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi int ret; bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)characteristic; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(characteristic); /* LCOV_EXCL_START */ @@ -3565,7 +3577,7 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid, bt_gatt_h gatt_handle = NULL; int ret; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); BT_CHECK_INPUT_PARAMETER(uuid); @@ -3590,7 +3602,7 @@ int bt_gatt_client_foreach_services(bt_gatt_client_h client, int total = 0; int index = 1; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); BT_CHECK_INPUT_PARAMETER(callback); /* LCOV_EXCL_LINE */ @@ -3613,7 +3625,7 @@ int bt_gatt_client_set_service_changed_cb(bt_gatt_client_h client, bluetooth_device_address_t bd_addr = { {0,} }; bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); BT_CHECK_INPUT_PARAMETER(callback); @@ -3645,7 +3657,7 @@ int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client) bluetooth_device_address_t bd_addr = { {0,} }; bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_GATT_SUPPORT(); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); @@ -3668,7 +3680,7 @@ int bt_gatt_client_request_att_mtu_change(bt_gatt_client_h client, unsigned int bluetooth_device_address_t addr_hex = { {0,} }; bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); @@ -3688,7 +3700,7 @@ int bt_gatt_client_get_att_mtu(bt_gatt_client_h client, unsigned int *mtu) unsigned int mtu_value = 0; bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client); @@ -3711,7 +3723,7 @@ int bt_gatt_client_set_att_mtu_changed_cb(bt_gatt_client_h client, bt_gatt_clien { bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(callback); BT_CHECK_INPUT_PARAMETER(client); @@ -3734,7 +3746,7 @@ int bt_gatt_client_unset_att_mtu_changed_cb(bt_gatt_client_h client) { bt_gatt_client_s *client_s = (bt_gatt_client_s *)client; - BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); + BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(client);