Publish LE scan filtering APIs to Native public API 65/117365/18
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 6 Mar 2017 01:07:29 +0000 (10:07 +0900)
committerPyun DoHyun <dh79.pyun@samsung.com>
Tue, 4 Apr 2017 07:38:28 +0000 (00:38 -0700)
Change-Id: I2c442c7f3ca3554029f112b952903a0ec2dfb8f5
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
include/bluetooth.h
include/bluetooth_internal.h
include/bluetooth_type.h
include/bluetooth_type_internal.h
src/bluetooth-adapter.c
test/bt_unit_test.c

index deaa0c2f5995d4992262e38a4e95e0150860f7f3..017000601cc8a53609bb7ef3df1fc51dab56c65d 100644 (file)
@@ -1136,6 +1136,48 @@ int bt_adapter_le_get_scan_result_appearance(const bt_adapter_le_device_scan_res
 int bt_adapter_le_get_scan_result_manufacturer_data(const bt_adapter_le_device_scan_result_info_s *info,
                        bt_adapter_le_packet_type_e pkt_type, int *manufacturer_id, char **manufacturer_data, int *manufacturer_data_len);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Gets iBeacon format's data from the scan result information.
+ * @since_tizen 4.0
+ *
+ * @remarks The @a ibeacon_info must be released with bt_adapter_le_free_ibeacon_report().
+ *
+ * @param[in] info The scan result information
+ * @param[in] pkt_type The packet type
+ * @param[out] ibeacon_info The iBeacon format's scan result data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NO_DATA  No data available
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ * @see bt_adapter_le_scan_result_cb()
+ */
+int bt_adapter_le_get_scan_result_ibeacon_report(const bt_adapter_le_device_scan_result_info_s *info,
+                       bt_adapter_le_packet_type_e pkt_type,
+                       bt_adapter_le_ibeacon_scan_result_info_s **ibeacon_info);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Frees iBeacon information.
+ * @since_tizen 4.0
+ *
+ * @param[in] ibeacon_info The iBeacon format's scan result data
+ *
+ * @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_adapter_le_get_scan_result_service_data_list()
+ */
+int bt_adapter_le_free_ibeacon_report(bt_adapter_le_ibeacon_scan_result_info_s *ibeacon_info);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
  * @brief Create advertiser to advertise device's existence or respond to LE scanning request.
@@ -5854,6 +5896,400 @@ int bt_pbap_client_search_phone_book(const char *address,
                                        bt_pbap_list_vcards_cb callback,
                                        void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Creates a scan filter to find only LE advertisements which match specific requirements.
+ * @details If the filter's attribute is not set, then the filter will accept
+ *              all values of that attribute. If an attribute is set, the filter
+ *              will accept only advertisements which match the set attribute.
+ *
+ *              For example, if device name is set with
+ *              bt_adapter_le_scan_filter_set_device_name(), the filter will accept
+ *              only advertisements from devices with the given name. If device name
+ *              is not set, advertisements will be filtered without regard to device
+ *              names.
+ * @since_tizen 4.0
+ *
+ * @remarks The @a scan_filter should be destroyed with bt_adapter_le_scan_filter_destroy().
+ *
+ * @param[out] scan_filter The scan filter handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ * @see bt_adapter_le_scan_filter_destroy()
+ */
+int bt_adapter_le_scan_filter_create(bt_scan_filter_h *scan_filter);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Destroys a scan filter.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ * @see bt_adapter_le_scan_filter_create()
+ */
+int bt_adapter_le_scan_filter_destroy(bt_scan_filter_h scan_filter);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the device address for the advertisements filter.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] address The device address by which advertisements will be filtered
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_device_address(bt_scan_filter_h scan_filter, const char *address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the device name for the advertisements filter.
+ * @details Any previously set value will be overwritten.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] name The device name by which advertisements will be filtered
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_device_name(bt_scan_filter_h scan_filter, const char *name);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the service UUID for the advertisements filter.
+ * @details Any previously set value will be overwritten.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] uuid The service UUID by which advertisements will be filtered
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_service_uuid(bt_scan_filter_h scan_filter, const char *uuid);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the service UUID and the mask for the advertisements filter,
+ *           to use for filtering by partial data.
+ * @details Any previously set value will be overwritten. The mask works as follows:
+ *             For each bit set to 1 in the mask, the corresponding bits in @a uuid
+ *             and in the filtered data will have to be equal. If the mask bit is set to 0,
+ *             the corresponding bits will be ignored.
+ * @since_tizen 4.0
+ *
+ * @remarks The @a mask and the service @a uuid must have equal lengths.
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] uuid The service UUID by which advertisements will be filtered
+ * @param[in] mask The mask to filter advertisements
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_service_uuid_with_mask(bt_scan_filter_h scan_filter,
+                       const char *uuid, const char *mask);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the service solicitation UUID for the advertisements filter.
+ * @details Any previously set value will be overwritten.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] uuid The service solicitation UUID by which advertisements will be filtered
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_service_solicitation_uuid(bt_scan_filter_h scan_filter, const char *uuid);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the service solicitation UUID and the mask for the advertisements filter,
+ *           to use for filtering by partial data.
+ * @details Any previously set value will be overwritten. The mask works as follows:
+ *             For each bit set to 1 in the mask, the corresponding bits in @a uuid
+ *             and in the filtered data will have to be equal. If the mask bit is set to 0,
+ *             the corresponding bits will be ignored.
+ * @since_tizen 4.0
+ *
+ * @remarks The @a mask and the service solicitation @a uuid must have equal lengths.
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] uuid The service solicitation UUID by which advertisements will be filtered
+ * @param[in] mask The mask by which advertisements will be filtered
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_service_solicitation_uuid_with_mask(bt_scan_filter_h scan_filter,
+                       const char *uuid, const char *mask);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the service data for the advertisements filter.
+ * @details Any previously set value will be overwritten.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] uuid The service UUID by which advertisements will be filtered
+ * @param[in] data The service data by which advertisements will be filtered
+ * @param[in] data_len The length of the service data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_service_data(bt_scan_filter_h scan_filter,
+                       const char *uuid, const char *data, unsigned int data_len);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the service data and the mask for the advertisements filter,
+ *           to use for filtering by partial data.
+ * @details Any previously set value will be overwritten. The mask works as follows:
+ *             For each bit set to 1 in the mask, the corresponding bits in @a data
+ *             and in the filtered data will have to be equal. If the mask bit is set to 0,
+ *             the corresponding bits will be ignored.
+ * @since_tizen 4.0
+ *
+ * @remarks The @a mask and the service @a data must have equal lengths.
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] uuid The service UUID by which advertisements will be filtered
+ * @param[in] data The service data by which advertisements will be filtered
+ * @param[in] data_len The length of the service data
+ * @param[in] mask The mask by which advertisements will be filtered
+ * @param[in] mask_len The length of the mask
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_service_data_with_mask(bt_scan_filter_h scan_filter,
+                       const char *uuid,
+                       const char *data,
+                       unsigned int data_len,
+                       const char *mask,
+                       unsigned int mask_len);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the manufacturer data for the advertisements filter.
+ * @details Any previously set value will be overwritten.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] manufacturer_id The manufacturer ID (0x0000 ~ 0xFFFF)
+ * @param[in] data The manufacturer data (byte array)
+ * @param[in] data_len The length of the manufacturer data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_manufacturer_data(bt_scan_filter_h scan_filter,
+                       int manufacturer_id,
+                       const char *data,
+                       unsigned int data_len);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the manufacturer data and the mask for the advertisements filter,
+ *           to use for filtering by partial data.
+ * @details Any previously set value will be overwritten. The mask works as follows:
+ *             For each bit set to 1 in the mask, the corresponding bits in @a data
+ *             and in the filtered data will have to be equal. If the mask bit is set to 0,
+ *             the corresponding bits will be ignored.
+ * @since_tizen 4.0
+ *
+ * @remarks The @a mask and the manufacturer @a data must have equal lengths.
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] manufacturer_id The manufacturer ID (0x0000 ~ 0xFFFF)
+ * @param[in] data The manufacturer data (byte array)
+ * @param[in] data_len The length of the manufacturer data
+ * @param[in] mask The mask by which advertisements will be filtered
+ * @param[in] mask_len The length of the mask
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_manufacturer_data_with_mask(bt_scan_filter_h scan_filter,
+                       int manufacturer_id,
+                       const char *data,
+                       unsigned int data_len,
+                       const char *mask,
+                       unsigned int mask_len);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Sets the scan filter type for the advertisements filter.
+ * @details The filter type is used when searching only for iBeacon or proximity
+ *              type's advertising data. If the type is not set, LE scanner will
+ *              search devices as with regard to other filtered attributes.
+ *              If the type is set, all other attributes set for the filter are ignored.
+ * @since_tizen 4.0
+ *
+ * @param[in] scan_filter The scan filter handle
+ * @param[in] mode The scan filter type
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_set_type(bt_scan_filter_h scan_filter,
+                        bt_adapter_le_scan_filter_type_e mode);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Registers a scan filter to use for scanning.
+ * @details If the filter is registered, it cannot be changed.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @remarks Several scan filters can be registered. If an advertisement passes
+ *                any of the registered scan filters, it will be included in the results.
+ *
+ * @param[in] scan_filter The scan filter handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOW_IN_PROGRESS  Scan is in progress
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_register(bt_scan_filter_h scan_filter);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Unregisters all registered scan filters.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] scan_filter The scan filter handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOW_IN_PROGRESS  Scan is in progress
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_unregister(bt_scan_filter_h scan_filter);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Unregisters all registered scan filters.
+ * @since_tizen 4.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_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_NOW_IN_PROGRESS  Scan is in progress
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ *
+ */
+int bt_adapter_le_scan_filter_unregister_all(void);
+
 /**
  * @}
  */
index d3567d699c23c6670bd4863d717f62686b35a328..c33f09b0218573b000d9522f71f118c775bd107d 100644 (file)
@@ -739,319 +739,6 @@ int bt_adapter_le_clear_white_list(void);
  */
 int bt_adapter_le_enable_privacy(bool enable_privacy);
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Creates scan filter to find only LE advertisement which has specific data.
- * @since_tizen 2.4
- *
- * @param[out] scan_filter The handle of scan filter
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_adapter_le_scan_filter_destroy()
- */
-int bt_adapter_le_scan_filter_create(bt_scan_filter_h *scan_filter);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Destroys scan filter.
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- * @see bt_adapter_le_scan_filter_create()
- */
-int bt_adapter_le_scan_filter_destroy(bt_scan_filter_h scan_filter);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the device address to filter advertisements
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] address The device address to filter advertisements
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_device_address(bt_scan_filter_h scan_filter, const char *address);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the device name to filter advertisements
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] name The device name to filter advertisements
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_device_name(bt_scan_filter_h scan_filter, const char *name);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the service UUID to filter advertisements
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] uuid The service UUID to filter advertisements
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_service_uuid(bt_scan_filter_h scan_filter, const char *uuid);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the service uuid and the mask to filter advertisements by partial data
- * @since_tizen 2.4
- *
- * @remarks the length of mask msut be the same with the length of service uuid.
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] uuid The service UUID to filter advertisements
- * @param[in] mask The mask to filter advertisements
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_service_uuid_with_mask(bt_scan_filter_h scan_filter,
-                       const char *uuid, const char *mask);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the service solicitation UUID to filter advertisements
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] uuid The service solicitation UUID to filter advertisements
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_service_solicitation_uuid(bt_scan_filter_h scan_filter, const char *uuid);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the service solicitation uuid and the mask to filter advertisements by partial data
- * @since_tizen 2.4
- *
- * @remarks the length of mask msut be the same with the length of service solicitation uuid.
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] uuid The service solicitation UUID to filter advertisements
- * @param[in] mask The mask to filter advertisements
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_service_solicitation_uuid_with_mask(bt_scan_filter_h scan_filter,
-                       const char *uuid, const char *mask);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the service data to filter advertisements
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] uuid The service UUID to filter advertisements
- * @param[in] data The service data to filter advertisements
- * @param[in] data_len The length of the service data
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_service_data(bt_scan_filter_h scan_filter,
-                       const char *uuid, const char *data, unsigned int data_len);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the service data and the mask to filter advertisements by partial data
- * @since_tizen 2.4
- *
- * @remarks the length of mask msut be the same with the length of service data.
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] uuid The service UUID to filter advertisements
- * @param[in] data The service data to filter advertisements
- * @param[in] data_len The length of the service data
- * @param[in] mask The mask to filter advertisements
- * @param[in] mask_len The length of the mask to be set.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_service_data_with_mask(bt_scan_filter_h scan_filter,
-                       const char *uuid, const char *data, unsigned int data_len, const char *mask, unsigned int mask_len);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the manufacturer data to filter advertisements
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] manufacturer_id The manufacturer ID (0x0000 ~ 0xFFFF)
- * @param[in] data The manufacturer data (byte array)
- * @param[in] data_len The length of manufacturer data
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_manufacturer_data(bt_scan_filter_h scan_filter,
-                       int manufacturer_id, const char *data, unsigned int data_len);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Adds the manufacturer data and the mask to filter advertisements by partial data
- * @since_tizen 2.4
- *
- * @remarks the length of mask msut be the same with the length of service uuid.
- *
- * @param[in] scan_filter The handle of scan filter
- * @param[in] manufacturer_id The manufacturer ID (0x0000 ~ 0xFFFF)
- * @param[in] data The manufacturer data (byte array)
- * @param[in] data_len The length of manufacturer data
- * @param[in] mask The mask to filter advertisements
- * @param[in] mask_len The length of the mask to be set.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #BT_ERROR_NOT_SUPPORTED     Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_set_manufacturer_data_with_mask(bt_scan_filter_h scan_filter,
-                       int manufacturer_id, const char *data, unsigned int data_len, const char *mask, unsigned int mask_len);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Registers the scan filter to use for scanning
- * @since_tizen 2.4
- *
- * @remarks Several scan filters can be registered. And the specific advertisements, satisfy the one of scan filters, will be found.
- *
- * @param[in] scan_filter The handle of scan filter
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOW_IN_PROGRESS  Scan is in progress
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_register(bt_scan_filter_h scan_filter);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Unregisters the scan filter to be registered
- * @since_tizen 2.4
- *
- * @param[in] scan_filter The handle of scan filter
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOW_IN_PROGRESS  Scan is in progress
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_unregister(bt_scan_filter_h scan_filter);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Unregisters all scan filters to be registered
- * @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_NOW_IN_PROGRESS  Scan is in progress
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- *
- */
-int bt_adapter_le_scan_filter_unregister_all(void);
-
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
  * @brief Set advertising filter policy to use white list
@@ -4101,37 +3788,13 @@ int bt_proximity_reporter_get_linkloss_alert(const char *remote_address, int *va
  */
 int bt_proximity_reporter_get_immediate_alert(const char *remote_address, int *value);
 
-
-/**
- * @internal
- * @brief API to set scan filter for iBeacons reports
- */
-int bt_adapter_le_scan_filter_set_ibeacon(bt_scan_filter_h scan_filter);
-
-/**
- * @internal
- * @brief API to read iBeacon report from LE scan result information
- */
-int bt_adapter_le_get_scan_result_ibeacon_report(const bt_adapter_le_device_scan_result_info_s *info,
-                       bt_adapter_le_packet_type_e pkt_type, bt_adapter_ibeacon_scan_result_info_s **ibeacon_info);
-
-/**
- * @internal
- * @brief API to clear the iBeacon report
- */
-int bt_adapter_le_free_ibeacon_report(bt_adapter_ibeacon_scan_result_info_s *ibeacon_info);
-
-/**
- * @internal
- * @brief API to Set the Proximity uuids scan report
- */
-int bt_adapter_le_scan_filter_set_proximity_uuid(bt_scan_filter_h scan_filter);
-
+/* This internal API will be removed */
 /**
  * @internal
+ * @deprecated Deprecated since 4.0. Use bt_adapter_le_scan_filter_unregister instead.
  * @brief API to Unset the Proximity uuids scan report
  */
-int bt_adapter_le_scan_filter_unset_proximity_uuid(bt_scan_filter_h scan_filter);
+int bt_adapter_le_scan_filter_unset_proximity_uuid(bt_scan_filter_h scan_filter) TIZEN_DEPRECATED_API;
 
 /**
  * @internal
index 11b32ad80d9328b17b9ab174227f2cb76310780d..a89e68df26b0139f05dbf7c6f38a764933e5ab78 100644 (file)
@@ -972,6 +972,22 @@ typedef struct {
        char *scan_data;        /**< scan response data */
 } bt_adapter_le_device_scan_result_info_s;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief The structure for LE iBeacon scan result information.
