Documentation ¶
Overview ¶
Package api is a generated protocol buffer package.
It is generated from these files:
api/cast_channel.proto
It has these top-level messages:
CastMessage AuthChallenge AuthResponse AuthError DeviceAuthMessage
Index ¶
- Variables
- func DiscoverCastDNSEntries(ctx context.Context, iface *net.Interface) (<-chan CastEntry, error)
- type Application
- func (a *Application) AddMessageFunc(f CastMessageFunc)
- func (a *Application) Close(stopMedia bool) error
- func (a *Application) LoadApp(appID, contentID string) error
- func (a *Application) Media() *Media
- func (a *Application) MediaFinished()
- func (a *Application) MediaStart()
- func (a *Application) MediaWait()
- func (a *Application) Next() error
- func (a *Application) Pause() error
- func (a *Application) Previous() error
- func (a *Application) Seek(value int) error
- func (a *Application) SeekFromStart(value int) error
- func (a *Application) SeekToTime(value float32) error
- func (a *Application) SetMuted(value bool) error
- func (a *Application) SetVolume(value float32) error
- func (a *Application) Skip() error
- func (a *Application) Start(addr string, port int) error
- func (a *Application) Status() (*PayloadApplication, *Media, *Volume)
- func (a *Application) Stop() error
- func (a *Application) StopMedia() error
- func (a *Application) Unpause() error
- func (a *Application) Update() error
- func (a *Application) Volume() *Volume
- type ApplicationOption
- type AuthChallenge
- type AuthError
- type AuthError_ErrorType
- type AuthResponse
- type CastEntry
- type CastMessage
- func (m *CastMessage) GetDestinationId() string
- func (m *CastMessage) GetNamespace() string
- func (m *CastMessage) GetPayloadBinary() []byte
- func (m *CastMessage) GetPayloadType() CastMessage_PayloadType
- func (m *CastMessage) GetPayloadUtf8() string
- func (m *CastMessage) GetProtocolVersion() CastMessage_ProtocolVersion
- func (m *CastMessage) GetSourceId() string
- func (*CastMessage) ProtoMessage()
- func (m *CastMessage) Reset()
- func (m *CastMessage) String() string
- type CastMessageFunc
- type CastMessage_PayloadType
- type CastMessage_ProtocolVersion
- type Connection
- type DeviceAuthMessage
- type Image
- type LaunchRequest
- type LoadMediaCommand
- type Media
- type MediaHeader
- type MediaItem
- type MediaMetadata
- type MediaStatusResponse
- type Payload
- type PayloadApplication
- type PayloadHeader
- type QueueData
- type QueueLoad
- type QueueLoadItem
- type QueueUpdate
- type ReceiverStatusRequest
- type ReceiverStatusResponse
- type SetVolume
- type Volume
Constants ¶
This section is empty.
Variables ¶
var ( // ConnectHeader Known Payload headers ConnectHeader = PayloadHeader{Type: "CONNECT"} CloseHeader = PayloadHeader{Type: "CLOSE"} GetStatusHeader = PayloadHeader{Type: "GET_STATUS"} PongHeader = PayloadHeader{Type: "PONG"} // Response to PING payload LaunchHeader = PayloadHeader{Type: "LAUNCH"} // Launches a new chromecast app StopHeader = PayloadHeader{Type: "STOP"} // Stop playing current media PlayHeader = PayloadHeader{Type: "PLAY"} // Plays / unpauses the running app PauseHeader = PayloadHeader{Type: "PAUSE"} // Pauses the running app SeekHeader = PayloadHeader{Type: "SEEK"} // Seek into the running app VolumeHeader = PayloadHeader{Type: "SET_VOLUME"} // Sets the volume LoadHeader = PayloadHeader{Type: "LOAD"} // Loads an application onto the chromecast QueueLoadHeader = PayloadHeader{Type: "QUEUE_LOAD"} // Loads an application onto the chromecast QueueUpdateHeader = PayloadHeader{Type: "QUEUE_UPDATE"} // Loads an application onto the chromecast )
var AuthError_ErrorType_name = map[int32]string{
0: "INTERNAL_ERROR",
1: "NO_TLS",
}
var AuthError_ErrorType_value = map[string]int32{
"INTERNAL_ERROR": 0,
"NO_TLS": 1,
}
var CastMessage_PayloadType_name = map[int32]string{
0: "STRING",
1: "BINARY",
}
var CastMessage_PayloadType_value = map[string]int32{
"STRING": 0,
"BINARY": 1,
}
var CastMessage_ProtocolVersion_name = map[int32]string{
0: "CASTV2_1_0",
}
var CastMessage_ProtocolVersion_value = map[string]int32{
"CASTV2_1_0": 0,
}
Functions ¶
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func NewApplication(opts ...ApplicationOption) *Application
func (*Application) AddMessageFunc ¶
func (a *Application) AddMessageFunc(f CastMessageFunc)
func (*Application) Close ¶
func (a *Application) Close(stopMedia bool) error
func (*Application) LoadApp ¶
func (a *Application) LoadApp(appID, contentID string) error
func (*Application) Media ¶
func (a *Application) Media() *Media
func (*Application) MediaFinished ¶
func (a *Application) MediaFinished()
func (*Application) MediaStart ¶
func (a *Application) MediaStart()
MediaStart TODO: Clean-up: these Media* methods are a hack around trying to use the mediaFinished channel when it hasn't been properly set up. This is happening because there is some instances where we don't have any running media ('watch' command) but yet the 'mediaFinished' is littered throughout the codebase. This needs a redesign now that we do things other than just loading and playing media files.
func (*Application) MediaWait ¶
func (a *Application) MediaWait()
func (*Application) Next ¶
func (a *Application) Next() error
func (*Application) Pause ¶
func (a *Application) Pause() error
func (*Application) Previous ¶
func (a *Application) Previous() error
func (*Application) Seek ¶
func (a *Application) Seek(value int) error
func (*Application) SeekFromStart ¶
func (a *Application) SeekFromStart(value int) error
func (*Application) SeekToTime ¶
func (a *Application) SeekToTime(value float32) error
func (*Application) SetMuted ¶
func (a *Application) SetMuted(value bool) error
func (*Application) SetVolume ¶
func (a *Application) SetVolume(value float32) error
func (*Application) Skip ¶
func (a *Application) Skip() error
func (*Application) Status ¶
func (a *Application) Status() (*PayloadApplication, *Media, *Volume)
func (*Application) Stop ¶
func (a *Application) Stop() error
func (*Application) StopMedia ¶
func (a *Application) StopMedia() error
func (*Application) Unpause ¶
func (a *Application) Unpause() error
func (*Application) Update ¶
func (a *Application) Update() error
func (*Application) Volume ¶
func (a *Application) Volume() *Volume
type ApplicationOption ¶
type ApplicationOption func(*Application)
func WithConnectionRetries ¶
func WithConnectionRetries(connectionRetries int) ApplicationOption
func WithIface ¶
func WithIface(iface *net.Interface) ApplicationOption
type AuthChallenge ¶
type AuthChallenge struct {
XXX_unrecognized []byte `json:"-"`
}
Messages for authentication protocol between a sender and a receiver.
func (*AuthChallenge) ProtoMessage ¶
func (*AuthChallenge) ProtoMessage()
func (*AuthChallenge) Reset ¶
func (m *AuthChallenge) Reset()
func (*AuthChallenge) String ¶
func (m *AuthChallenge) String() string
type AuthError ¶
type AuthError struct { ErrorType *AuthError_ErrorType `protobuf:"varint,1,req,name=error_type,enum=api.AuthError_ErrorType" json:"error_type,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*AuthError) GetErrorType ¶
func (m *AuthError) GetErrorType() AuthError_ErrorType
func (*AuthError) ProtoMessage ¶
func (*AuthError) ProtoMessage()
type AuthError_ErrorType ¶
type AuthError_ErrorType int32
const ( AuthError_INTERNAL_ERROR AuthError_ErrorType = 0 AuthError_NO_TLS AuthError_ErrorType = 1 )
func (AuthError_ErrorType) Enum ¶
func (x AuthError_ErrorType) Enum() *AuthError_ErrorType
func (AuthError_ErrorType) String ¶
func (x AuthError_ErrorType) String() string
func (*AuthError_ErrorType) UnmarshalJSON ¶
func (x *AuthError_ErrorType) UnmarshalJSON(data []byte) error
type AuthResponse ¶
type AuthResponse struct { Signature []byte `protobuf:"bytes,1,req,name=signature" json:"signature,omitempty"` ClientAuthCertificate []byte `protobuf:"bytes,2,req,name=client_auth_certificate" json:"client_auth_certificate,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*AuthResponse) GetClientAuthCertificate ¶
func (m *AuthResponse) GetClientAuthCertificate() []byte
func (*AuthResponse) GetSignature ¶
func (m *AuthResponse) GetSignature() []byte
func (*AuthResponse) ProtoMessage ¶
func (*AuthResponse) ProtoMessage()
func (*AuthResponse) Reset ¶
func (m *AuthResponse) Reset()
func (*AuthResponse) String ¶
func (m *AuthResponse) String() string
type CastEntry ¶
type CastEntry struct { AddrV4 net.IP AddrV6 net.IP Port int Name string Host string UUID string Device string Status string DeviceName string InfoFields map[string]string }
CastEntry is the concrete cast entry type.
func (CastEntry) GetAddr ¶
GetAddr returns the IPV4 of a cast entry if it is not nil otherwise the IPV6.
type CastMessage ¶
type CastMessage struct { ProtocolVersion *CastMessage_ProtocolVersion `protobuf:"varint,1,req,name=protocol_version,enum=api.CastMessage_ProtocolVersion" json:"protocol_version,omitempty"` // source and destination ids identify the origin and destination of the // message. They are used to route messages between endpoints that share a // device-to-device channel. // // For messages between applications: // - The sender application id is a unique identifier generated on behalf of // the sender application. // - The receiver id is always the the session id for the application. // // For messages to or from the sender or receiver platform, the special ids // 'sender-0' and 'receiver-0' can be used. // // For messages intended for all endpoints using a given channel, the // wildcard destination_id '*' can be used. SourceId *string `protobuf:"bytes,2,req,name=source_id" json:"source_id,omitempty"` DestinationId *string `protobuf:"bytes,3,req,name=destination_id" json:"destination_id,omitempty"` // This is the core multiplexing key. All messages are sent on a namespace // and endpoints sharing a channel listen on one or more namespaces. The // namespace defines the protocol and semantics of the message. Namespace *string `protobuf:"bytes,4,req,name=namespace" json:"namespace,omitempty"` PayloadType *CastMessage_PayloadType `protobuf:"varint,5,req,name=payload_type,enum=api.CastMessage_PayloadType" json:"payload_type,omitempty"` // Depending on payload_type, exactly one of the following optional fields // will always be set. PayloadUtf8 *string `protobuf:"bytes,6,opt,name=payload_utf8" json:"payload_utf8,omitempty"` PayloadBinary []byte `protobuf:"bytes,7,opt,name=payload_binary" json:"payload_binary,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*CastMessage) GetDestinationId ¶
func (m *CastMessage) GetDestinationId() string
func (*CastMessage) GetNamespace ¶
func (m *CastMessage) GetNamespace() string
func (*CastMessage) GetPayloadBinary ¶
func (m *CastMessage) GetPayloadBinary() []byte
func (*CastMessage) GetPayloadType ¶
func (m *CastMessage) GetPayloadType() CastMessage_PayloadType
func (*CastMessage) GetPayloadUtf8 ¶
func (m *CastMessage) GetPayloadUtf8() string
func (*CastMessage) GetProtocolVersion ¶
func (m *CastMessage) GetProtocolVersion() CastMessage_ProtocolVersion
func (*CastMessage) GetSourceId ¶
func (m *CastMessage) GetSourceId() string
func (*CastMessage) ProtoMessage ¶
func (*CastMessage) ProtoMessage()
func (*CastMessage) Reset ¶
func (m *CastMessage) Reset()
func (*CastMessage) String ¶
func (m *CastMessage) String() string
type CastMessageFunc ¶
type CastMessageFunc func(*CastMessage)
type CastMessage_PayloadType ¶
type CastMessage_PayloadType int32
What type of data do we have in this message.
const ( CastMessage_STRING CastMessage_PayloadType = 0 CastMessage_BINARY CastMessage_PayloadType = 1 )
func (CastMessage_PayloadType) Enum ¶
func (x CastMessage_PayloadType) Enum() *CastMessage_PayloadType
func (CastMessage_PayloadType) String ¶
func (x CastMessage_PayloadType) String() string
func (*CastMessage_PayloadType) UnmarshalJSON ¶
func (x *CastMessage_PayloadType) UnmarshalJSON(data []byte) error
type CastMessage_ProtocolVersion ¶
type CastMessage_ProtocolVersion int32
CastMessage_ProtocolVersion Always pass a version of the protocol for future compatibility requirements.
const (
CastMessage_CASTV2_1_0 CastMessage_ProtocolVersion = 0
)
func (CastMessage_ProtocolVersion) Enum ¶
func (x CastMessage_ProtocolVersion) Enum() *CastMessage_ProtocolVersion
func (CastMessage_ProtocolVersion) String ¶
func (x CastMessage_ProtocolVersion) String() string
func (*CastMessage_ProtocolVersion) UnmarshalJSON ¶
func (x *CastMessage_ProtocolVersion) UnmarshalJSON(data []byte) error
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(recvMsgChan chan *CastMessage) *Connection
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) LocalAddr ¶
func (c *Connection) LocalAddr() (addr string, err error)
func (*Connection) Send ¶
func (c *Connection) Send(requestID int, payload Payload, sourceID, destinationID, namespace string) error
func (*Connection) SetDebug ¶
func (c *Connection) SetDebug(debug bool)
type DeviceAuthMessage ¶
type DeviceAuthMessage struct { // Request fields Challenge *AuthChallenge `protobuf:"bytes,1,opt,name=challenge" json:"challenge,omitempty"` // Response fields Response *AuthResponse `protobuf:"bytes,2,opt,name=response" json:"response,omitempty"` Error *AuthError `protobuf:"bytes,3,opt,name=error" json:"error,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*DeviceAuthMessage) GetChallenge ¶
func (m *DeviceAuthMessage) GetChallenge() *AuthChallenge
func (*DeviceAuthMessage) GetError ¶
func (m *DeviceAuthMessage) GetError() *AuthError
func (*DeviceAuthMessage) GetResponse ¶
func (m *DeviceAuthMessage) GetResponse() *AuthResponse
func (*DeviceAuthMessage) ProtoMessage ¶
func (*DeviceAuthMessage) ProtoMessage()
func (*DeviceAuthMessage) Reset ¶
func (m *DeviceAuthMessage) Reset()
func (*DeviceAuthMessage) String ¶
func (m *DeviceAuthMessage) String() string
type LaunchRequest ¶
type LaunchRequest struct { PayloadHeader AppId string `json:"appId"` }
type LoadMediaCommand ¶
type LoadMediaCommand struct { PayloadHeader Media MediaItem `json:"media"` CurrentTime int `json:"currentTime"` Autoplay bool `json:"autoplay"` QueueData QueueData `json:"queueData"` CustomData interface{} `json:"customData"` }
type Media ¶
type Media struct { MediaSessionId int `json:"mediaSessionId"` PlayerState string `json:"playerState"` CurrentTime float32 `json:"currentTime"` IdleReason string `json:"idleReason"` Volume Volume `json:"volume"` CurrentItemId int `json:"currentItemId"` LoadingItemId int `json:"loadingItemId"` Media MediaItem `json:"media"` }
type MediaHeader ¶
type MediaHeader struct { PayloadHeader MediaSessionId int `json:"mediaSessionId"` CurrentTime float32 `json:"currentTime"` RelativeTime float32 `json:"relativeTime,omitempty"` ResumeState string `json:"resumeState"` }
type MediaItem ¶
type MediaItem struct { ContentId string `json:"contentId"` ContentType string `json:"contentType"` StreamType string `json:"streamType"` Duration float32 `json:"duration"` Metadata MediaMetadata `json:"metadata"` }
type MediaMetadata ¶
type MediaStatusResponse ¶
type MediaStatusResponse struct { PayloadHeader Status []Media `json:"status"` }
type PayloadApplication ¶
type PayloadHeader ¶
func (*PayloadHeader) SetRequestId ¶
func (p *PayloadHeader) SetRequestId(id int)
type QueueLoad ¶
type QueueLoad struct { PayloadHeader MediaSessionId int `json:"mediaSessionId,omitempty"` CurrentTime float32 `json:"currentTime"` StartIndex int `json:"startIndex"` RepeatMode string `json:"repeatMode"` Items []QueueLoadItem `json:"items"` }
type QueueLoadItem ¶
type QueueUpdate ¶
type QueueUpdate struct { PayloadHeader MediaSessionId int `json:"mediaSessionId,omitempty"` Jump int `json:"jump,omitempty"` }
type ReceiverStatusRequest ¶
type ReceiverStatusRequest struct { PayloadHeader Applications []PayloadApplication `json:"applications"` Volume Volume `json:"volume"` }
type ReceiverStatusResponse ¶
type ReceiverStatusResponse struct { PayloadHeader Status struct { Applications []PayloadApplication `json:"applications"` Volume Volume `json:"volume"` } `json:"status"` }
type SetVolume ¶
type SetVolume struct { PayloadHeader Volume Volume `json:"volume"` }