gocast

package module
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 19 Imported by: 3

README

gocast

Simple library to find, control and get status from google chromecast devices

Build Status

Documentation

Index

Constants

View Source
const AppMedia = "CC1AD845"

Variables

This section is empty.

Functions

func NewPacketStream

func NewPacketStream(stream io.ReadWriteCloser, logger logrus.FieldLogger) *packetStream

Types

type Device

type Device struct {
	sync.RWMutex

	ReceiverHandler *handlers.Receiver
	// contains filtered or unexported fields
}

func NewDevice

func NewDevice(logger logrus.FieldLogger) *Device

func (*Device) Connect

func (d *Device) Connect(ctx context.Context) error

func (*Device) Disconnect

func (d *Device) Disconnect()

func (*Device) Dispatch

func (d *Device) Dispatch(event events.Event)

func (*Device) Ip

func (d *Device) Ip() net.IP

func (*Device) Name

func (d *Device) Name() string

func (*Device) OnEvent

func (d *Device) OnEvent(callback func(event events.Event))

func (*Device) Port

func (d *Device) Port() int

func (*Device) Send

func (d *Device) Send(urn, sourceId, destinationId string, payload responses.Payload) error

func (*Device) SetIp

func (d *Device) SetIp(ip net.IP)

func (*Device) SetLogger added in v0.5.1

func (d *Device) SetLogger(logger logrus.FieldLogger)

func (*Device) SetName

func (d *Device) SetName(name string)

func (*Device) SetPort

func (d *Device) SetPort(port int)

func (*Device) SetUuid

func (d *Device) SetUuid(uuid string)

func (*Device) String

func (d *Device) String() string

func (*Device) Subscribe

func (d *Device) Subscribe(urn, destinationId string, handler Handler)

func (*Device) UnsubscribeByUrn

func (d *Device) UnsubscribeByUrn(urn string)

func (*Device) UnsubscribeByUrnAndDestinationId

func (d *Device) UnsubscribeByUrnAndDestinationId(urn, destinationId string)

func (*Device) Uuid

func (d *Device) Uuid() string

type Handler

type Handler interface {
	RegisterSend(func(responses.Payload) error)
	RegisterRequest(func(responses.Payload) (*api.CastMessage, error))
	RegisterDispatch(func(events.Event))
	Send(responses.Payload) error
	Request(responses.Payload) (*api.CastMessage, error)

	Connect()
	Disconnect()
	Unmarshal(string)
}

type Subscription

type Subscription struct {
	Urn           string
	SourceId      string
	DestinationId string
	Handler       Handler
	Device        *Device
	// contains filtered or unexported fields
}

func (*Subscription) Receive

func (s *Subscription) Receive(message *api.CastMessage, headers *responses.Headers) bool

func (*Subscription) Request

func (s *Subscription) Request(payload responses.Payload) (*api.CastMessage, error)

Request works like send, but waits for resposne to requestId before returning.

func (*Subscription) Send

func (s *Subscription) Send(payload responses.Payload) error

func (*Subscription) Sha256

func (s *Subscription) Sha256() string

Directories

Path Synopsis
Package api is a generated protocol buffer package.
Package api is a generated protocol buffer package.
Package discovery provides a discovery service for chromecast devices
Package discovery provides a discovery service for chromecast devices
Package main provides an example of the stampzilla/gocast library
Package main provides an example of the stampzilla/gocast library

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL