Beispiel #1
0
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
}
Beispiel #2
0
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
}
Beispiel #3
0
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
}
Beispiel #4
0
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
}