public RendererDebugForm(AVRenderer renderer)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.renderer = renderer;

            renderingControlWatcher = renderer.RenderingControlWatcher;
            avTransportControlWatcher = renderer.AVTransportWatcher;
            connectionManagerControlWatcher = renderer.ConnectionManagerWatcher;

            renderingControlWatcher.OnSniff += new UPnPServiceWatcher.SniffHandler(renderingSniffHandlerSink);
            avTransportControlWatcher.OnSniff += new UPnPServiceWatcher.SniffHandler(avTransportSniffHandlerSink);
            connectionManagerControlWatcher.OnSniff += new UPnPServiceWatcher.SniffHandler(connectionManagerSniffHandlerSink);
        }
Ejemplo n.º 2
0
 private void PacketCaptureSink(UPnPServiceWatcher sender, byte[] raw, int offset, int length)
 {
     string packetText = new UTF8Encoding().GetString(raw,offset,length);
     //if (DebugTextBox.Text.Length != 0) DebugTextBox.Text += "\r\n\r\n\r\n";
     DebugTextBox.Text += packetText;
 }
Ejemplo n.º 3
0
 private void MethodInvoke_Load(object sender, System.EventArgs e)
 {
     spy = new UPnPServiceWatcher(this.service,new UPnPServiceWatcher.SniffHandler(PacketCaptureSink));
 }
 public void connectionManagerSniffHandlerSink(UPnPServiceWatcher sender, byte[] raw, int offset, int length)
 {
     lock (connectionManagerTextBox)
     {
         connectionManagerTextBox.AppendText(utf8encoder.GetString(raw,offset,length));
     }
 }
 public void avTransportSniffHandlerSink(UPnPServiceWatcher sender, byte[] raw, int offset, int length)
 {
     lock (avTransportTextBox)
     {
         avTransportTextBox.AppendText(utf8encoder.GetString(raw,offset,length));
     }
 }
 private void RendererDebugForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     renderingControlWatcher.OnSniff -= new UPnPServiceWatcher.SniffHandler(renderingSniffHandlerSink);
     avTransportControlWatcher.OnSniff -= new UPnPServiceWatcher.SniffHandler(avTransportSniffHandlerSink);
     connectionManagerControlWatcher.OnSniff -= new UPnPServiceWatcher.SniffHandler(connectionManagerSniffHandlerSink);
     renderingControlWatcher = null;
     avTransportControlWatcher = null;
     connectionManagerControlWatcher = null;
     renderer = null;
 }
 public void renderingSniffHandlerSink(UPnPServiceWatcher sender, byte[] raw, int offset, int length)
 {
     lock (rendererControlTextBox)
     {
         rendererControlTextBox.AppendText(utf8encoder.GetString(raw,offset,length));
     }
 }
Ejemplo n.º 8
0
        public void RunQueue()
        {
            Arg.TestGroup.state = UPnPTestStates.Running;

            UPnPService[] services = Arg.Device.Services;
            UPnPServiceWatcher[] watchers = new UPnPServiceWatcher[services.Length];
            for (int i=0; i < services.Length; i++)
            {
                //watchers[i] = new UPnPServiceWatcher(services[i], null, new UPnPServiceWatcher.SniffPacketHandler(this.SniffPacketSink));
            }

            foreach (ISubTest sub in Q.Values)
            {
                Arg.TestGroup.SetState(sub.Name, UPnPTestStates.Running);

                bool cont = true;
                foreach (SubTest pre1 in sub.Prerequisites)
                {
                    pre1.CalculateExpectedTestingTime(Q.Values, Arg);

                    ISubTest pre = null;
                    foreach (ISubTest pre2 in Q.Values)
                    {
                        if (pre2.Name == pre1.Name)
                        {
                            pre = pre2;
                        }
                    }

                    if (
                        (!
                        (pre.TestState == UPnPTestStates.Pass) ||
                        (pre.TestState == UPnPTestStates.Warn)
                        )
                        )
                    {
                        cont = false;
                    }
                }

                this.UpdateTimeAndProgress(0);
                if (cont)
                {
                    UPnPTestStates result = sub.Run(Q.Values, Arg);
                    Arg.TestGroup.SetState(sub.Name, result);

                    if (sub.TestState != result)
                    {
                        throw new ApplicationException("Test state does not match the set value.");
                    }
                }
                this.UpdateTimeAndProgress(0);
            }

            UPnPTestStates MasterResult = UPnPTestStates.Pass;
            foreach (ISubTest done in Q.Values)
            {
                if (done.TestState > MasterResult)
                {
                    MasterResult = done.TestState;
                    break;
                }
            }

            for (int i=0; i < services.Length; i++)
            {
                //watchers[i].OnSniffPacket -= new UPnPServiceWatcher.SniffPacketHandler(this.SniffPacketSink);
            }

            Arg.TestGroup.state = MasterResult;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Logs packets.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="MSG"></param>
 private void SniffPacketSink(UPnPServiceWatcher sender, HTTPMessage MSG)
 {
     this.Arg.TestGroup.AddPacket(MSG);
 }
        public override void Start(UPnPDevice device)
        {
            Reset();

            UPnPService[] _S = device.GetServices("urn:");

            TotalTime = 0;
            int CurrentTime = 0;
            foreach(UPnPService s in _S)
            {
                TotalTime += s.Actions.Count*30;
            }
            foreach(UPnPService s in _S)
            {
                UPnPServiceWatcher W = new UPnPServiceWatcher(s,null,new UPnPServiceWatcher.SniffPacketHandler(SniffPacketSink));

                foreach(UPnPAction A in s.Actions)
                {
                    StartCountDown(CurrentTime,TotalTime);
                    BasicControlTest_ACTION(s,A);
                    AbortCountDown();
                    CurrentTime += 30;
                }
            }

            if(WARN_VALID && !FAIL_VALID)
            {
                Results.Add("Invocations: Valid Values  -  Had undesirable behavior");
                SetState("Valid Values", UPnPTestStates.Warn);
            }
            else
            {
                if(FAIL_VALID)
                {
                    Results.Add("Invocations: Valid Values  -  Failed");
                    SetState("Valid Values",UPnPTestStates.Failed);
                }
                else
                {
                    Results.Add("Invocations: Valid Values  -  Passed");
                    SetState("Valid Values",UPnPTestStates.Pass);
                }
            }

            CurrentTime = 0;
            foreach(UPnPService s in _S)
            {
                UPnPServiceWatcher W = new UPnPServiceWatcher(s,null,new UPnPServiceWatcher.SniffPacketHandler(SniffPacketSink));

                foreach(UPnPAction A in s.Actions)
                {
                    StartCountDown(CurrentTime,TotalTime);
                    BasicControlTest_ACTION_BadAllowedValues(s,A);
                    AbortCountDown();
                    CurrentTime += 30;
                }
            }
            if(WARN_ALLOWED && !FAIL_ALLOWED)
            {
                Results.Add("Invocations: Allowed Values  -  Had undesirable behavior");
                SetState("Allowed Values",UPnPTestStates.Warn);
            }
            else
            {
                if(FAIL_ALLOWED)
                {
                    Results.Add("Invocations: Allowed Values  -  Failed");
                    SetState("Allowed Values",UPnPTestStates.Failed);
                }
                else
                {
                    Results.Add("Invocations: Allowed Values  -  Passed");
                    SetState("Allowed Values",UPnPTestStates.Pass);
                }
            }

            CurrentTime = 0;
            foreach(UPnPService s in _S)
            {
                UPnPServiceWatcher W = new UPnPServiceWatcher(s,null,new UPnPServiceWatcher.SniffPacketHandler(SniffPacketSink));

                foreach(UPnPAction A in s.Actions)
                {
                    StartCountDown(CurrentTime,TotalTime);
                    BasicControlTest_ACTION_BadRange(s,A);
                    AbortCountDown();
                    CurrentTime += 30;
                }
            }
            if(WARN_RANGE && !FAIL_RANGE)
            {
                Results.Add("Invocations: Range  -  Had undesirable behavior");
                SetState("Range",UPnPTestStates.Warn);
            }
            else
            {
                if(FAIL_RANGE)
                {
                    Results.Add("Invocations: Range  -  Failed");
                    SetState("Range",UPnPTestStates.Failed);
                }
                else
                {
                    Results.Add("Invocations: Range  -  Passed");
                    SetState("Range",UPnPTestStates.Pass);
                }
            }

            WARN_MASTER = WARN_VALID||WARN_ALLOWED||WARN_RANGE;
            FAIL_MASTER = FAIL_VALID||FAIL_ALLOWED||FAIL_RANGE;

            if(WARN_MASTER && !FAIL_MASTER)
            {
                state = UPnPTestStates.Warn;
            }
            else
            {
                if(FAIL_MASTER)
                {
                    state = UPnPTestStates.Failed;
                }
                else
                {
                    state = UPnPTestStates.Pass;
                }
            }

            SetProgress(100);
        }
 private void SniffPacketSink(UPnPServiceWatcher sender, HTTPMessage MSG)
 {
     AddPacket(MSG);
 }