///// <summary>
        ///// Handles the channel range request.
        ///// </summary>
        ///// <param name="header">The header.</param>
        ///// <param name="channelRangeRequest">The channel range request.</param>
        //protected override void HandleChannelRangeRequest(IMessageHeader header, ChannelRangeRequest channelRangeRequest)
        //{
        //    base.HandleChannelRangeRequest(header, channelRangeRequest);
        //
        //    Request = header;
        //
        //    if (_tokenSource == null)
        //        _tokenSource = new CancellationTokenSource();
        //    var token = _tokenSource.Token;
        //
        //    Logger.Debug("Channel Range Request starting.");
        //    Task.Run(() => StartChannelRangeRequest(channelRangeRequest.ChannelRanges, token), token);
        //}

        /// <summary>
        /// Handles the stop streaming.
        /// </summary>
        /// <param name="header">The header.</param>
        /// <param name="stopStreaming">The stop streaming.</param>
        protected override void HandleStopStreaming(IMessageHeader header, StopStreaming stopStreaming)
        {
            // no action needed if streaming not in progress
            if (_tokenSource == null)
            {
                this.InvalidState("There are currently no channels streaming.", header.MessageId);
                return;
            }

            StopStreamingChannels(header.MessageId, Channels.Keys.ToList());

            base.HandleStopStreaming(header, stopStreaming);
        }
Esempio n. 2
0
 //Stop the video stream
 public void StopStream()
 {
     try
     {
         //Send a control signal to the PiCar
         var request = new StopStreaming();
         _client.StopStream(request);
     }
     catch (RpcException e)
     {
         Console.Write("RPC failed " + e);
         throw;
     }
 }
 protected override void HandleStopStreaming(IMessageHeader header, StopStreaming stopStreaming)
 {
     base.HandleStopStreaming(header, stopStreaming);
     _tokenSource?.Cancel();
 }