GCKCastChannel Class

GCKCastChannel Class Reference

Overview

A GCKCastChannel is used to send and receive messages that are tagged with a specific namespace.

In this way, multiple channels may be multiplexed over a single connection to a Cast device.

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

Inherits NSObject.

Inherited by GCKGameManagerChannel, GCKGenericChannel, GCKMediaControlChannel, and GCKRemoteDisplayChannel.

Instance Method Summary

(instancetype) - initWithNamespace:
 Designated initializer. More...
 
(void) - didReceiveTextMessage:
 Called when a text message has been received on this channel. More...
 
(BOOL) - sendTextMessage:
 Sends a text message 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 *) - generateRequestNumber
 A convenience method which wraps 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...
 

Properties

NSString * protocolNamespace
 The channel's namespace. More...
 
BOOL isConnected
 A flag indicating whether this channel is currently connected. More...
 
GCKDeviceManagerdeviceManager
 The device manager with which this channel is registered, if any. More...
 

Method Detail

- (instancetype) initWithNamespace: (NSString *)  protocolNamespace

Designated initializer.

Constructs a new GCKCastChannel with the given namespace.

Parameters
protocolNamespaceThe namespace.

Implemented in GCKGenericChannel.

- (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.
- (BOOL) sendTextMessage: (NSString *)  message

Sends a text message on this channel.

Parameters
messageThe 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).
- (BOOL) sendTextMessage: (NSString *)  message
error: (GCKError **)  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.
- (NSInteger) generateRequestID

Generates a request ID for a new message.

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

A convenience method which wraps 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 Documentation

- (NSString*) protocolNamespace
readnonatomiccopy

The channel's namespace.

- (BOOL) isConnected
readnonatomicassign

A flag indicating whether this channel is currently connected.

- (GCKDeviceManager*) deviceManager
readnonatomicweak

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

Google Cast iOS Sender API Reference v 2.10.1 4691