예제 #1
0
 /// <summary>
 /// Handles device discovered event
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event parameter</param>
 protected void OnDeviceDiscovered(object sender, DiscoveryMessageEventArgs e)
 {
     if (DeviceDiscovered != null)
     {
         List <DeviceDiscoveryData> devices = DiscoveryUtils.GetDevices(e.Message.ToSoapMessage <WSD.ProbeMatchesType>(), e.Sender);
         if (devices.Count == 0)
         {
             OnDiscoveryError(this, new DiscoveryErrorEventArgs(new Exception("Device type is not " + DiscoveryUtils.ONVIF_DISCOVER_TYPES), null));
         }
         else
         {
             foreach (DeviceDiscoveryData device in devices)
             {
                 DeviceDiscovered(device);
             }
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Handles device discovered event
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event parameter</param>
        /// <param name="allDevices"></param>
        /// <param name="errors"></param>
        /// <param name="types"></param>
        protected void OnDeviceDiscovered(object sender,
                                          DiscoveryMessageEventArgs e,
                                          List <DeviceDiscoveryData> allDevices,
                                          List <DiscoveryErrorEventArgs> errors,
                                          DiscoveryUtils.DiscoveryType[][] types)
        {
            if (DeviceDiscovered != null)
            {
                List <DeviceDiscoveryData> devices =
                    DiscoveryUtils.GetDevices(e.Message.ToSoapMessage <WSD.ProbeMatchesType>(), e.Sender, types);
                allDevices.AddRange(devices);

                foreach (DeviceDiscoveryData device in devices)
                {
                    DeviceDiscovered(device);
                }
            }
        }