GCKCastChannel Class Reference

A virtual communication channel for exchanging messages between a Cast sender and a Cast receiver. More...

#import <GCKCastChannel.h>

+ Inheritance diagram for GCKCastChannel:

Instance Methods

(instancetype) - initWithNamespace:
 Designated initializer. More...
 
(instancetype) - NS_UNAVAILABLE
 Default initializer is not available. More...
 
(void) - didReceiveTextMessage:
 Called when a text message has been received on this channel. More...
 
(BOOL) - sendTextMessage:error:
 Sends a text message on this channel. More...
 
(NSInteger) - generateRequestID
 Generates a request ID for a new message. More...
 
(NSNumber *GCK_NULLABLE_TYPE) - generateRequestNumber
 A convenience method which wraps the result of generateRequestID in an NSNumber. More...
 
(void) - didConnect
 Called when this channel has been connected, indicating that messages can now be exchanged with the Cast device over this channel. More...
 
(void) - didDisconnect
 Called when this channel has been disconnected, indicating that messages can no longer be exchanged with the Cast device over this channel. More...
 
(void) - didChangeWritableState:
 Called when the writable state of this channel has changed. More...
 

Properties

NSString * protocolNamespace
 The channel's namespace. More...
 
BOOL isConnected
 A flag indicating whether this channel is currently connected. More...
 
BOOL isWritable
 A flag indicating whether this channel is currently writable. More...
 

Detailed Description

A virtual communication channel for exchanging messages between a Cast sender and a Cast receiver.

Each channel is tagged with a unique namespace, so multiple channels may be multiplexed over a single network connection between a sender and a receiver.

A channel must be registered with a GCKCastSession before it can be used. When the associated session is established, the channel will be connected automatically and can then send and receive messages.

Subclasses should implement the didReceiveTextMessage: (GCKCastChannel) method to process incoming messages, and will typically provide additional methods for sending messages that are specific to a given namespace.

Method Documentation

- (void) didChangeWritableState: (BOOL)  isWritable

Called when the writable state of this channel has changed.

The default implementation is a no-op.

Parameters
isWritableWhether the channel is now writable.
Since
4.0
- (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.

Implemented in OOCastPlayer.

- (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.

Implemented in OOCastPlayer.

- (void) didReceiveTextMessage: (NSString *)  message

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

The default implementation is a no-op.

Parameters
messageThe message.

Implemented in OOCastPlayer.

- (NSInteger) generateRequestID

Generates a request ID for a new message.

Returns
The generated ID, or kGCKInvalidRequestID if the channel is not currently connected.
- (NSNumber * GCK_NULLABLE_TYPE) 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.
- (instancetype) initWithNamespace: (NSString *)  protocolNamespace

Designated initializer.

Constructs a new GCKCastChannel with the given namespace.

Parameters
protocolNamespaceThe namespace.

Implemented in GCKGenericChannel.

- (instancetype) NS_UNAVAILABLE

Default initializer is not available.

- (BOOL) sendTextMessage: (NSString *)  message
error: (GCKError *GCK_NULLABLE_TYPE *GCK_NULLABLE_TYPE)  error 

Sends a text message on this channel.

Parameters
messageThe message.
errorA pointer at which to store the error result. May be nil.
Returns
YES on success or NO if the message could not be sent.

Property Documentation

- (BOOL) isConnected
readnonatomicassign

A flag indicating whether this channel is currently connected.

- (BOOL) isWritable
readnonatomicassign

A flag indicating whether this channel is currently writable.

Since
4.0
- (NSString*) protocolNamespace
readnonatomiccopy

The channel's namespace.


The documentation for this class was generated from the following file: