@@ -239,11 +239,36 @@ public BluetoothDevice find(String name, String address) {
239239 */
240240 public native String getModalias ();
241241
242+ /** This method sets the device discovery filter for the caller. When this method is called
243+ * with no filter parameter, filter is removed.
244+ * <p>
245+ * When a remote device is found that advertises any UUID from UUIDs, it will be reported if:
246+ * <ul><li>Pathloss and RSSI are both empty.</li>
247+ * <li>only Pathloss param is set, device advertise TX pwer, and computed pathloss is less than Pathloss param.</li>
248+ * <li>only RSSI param is set, and received RSSI is higher than RSSI param.</li>
249+ * </ul>
250+ * <p>
251+ * If one or more discovery filters have been set, the RSSI delta-threshold,
252+ * that is imposed by StartDiscovery by default, will not be applied.
253+ * <p>
254+ * If "auto" transport is requested, scan will use LE, BREDR, or both, depending on what's
255+ * currently enabled on the controller.
256+ *
257+ * @param uuids a list of device UUIDs
258+ * @param rssi a rssi value
259+ * @param pathloss a pathloss value
260+ */
261+ public void setDiscoveryFilter (List <Integer > uuids , int rssi , int pathloss , TransportType transportType ) {
262+ setDiscoveryFilter (uuids , rssi , pathloss , transportType .ordinal ());
263+ }
264+
242265 /** This method sets RSSI device discovery filter for the caller. When this method is called
243266 * with 0, filter is removed.
244267 * @param rssi a rssi value
245268 */
246- public native void setRssiDiscoveryFilter (int rssi );
269+ public void setRssiDiscoveryFilter (int rssi ) {
270+ setDiscoveryFilter (Collections .EMPTY_LIST , rssi , 0 , TransportType .AUTO );
271+ }
247272
248273 /** Returns the interface name of the adapter.
249274 * @return The interface name of the adapter.
@@ -255,6 +280,8 @@ public String getInterfaceName() {
255280
256281 private native void delete ();
257282
283+ private native void setDiscoveryFilter (List <Integer > uuids , int rssi , int pathloss , int transportType );
284+
258285 private BluetoothAdapter (long instance )
259286 {
260287 super (instance );
0 commit comments