예제 #1
0
        public virtual async Task StartDevice()
        {
            var chromeCastReport = Report as ChromecastDeviceDiscoveryReportItem;

            Device = new ChromecastDevice(chromeCastReport);
            Client = new ChromecastClient(chromeCastReport.EndPoint.Address, 8009);   // <-- dat port number :(

            ConnectionChannel = Client.CreateChannel(DialConstants.DialConnectionUrn);
            HeartbeatChannel  = Client.CreateChannel(DialConstants.DialHeartbeatUrn);
            ReceiverChannel   = Client.CreateChannel(DialConstants.DialReceiverUrn);
            MediaChannel      = Client.CreateChannel(DialConstants.DialMediaUrn);

            await Client.Connect();

            Client.Listen();

            // Send the connect message
            Client.Write(MessageFactory.Connect());

            Client.StartHeartbeat();
        }