Exemple #1
0
 void discovery_Discovered(object sender, DiscoveryMessageEventArgs e)
 {
     lock (this)
     {
         if (_probeMessage != null)
         {
             return;
         }
         System.Diagnostics.Debug.WriteLine("Discovered");
         _probeMessage = DiscoveryUtils.XmlToString(e.Message.Raw);
         _discoveredEvent.Set();
     }
 }
Exemple #2
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);
             }
         }
     }
 }
Exemple #3
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);
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// Handles incoming discovery Bye message
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments</param>
 protected void OnByeReceived(object sender, DiscoveryMessageEventArgs e)
 {
     _eventByeReceived.Set();
 }
Exemple #5
0
 /// <summary>
 /// Handles incoming discovery Hello message
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments</param>
 protected void OnHelloReceived(object sender, DiscoveryMessageEventArgs e)
 {
     _message = e.Message.Clone() as SoapMessage <object>;
     _eventHelloReceived.Set();
 }
Exemple #6
0
 /// <summary>
 /// Handles incoming discovery Bye message
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments</param>
 public void OnByeReceived(object sender, DiscoveryMessageEventArgs e)
 {
     _message = e.Message.Clone() as SoapMessage <object>;
     _eventByeReceived.Set();
 }