/// <summary> /// Event handler for when the device is ready /// </summary> protected override void OnDeviceReady() { base.OnDeviceReady(); // Raise an event for any interested parties DeviceReadyEvent?.Invoke(this, new EventArgs()); }
/// <summary> /// Event handler to receive notice that the device is ready /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event args including the device info</param> private void _bleManager_DeviceReadyEvent(object sender, DeviceEventArgs e) { Log(string.Format("Device {0} [{1}] ready!", e.Device.Name, e.Device.Address)); DeviceInfo device = FindDeviceInfo(e.Device); if (device != null) { DeviceReadyEvent?.Invoke(this, new DeviceInfoEventArgs(FindDeviceInfo(e.Device))); } }
/// <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; } } }
void IBleManagerCallbacks.OnDeviceReady(BluetoothDevice p0) { DeviceReadyEvent?.Invoke(this, new DeviceEventArgs(p0)); }
/// <summary> /// Event handler for when the device is ready /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event arguments including a Bluetooth device</param> private void _skfBleManagerCallbacks_DeviceReadyEvent(object sender, DeviceEventArgs e) { _currentDevice = e.Device; DeviceReadyEvent?.Invoke(this, new DeviceEventArgs(e.Device)); }