1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_BLUETOOTH_BLUETOOTH_LE_SCAN_H_
6 #define THIRD_PARTY_BLINK_RENDERER_MODULES_BLUETOOTH_BLUETOOTH_LE_SCAN_H_
7 
8 #include "mojo/public/cpp/bindings/receiver_set.h"
9 #include "third_party/blink/renderer/bindings/modules/v8/v8_bluetooth_le_scan_filter_init.h"
10 #include "third_party/blink/renderer/modules/bluetooth/bluetooth.h"
11 #include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
12 #include "third_party/blink/renderer/platform/wtf/vector.h"
13 
14 namespace blink {
15 
16 class BluetoothLEScan final : public ScriptWrappable {
17   DEFINE_WRAPPERTYPEINFO();
18 
19  public:
20   BluetoothLEScan(mojo::ReceiverId,
21                   Bluetooth*,
22                   mojom::blink::WebBluetoothRequestLEScanOptionsPtr);
23 
24   // IDL exposed interface:
25   const HeapVector<Member<BluetoothLEScanFilterInit>>& filters() const;
26   bool keepRepeatedDevices() const;
27   bool acceptAllAdvertisements() const;
28   bool active() const;
29   bool stop();
30 
31   // Interface required by garbage collection.
32   void Trace(Visitor*) override;
33 
34  private:
35   mojo::ReceiverId id_;
36   HeapVector<Member<BluetoothLEScanFilterInit>> filters_;
37   Member<Bluetooth> bluetooth_;
38   const bool keep_repeated_devices_;
39   const bool accept_all_advertisements_;
40 };
41 
42 }  // namespace blink
43 
44 #endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_BLUETOOTH_BLUETOOTH_LE_SCAN_H_
45