API addition for getting Gatt permission of characteristic or descriptor 88/70688/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Fri, 20 May 2016 06:31:04 +0000 (15:31 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Fri, 20 May 2016 06:31:04 +0000 (15:31 +0900)
Change-Id: Ifeae8ebeb213693394a1cc3a22251e03c8663516
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
include/mobile/bluetooth_internal.h
include/tv/bluetooth_internal.h
include/wearable/bluetooth_internal.h
src/bluetooth-gatt.c

index 01d4881..9d926a9 100644 (file)
@@ -1815,21 +1815,37 @@ int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a characteristic or descriptor's GATT handle has
+ * @brief  Gets the permissions which a characteristic's GATT handle has
  * @since_tizen 2.4
  *
- * @param[in] gatt_handle The handle of a characteristic or descriptor
- * @param[out] permissions The permissions which a characteristic or descriptor's GATT handle has.
+ * @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_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
index 3666d28..b7c37a9 100644 (file)
@@ -1815,21 +1815,37 @@ int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a characteristic or descriptor's GATT handle has
+ * @brief  Gets the permissions which a characteristic's GATT handle has
  * @since_tizen 2.4
  *
- * @param[in] gatt_handle The handle of a characteristic or descriptor
- * @param[out] permissions The permissions which a characteristic or descriptor's GATT handle has.
+ * @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_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
index 32018d9..4aef17a 100644 (file)
@@ -2460,21 +2460,37 @@ int bt_gatt_descriptor_destroy(bt_gatt_h gatt_handle);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
- * @brief  Gets the permissions which a characteristic or descriptor's GATT handle has
+ * @brief  Gets the permissions which a characteristic's GATT handle has
  * @since_tizen 2.4
  *
- * @param[in] gatt_handle The handle of a characteristic or descriptor
- * @param[out] permissions The permissions which a characteristic or descriptor's GATT handle has.
+ * @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_get_permissions(bt_gatt_h gatt_handle, int *permissions);
+int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
index db2fe70..fb6003a 100644 (file)
@@ -1367,11 +1367,10 @@ int bt_gatt_set_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
        return BT_ERROR_NONE; /* LCOV_EXCL_STOP */
 }
 /* LCOV_EXCL_START */
-int bt_gatt_get_permissions(bt_gatt_h gatt_handle, int *permissions)
+int bt_gatt_characteristic_get_permissions(bt_gatt_h gatt_handle, int *permissions)
 {
        bt_gatt_common_s *handle = (bt_gatt_common_s *)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_INIT_STATUS();
@@ -1381,7 +1380,26 @@ int bt_gatt_get_permissions(bt_gatt_h gatt_handle, int *permissions)
 
        if (handle->type == BT_GATT_TYPE_CHARACTERISTIC)
                *permissions = chr->permissions;
-       else if (handle->type == BT_GATT_TYPE_DESCRIPTOR)
+       else {
+               BT_ERR("Type is invalid(type:%d)", handle->type);
+               return BT_ERROR_INVALID_PARAMETER;
+       }
+
+       return BT_ERROR_NONE;
+}
+
+int bt_gatt_descriptor_get_permissions(bt_gatt_h gatt_handle, int *permissions)
+{
+       bt_gatt_common_s *handle = (bt_gatt_common_s *)gatt_handle;
+       bt_gatt_descriptor_s *desc = (bt_gatt_descriptor_s *)gatt_handle;
+
+       BT_CHECK_GATT_SUPPORT();
+       BT_CHECK_INIT_STATUS();
+
+       BT_CHECK_INPUT_PARAMETER(gatt_handle);
+       BT_CHECK_INPUT_PARAMETER(permissions);
+
+       if (handle->type == BT_GATT_TYPE_DESCRIPTOR)
                *permissions = desc->permissions;
        else {
                BT_ERR("Type is invalid(type:%d)", handle->type);