概览
用于执行设备发现和会话构建的抽象基类。
通过扩展此类,可以添加对其他设备类型的支持。如需查看旨在供子类使用的辅助方法列表,请参阅 GCKDeviceProvider(Protected) 类别。使用 registerDeviceProvider: (GCKCastContext) 向框架注册新的设备提供程序。
- 开始时间
- 3.0
此类继承 NSObject。
实例方法摘要 | |
(instancetype) | - initWithDeviceCategory: |
指定初始化程序。更多… | |
(void) | - startDiscovery |
开始新的发现扫描。更多… | |
(void) | - stopDiscovery |
停止发现扫描。更多… | |
(GCKSession *) | - createSessionForDevice:sessionID: |
为指定设备构建新会话,并可选择性地指定现有会话 ID。更多… | |
(void) | - notifyDidStartDiscovery |
通知发现管理器发现已开始。更多… | |
(void) | - notifyDidPublishDevice: |
通知发现管理器有新设备已发布。更多… | |
(void) | - notifyDidUnpublishDevice: |
通知发现管理器之前发布的设备已取消发布,因为该设备不再可用。更多… | |
(void) | - notifyDidUpdateDevice: |
通知发现管理器之前发布的一个或多个设备的显示属性(例如友好名称或图标)已更改。更多… | |
(GCKDevice *) | - createDeviceWithID:ipAddress:servicePort: |
用于构建新的 GCKDevice 实例的工厂方法。更多… | |
房源摘要 | |
NSString * | deviceCategory |
一个字符串,用于唯一标识将由此提供程序发现的设备类型。更多… | |
BOOL | passiveScan |
扫描是否应为被动扫描。更多… | |
NSArray< GCKDevice * > * | devices |
已发现设备的数组。更多… | |
方法详细信息
- (instancetype) initWithDeviceCategory: | (NSString *) | deviceCategory |
指定初始化程序。
为指定类型的设备构造新的 GCKDeviceProvider。
- Parameters
-
deviceCategory A string that uniquely identifies the type of device that is managed by by this provider.
- (void) startDiscovery |
开始新的发现扫描。
这是一项(通常)异步操作。如果之前扫描发现的任何设备不再有效,提供方应立即取消发布这些设备。必须由子类替换。
提供程序必须在扫描开始后(并且所有过时的设备都已取消发布)通过调用 notifyDidStartDiscovery (GCKDeviceProvider(Protected)) 通知发现管理器。如果此方法的特定实现在开始扫描时没有要执行的异步工作,则可以在返回之前直接调用通知方法。
- (void) stopDiscovery |
停止发现扫描。
必须由子类替换。
- (GCKSession *) createSessionForDevice: | (GCKDevice *) | device | |
sessionID: | (NSString *__nullable) | sessionID | |
为指定设备构建新会话,并可选择性地指定现有会话 ID。
必须由子类替换。
- Parameters
-
device The device to connect to. sessionID The ID of the session to resume; or nil
to start a new session.
- (void) notifyDidStartDiscovery |
通知发现管理器发现已开始。
由类别 GCKDeviceProvider(Protected) 提供。
- (void) notifyDidPublishDevice: | (GCKDevice *) | device |
通知发现管理器有新设备已发布。
由类别 GCKDeviceProvider(Protected) 提供。
- (void) notifyDidUnpublishDevice: | (GCKDevice *) | device |
通知发现管理器之前发布的设备已取消发布,因为该设备不再可用。
由类别 GCKDeviceProvider(Protected) 提供。
- (void) notifyDidUpdateDevice: | (GCKDevice *) | device |
通知发现管理器之前发布的一个或多个设备的显示属性(例如友好名称或图标)已更改。
由类别 GCKDeviceProvider(Protected) 提供。
- (GCKDevice *) createDeviceWithID: | (NSString *) | deviceID | |
ipAddress: | (NSString *) | ipAddress | |
servicePort: | (uint16_t) | servicePort | |
用于构建新的 GCKDevice 实例的工厂方法。
这些参数对应于 GCKDevice 的不可变属性。
- Parameters
-
deviceID The unique ID identifying this device. This value must be unique among all GCKDevice objects that are created by this provider. ipAddress The IP address of the device, in numeric form (for example, @"10.0.0.10"
). May not benil
.servicePort The service port on which connections should be made to this device. May be 0 if a service port is not applicable.
由类别 GCKDeviceProvider(Protected) 提供。
媒体资源详情
|
readnonatomiccopy |
一个字符串,用于唯一标识将由此提供程序发现的设备类型。
|
readwritenonatomicassign |
扫描是否应为被动扫描。
被动扫描发送发现查询的频率较低,因此效率更高,但结果不会那么新。当用户未主动选择 Cast 目标时,适合执行被动扫描。并非所有实现都会遵循此属性。
|
readnonatomiccopy |
已发现设备的数组。