예제 #1
0
        //------------------------------------------------------------------------------------------------------------------------

        void clientOnMessageReceived(Yodiwo.YPChannel.Channel channel, Yodiwo.YPChannel.YPMessage msg)
        {
            if (msg.Payload is AudioDataReq)
            {
                var req = (msg.Payload as AudioDataReq);
                if (req.aflow == AudioFlow.Start)
                {
                    try
                    {
                        audiosource.Start();
                    }
                    catch { }
                    var resp = new AudioDataResp()
                    {
                        status = StatusCode.Success
                    };
                    yclient.SendResponse(resp, msg.MessageID);
                    IsTransmitting = true;
                }
                else if (req.aflow == AudioFlow.Stop)
                {
                    IsTransmitting = false;
                    audiosource.Stop();
                    var resp = new AudioDataResp()
                    {
                        status = StatusCode.Success
                    };
                    channel.SendResponse(resp, msg.MessageID);
                }
            }
            else if (msg.Payload is AudioAuthenticationRequest)
            {
                var resp = new AudioAuthenticationResponse()
                {
                    audiotoken = this.audiotoken
                };
                channel.SendResponse(resp, msg.MessageID);
            }
        }
예제 #2
0
        //------------------------------------------------------------------------------------------------------------------------

        void clientOnMessageReceived(Yodiwo.YPChannel.Channel channel, Yodiwo.YPChannel.YPMessage msg)
        {
            if (msg.Payload is VideoDataReq)
            {
                var req = (msg.Payload as VideoDataReq);
                if (req.vflow == VideoFlow.Start)
                {
                    videosource.Start();
                }
                else if (req.vflow == VideoFlow.Stop)
                {
                    videosource.Stop();
                }
            }
            else if (msg.Payload is VideoAuthenticationRequest)
            {
                var resp = new VideoAuthenticationResponse()
                {
                    videotoken = this.videotoken
                };
                channel.SendResponse(resp, msg.MessageID);
                DebugEx.TraceLog("Sening response for VideoAuthenticationResponse , token=" + this.videotoken);
            }
        }
예제 #3
0
 //------------------------------------------------------------------------------------------------------------------------
 private void OnTransportErrorCb(Yodiwo.NodeLibrary.Transport Transport, TransportErrors Error, string msg)
 {
     DebugEx.TraceLog("OnTransportError transport=" + Transport.ToString() + " msg=" + msg);
 }
예제 #4
0
 //------------------------------------------------------------------------------------------------------------------------
 private void OnTransportDisconnectedCb(Yodiwo.NodeLibrary.Transport Transport, string msg)
 {
     DebugEx.TraceLog("OnDisconnected transport=" + Transport.ToString() + " msg=" + msg);
 }
예제 #5
0
 //------------------------------------------------------------------------------------------------------------------------
 public void serverChannel_OnOpenEvent(Yodiwo.YPChannel.Channel channel)
 {
     DebugEx.TraceLog("A mjpeg recorder has been connected to me");
     Task.Run(() =>
     {
         var req = new VideoDataReq()
         {
             vflow = VideoFlow.Start
         };
         channel.SendRequest(req);
     });
 }
예제 #6
0
 //------------------------------------------------------------------------------------------------------------------------
 public void serverOnMessageReceived(Yodiwo.YPChannel.Channel channel, Yodiwo.YPChannel.YPMessage msg)
 {
     //get context
     var ctx = channel.Tags.TryGetOrDefault(typeof(ChannelContext)) as ChannelContext;
     //handle data
     if (msg.Payload is VideoDataResp)
     {
         var resp = (msg.Payload as VideoDataResp);
     }
     else if (msg.Payload is VideoData)
     {
         var resp = (msg.Payload as VideoData);
         //add bitmap to videofeed
         if (ctx.Receiving && ctx.videoInfo != null && ctx.videoInfo.IsActive)
             ctx.videoInfo.AddFrame(resp.linearBytes);
     }
 }
예제 #7
0
 //------------------------------------------------------------------------------------------------------------------------
 public bool serverNegotiation(Yodiwo.YPChannel.Channel channel)
 {
     //requires authentication
     var resp = channel.SendRequest<VideoAuthenticationResponse>(new VideoAuthenticationRequest());
     if (resp == null)
         return false;
     else
     {
         //handle response
         if (!videofeeds.ContainsKey(resp.videotoken))
             return false;
         else
         {
             //create context
             var ctx = new ChannelContext()
             {
                 videoInfo = videofeeds[resp.videotoken],
             };
             channel.Tags.Add(typeof(ChannelContext), ctx);
             ctx.Receiving = true;
             return true;
         }
     }
 }
예제 #8
0
        //------------------------------------------------------------------------------------------------------------------------

        public void serverOnMessageReceived(Yodiwo.YPChannel.Channel channel, Yodiwo.YPChannel.YPMessage msg)
        {
            //get context
            var ctx = channel.Tags.TryGetOrDefault(typeof(ChannelContext)) as ChannelContext;
            //handle data
            if (msg.Payload is AudioDataResp)
            {
                var resp = (msg.Payload as AudioDataResp);
            }
            else if (msg.Payload is AudioData)
            {
                var resp = (msg.Payload as AudioData);
                if (ctx.Receiving && ctx.audioInfo.audiosink != null && ctx.audioInfo.audiosink.IsActive)
                {
                    ctx.audioInfo.audiosink.AddPCMdata(resp.linearBytes);
                }
            }
        }
예제 #9
0
        //------------------------------------------------------------------------------------------------------------------------

        public bool serverNegotiation(Yodiwo.YPChannel.Channel channel)
        {
            var resp = channel.SendRequest<AudioAuthenticationResponse>(new AudioAuthenticationRequest());
            if (resp == null)
                return false;
            else
            {
                //handle response
                if (!audiopipes.ContainsKey(resp.audiotoken))
                    return false;
                else
                {
                    //create context
                    var ctx = new ChannelContext()
                    {
                        audioInfo = audiopipes[resp.audiotoken],
                    };
                    channel.Tags.Add(typeof(ChannelContext), ctx);
                    ctx.Receiving = true;
                    return true;
                }
            }
        }