Пример #1
0
 /// <summary>
 /// Clear all event handlers
 /// </summary>
 public void ClearEventHandlers()
 {
     if (DeviceConnectedEvent != null)
     {
         foreach (Delegate d in DeviceConnectedEvent?.GetInvocationList())
         {
             DeviceConnectedEvent -= (EventHandler <DeviceEventArgs>)d;
         }
     }
     if (DeviceReadyEvent != null)
     {
         foreach (Delegate d in DeviceReadyEvent?.GetInvocationList())
         {
             DeviceReadyEvent -= (EventHandler <DeviceEventArgs>)d;
         }
     }
     if (DeviceDisconnectedEvent != null)
     {
         foreach (Delegate d in DeviceDisconnectedEvent?.GetInvocationList())
         {
             DeviceDisconnectedEvent -= (EventHandler <DeviceEventArgs>)d;
         }
     }
     if (MtuChangeEvent != null)
     {
         foreach (Delegate d in MtuChangeEvent?.GetInvocationList())
         {
             MtuChangeEvent -= (EventHandler <DeviceMtuEventArgs>)d;
         }
     }
     if (ServicesDiscoveredEvent != null)
     {
         foreach (Delegate d in ServicesDiscoveredEvent?.GetInvocationList())
         {
             ServicesDiscoveredEvent -= (EventHandler <EventArgs>)d;
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Callback event raised when the MTU request is granted
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">Event args including the new MTU value</param>
 private void MtuRequest_DeviceMtuEvent(object sender, DeviceMtuEventArgs e)
 {
     MtuChangeEvent?.Invoke(this, e);
 }