From: DoHyun Pyun Date: Wed, 7 Sep 2016 01:34:43 +0000 (+0900) Subject: Add gatt service changed callback APIs X-Git-Tag: submit/tizen/20160921.010208~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27edb2803529562f56f3d4b8d14f21e88a23b1c9;p=platform%2Fcore%2Fapi%2Fbluetooth.git Add gatt service changed callback APIs Change-Id: I455f1e8015e1a09d57248db1be450344a012a5ca Signed-off-by: DoHyun Pyun --- diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index c774406..87981db 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -262,15 +262,6 @@ int bt_adapter_set_passkey_notification(bt_adapter_passkey_notification_cb callb */ int bt_adapter_unset_passkey_notification(void); -typedef enum { - BT_GATT_CLIENT_SERVICE_ADDED, - BT_GATT_CLIENT_SERVICE_REMOVED, -} bt_gatt_client_service_change_type_e; - -typedef void (*bt_gatt_client_service_changed_cb) (bt_gatt_client_h client, - bt_gatt_client_service_change_type_e change_type, - const char* service_uuid, void *user_data); - /** * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE * @brief Enumerations of the Bluetooth device's LE connection mode. @@ -1028,39 +1019,6 @@ int bt_passkey_reply(char *passkey, bool authentication_reply); */ int bt_passkey_confirmation_reply(bool confirmation_reply); -/** - * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE - * @brief Registers a callback function to be invoked when service is changed from a remote device(GATT server). - * @since_tizen 3.0 - * - * @param[in] client The GATT client's handle - * @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_client_unset_service_changed_cb() - */ -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 - * @brief Unregisters a callback function - * @since_tizen 3.0 - * - * @param[in] client The GATT client'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_client_unset_service_changed_cb() - */ -int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client); - /** * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE * @brief Sends the custom event data. diff --git a/include/mobile/bluetooth.h b/include/mobile/bluetooth.h index a712b3e..2d10b81 100644 --- a/include/mobile/bluetooth.h +++ b/include/mobile/bluetooth.h @@ -4507,6 +4507,39 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid, 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 + * @brief Registers a callback function to be invoked when service is changed from a remote device(GATT server). + * @since_tizen 3.0 + * + * @param[in] client The GATT client's handle + * @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_client_unset_service_changed_cb() + */ +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 + * @brief Unregisters a callback function + * @since_tizen 3.0 + * + * @param[in] client The GATT client'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_client_set_service_changed_cb() + */ +int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Connect to a specific LE based service on a remote bluetooth device address, asynchronously. diff --git a/include/mobile/bluetooth_type.h b/include/mobile/bluetooth_type.h index a167214..6318f98 100644 --- a/include/mobile/bluetooth_type.h +++ b/include/mobile/bluetooth_type.h @@ -696,6 +696,16 @@ typedef enum { BT_GATT_PROPERTY_EXTENDED_PROPERTIES = 0x80, /**< Extended properties */ } bt_gatt_property_e; +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Enumerations of gatt server's service changing mode. + * @since_tizen 3.0 + */ +typedef enum { + BT_GATT_CLIENT_SERVICE_ADDED, /**< Service added */ + BT_GATT_CLIENT_SERVICE_REMOVED, /**< Service removed */ +} bt_gatt_client_service_change_type_e; + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE * @brief Enumerations of the attribute's permission. @@ -1716,6 +1726,22 @@ typedef void (*bt_gatt_client_request_completed_cb) (int result, typedef void (*bt_gatt_client_characteristic_value_changed_cb) (bt_gatt_h characteristic, char *value, int len, void *user_data); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Called when a service of a remote GATT server has been changed. + * @since_tizen 3.0 + * + * @param[in] client The handle of a GATT client which is associated with a remote device. + * @param[in] change_type The changed type + * @param[in] service_uuid The changed service uuid + * @param[in] user_data The user data passed from the registering function + * + * @see bt_gatt_client_set_characteristic_value_changed_cb() + */ +typedef void (*bt_gatt_client_service_changed_cb) (bt_gatt_client_h client, + bt_gatt_client_service_change_type_e change_type, + const char* service_uuid, void *user_data); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Called when the connection state is changed. diff --git a/include/tv/bluetooth.h b/include/tv/bluetooth.h index 31eab35..ef9bce7 100644 --- a/include/tv/bluetooth.h +++ b/include/tv/bluetooth.h @@ -4510,6 +4510,39 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid, 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 + * @brief Registers a callback function to be invoked when service is changed from a remote device(GATT server). + * @since_tizen 3.0 + * + * @param[in] client The GATT client's handle + * @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_client_unset_service_changed_cb() + */ +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 + * @brief Unregisters a callback function + * @since_tizen 3.0 + * + * @param[in] client The GATT client'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_client_set_service_changed_cb() + */ +int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Connect to a specific LE based service on a remote bluetooth device address, asynchronously. diff --git a/include/tv/bluetooth_type.h b/include/tv/bluetooth_type.h index b5b1fde..e498338 100644 --- a/include/tv/bluetooth_type.h +++ b/include/tv/bluetooth_type.h @@ -696,6 +696,16 @@ typedef enum { BT_GATT_PROPERTY_EXTENDED_PROPERTIES = 0x80, /**< Extended properties */ } bt_gatt_property_e; +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Enumerations of gatt server's service changing mode. + * @since_tizen 3.0 + */ +typedef enum { + BT_GATT_CLIENT_SERVICE_ADDED, /**< Service added */ + BT_GATT_CLIENT_SERVICE_REMOVED, /**< Service removed */ +} bt_gatt_client_service_change_type_e; + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE * @brief Enumerations of the attribute's permission. @@ -1716,6 +1726,23 @@ typedef void (*bt_gatt_client_request_completed_cb) (int result, typedef void (*bt_gatt_client_characteristic_value_changed_cb) (bt_gatt_h characteristic, char *value, int len, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Called when a service of a remote GATT server has been changed. + * @since_tizen 3.0 + * + * @param[in] client The handle of a GATT client which is associated with a remote device. + * @param[in] change_type The changed type + * @param[in] service_uuid The changed service uuid + * @param[in] user_data The user data passed from the registering function + * + * @see bt_gatt_client_set_characteristic_value_changed_cb() + */ +typedef void (*bt_gatt_client_service_changed_cb) (bt_gatt_client_h client, + bt_gatt_client_service_change_type_e change_type, + const char* service_uuid, void *user_data); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Called when the connection state is changed. diff --git a/include/wearable/bluetooth.h b/include/wearable/bluetooth.h index c4bd766..2c5efc6 100644 --- a/include/wearable/bluetooth.h +++ b/include/wearable/bluetooth.h @@ -4160,6 +4160,39 @@ int bt_gatt_client_get_service(bt_gatt_client_h client, const char *uuid, 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 + * @brief Registers a callback function to be invoked when service is changed from a remote device(GATT server). + * @since_tizen 3.0 + * + * @param[in] client The GATT client's handle + * @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_client_unset_service_changed_cb() + */ +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 + * @brief Unregisters a callback function + * @since_tizen 3.0 + * + * @param[in] client The GATT client'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_client_set_service_changed_cb() + */ +int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Connect to a specific LE based service on a remote bluetooth device address, asynchronously. diff --git a/include/wearable/bluetooth_type.h b/include/wearable/bluetooth_type.h index 10a6767..37c47e7 100644 --- a/include/wearable/bluetooth_type.h +++ b/include/wearable/bluetooth_type.h @@ -695,6 +695,16 @@ typedef enum { BT_GATT_PROPERTY_EXTENDED_PROPERTIES = 0x80, /**< Extended properties */ } bt_gatt_property_e; +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Enumerations of gatt server's service changing mode. + * @since_tizen 3.0 + */ +typedef enum { + BT_GATT_CLIENT_SERVICE_ADDED, /**< Service added */ + BT_GATT_CLIENT_SERVICE_REMOVED, /**< Service removed */ +} bt_gatt_client_service_change_type_e; + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_SERVER_MODULE * @brief Enumerations of the attribute's permission. @@ -1591,6 +1601,23 @@ typedef void (*bt_gatt_client_request_completed_cb) (int result, typedef void (*bt_gatt_client_characteristic_value_changed_cb) (bt_gatt_h characteristic, char *value, int len, void *user_data); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE + * @brief Called when a service of a remote GATT server has been changed. + * @since_tizen 3.0 + * + * @param[in] client The handle of a GATT client which is associated with a remote device. + * @param[in] change_type The changed type + * @param[in] service_uuid The changed service uuid + * @param[in] user_data The user data passed from the registering function + * + * @see bt_gatt_client_set_characteristic_value_changed_cb() + */ +typedef void (*bt_gatt_client_service_changed_cb) (bt_gatt_client_h client, + bt_gatt_client_service_change_type_e change_type, + const char* service_uuid, void *user_data); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE * @brief Called when the connection state is changed.