/// <summary> /// Event handler to receive notice that the MTU has changed /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event args including new MTU</param> private void _bleManager_MtuChangeEvent(object sender, DeviceMtuEventArgs e) { if (e.Success) { _mtu = e.MTU; ConnectionMtuChangeEvent?.Invoke(this, new MtuEventArgs(e.MTU)); } else { ConnectionMtuChangeEvent?.Invoke(this, new MtuEventArgs(0, e.Success, e.MTU)); } }
/// <summary> /// Event handler to tell caller that the external MTU request has been handled /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event args including the new MTU value</param> /// <remarks> /// This handler is only invoked when requesting MTU manually outside of Connect() method /// </remarks> private void MtuRequest_DeviceMtuEvent(object sender, DeviceMtuEventArgs e) { // Must update local setting if successful if (e.Success) { _mtu = e.MTU; _connectionMtuChangeEvent?.Invoke(this, new MtuEventArgs(e.MTU)); } else { _connectionMtuChangeEvent?.Invoke(this, new MtuEventArgs(0, e.Success, e.MTU)); } }
/// <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); }