Ejemplo n.º 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;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Event handler for when services are discovered
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">Event arguments</param>
 private void _gattCallBack_OnDeviceDisconnectedEvent(object sender, EventArgs e)
 {
     ServicesDiscoveredEvent?.Invoke(this, new EventArgs());
 }