/// <summary> /// Sends probe message to specified address from specified address, and starts listening for answer /// </summary> /// <param name="local">Local address to send message from</param> /// <param name="remote">Address to send message to, if IPAddress.None multicast message will be sent</param> protected void ProbeInternal(IPAddress local, IPAddress remote) { List <DiscoveryErrorEventArgs> errors = new List <DiscoveryErrorEventArgs>(); List <DeviceDiscoveryData> devices = new List <DeviceDiscoveryData>(); DiscoveryUtils.DiscoveryType[][] types = new DiscoveryUtils.DiscoveryType[][] { DiscoveryUtils.GetOnvif10Type(), DiscoveryUtils.GetOnvif20Type() }; Discovery discovery = new Discovery(local); //passing null instead of types will accept devices according to Test Spec //if types is not null - devices which contains at least one type from types discovery.Discovered += (s, e) => OnDeviceDiscovered(s, e, devices, errors, types); discovery.DiscoveryFinished += (s, e) => OnDiscoveryFinished(s, e, devices, errors); discovery.ReceiveError += (s, e) => OnDiscoveryError(s, e, errors); _queriesRunning = 1; if (remote != IPAddress.None) { discovery.Probe(remote, types); } else { //probe multicast address discovery.Probe(types); } if (DiscoveryStarted != null) { DiscoveryStarted(); } }
/// <summary> /// Sends probe message to specified address from specified address, and starts listening for answer /// </summary> /// <param name="local">Local address to send message from</param> /// <param name="remote">Address to send message to, if IPAddress.None multicast message will be sent</param> protected void ProbeInternal(IPAddress local, IPAddress remote) { List <DiscoveryErrorEventArgs> errors = new List <DiscoveryErrorEventArgs>(); List <DeviceDiscoveryData> devices = new List <DeviceDiscoveryData>(); DiscoveryUtils.DiscoveryType[][] types = new DiscoveryUtils.DiscoveryType[][] { DiscoveryUtils.GetOnvif10Type(), DiscoveryUtils.GetOnvif20Type() }; Discovery discovery = new Discovery(local); //passing null instead of types will accept devices according to Test Spec //if types is not null - devices which contains at least one type from types discovery.Discovered += (s, e) => OnDeviceDiscovered(s, e, devices, errors, types); discovery.DiscoveryFinished += (s, e) => OnDiscoveryFinished(s, e, devices, errors); discovery.ReceiveError += (s, e) => OnDiscoveryError(s, e, errors); string[] scopes = null; string searchScopes = View.SearchScopes; if (!string.IsNullOrEmpty(searchScopes)) { searchScopes = searchScopes.Replace(Environment.NewLine, " "); scopes = searchScopes.Split(' '); List <string> correctedScopes = new List <string>(); foreach (string scope in scopes) { if (!string.IsNullOrEmpty(scope)) { correctedScopes.Add(scope); } } scopes = correctedScopes.ToArray(); } _queriesRunning = 1; if (remote != IPAddress.None) { discovery.Probe(remote, types, scopes); } else { //probe multicast address discovery.Probe(types, scopes); } if (DiscoveryStarted != null) { DiscoveryStarted(); } }