public override void OnConnectionStateChange(BluetoothGatt gatt, [GeneratedEnum] GattStatus status, [GeneratedEnum] ProfileState newState) { try { if (status == GattStatus.Success) { if (newState == ProfileState.Connected && _Device == null) { BLEC("connected to " + gatt.Device.Address + ", status=" + status + ", bond=" + gatt.Device.BondState + ", discovering service..."); _ServerDevice = gatt; _Device = gatt.Device.Address; ConnectionCompleted?.Invoke(true); if (!_ServerDevice.DiscoverServices()) { BLEC_ERR("can't start discovery service"); } } else if (newState == ProfileState.Connected) { gatt.Close(); } else if (newState == ProfileState.Disconnected && _Device != null && gatt.Device.Address == _Device) { _Device = null; ConnectionCompleted?.Invoke(false); } } } catch (Exception ex) { BLEC_ERR("generic connection state changed", ex); } }
public override void OnConnectionStateChange(BluetoothDevice device, [GeneratedEnum] ProfileState status, [GeneratedEnum] ProfileState newState) { base.OnConnectionStateChange(device, status, newState); bool connected = newState == ProfileState.Connected; ConnectionCompleted?.Invoke(connected); SERVERC("OnConnection device=" + device.Address + " status=" + status.ToString() + " state=" + newState.ToString()); }
public new string GetEventMessage() { string rvalue = base.GetEventMessage(); return(string.Concat(rvalue, string.Format("Connecting to {0} host ({1}:{2}); started: {3}; ssl success: {4}; completed: {5}; fail over: {6}; attempts: {7}; connection time (milliseconds): {8}ms.", Host, Endpoint, Port, ConnectionStarted.ToString("hh:mm:ss.SSS"), SslNavigation, ConnectionCompleted != null ? ConnectionCompleted.ToString("hh:mm:ss.SSS") : "null", ConnectionFailOver != null ? ConnectionFailOver.ToString("hh:mm:ss.SSS") : "null", ConnectionAttempts + 1, GetConnectionTime() ))); }
public void OnConnectionCompleted(ScannerExceptions type, string message) { ConnectionCompleted?.Invoke(this, new object[] { type, message }); }
private static void OnConnectionRequested(Link l) { ConnectionCompleted?.Invoke(l); }