+ * @since_tizen 4.0
+ *
+ * @see bt_adapter_le_start_scan()
+ */
+typedef struct {
+       int company_id;         /**< Company ID */
+       int ibeacon_type;       /**< iBeacon type */
+       char *uuid;                     /**< UUID */
+       int major_id;           /**< Major ID */
+       int minor_id;           /**< Minor ID */
+       int measured_power;     /**< Measured power */
+} bt_adapter_le_ibeacon_scan_result_info_s;
+
 /**
  * @deprecated Deprecated since 2.3.1
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
@@ -2229,6 +2245,24 @@ typedef void (*bt_pbap_phone_book_received_cb)(int result, const char *remote_ad
 typedef void (*bt_pbap_list_vcards_cb)(int result, const char *remote_address,
                const bt_pbap_vcard_info_s *vcard_info, int count, void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief Enumeration for the scan filter type.
+ * @since_tizen 4.0
+ * @see bt_adapter_le_scan_filter_set_type()
+ */
+typedef enum {
+       BT_ADAPTER_LE_SCAN_FILTER_TYPE_IBEACON, /**< iBeacon filter type */
+       BT_ADAPTER_LE_SCAN_FILTER_TYPE_PROXIMITY_UUID, /**< Proximity UUID filter type */
+} bt_adapter_le_scan_filter_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
+ * @brief The handle of a Bluetooth LE scan filter.
+ * @since_tizen 4.0
+ */
+typedef void *bt_scan_filter_h;
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index da53b9ea0a5f639629cc2128f40d3375c4c762cf..5116e0242df48b71a934ae4baa1193ee7f5a3a68 100644 (file)
@@ -475,13 +475,6 @@ typedef enum {
        BT_DPM_PROFILE_NONE,
 } bt_dpm_profile_e;
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief The handle to control Bluetooth LE scan filter
- * @since_tizen 2.4
- */
-typedef void *bt_scan_filter_h;
-
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Device LE connection update structure.
@@ -870,22 +863,6 @@ typedef void (*bt_hf_remote_call_event_cb) (bt_hf_remote_call_event_e event, cha
  */
 typedef void (*bt_ag_vendor_cmd_cb) (char *command, void *user_data);
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
- * @brief Structure of le iBeacon scan result information.
- * @since_tizen 3.0
- *
- * @see bt_adapter_le_start_scan()
- */
-typedef struct {
-       int company_id;         /**< company ID */
-       int ibeacon_type;       /**< Ibeacon type */
-       char *uuid;                     /**< UUID */
-       int major_id;           /**< Major ID */
-       int minor_id;           /**< Minor ID */
-       int measured_power;     /**< measured Power */
-} bt_adapter_ibeacon_scan_result_info_s;
-
 /**
  * @internal
  * @brief The handle of a Transport Discover Service Provider.
index b8a71c165efeea256b9b4de06d7bd35d0d48d366..04079ebd7efb436af7875d41d02db06acd51442b 100644 (file)
@@ -3262,7 +3262,7 @@ int bt_adapter_le_get_scan_result_manufacturer_data(const bt_adapter_le_device_s
        return BT_ERROR_NO_DATA; /* LCOV_EXCL_STOP */
 }
 
