GCKDiscoveryManager Class

GCKDiscoveryManager Class Reference

Overview

A class that manages the device discovery process.

GCKDiscoveryManager manages a collection of GCKDeviceProvider subclass instances, each of which is responsible for discovering devices of a specific type. It also maintains a lexicographically ordered list of the currently discovered devices.

The framework automatically starts the discovery process when the application moves to the foreground and suspends it when the application moves to the background. It is generally not necessary for the application to call startDiscovery (GCKDiscoveryManager) and stopDiscovery (GCKDiscoveryManager) , except as an optimization measure to reduce network traffic and CPU utilization in areas of the application that do not use Casting functionality.

If the application is using the framework's Cast dialog, either by way of GCKUICastButton or by presenting it directly, then that dialog will use GCKDiscoveryManager to populate its list of available devices. If however the application is providing its own device selection/control dialog UI, then it should use the GCKDiscoveryManager and its associated listener protocol, GCKDiscoveryManagerListener , to populate and update its list of available devices.

Since
3.0

Inherits NSObject.

Instance Method Summary

(instancetype) 
- init
Default initializer is not available. More...
(void) 
Adds a listener that will receive discovery notifications. More...
(void) 
Removes a previously registered listener. More...
(void) 
Starts the discovery process. More...
(void) 
Stops the discovery process. More...
Tests whether discovery is currently active for the given device category. More...
Returns the device at the given index in the manager's list of discovered devices. More...
( GCKDevice *__nullable) 
Returns the device with the given unique ID in the manager's list of discovered devices. More...

Property Summary

GCKDiscoveryState 
The current discovery state. More...
A flag indicating whether any devices have been discovered by any of the discovery providers managed by this object. More...
BOOL 
A flag indicating whether discovery should employ a "passive" scan. More...
A flag indicating whether discovery is active or not. More...
NSUInteger 
The number of devices that are currently discovered. More...

Method Detail

- (instancetype) init

Default initializer is not available.

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

Adds a listener that will receive discovery notifications.

Parameters
listener
The listener to add.
- (void) removeListener: (id< GCKDiscoveryManagerListener >)  listener

Removes a previously registered listener.

Parameters
listener
The listener to remove.
- (void) startDiscovery

Starts the discovery process.

- (void) stopDiscovery

Stops the discovery process.

- (BOOL) isDiscoveryActiveForDeviceCategory: (NSString *)  deviceCategory

Tests whether discovery is currently active for the given device category.

- ( GCKDevice *) deviceAtIndex: (NSUInteger)  index

Returns the device at the given index in the manager's list of discovered devices.

- ( GCKDevice *__nullable) deviceWithUniqueID: (NSString *)  uniqueID

Returns the device with the given unique ID in the manager's list of discovered devices.

Parameters
uniqueID
The device's unique ID.
Returns
The matching GCKDevice object, or nil if a matching device was not found.

Property Detail

- (GCKDiscoveryState) discoveryState
read nonatomic assign

The current discovery state.

- (BOOL) hasDiscoveredDevices
read nonatomic assign

A flag indicating whether any devices have been discovered by any of the discovery providers managed by this object.

- (BOOL) passiveScan
read write nonatomic assign

A flag indicating whether discovery should employ a "passive" scan.

Passive scans are less resource-intensive but do not provide results that are as fresh as active scans.

- (BOOL) discoveryActive
read nonatomic assign

A flag indicating whether discovery is active or not.

Since
3.4
- (NSUInteger) deviceCount
read nonatomic assign

The number of devices that are currently discovered.

Create a Mobile Website
View Site in Mobile | Classic
Share by: