GCKGenericChannel Class
Stay organized with collections
Save and categorize content based on your preferences.
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
.
Default initializer is not available. More...
Called when a text message has been received on this channel. More...
Sends a text message on this channel. More...
Generates a request ID for a new message. More...
Called when this channel has been connected, indicating that messages can now be exchanged with the Cast device over this channel. More...
Called when this channel has been disconnected, indicating that messages can no longer be exchanged with the Cast device over this channel. More...
Called when the writable state of this channel has changed. More...
The delegate for receiving notifications about changes in the channel's state. More...
A flag indicating whether this channel is currently connected. More...
A flag indicating whether this channel is currently writable. More...
- (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
.
Default initializer is not available.
- (void) didReceiveTextMessage: |
|
(NSString *) |
message
|
|
Called when a text message has been received on this channel.
The default implementation is a no-op.
- Parameters
-
- (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.
- (nullable NSNumber *) 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.
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.
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.
- (void) didChangeWritableState: |
|
(BOOL) |
isWritable
|
|
Called when the writable state of this channel has changed.
The default implementation is a no-op.
- Parameters
-
isWritable
Whether the channel is now writable.
- Since
- 4.0
read
write
nonatomic
weak
The delegate for receiving notifications about changes in the channel's state.
- (NSString*) protocolNamespace
read
nonatomic
copy
inherited
read
nonatomic
assign
inherited
A flag indicating whether this channel is currently connected.
read
nonatomic
assign
inherited
A flag indicating whether this channel is currently writable.
- Since
- 4.0
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["\u003cp\u003e\u003ccode\u003eGCKGenericChannel\u003c/code\u003e provides a basic implementation of a Cast channel for communication with Cast devices, forwarding events to its delegate without internal processing.\u003c/p\u003e\n"],["\u003cp\u003eIt allows sending and receiving text messages, managing connection status, and handling writability changes through its delegate.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use this class directly or subclass it for custom channel logic using a unique namespace.\u003c/p\u003e\n"],["\u003cp\u003eThis class inherits properties and methods from the \u003ccode\u003eGCKCastChannel\u003c/code\u003e class, offering standard channel functionalities.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGCKGenericChannel\u003c/code\u003e uses a delegate pattern for handling events, requiring the delegate to conform to the \u003ccode\u003eGCKGenericChannelDelegate\u003c/code\u003e protocol.\u003c/p\u003e\n"]]],["The `GCKGenericChannel` class, a `GCKCastChannel` implementation, facilitates message exchange between a sender and a receiver without custom processing. It initializes with a unique namespace and forwards connectivity and message events to its delegate. Key actions include initializing with `initWithNamespace:`, sending text messages via `sendTextMessage:error:`, and generating message request IDs with `generateRequestID`. The channel also handles connection events through `didConnect`, `didDisconnect`, and `didChangeWritableState:`, informing the delegate about state changes. It has properties for `delegate`, `protocolNamespace`, `isConnected`, and `isWritable`.\n"],null,[]]