-int bt_adapter_le_free_ibeacon_report(bt_adapter_ibeacon_scan_result_info_s *ibeacon_info)
+int bt_adapter_le_free_ibeacon_report(bt_adapter_le_ibeacon_scan_result_info_s *ibeacon_info)
 {
 
        BT_CHECK_LE_SUPPORT();
@@ -3278,7 +3278,7 @@ int bt_adapter_le_free_ibeacon_report(bt_adapter_ibeacon_scan_result_info_s *ibe
 }
 
 int bt_adapter_le_get_scan_result_ibeacon_report(const bt_adapter_le_device_scan_result_info_s *info,
-                       bt_adapter_le_packet_type_e pkt_type, bt_adapter_ibeacon_scan_result_info_s **ibeacon_info)
+                       bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_ibeacon_scan_result_info_s **ibeacon_info)
 {
        int manufacturer_id;
        char *manufacturer_data;
@@ -3299,7 +3299,7 @@ int bt_adapter_le_get_scan_result_ibeacon_report(const bt_adapter_le_device_scan
        if (manufacturer_id != COMPANY_ID_APPLE)
                return BT_ERROR_NO_DATA;
 
-       *ibeacon_info = g_malloc0(sizeof(bt_adapter_ibeacon_scan_result_info_s));
+       *ibeacon_info = g_malloc0(sizeof(bt_adapter_le_ibeacon_scan_result_info_s));
        if (*ibeacon_info == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
 
@@ -3932,6 +3932,17 @@ int bt_adapter_le_scan_filter_unset_proximity_uuid(bt_scan_filter_h scan_filter)
 }
 /* LCOV_EXCL_STOP */
 
+int bt_adapter_le_scan_filter_set_type(bt_scan_filter_h scan_filter,
+                       bt_adapter_le_scan_filter_type_e mode)
+{
+       if (mode == BT_ADAPTER_LE_SCAN_FILTER_TYPE_IBEACON)
+               return bt_adapter_le_scan_filter_set_ibeacon(scan_filter);
+       else if (mode == BT_ADAPTER_LE_SCAN_FILTER_TYPE_PROXIMITY_UUID)
+               return bt_adapter_le_scan_filter_set_proximity_uuid(scan_filter);
+       else
+               return BT_ERROR_INVALID_PARAMETER;
+}
+
 int bt_adapter_passkey_reply(char *passkey, bool authentication_reply)
 {
        BT_CHECK_INIT_STATUS();
index 93587033c5409d7770839a026457496aed6a4747..a95efa3782f7ef875aed0465f107d516f3848214 100644 (file)
@@ -1589,7 +1589,7 @@ static void __bt_adapter_le_scan_result_cb(
                char *manufacturer_data;
                int manufacturer_data_len;
                int count;
-               bt_adapter_ibeacon_scan_result_info_s *ibeacon_info = NULL;
+               bt_adapter_le_ibeacon_scan_result_info_s *ibeacon_info = NULL;
 
                pkt_type += i;
                if (pkt_type == BT_ADAPTER_LE_PACKET_ADVERTISING
@@ -5606,7 +5606,7 @@ int test_input_callback(void *data)
                        if (ret != BT_ERROR_NONE)
                           TC_PRT("failed with [0x%04x]", ret);
 
-                       ret = bt_adapter_le_scan_filter_set_ibeacon(scan_filter);
+                       ret = bt_adapter_le_scan_filter_set_type(scan_filter, BT_ADAPTER_LE_SCAN_FILTER_TYPE_IBEACON);
                        if (ret != BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
 
@@ -9336,7 +9336,8 @@ int test_input_callback(void *data)
                        ret = bt_adapter_le_scan_filter_create(&pxp_scan_filter);
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
 
-                       ret = bt_adapter_le_scan_filter_set_proximity_uuid(pxp_scan_filter);
+                       ret = bt_adapter_le_scan_filter_set_type(pxp_scan_filter,
+                                       BT_ADAPTER_LE_SCAN_FILTER_TYPE_PROXIMITY_UUID);
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
 
                        ret = bt_adapter_le_scan_filter_register(pxp_scan_filter);