GCKDiscoveryManager.h
1 // Copyright 2015 Google Inc.
2 
3 #import <GoogleCast/GCKDefines.h>
4 
5 #import <Foundation/Foundation.h>
6 
7 @class GCKDevice;
8 
9 GCK_ASSUME_NONNULL_BEGIN
10 
11 GCK_EXTERN NSString *const kGCKKeyHasDiscoveredDevices;
12 
13 typedef NS_ENUM(NSInteger, GCKDiscoveryState) {
14  GCKDiscoveryStateStopped = 0,
15  GCKDiscoveryStateRunning = 1
16 };
17 
18 @protocol GCKDiscoveryManagerListener;
19 
40 GCK_EXPORT
41 @interface GCKDiscoveryManager : NSObject
42 
46 @property(nonatomic, assign, readonly) GCKDiscoveryState discoveryState;
47 
52 @property(nonatomic, assign, readonly) BOOL hasDiscoveredDevices;
53 
58 @property(nonatomic, assign, readwrite) BOOL passiveScan;
59 
65 @property(nonatomic, assign, readonly) BOOL discoveryActive;
66 
70 @property(nonatomic, assign, readonly) NSUInteger deviceCount;
71 
75 - (instancetype)init NS_UNAVAILABLE;
76 
82 - (void)addListener:(id<GCKDiscoveryManagerListener>)listener;
83 
89 - (void)removeListener:(id<GCKDiscoveryManagerListener>)listener;
90 
94 - (void)startDiscovery;
95 
99 - (void)stopDiscovery;
100 
104 - (BOOL)isDiscoveryActiveForDeviceCategory:(NSString *)deviceCategory;
105 
109 - (GCKDevice *)deviceAtIndex:(NSUInteger)index;
110 
117 - (GCKDevice *GCK_NULLABLE_TYPE)deviceWithUniqueID:(NSString *)uniqueID;
118 
133 - (void)findDeviceWithUniqueID:(NSString *)uniqueID
134  timeout:(NSTimeInterval)timeout
135  completion:(void (^)(GCKDevice *))completion;
136 
142 - (void)cancelFindOperation;
143 
144 @end
145 
151 @protocol GCKDiscoveryManagerListener <NSObject>
152 
153 @optional
154 
158 - (void)didStartDiscoveryForDeviceCategory:(NSString *)deviceCategory;
159 
163 - (void)willUpdateDeviceList;
164 
168 - (void)didUpdateDeviceList;
169 
176 - (void)didInsertDevice:(GCKDevice *)device atIndex:(NSUInteger)index;
177 
184 - (void)didUpdateDevice:(GCKDevice *)device atIndex:(NSUInteger)index;
185 
193 - (void)didUpdateDevice:(GCKDevice *)device
194  atIndex:(NSUInteger)index
195  andMoveToIndex:(NSUInteger)newIndex;
196 
203 - (void)didRemoveDeviceAtIndex:(NSUInteger)index;
204 
215 - (void)didRemoveDevice:(GCKDevice *)device atIndex:(NSUInteger)index;
216 
217 @end
218 
219 GCK_ASSUME_NONNULL_END
instancetype NS_UNAVAILABLE()
Default initializer is not available.
An object representing a receiver device.
Definition: GCKDevice.h:82
NSUInteger deviceCount
The number of devices that are currently discovered.
Definition: GCKDiscoveryManager.h:70
BOOL discoveryActive
A flag indicating whether discovery is active or not.
Definition: GCKDiscoveryManager.h:65
GCKDiscoveryState discoveryState
The current discovery state.
Definition: GCKDiscoveryManager.h:46
void cancelFindOperation()
Cancels any in-progress find operation started by findDeviceWithUniqueID:timeout:completion:.
void startDiscovery()
Starts the discovery process.
void stopDiscovery()
Stops the discovery process.
A class that manages the device discovery process.
Definition: GCKDiscoveryManager.h:41
BOOL passiveScan
A flag indicating whether discovery should employ a "passive" scan.
Definition: GCKDiscoveryManager.h:58
BOOL hasDiscoveredDevices
A flag indicating whether any devices have been discovered by any of the discovery providers managed ...
Definition: GCKDiscoveryManager.h:52