예제 #1
0
        public static Dictionary <Conversation, HashSet <TestInfo> > GetMappedTests()
        {
            var mappedTests = new Dictionary <Conversation, HashSet <TestInfo> >();

            foreach (var conversation in ConversationList.GetConversations())
            {
                var device = conversation.Device as Device;

                if (null == device || !device.IsFeatureListAttached) //TODO think about Conversation w/ 2 Clients
                {
                    mappedTests.Add(conversation, new HashSet <TestInfo>(TestCaseSet.Instance.Tests));
                    continue;
                }

                var profiles = device.GetSupportedProfiles();

                var profileMandatoryFeatures   = profiles.SelectMany(profile => profile.GetMandatoryFeatures()).ToList();
                var profileConditionalFeatures = profiles.SelectMany(profile => profile.GetConditionalFeatures()).ToList();
                var deviceSpecificFeatures     = device.GetSupportedFeatures();

                var testList = profileMandatoryFeatures.Union(profileConditionalFeatures)
                               .Union(deviceSpecificFeatures)
                               .Select(feature => feature.GetDependingTest())
                               .ToList();

                mappedTests.Add(conversation, new HashSet <TestInfo>(testList));
            }

            return(mappedTests);
        }
예제 #2
0
 //TODO
 private void CheckConversations()
 {
     if (0 == ConversationList.GetConversations(NetworkTrace).Count)
     {
         DialogHelper.ShowError(NetworkTrace.Filename, "Communication was not detected between Client and Device using ONVIF standard.\r\nConversation list cannot be generated.");
     }
 }
예제 #3
0
        /// <summary>
        /// Details to show (first tag after SOAP Body)
        /// </summary>
        public override String GetDetails()
        {
            if (!ContainsXml)
            {
                return(String.Empty);
            }

            if (null != mDetails)
            {
                return(mDetails);
            }

            try
            {
                XElement doc = XElement.Parse(GetXmlString(XmlNamespaceOption.IgnoreNamespaces));

                var element = doc.Element(SoapOptions.BODY_TAG);
                mDetails = element.Elements().First().Name.LocalName;
            }
            catch (Exception e)
            {
                Logger.WriteLine(String.Format("Frame:{0}{1}Conversation:{2}{1}{3}", FrameNumber, Environment.NewLine,
                                               ConversationList.GetConversations().IndexOf(mConversation) + 1, e.Message));

                mDetails = String.Empty;
            }

            return(mDetails);
        }
예제 #4
0
        private String GetPairInfo(RequestResponsePair pair)
        {
            var conversation        = pair.Conversation;
            int indexOfConversation = ConversationList.GetConversations().IndexOf(conversation) + 1;
            int indexOfPair         = conversation.IndexOf(pair) + 1;

            return(String.Format("Conversation:{0} - {1} \\ Pair:{2}", indexOfConversation, conversation.Name, indexOfPair));
        }
예제 #5
0
        private void lVConversations_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (0 == lVConversations.SelectedIndices.Count)
            {
                ClearSelection();
                return;
            }

            mSelectedConversationIndex = lVConversations.SelectedIndices[0];
            requestResponseList.SelectedConversation = ConversationList.GetConversations()[mSelectedConversationIndex];
        }
예제 #6
0
        private Conversation FindConversation(Frame frame, String protocol)
        {
            if (protocol.Contains(TSharkHelper.PROTOCOL_RTSP)) // HACK //TODO
            {
                return
                    (ConversationList.GetConversations(
                         item => (item.Client.Mac == frame.SourceMac && item.Device.Mac == frame.DestinationMac) ||
                         item.Client.Mac == frame.DestinationMac && item.Device.Mac == frame.SourceMac).FirstOrDefault());
            }

            return(ConversationList.GetConversations(item => item.ContainsFrame(frame)).FirstOrDefault());
        }
예제 #7
0
        private void FillListView()
        {
            this.InvokeIfRequired(() =>
            {
                lVConversations.Items.Clear();
                requestResponseList.Clear();

                foreach (var conversation in ConversationList.GetConversations())
                {
                    var item = new ListViewItem((lVConversations.Items.Count + 1).ToString(CultureInfo.InvariantCulture));

                    item.SubItems.Add(conversation.Name);
                    item.SubItems.Add(conversation.GetStatusString());

                    lVConversations.Items.Add(item);
                }
            });
        }
예제 #8
0
        public static void ParseUnitInfo(Unit unit)
        {
            Conversation conversation = ConversationList.GetConversations(item => Equals(item.Client, unit) ||
                                                                          Equals(item.Device, unit))
                                        .LastOrDefault(); // last, not first :\

            if (null == conversation)
            {
                return;
            }

            switch (unit.Type)
            {
            case UnitType.Client:
                ParseClientInfo(conversation, unit as Client);
                break;

            case UnitType.Device:
                ParseDeviceInfo(conversation, unit as Device);
                break;
            }
        }
예제 #9
0
        private void Conversations_PairAdded(object sender, ConversationElementEventArgs e)
        {
            this.InvokeIfRequired((() =>
            {
                if (0 == lVConversations.SelectedIndices.Count)
                {
                    return;
                }

                if (null == requestResponseList.SelectedConversation)
                {
                    return;
                }

                var affectedConversation = ConversationList.GetConversations()[e.ConversationIndex];

                if (requestResponseList.SelectedConversation == affectedConversation)
                {
                    requestResponseList.Refresh();
                }
            }));
        }