GCKDeviceScanner Class

GCKDeviceScanner Class Reference

Overview

A class that (asynchronously) scans for available devices and sends corresponding notifications to its listener(s).

This class is implicitly a singleton; since it does a network scan, it isn't useful to have more than one instance of it in use. All methods and properties of this class may only be accessed from the main thread.

Inherits NSObject.

Instance Method Summary

("Use initWithFilterCriteria,
do not use without a criteria") 
- GCK_DEPRECATED
 Constructs a new GCKDeviceScanner. More...
 
(instancetype) - initWithFilterCriteria:
 Designated initializer. More...
 
(void) - startScan
 Starts a new device scan. More...
 
(void) - stopScan
 Stops any in-progress device scan. More...
 
(void) - addListener:
 Adds a listener for receiving notifications. More...
 
(void) - removeListener:
 Removes a listener that was previously added with addListener:. More...
 

Properties

NSArray * devices
 The array of discovered devices. More...
 
BOOL hasDiscoveredDevices
 Whether the current/latest scan has discovered any devices. More...
 
BOOL scanning
 Whether a scan is currently in progress. More...
 
GCKFilterCriteriafilterCriteria
 The current filtering criteria. More...
 
BOOL passiveScan
 Whether the scan should be a passive scan. More...
 

Method Detail

- ("Use initWithFilterCriteria, do not use without a criteria") GCK_DEPRECATED

Constructs a new GCKDeviceScanner.

- (instancetype) initWithFilterCriteria: (GCKFilterCriteria *)  filterCriteria

Designated initializer.

Constructs a new GCKDeviceScanner with the given filter criteria.

Parameters
filterCriteriaThe filter criteria. May not be nil.
- (void) startScan

Starts a new device scan.

The scan must eventually be stopped by calling stopScan.

- (void) stopScan

Stops any in-progress device scan.

This method must be called at some point after startScan was called and before this object is released by its owner.

- (void) addListener: (id< GCKDeviceScannerListener >)  listener

Adds a listener for receiving notifications.

Parameters
listenerThe listener to add.
- (void) removeListener: (id< GCKDeviceScannerListener >)  listener

Removes a listener that was previously added with addListener:.

Parameters
listenerThe listener to remove.

Property Documentation

- (NSArray*) devices
readnonatomiccopy

The array of discovered devices.

- (BOOL) hasDiscoveredDevices
readnonatomicassign

Whether the current/latest scan has discovered any devices.

- (BOOL) scanning
readnonatomicassign

Whether a scan is currently in progress.

- (GCKFilterCriteria*) filterCriteria
readwritenonatomiccopy

The current filtering criteria.

- (BOOL) passiveScan
readwritenonatomicassign

Whether the scan should be a passive scan.

A passive scan sends discovery queries less frequently, so it is more efficient, but the results will not be as fresh. It's appropriate to do a passive scan when the user is not actively selecting a Cast target.

Google Cast iOS Sender API Reference v 2.10.1 4691