func NewConnectionController(client *castv2.Client, sourceId, destinationId string) *connectionController { controller := &connectionController{ channel: client.NewChannel(sourceId, destinationId, "urn:x-cast:com.google.cast.tp.connection"), } return controller }
func NewHeartbeatController(client *castv2.Client, sourceId, destinationId string) *heartbeatController { controller := &heartbeatController{ channel: client.NewChannel(sourceId, destinationId, "urn:x-cast:com.google.cast.tp.heartbeat"), } controller.channel.OnMessage("PING", controller.onPing) return controller }
func NewReceiverController(client *castv2.Client, sourceId, destinationId string) *ReceiverController { controller := &ReceiverController{ channel: client.NewChannel(sourceId, destinationId, "urn:x-cast:com.google.cast.receiver"), Incoming: make(chan *ReceiverStatus, 0), } controller.channel.OnMessage("RECEIVER_STATUS", controller.onStatus) return controller }
func NewMediaController(client *castv2.Client, sourceId, destinationID string) *MediaController { controller := &MediaController{ channel: client.NewChannel(sourceId, destinationID, "urn:x-cast:com.google.cast.media"), Incoming: make(chan []*MediaStatus, 0), DestinationID: destinationID, } controller.channel.OnMessage("MEDIA_STATUS", func(message *api.CastMessage) { controller.onStatus(message) }) return controller }