OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 IOS_CHROME_COMMON_PHYSICAL_WEB_PHYSICAL_WEB_SCANNER_H_ |
| 6 #define IOS_CHROME_COMMON_PHYSICAL_WEB_PHYSICAL_WEB_SCANNER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 @class PhysicalWebDevice; |
| 11 |
| 12 @protocol PhysicalWebScannerDelegate; |
| 13 |
| 14 // This class will scan for physical web devices. |
| 15 |
| 16 @interface PhysicalWebScanner : NSObject |
| 17 |
| 18 // When networkRequest is NO, no network request will be sent. |
| 19 @property(nonatomic, assign) BOOL networkRequestEnabled; |
| 20 |
| 21 // When networkRequest is NO, it returns the number of discovered beacons. |
| 22 @property(nonatomic, readonly) int unresolvedBeaconsCount; |
| 23 |
| 24 // Whether bluetooth is enabled. Must not be read before the first call of |
| 25 // scannerBluetoothStatusUpdated. |
| 26 @property(nonatomic, readonly) BOOL bluetoothEnabled; |
| 27 |
| 28 // Initializes a physical web device scanner. |
| 29 - (instancetype)initWithDelegate:(id<PhysicalWebScannerDelegate>)delegate |
| 30 NS_DESIGNATED_INITIALIZER; |
| 31 |
| 32 - (instancetype)init NS_UNAVAILABLE; |
| 33 |
| 34 // Start scanning and clear the list of discovered devices. The scanning might |
| 35 // not start effectively immediately. |
| 36 // It can happen when the bluetooth is turned off. In this case, scanning will |
| 37 // start as soon as the bluetooth is turned on. |
| 38 - (void)start; |
| 39 |
| 40 // Stop scanning. |
| 41 - (void)stop; |
| 42 |
| 43 // Returns a list of physical web devices (PhysicalWebDevice). |
| 44 - (NSArray*)devices; |
| 45 |
| 46 @end |
| 47 |
| 48 @protocol PhysicalWebScannerDelegate<NSObject> |
| 49 |
| 50 // This delegate method is called when the list of discovered devices is updated |
| 51 // by the scanner. |
| 52 - (void)scannerUpdatedDevices:(PhysicalWebScanner*)scanner; |
| 53 |
| 54 // This delegate method is called when the bluetooth status is updated. |
| 55 - (void)scannerBluetoothStatusUpdated:(PhysicalWebScanner*)scanner; |
| 56 |
| 57 @end |
| 58 |
| 59 #endif // IOS_CHROME_COMMON_PHYSICAL_WEB_PHYSICAL_WEB_SCANNER_H_ |
OLD | NEW |