GCKGenericChannel Class

GCKGenericChannel Class Reference

Overview

A generic GCKCastChannel implementation, suitable for use when subclassing is not desired.

GCKGenericChannel forwards message and connectivity events to its delegate, and has no processing logic of its own.

See GCKGenericChannelDelegate for the delegate protocol.

Inherits GCKCastChannel .

Instance Method Summary

(instancetype) 
Designated initializer. More...
(instancetype) 
- init
Default initializer is not available. More...
Called when a text message has been received on this channel. More...
(BOOL) 
Sends a text message on this channel. More...
Sends a text message on this channel. More...
(NSInteger) 
Generates a request ID for a new message. More...
(NSNumber *__nullable) 
A convenience method which wraps the result of generateRequestID in an NSNumber . More...
(void) 
Called when this channel has been connected, indicating that messages can now be exchanged with the Cast device over this channel. More...
(void) 
Called when this channel has been disconnected, indicating that messages can no longer be exchanged with the Cast device over this channel. More...

Property Summary

The delegate for receiving notifications about changes in the channel's state. More...
NSString * 
The channel's namespace. More...
BOOL 
A flag indicating whether this channel is currently connected. More...
The device manager with which this channel is registered, if any. More...

Method Detail

- (instancetype) initWithNamespace: (NSString *)  protocolNamespace

Designated initializer.

Parameters
protocolNamespace
The namespace for this channel. This namespace must be unique across all channels used by a given application.

Implements GCKCastChannel .

- (instancetype) init

Default initializer is not available.

Implemented in GCKMediaControlChannel , and GCKGameManagerChannel .

- (void) didReceiveTextMessage: (NSString *)  message

Called when a text message has been received on this channel.

The default implementation is a no-op.

Parameters
message
The message.
- (BOOL) sendTextMessage: (NSString *)  message

Sends a text message on this channel.

Parameters
message
The message.
Returns
YES on success or NO if the message could not be sent (because the channel is not connected, or because the send buffer is too full at the moment).
Deprecated:
Use sendTextMessage:error: which provides detailed error information.
- (BOOL) sendTextMessage: (NSString *)  message
error: ( GCKError *__nullable *__nullable)  error

Sends a text message on this channel.

Parameters
message The message.
error A pointer at which to store the error result. May be nil .
Returns
YES on success or NO if the message could not be sent.
- (NSInteger) generateRequestID

Generates a request ID for a new message.

Returns
The generated ID, or kGCKInvalidRequestID if the channel is not currently connected.
- (NSNumber * __nullable) generateRequestNumber

A convenience method which wraps the result of generateRequestID in an NSNumber .

Returns
The generated ID, or nil if the channel is not currently connected.
- (void) didConnect

Called when this channel has been connected, indicating that messages can now be exchanged with the Cast device over this channel.

The default implementation is a no-op.

- (void) didDisconnect

Called when this channel has been disconnected, indicating that messages can no longer be exchanged with the Cast device over this channel.

The default implementation is a no-op.

Property Detail

- (id< GCKGenericChannelDelegate >) delegate
read write nonatomic weak

The delegate for receiving notifications about changes in the channel's state.

- (NSString*) protocolNamespace
read nonatomic copy inherited

The channel's namespace.

- (BOOL) isConnected
read nonatomic assign inherited

A flag indicating whether this channel is currently connected.

- ( GCKDeviceManager *) deviceManager
read nonatomic weak inherited

The device manager with which this channel is registered, if any.

Deprecated:
If this channel was not registered with the deprecated GCKDeviceManager class, this will be nil .
Create a Mobile Website
View Site in Mobile | Classic
Share by: